xref: /petsc/src/vec/is/section/interface/ftn-custom/zvsectionisf90.c (revision b0dcfd164860a975c76f90dabf1036901aab1c4e) !
1*6dd63270SBarry Smith #include <petscsection.h>
2*6dd63270SBarry Smith #include <petsc/private/ftnimpl.h>
3*6dd63270SBarry Smith 
4*6dd63270SBarry Smith #if defined(PETSC_HAVE_FORTRAN_CAPS)
5*6dd63270SBarry Smith   #define petscsectiongetconstraintindices_          PETSCSECTIONGETCONSTRAINTINDICES
6*6dd63270SBarry Smith   #define petscsectionrestoreconstraintindices_      PETSCSECTIONRESTORECONSTRAINTINDICES
7*6dd63270SBarry Smith   #define petscsectiongetfieldconstraintindices_     PETSCSECTIONGETFIELDCONSTRAINTINDICES
8*6dd63270SBarry Smith   #define petscsectionrestorefieldconstraintindices_ PETSCSECTIONRESTOREFIELDCONSTRAINTINDICES
9*6dd63270SBarry Smith #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
10*6dd63270SBarry Smith   #define petscsectiongetconstraintindices_          petscsectiongetconstraintindices
11*6dd63270SBarry Smith   #define petscsectionrestoreconstraintindices_      petscsectionrestoreconstraintindices
12*6dd63270SBarry Smith   #define petscsectiongetfieldconstraintindices_     petscsectiongetfieldconstraintindices
13*6dd63270SBarry Smith   #define petscsectionrestorefieldconstraintindices_ petscsectionrestorefieldconstraintindices
14*6dd63270SBarry Smith #endif
15*6dd63270SBarry Smith 
petscsectiongetconstraintindices_(PetscSection * s,PetscInt * point,F90Array1d * indices,int * ierr PETSC_F90_2PTR_PROTO (ptrd))16*6dd63270SBarry Smith PETSC_EXTERN void petscsectiongetconstraintindices_(PetscSection *s, PetscInt *point, F90Array1d *indices, int *ierr PETSC_F90_2PTR_PROTO(ptrd))
17*6dd63270SBarry Smith {
18*6dd63270SBarry Smith   const PetscInt *idx;
19*6dd63270SBarry Smith   PetscInt        n;
20*6dd63270SBarry Smith 
21*6dd63270SBarry Smith   *ierr = PetscSectionGetConstraintIndices(*s, *point, &idx);
22*6dd63270SBarry Smith   if (*ierr) return;
23*6dd63270SBarry Smith   *ierr = PetscSectionGetConstraintDof(*s, *point, &n);
24*6dd63270SBarry Smith   if (*ierr) return;
25*6dd63270SBarry Smith   *ierr = F90Array1dCreate((void *)idx, MPIU_INT, 1, n, indices PETSC_F90_2PTR_PARAM(ptrd));
26*6dd63270SBarry Smith }
27*6dd63270SBarry Smith 
petscsectionrestoreconstraintindices_(PetscSection * s,PetscInt * point,F90Array1d * indices,int * ierr PETSC_F90_2PTR_PROTO (ptrd))28*6dd63270SBarry Smith PETSC_EXTERN void petscsectionrestoreconstraintindices_(PetscSection *s, PetscInt *point, F90Array1d *indices, int *ierr PETSC_F90_2PTR_PROTO(ptrd))
29*6dd63270SBarry Smith {
30*6dd63270SBarry Smith   *ierr = F90Array1dDestroy(indices, MPIU_INT PETSC_F90_2PTR_PARAM(ptrd));
31*6dd63270SBarry Smith }
32*6dd63270SBarry Smith 
petscsectiongetfieldconstraintindices_(PetscSection * s,PetscInt * point,PetscInt * field,F90Array1d * indices,int * ierr PETSC_F90_2PTR_PROTO (ptrd))33*6dd63270SBarry Smith PETSC_EXTERN void petscsectiongetfieldconstraintindices_(PetscSection *s, PetscInt *point, PetscInt *field, F90Array1d *indices, int *ierr PETSC_F90_2PTR_PROTO(ptrd))
34*6dd63270SBarry Smith {
35*6dd63270SBarry Smith   const PetscInt *idx;
36*6dd63270SBarry Smith   PetscInt        n;
37*6dd63270SBarry Smith 
38*6dd63270SBarry Smith   *ierr = PetscSectionGetFieldConstraintIndices(*s, *point, *field, &idx);
39*6dd63270SBarry Smith   if (*ierr) return;
40*6dd63270SBarry Smith   *ierr = PetscSectionGetFieldConstraintDof(*s, *point, *field, &n);
41*6dd63270SBarry Smith   if (*ierr) return;
42*6dd63270SBarry Smith   *ierr = F90Array1dCreate((void *)idx, MPIU_INT, 1, n, indices PETSC_F90_2PTR_PARAM(ptrd));
43*6dd63270SBarry Smith }
44*6dd63270SBarry Smith 
petscsectionrestorefieldconstraintindices_(PetscSection * s,PetscInt * point,PetscInt * field,F90Array1d * indices,int * ierr PETSC_F90_2PTR_PROTO (ptrd))45*6dd63270SBarry Smith PETSC_EXTERN void petscsectionrestorefieldconstraintindices_(PetscSection *s, PetscInt *point, PetscInt *field, F90Array1d *indices, int *ierr PETSC_F90_2PTR_PROTO(ptrd))
46*6dd63270SBarry Smith {
47*6dd63270SBarry Smith   *ierr = F90Array1dDestroy(indices, MPIU_INT PETSC_F90_2PTR_PARAM(ptrd));
48*6dd63270SBarry Smith   if (*ierr) return;
49*6dd63270SBarry Smith }
50