[petsc-dev] PetscDataTypeGetSize fortran binding is gone?

Blaise A Bourdin bourdin at lsu.edu
Fri Jul 14 17:23:05 CDT 2017


Great, thanks

> On Jul 14, 2017, at 4:53 PM, Satish Balay <balay at mcs.anl.gov> wrote:
> 
> Added - and merged to next.
> 
> satish
> 
> On Fri, 14 Jul 2017, Blaise A Bourdin wrote:
> 
>> Got it. It works.
>> 
>> While you are at it, would you minding adding the binding for PetscOptionsLeft.
>> I am attaching the patch,
>> 
>> diff --git a/src/sys/objects/ftn-custom/zoptionsf.c b/src/sys/objects/ftn-custom/zoptionsf.c
>> index 65d64b1580..9d36bc2d4d 100644
>> --- a/src/sys/objects/ftn-custom/zoptionsf.c
>> +++ b/src/sys/objects/ftn-custom/zoptionsf.c
>> @@ -24,6 +24,7 @@
>> #define petscoptionsclear_                 PETSCOPTIONSCLEAR
>> #define petscoptionsinsertstring_          PETSCOPTIONSINSERTSTRING
>> #define petscoptionsview_                  PETSCOPTIONSVIEW
>> +#define petscoptionsleft_                  PETSCOPTIONSLEFT
>> #define petscobjectviewfromoptions_        PETSCOBJECTVIEWFROMOPTIONS
>> #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
>> #define petscoptionsgetenumprivate_        petscoptionsgetenumprivate
>> @@ -42,6 +43,7 @@
>> #define petscoptionsclear_                 petscoptionsclear
>> #define petscoptionsinsertstring_          petscoptionsinsertstring
>> #define petscoptionsview_                  petscoptionsview
>> +#define petscoptionsleft_                  petscoptionsleft
>> #define petscobjectviewfromoptions_        petscobjectviewfromoptions
>> #endif
>> 
>> 
>> 
>> @@ -254,6 +256,12 @@ PETSC_EXTERN void PETSC_STDCALL petscoptionsview_(PetscOptions *options,PetscVie
>>   *ierr = PetscOptionsView(*options,v);
>> }
>> 
>> 
>> 
>> +PETSC_EXTERN void PETSC_STDCALL petscoptionsleft_(PetscOptions *options,PetscErrorCode *ierr)
>> +{
>> + CHKFORTRANNULLOBJECTDEREFERENCE(options);
>> +  *ierr = PetscOptionsLeft(*options);
>> +}
>> +
>> PETSC_EXTERN void PETSC_STDCALL petscobjectviewfromoptions_(PetscObject *obj,PetscObject *bobj,char* option PETSC_MIXED_LEN(loption),PetscErrorCode *ierr  PETSC_END_LEN(loption))
>> {
>>   char *o;
>> 
>> 
>> Blaise
>> 
>> On Jul 14, 2017, at 3:54 PM, Satish Balay <balay at mcs.anl.gov<mailto:balay at mcs.anl.gov>> wrote:
>> 
>> include/petscsys.h:PETSC_EXTERN PetscErrorCode PetscDataTypeGetSize(PetscDataType,size_t*);
>> 
>> Looks like this needs a custom stub due to 'size_t' parameter.
>> 
>> I've aded the custom interface to balay/add-ftn-PetscDataTypeGetSize. Can you give it a try?
>> 
>> You would have to use a datatype that matches 'size_t' on the fortran size - i.e PetscSizeT.
>> 
>> Satish
>> 
>> On Fri, 14 Jul 2017, Blaise A Bourdin wrote:
>> 
>> Hi,
>> 
>> It looks like the fortran binding for PetscDataTypeGetSize was removed a while ago. Evidently, auto generated binding won’t work here.
>> I’m a bit out of sync with the recent fortran changes, but why are automatically generated binding not working anymore, and what should the proper binding look like?
>> 
>> Alternatively, is there a new recommended way to query the size of a Petsc type from fortran?
>> 
>> Blaise
>> 
>> 
>> 
>> 
>> --
>> Department of Mathematics and Center for Computation & Technology
>> Louisiana State University, Baton Rouge, LA 70803, USA
>> Tel. +1 (225) 578 1612, Fax  +1 (225) 578 4276 http://www.math.lsu.edu/~bourdin
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 

-- 
Department of Mathematics and Center for Computation & Technology
Louisiana State University, Baton Rouge, LA 70803, USA
Tel. +1 (225) 578 1612, Fax  +1 (225) 578 4276 http://www.math.lsu.edu/~bourdin









More information about the petsc-dev mailing list