[petsc-dev] PetscDataTypeGetSize fortran binding is gone?

Blaise A Bourdin bourdin at lsu.edu
Fri Jul 14 16:47:17 CDT 2017

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
 #define petscoptionsgetenumprivate_        petscoptionsgetenumprivate
@@ -42,6 +43,7 @@
 #define petscoptionsclear_                 petscoptionsclear
 #define petscoptionsinsertstring_          petscoptionsinsertstring
 #define petscoptionsview_                  petscoptionsview
+#define petscoptionsleft_                  petscoptionsleft
 #define petscobjectviewfromoptions_        petscobjectviewfromoptions

@@ -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)
+  *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;


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.


On Fri, 14 Jul 2017, Blaise A Bourdin wrote:


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?


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20170714/ab5ad47b/attachment.html>

More information about the petsc-dev mailing list