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