xref: /petsc/src/vec/is/utils/ftn-custom/zvsectionisf.c (revision d5b43468fb8780a8feea140ccd6fa3e6a50411cc)
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 {
26 *__ierr = PetscSectionGetPointSyms(section,*numPoints,points,(const PetscInt ***)perms,(const PetscScalar ***)rots);
27 }
28 PETSC_EXTERN void  petscsectionrestorepointsyms_(PetscSection section,PetscInt *numPoints, PetscInt *points, PetscInt ***perms, PetscScalar ***rots, int *__ierr)
29 {
30 *__ierr = PetscSectionRestorePointSyms(section,*numPoints,points,(const PetscInt ***)perms,(const PetscScalar ***)rots);
31 }
32 PETSC_EXTERN void  petscsectiongetfieldpointsyms_(PetscSection section,PetscInt *field,PetscInt *numPoints, PetscInt *points, PetscInt ***perms, PetscScalar ***rots, int *__ierr)
33 {
34 *__ierr = PetscSectionGetFieldPointSyms(section,*field,*numPoints,points,(const PetscInt ***)perms,(const PetscScalar ***)rots);
35 }
36 PETSC_EXTERN void  petscsectionrestorefieldpointsyms_(PetscSection section,PetscInt *field,PetscInt *numPoints, PetscInt *points, PetscInt ***perms, PetscScalar ***rots, int *__ierr)
37 {
38 *__ierr = PetscSectionRestoreFieldPointSyms(section,*field,*numPoints,points,(const PetscInt ***)perms,(const PetscScalar ***)rots);
39 }
40 
41 PETSC_EXTERN void petscsectionview_(PetscSection *s, PetscViewer *vin, PetscErrorCode *ierr)
42 {
43   PetscViewer v;
44 
45   PetscPatchDefaultViewers_Fortran(vin, v);
46   *ierr = PetscSectionView(*s, v);
47 }
48 
49 PETSC_EXTERN void petscsectiongetfieldname_(PetscSection *s, PetscInt *field, char* name, PetscErrorCode *ierr,PETSC_FORTRAN_CHARLEN_T len)
50 {
51   const char *fname;
52 
53   *ierr = PetscSectionGetFieldName(*s, *field, &fname);if (*ierr) return;
54   *ierr = PetscStrncpy(name, fname, len);
55   FIXRETURNCHAR(PETSC_TRUE,name,len);
56 }
57 
58 PETSC_EXTERN void petscsectionsetfieldname_(PetscSection *s, PetscInt *field, char* name, PetscErrorCode *ierr,PETSC_FORTRAN_CHARLEN_T len)
59 {
60   char *f;
61 
62   FIXCHAR(name, len, f);
63   *ierr = PetscSectionSetFieldName(*s, *field, f);if (*ierr) return;
64   FREECHAR(name, f);
65 }
66