xref: /petsc/src/vec/is/utils/ftn-custom/zvsectionisf.c (revision 224ef0b136b07c08f029d27df75fbb11d621f602)
1b5a418daSToby Isaac #include <petsc/private/fortranimpl.h>
2b5a418daSToby Isaac #include <petscis.h>
3*224ef0b1SMatthew Knepley #include <petscsection.h>
4b5a418daSToby Isaac #include <petscviewer.h>
5b5a418daSToby Isaac 
6b5a418daSToby Isaac #if defined(PETSC_HAVE_FORTRAN_CAPS)
7b5a418daSToby Isaac #define petscsectiongetpointsyms_          PETSCSECTIONGETPOINTSYMS
8b5a418daSToby Isaac #define petscsectionrestorepointsyms_      PETSCSECTIONRESTOREPOINTSYMS
9b5a418daSToby Isaac #define petscsectiongetfieldpointsyms_     PETSCSECTIONGETFIELDPOINTSYMS
10b5a418daSToby Isaac #define petscsectionrestorefieldpointsyms_ PETSCSECTIONRESTOREFIELDPOINTSYMS
11a1535ed2SVaclav Hapla #define petscsectionview_                  PETSCSECTIONVIEW
12a1535ed2SVaclav Hapla #define petscsectiongetfieldname_          PETSCSECTIONGETFIELDNAME
13a1535ed2SVaclav Hapla #define petscsectionsetfieldname_          PETSCSECTIONSETFIELDNAME
140d256f5dSMatthew G. Knepley #define petscsfdistributesection_          PETSCSFDISTRIBUTESECTION
15b5a418daSToby Isaac #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
16b5a418daSToby Isaac #define petscsectiongetpointsyms_          petscsectiongetpointsyms
17b5a418daSToby Isaac #define petscsectionrestorepointsyms_      petscsectionrestorepointsyms
18b5a418daSToby Isaac #define petscsectiongetfieldpointsyms_     petscsectiongetfieldpointsyms
19b5a418daSToby Isaac #define petscsectionrestorefieldpointsyms_ petscsectionrestorefieldpointsyms
20a1535ed2SVaclav Hapla #define petscsectionview_                  petscsectionview
21a1535ed2SVaclav Hapla #define petscsectiongetfieldname_          petscsectiongetfieldname
22a1535ed2SVaclav Hapla #define petscsectionsetfieldname_          petscsectionsetfieldname
230d256f5dSMatthew G. Knepley #define petscsfdistributesection_          petscsfdistributesection
24b5a418daSToby Isaac #endif
25b5a418daSToby Isaac 
26b5a418daSToby Isaac PETSC_EXTERN void PETSC_STDCALL  petscsectiongetpointsyms_(PetscSection section,PetscInt *numPoints, PetscInt *points, PetscInt ***perms, PetscScalar ***rots, int *__ierr ){
27b5a418daSToby Isaac *__ierr = PetscSectionGetPointSyms(section,*numPoints,points,(const PetscInt ***)perms,(const PetscScalar ***)rots);
28b5a418daSToby Isaac }
29b5a418daSToby Isaac PETSC_EXTERN void PETSC_STDCALL  petscsectionrestorepointsyms_(PetscSection section,PetscInt *numPoints, PetscInt *points, PetscInt ***perms, PetscScalar ***rots, int *__ierr ){
30b5a418daSToby Isaac *__ierr = PetscSectionRestorePointSyms(section,*numPoints,points,(const PetscInt ***)perms,(const PetscScalar ***)rots);
31b5a418daSToby Isaac }
32b5a418daSToby Isaac PETSC_EXTERN void PETSC_STDCALL  petscsectiongetfieldpointsyms_(PetscSection section,PetscInt *field,PetscInt *numPoints, PetscInt *points, PetscInt ***perms, PetscScalar ***rots, int *__ierr ){
33b5a418daSToby Isaac *__ierr = PetscSectionGetFieldPointSyms(section,*field,*numPoints,points,(const PetscInt ***)perms,(const PetscScalar ***)rots);
34b5a418daSToby Isaac }
35b5a418daSToby Isaac PETSC_EXTERN void PETSC_STDCALL  petscsectionrestorefieldpointsyms_(PetscSection section,PetscInt *field,PetscInt *numPoints, PetscInt *points, PetscInt ***perms, PetscScalar ***rots, int *__ierr ){
36b5a418daSToby Isaac *__ierr = PetscSectionRestoreFieldPointSyms(section,*field,*numPoints,points,(const PetscInt ***)perms,(const PetscScalar ***)rots);
37b5a418daSToby Isaac }
38a1535ed2SVaclav Hapla 
39a1535ed2SVaclav Hapla PETSC_EXTERN void PETSC_STDCALL petscsectionview_(PetscSection *s, PetscViewer *vin, PetscErrorCode *ierr)
40a1535ed2SVaclav Hapla {
41a1535ed2SVaclav Hapla   PetscViewer v;
42a1535ed2SVaclav Hapla 
43a1535ed2SVaclav Hapla   PetscPatchDefaultViewers_Fortran(vin, v);
44a1535ed2SVaclav Hapla   *ierr = PetscSectionView(*s, v);
45a1535ed2SVaclav Hapla }
46a1535ed2SVaclav Hapla 
47a1535ed2SVaclav Hapla PETSC_EXTERN void PETSC_STDCALL petscsectiongetfieldname_(PetscSection *s, PetscInt *field, char* name PETSC_MIXED_LEN(len), PetscErrorCode *ierr PETSC_END_LEN(len))
48a1535ed2SVaclav Hapla {
49a1535ed2SVaclav Hapla   const char *fname;
50a1535ed2SVaclav Hapla 
51a1535ed2SVaclav Hapla   *ierr = PetscSectionGetFieldName(*s, *field, &fname);if (*ierr) return;
52a1535ed2SVaclav Hapla   *ierr = PetscStrncpy(name, fname, len);
53a1535ed2SVaclav Hapla   FIXRETURNCHAR(PETSC_TRUE,name,len);
54a1535ed2SVaclav Hapla }
55a1535ed2SVaclav Hapla 
56a1535ed2SVaclav Hapla PETSC_EXTERN void PETSC_STDCALL petscsectionsetfieldname_(PetscSection *s, PetscInt *field, char* name PETSC_MIXED_LEN(len), PetscErrorCode *ierr PETSC_END_LEN(len))
57a1535ed2SVaclav Hapla {
58a1535ed2SVaclav Hapla   char *f;
59a1535ed2SVaclav Hapla 
60a1535ed2SVaclav Hapla   FIXCHAR(name, len, f);
61a1535ed2SVaclav Hapla   *ierr = PetscSectionSetFieldName(*s, *field, f);if (*ierr) return;
62a1535ed2SVaclav Hapla   FREECHAR(name, f);
63a1535ed2SVaclav Hapla }
640d256f5dSMatthew G. Knepley 
650d256f5dSMatthew G. Knepley PETSC_EXTERN void PETSC_STDCALL  petscsfdistributesection_(PetscSF sf,PetscSection rootSection,PetscInt **remoteOffsets,PetscSection leafSection, int *__ierr ){
66c93efe82SMatthew G. Knepley   if (remoteOffsets != PETSC_NULL_INTEGER_Fortran) {
67353b39ddSMatthew G. Knepley     PetscError(PETSC_COMM_SELF, __LINE__, "PetscSFDistributeSection_Fortran", __FILE__, PETSC_ERR_SUP, PETSC_ERROR_INITIAL,
68353b39ddSMatthew G. Knepley                "The remoteOffsets argument must be PETSC_NULL_INTEGER in Fortran");
69353b39ddSMatthew G. Knepley     *__ierr = 1;
70353b39ddSMatthew G. Knepley     return;
71353b39ddSMatthew G. Knepley   }
72353b39ddSMatthew G. Knepley   *__ierr = PetscSFDistributeSection(sf,rootSection,NULL,leafSection);
730d256f5dSMatthew G. Knepley }
74