xref: /petsc/src/vec/is/utils/ftn-custom/zvsectionisf.c (revision 55e7fe800d976e85ed2b5cd8bfdef564daa37bd9)
1 #include <petsc/private/fortranimpl.h>
2 #include <petscis.h>
3 #include <petscviewer.h>
4 
5 #if defined(PETSC_HAVE_FORTRAN_CAPS)
6 #define petscsectiongetpointsyms_          PETSCSECTIONGETPOINTSYMS
7 #define petscsectionrestorepointsyms_      PETSCSECTIONRESTOREPOINTSYMS
8 #define petscsectiongetfieldpointsyms_     PETSCSECTIONGETFIELDPOINTSYMS
9 #define petscsectionrestorefieldpointsyms_ PETSCSECTIONRESTOREFIELDPOINTSYMS
10 #define petscsectionview_                  PETSCSECTIONVIEW
11 #define petscsectiongetfieldname_          PETSCSECTIONGETFIELDNAME
12 #define petscsectionsetfieldname_          PETSCSECTIONSETFIELDNAME
13 #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
14 #define petscsectiongetpointsyms_          petscsectiongetpointsyms
15 #define petscsectionrestorepointsyms_      petscsectionrestorepointsyms
16 #define petscsectiongetfieldpointsyms_     petscsectiongetfieldpointsyms
17 #define petscsectionrestorefieldpointsyms_ petscsectionrestorefieldpointsyms
18 #define petscsectionview_                  petscsectionview
19 #define petscsectiongetfieldname_          petscsectiongetfieldname
20 #define petscsectionsetfieldname_          petscsectionsetfieldname
21 #endif
22 
23 PETSC_EXTERN void PETSC_STDCALL  petscsectiongetpointsyms_(PetscSection section,PetscInt *numPoints, PetscInt *points, PetscInt ***perms, PetscScalar ***rots, int *__ierr ){
24 *__ierr = PetscSectionGetPointSyms(section,*numPoints,points,(const PetscInt ***)perms,(const PetscScalar ***)rots);
25 }
26 PETSC_EXTERN void PETSC_STDCALL  petscsectionrestorepointsyms_(PetscSection section,PetscInt *numPoints, PetscInt *points, PetscInt ***perms, PetscScalar ***rots, int *__ierr ){
27 *__ierr = PetscSectionRestorePointSyms(section,*numPoints,points,(const PetscInt ***)perms,(const PetscScalar ***)rots);
28 }
29 PETSC_EXTERN void PETSC_STDCALL  petscsectiongetfieldpointsyms_(PetscSection section,PetscInt *field,PetscInt *numPoints, PetscInt *points, PetscInt ***perms, PetscScalar ***rots, int *__ierr ){
30 *__ierr = PetscSectionGetFieldPointSyms(section,*field,*numPoints,points,(const PetscInt ***)perms,(const PetscScalar ***)rots);
31 }
32 PETSC_EXTERN void PETSC_STDCALL  petscsectionrestorefieldpointsyms_(PetscSection section,PetscInt *field,PetscInt *numPoints, PetscInt *points, PetscInt ***perms, PetscScalar ***rots, int *__ierr ){
33 *__ierr = PetscSectionRestoreFieldPointSyms(section,*field,*numPoints,points,(const PetscInt ***)perms,(const PetscScalar ***)rots);
34 }
35 
36 PETSC_EXTERN void PETSC_STDCALL petscsectionview_(PetscSection *s, PetscViewer *vin, PetscErrorCode *ierr)
37 {
38   PetscViewer v;
39 
40   PetscPatchDefaultViewers_Fortran(vin, v);
41   *ierr = PetscSectionView(*s, v);
42 }
43 
44 PETSC_EXTERN void PETSC_STDCALL petscsectiongetfieldname_(PetscSection *s, PetscInt *field, char* name PETSC_MIXED_LEN(len), PetscErrorCode *ierr PETSC_END_LEN(len))
45 {
46   const char *fname;
47 
48   *ierr = PetscSectionGetFieldName(*s, *field, &fname);if (*ierr) return;
49   *ierr = PetscStrncpy(name, fname, len);
50   FIXRETURNCHAR(PETSC_TRUE,name,len);
51 }
52 
53 PETSC_EXTERN void PETSC_STDCALL petscsectionsetfieldname_(PetscSection *s, PetscInt *field, char* name PETSC_MIXED_LEN(len), PetscErrorCode *ierr PETSC_END_LEN(len))
54 {
55   char *f;
56 
57   FIXCHAR(name, len, f);
58   *ierr = PetscSectionSetFieldName(*s, *field, f);if (*ierr) return;
59   FREECHAR(name, f);
60 }
61