xref: /petsc/src/dm/ftn-mod/petscdmmod.F90 (revision 8d9ecca5a504194654f5c92cc5cdc8b5689a3cbe)
16dd63270SBarry Smith        module petscdmdef
26dd63270SBarry Smith        use petscvecdef
36dd63270SBarry Smith        use petscmatdef
46dd63270SBarry Smith#include <../ftn/dm/petscall.h>
56dd63270SBarry Smith#include <../ftn/dm/petscspace.h>
66dd63270SBarry Smith#include <../ftn/dm/petscdualspace.h>
76dd63270SBarry Smith
86dd63270SBarry Smith       type ttPetscTabulation
96dd63270SBarry Smith         sequence
106dd63270SBarry Smith         PetscInt                K
116dd63270SBarry Smith         PetscInt                Nr
126dd63270SBarry Smith         PetscInt                Np
136dd63270SBarry Smith         PetscInt                Nb
146dd63270SBarry Smith         PetscInt                Nc
156dd63270SBarry Smith         PetscInt                cdim
166dd63270SBarry Smith         PetscReal2d, pointer :: T(:)
176dd63270SBarry Smith       end type ttPetscTabulation
186dd63270SBarry Smith
196dd63270SBarry Smith       type tPetscTabulation
206dd63270SBarry Smith         type(ttPetscTabulation), pointer :: ptr
216dd63270SBarry Smith       end type tPetscTabulation
226dd63270SBarry Smith
236dd63270SBarry Smith       end module petscdmdef
246dd63270SBarry Smith!     ----------------------------------------------
256dd63270SBarry Smith
266dd63270SBarry Smith!     Needed by Fortran stub petscdsgettabulation_()
276dd63270SBarry Smith      subroutine F90Array1dCreateTabulation(array,start,len,ptr)
286dd63270SBarry Smith      use petscdmdef
296dd63270SBarry Smith      implicit none
306dd63270SBarry Smith      PetscInt                    start,len
316dd63270SBarry Smith      PetscTabulation, target  :: array(start:start+len-1)
326dd63270SBarry Smith      PetscTabulation, pointer :: ptr(:)
336dd63270SBarry Smith      ptr => array
346dd63270SBarry Smith      print*,'create tab', array(1)%ptr%K,array(1)%ptr%cdim
356dd63270SBarry Smith      print*,ptr(1)%ptr%K,ptr(1)%ptr%cdim
366dd63270SBarry Smith      end subroutine
376dd63270SBarry Smith#if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
386dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT:: F90Array1dCreateTabulation
396dd63270SBarry Smith#endif
406dd63270SBarry Smith
416dd63270SBarry Smith      subroutine F90Array1dDestroyTabulation(ptr)
426dd63270SBarry Smith      use petscdmdef
436dd63270SBarry Smith      implicit none
446dd63270SBarry Smith      PetscTabulation, pointer :: ptr(:)
456dd63270SBarry Smith      nullify(ptr)
466dd63270SBarry Smith      end subroutine
476dd63270SBarry Smith#if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
486dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT:: F90Array1dDestroyTabulation
496dd63270SBarry Smith#endif
506dd63270SBarry Smith
516dd63270SBarry Smith        module petscdm
526dd63270SBarry Smith        use petscmat
536dd63270SBarry Smith        use petscdmdef
546dd63270SBarry Smith#include <../src/dm/ftn-mod/petscdm.h90>
556dd63270SBarry Smith#include <../src/dm/ftn-mod/petscdt.h90>
566dd63270SBarry Smith#include <../ftn/dm/petscall.h90>
576dd63270SBarry Smith#include <../ftn/dm/petscspace.h90>
586dd63270SBarry Smith#include <../ftn/dm/petscdualspace.h90>
596dd63270SBarry Smith
60*8d9ecca5SBarry Smith        ! C stub utility
616dd63270SBarry Smith        interface PetscDSGetTabulationSetSizes
626dd63270SBarry Smith        subroutine PetscDSGetTabulationSetSizes(ds,i, tab,ierr)
636dd63270SBarry Smith          import tPetscDS, ttPetscTabulation
646dd63270SBarry Smith          PetscErrorCode              ierr
656dd63270SBarry Smith          type(ttPetscTabulation)     tab
666dd63270SBarry Smith          PetscDS                     ds
676dd63270SBarry Smith          PetscInt                    i
686dd63270SBarry Smith        end subroutine
696dd63270SBarry Smith        end interface
706dd63270SBarry Smith
71*8d9ecca5SBarry Smith        ! C stub utility
726dd63270SBarry Smith        interface PetscDSGetTabulationSetPointers
736dd63270SBarry Smith        subroutine PetscDSGetTabulationSetPointers(ds,i, T,ierr)
746dd63270SBarry Smith          import tPetscDS, ttPetscTabulation,tPetscReal2d
756dd63270SBarry Smith          PetscErrorCode              ierr
766dd63270SBarry Smith          type(tPetscReal2d), pointer :: T(:)
776dd63270SBarry Smith          PetscDS                     ds
786dd63270SBarry Smith          PetscInt                    i
796dd63270SBarry Smith        end subroutine
806dd63270SBarry Smith        end interface
816dd63270SBarry Smith
82*8d9ecca5SBarry Smith        ! C stub utility
83*8d9ecca5SBarry Smith        interface DMCreateFieldDecompositionGetName
84*8d9ecca5SBarry Smith        subroutine DMCreateFieldDecompositionGetName(dm, i, name, ierr)
85*8d9ecca5SBarry Smith          import tDM
86*8d9ecca5SBarry Smith          PetscErrorCode              ierr
87*8d9ecca5SBarry Smith          DM dm
88*8d9ecca5SBarry Smith          character(*) name
89*8d9ecca5SBarry Smith          PetscInt                    i
90*8d9ecca5SBarry Smith        end subroutine
91*8d9ecca5SBarry Smith        end interface
92*8d9ecca5SBarry Smith
93*8d9ecca5SBarry Smith        ! C stub utility
94*8d9ecca5SBarry Smith        interface DMCreateFieldDecompositionGetISDM
95*8d9ecca5SBarry Smith        subroutine DMCreateFieldDecompositionGetISDM(dm, iss, dms, ierr)
96*8d9ecca5SBarry Smith          import tIS, tDM
97*8d9ecca5SBarry Smith          PetscErrorCode              ierr
98*8d9ecca5SBarry Smith          DM dm
99*8d9ecca5SBarry Smith          IS, pointer :: iss(:)
100*8d9ecca5SBarry Smith          DM, pointer :: dms(:)
101*8d9ecca5SBarry Smith        end subroutine
102*8d9ecca5SBarry Smith        end interface
103*8d9ecca5SBarry Smith
104*8d9ecca5SBarry Smith        ! C stub utility
105*8d9ecca5SBarry Smith        interface DMCreateFieldDecompositionRestoreISDM
106*8d9ecca5SBarry Smith        subroutine DMCreateFieldDecompositionRestoreISDM(dm, iss, dms, ierr)
107*8d9ecca5SBarry Smith          import tIS, tDM
108*8d9ecca5SBarry Smith          PetscErrorCode              ierr
109*8d9ecca5SBarry Smith          DM dm
110*8d9ecca5SBarry Smith          IS, pointer :: iss(:)
111*8d9ecca5SBarry Smith          DM, pointer :: dms(:)
112*8d9ecca5SBarry Smith        end subroutine
113*8d9ecca5SBarry Smith        end interface
114*8d9ecca5SBarry Smith
1156dd63270SBarry Smith        interface PetscDSGetTabulation
1166dd63270SBarry Smith          module procedure PetscDSGetTabulation
1176dd63270SBarry Smith       end interface
1186dd63270SBarry Smith
1196dd63270SBarry Smith        interface PetscDSRestoreTabulation
1206dd63270SBarry Smith          module procedure PetscDSRestoreTabulation
1216dd63270SBarry Smith       end interface
1226dd63270SBarry Smith
1236dd63270SBarry Smith       contains
1246dd63270SBarry Smith
1256dd63270SBarry Smith#include <../ftn/dm/petscall.hf90>
1266dd63270SBarry Smith#include <../ftn/dm/petscspace.hf90>
1276dd63270SBarry Smith#include <../ftn/dm/petscdualspace.hf90>
1286dd63270SBarry Smith
1296dd63270SBarry Smith        Subroutine PetscDSGetTabulation(ds,tab,ierr)
1306dd63270SBarry Smith          PetscErrorCode              ierr
1316dd63270SBarry Smith          PetscTabulation, pointer :: tab(:)
1326dd63270SBarry Smith          PetscDS                     ds
1336dd63270SBarry Smith
1346dd63270SBarry Smith          PetscInt  Nf, i
1356dd63270SBarry Smith          call PetscDSGetNumFields(ds, Nf, ierr)
1366dd63270SBarry Smith          allocate(tab(Nf))
1376dd63270SBarry Smith          do i=1,Nf
1386dd63270SBarry Smith             allocate(tab(i)%ptr)
1396dd63270SBarry Smith             CHKMEMQ
1406dd63270SBarry Smith             call PetscDSGetTabulationSetSizes(ds, i, tab(i)%ptr, ierr)
1416dd63270SBarry Smith             CHKMEMQ
1426dd63270SBarry Smith             allocate(tab(i)%ptr%T(tab(i)%ptr%K+1))
1436dd63270SBarry Smith             call PetscDSGetTabulationSetPointers(ds, i, tab(i)%ptr%T, ierr)
1446dd63270SBarry Smith             CHKMEMQ
1456dd63270SBarry Smith          enddo
1466dd63270SBarry Smith        End Subroutine PetscDSGetTabulation
1476dd63270SBarry Smith
1486dd63270SBarry Smith        Subroutine PetscDSRestoreTabulation(ds,tab,ierr)
1496dd63270SBarry Smith          PetscErrorCode              ierr
1506dd63270SBarry Smith          PetscTabulation, pointer :: tab(:)
1516dd63270SBarry Smith          PetscDS                     ds
1526dd63270SBarry Smith
1536dd63270SBarry Smith          PetscInt  Nf, i
1546dd63270SBarry Smith          call PetscDSGetNumFields(ds, Nf, ierr)
1556dd63270SBarry Smith          do i=1,Nf
1566dd63270SBarry Smith             deallocate(tab(i)%ptr%T)
1576dd63270SBarry Smith             deallocate(tab(i)%ptr)
1586dd63270SBarry Smith          enddo
1596dd63270SBarry Smith          deallocate(tab)
1606dd63270SBarry Smith        End Subroutine PetscDSRestoreTabulation
1616dd63270SBarry Smith
162*8d9ecca5SBarry Smith        Subroutine DMCreateFieldDecomposition(dm, n, names, iss, dms, ierr)
163*8d9ecca5SBarry Smith          PetscErrorCode            ierr
164*8d9ecca5SBarry Smith          character(80), pointer :: names(:)
165*8d9ecca5SBarry Smith          IS, pointer            :: iss(:)
166*8d9ecca5SBarry Smith          DM, pointer            :: dms(:)
167*8d9ecca5SBarry Smith          DM                        dm
168*8d9ecca5SBarry Smith          PetscInt                  i,n
169*8d9ecca5SBarry Smith
170*8d9ecca5SBarry Smith          call DMGetNumFields(dm, n, ierr)
171*8d9ecca5SBarry Smith          ! currently requires that names is requested
172*8d9ecca5SBarry Smith          allocate(names(n))
173*8d9ecca5SBarry Smith          do i=1,n
174*8d9ecca5SBarry Smith             call DMCreateFieldDecompositionGetName(dm,i,names(i),ierr)
175*8d9ecca5SBarry Smith          enddo
176*8d9ecca5SBarry Smith          call DMCreateFieldDecompositionGetISDM(dm,iss,dms,ierr)
177*8d9ecca5SBarry Smith          End Subroutine DMCreateFieldDecomposition
178*8d9ecca5SBarry Smith
179*8d9ecca5SBarry Smith        Subroutine DMDestroyFieldDecomposition(dm, n, names, iss, dms, ierr)
180*8d9ecca5SBarry Smith          PetscErrorCode            ierr
181*8d9ecca5SBarry Smith          character(80), pointer :: names(:)
182*8d9ecca5SBarry Smith          IS, pointer            :: iss(:)
183*8d9ecca5SBarry Smith          DM, pointer            :: dms(:)
184*8d9ecca5SBarry Smith          DM                        dm
185*8d9ecca5SBarry Smith          PetscInt                  n
186*8d9ecca5SBarry Smith
187*8d9ecca5SBarry Smith          ! currently requires that names is requested
188*8d9ecca5SBarry Smith          deallocate(names)
189*8d9ecca5SBarry Smith          call DMCreateFieldDecompositionRestoreISDM(dm,iss,dms,ierr)
190*8d9ecca5SBarry Smith        End Subroutine DMDestroyFieldDecomposition
191*8d9ecca5SBarry Smith
1926dd63270SBarry Smith      end module petscdm
1936dd63270SBarry Smith
1946dd63270SBarry Smith!     ----------------------------------------------
1956dd63270SBarry Smith
1966dd63270SBarry Smith        module petscdmdadef
1976dd63270SBarry Smith        use petscdmdef
1986dd63270SBarry Smith        use petscaodef
1996dd63270SBarry Smith        use petscpfdef
2006dd63270SBarry Smith#include <petsc/finclude/petscao.h>
2016dd63270SBarry Smith#include <petsc/finclude/petscdmda.h>
2026dd63270SBarry Smith#include <../ftn/dm/petscdmda.h>
2036dd63270SBarry Smith        end module petscdmdadef
2046dd63270SBarry Smith
2056dd63270SBarry Smith        module petscdmda
2066dd63270SBarry Smith        use petscdm
2076dd63270SBarry Smith        use petscdmdadef
2086dd63270SBarry Smith
2096dd63270SBarry Smith#include <../src/dm/ftn-mod/petscdmda.h90>
2106dd63270SBarry Smith#include <../ftn/dm/petscdmda.h90>
2116dd63270SBarry Smith
2126dd63270SBarry Smith        contains
2136dd63270SBarry Smith
2146dd63270SBarry Smith#include <../ftn/dm/petscdmda.hf90>
2156dd63270SBarry Smith        end module petscdmda
2166dd63270SBarry Smith
2176dd63270SBarry Smith!     ----------------------------------------------
2186dd63270SBarry Smith
2196dd63270SBarry Smith        module petscdmplex
2206dd63270SBarry Smith        use petscdm
2216dd63270SBarry Smith        use petscdmdef
2226dd63270SBarry Smith#include <petsc/finclude/petscfv.h>
2236dd63270SBarry Smith#include <petsc/finclude/petscdmplex.h>
2246dd63270SBarry Smith#include <petsc/finclude/petscdmplextransform.h>
2256dd63270SBarry Smith#include <../src/dm/ftn-mod/petscdmplex.h90>
2266dd63270SBarry Smith#include <../ftn/dm/petscfv.h>
2276dd63270SBarry Smith#include <../ftn/dm/petscdmplex.h>
2286dd63270SBarry Smith#include <../ftn/dm/petscdmplextransform.h>
2296dd63270SBarry Smith
2306dd63270SBarry Smith#include <../ftn/dm/petscfv.h90>
2316dd63270SBarry Smith#include <../ftn/dm/petscdmplex.h90>
2326dd63270SBarry Smith#include <../ftn/dm/petscdmplextransform.h90>
2336dd63270SBarry Smith
2346dd63270SBarry Smith        contains
2356dd63270SBarry Smith
2366dd63270SBarry Smith#include <../ftn/dm/petscfv.hf90>
2376dd63270SBarry Smith#include <../ftn/dm/petscdmplex.hf90>
2386dd63270SBarry Smith#include <../ftn/dm/petscdmplextransform.hf90>
2396dd63270SBarry Smith        end module petscdmplex
2406dd63270SBarry Smith
2416dd63270SBarry Smith!     ----------------------------------------------
2426dd63270SBarry Smith
2436dd63270SBarry Smith        module petscdmstag
2446dd63270SBarry Smith        use petscdmdef
2456dd63270SBarry Smith#include <petsc/finclude/petscdmstag.h>
2466dd63270SBarry Smith#include <../ftn/dm/petscdmstag.h>
2476dd63270SBarry Smith
2486dd63270SBarry Smith#include <../ftn/dm/petscdmstag.h90>
2496dd63270SBarry Smith
2506dd63270SBarry Smith        contains
2516dd63270SBarry Smith
2526dd63270SBarry Smith#include <../ftn/dm/petscdmstag.hf90>
2536dd63270SBarry Smith        end module petscdmstag
2546dd63270SBarry Smith
2556dd63270SBarry Smith!     ----------------------------------------------
2566dd63270SBarry Smith
2576dd63270SBarry Smith        module petscdmswarm
2586dd63270SBarry Smith        use petscdm
2596dd63270SBarry Smith        use petscdmdef
2606dd63270SBarry Smith#include <petsc/finclude/petscdmswarm.h>
2616dd63270SBarry Smith#include <../ftn/dm/petscdmswarm.h>
2626dd63270SBarry Smith
2636dd63270SBarry Smith#include <../src/dm/ftn-mod/petscdmswarm.h90>
2646dd63270SBarry Smith#include <../ftn/dm/petscdmswarm.h90>
2656dd63270SBarry Smith
2666dd63270SBarry Smith        contains
2676dd63270SBarry Smith
2686dd63270SBarry Smith#include <../ftn/dm/petscdmswarm.hf90>
2696dd63270SBarry Smith        end module petscdmswarm
2706dd63270SBarry Smith
2716dd63270SBarry Smith!     ----------------------------------------------
2726dd63270SBarry Smith
2736dd63270SBarry Smith        module petscdmcomposite
2746dd63270SBarry Smith        use petscdm
2756dd63270SBarry Smith#include <petsc/finclude/petscdmcomposite.h>
2766dd63270SBarry Smith
2776dd63270SBarry Smith#include <../src/dm/ftn-mod/petscdmcomposite.h90>
2786dd63270SBarry Smith#include <../ftn/dm/petscdmcomposite.h90>
2796dd63270SBarry Smith        end module petscdmcomposite
2806dd63270SBarry Smith
2816dd63270SBarry Smith!     ----------------------------------------------
2826dd63270SBarry Smith
2836dd63270SBarry Smith        module petscdmforest
2846dd63270SBarry Smith        use petscdm
2856dd63270SBarry Smith#include <petsc/finclude/petscdmforest.h>
2866dd63270SBarry Smith#include <../ftn/dm/petscdmforest.h>
2876dd63270SBarry Smith#include <../ftn/dm/petscdmforest.h90>
2886dd63270SBarry Smith        end module petscdmforest
2896dd63270SBarry Smith
2906dd63270SBarry Smith!     ----------------------------------------------
2916dd63270SBarry Smith
2926dd63270SBarry Smith        module petscdmnetwork
2936dd63270SBarry Smith        use petscdm
2946dd63270SBarry Smith#include <petsc/finclude/petscdmnetwork.h>
2956dd63270SBarry Smith#include <../ftn/dm/petscdmnetwork.h>
2966dd63270SBarry Smith
2976dd63270SBarry Smith#include <../ftn/dm/petscdmnetwork.h90>
2986dd63270SBarry Smith
2996dd63270SBarry Smith        contains
3006dd63270SBarry Smith
3016dd63270SBarry Smith#include <../ftn/dm/petscdmnetwork.hf90>
3026dd63270SBarry Smith        end module petscdmnetwork
3036dd63270SBarry Smith
3046dd63270SBarry Smith!     ----------------------------------------------
3056dd63270SBarry Smith
3066dd63270SBarry Smith        module petscdmadaptor
3076dd63270SBarry Smith        use petscdm
3086dd63270SBarry Smith        use petscdmdef
3096dd63270SBarry Smith!        use petscsnes
3106dd63270SBarry Smith#include <petsc/finclude/petscdmadaptor.h>
3116dd63270SBarry Smith#include <../ftn/dm/petscdmadaptor.h>
3126dd63270SBarry Smith
3136dd63270SBarry Smith!#include <../ftn/dm/petscdmadaptor.h90>
3146dd63270SBarry Smith
3156dd63270SBarry Smith        contains
3166dd63270SBarry Smith
3176dd63270SBarry Smith!#include <../ftn/dm/petscdmadaptor.hf90>
3186dd63270SBarry Smith        end module petscdmadaptor
319