xref: /petsc/include/petscdm.h (revision 1321219c1d5e9ec6e55fd54fae073108c73e7932)
1e1589f56SBarry Smith /*
2e1589f56SBarry Smith       Objects to manage the interactions between the mesh data structures and the algebraic objects
3e1589f56SBarry Smith */
4e1589f56SBarry Smith #if !defined(__PETSCDA_H)
5e1589f56SBarry Smith #define __PETSCDA_H
6e1589f56SBarry Smith #include "petscvec.h"
7e1589f56SBarry Smith #include "petscao.h"
8e1589f56SBarry Smith PETSC_EXTERN_CXX_BEGIN
9e1589f56SBarry Smith 
107087cfbeSBarry Smith extern PetscErrorCode  DMInitializePackage(const char[]);
11e1589f56SBarry Smith /*S
12e1589f56SBarry Smith      DM - Abstract PETSc object that manages an abstract grid object
13e1589f56SBarry Smith 
14e1589f56SBarry Smith    Level: intermediate
15e1589f56SBarry Smith 
16e1589f56SBarry Smith   Concepts: grids, grid refinement
17e1589f56SBarry Smith 
18325fc9f4SBarry Smith    Notes: The DMDACreate() based object and the DMCompositeCreate() based object are examples of DMs
19e1589f56SBarry Smith 
20325fc9f4SBarry Smith           Though the DM objects require the petscsnes.h include files the DM library is
21e1589f56SBarry Smith     NOT dependent on the SNES or KSP library. In fact, the KSP and SNES libraries depend on
22e1589f56SBarry Smith     DM. (This is not great design, but not trivial to fix).
23e1589f56SBarry Smith 
24e1589f56SBarry Smith .seealso:  DMCompositeCreate(), DMDACreate()
25e1589f56SBarry Smith S*/
26e1589f56SBarry Smith typedef struct _p_DM* DM;
27e1589f56SBarry Smith 
28e1589f56SBarry Smith /*E
29e1589f56SBarry Smith     DMDAStencilType - Determines if the stencil extends only along the coordinate directions, or also
30e1589f56SBarry Smith       to the northeast, northwest etc
31e1589f56SBarry Smith 
32e1589f56SBarry Smith    Level: beginner
33e1589f56SBarry Smith 
34e1589f56SBarry Smith .seealso: DMDACreate1d(), DMDACreate2d(), DMDACreate3d(), DMDACreate()
35e1589f56SBarry Smith E*/
36e1589f56SBarry Smith typedef enum { DMDA_STENCIL_STAR,DMDA_STENCIL_BOX } DMDAStencilType;
37e1589f56SBarry Smith 
38e1589f56SBarry Smith /*MC
39e1589f56SBarry Smith      DMDA_STENCIL_STAR - "Star"-type stencil. In logical grid coordinates, only (i,j,k), (i+s,j,k), (i,j+s,k),
40e1589f56SBarry Smith                        (i,j,k+s) are in the stencil  NOT, for example, (i+s,j+s,k)
41e1589f56SBarry Smith 
42e1589f56SBarry Smith      Level: beginner
43e1589f56SBarry Smith 
44e1589f56SBarry Smith .seealso: DMDA_STENCIL_BOX, DMDAStencilType
45e1589f56SBarry Smith M*/
46e1589f56SBarry Smith 
47e1589f56SBarry Smith /*MC
48e1589f56SBarry Smith      DMDA_STENCIL_BOX - "Box"-type stencil. In logical grid coordinates, any of (i,j,k), (i+s,j+r,k+t) may
49e1589f56SBarry Smith                       be in the stencil.
50e1589f56SBarry Smith 
51e1589f56SBarry Smith      Level: beginner
52e1589f56SBarry Smith 
53e1589f56SBarry Smith .seealso: DMDA_STENCIL_STAR, DMDAStencilType
54e1589f56SBarry Smith M*/
55e1589f56SBarry Smith 
56e1589f56SBarry Smith /*E
57*1321219cSEthan Coon     DMDABoundaryType - Describes the choice for fill of ghost cells on domain boundaries.
58e1589f56SBarry Smith 
59e1589f56SBarry Smith    Level: beginner
60e1589f56SBarry Smith 
61*1321219cSEthan Coon    A boundary may be of type DMDA_BOUNDARY_NONE (no ghost nodes), DMDA_BOUNDARY_GHOST (ghost nodes
62*1321219cSEthan Coon    exist but aren't filled), DMDA_BOUNDARY_MIRROR (not yet implemented), or DMDA_BOUNDARY_PERIODIC
63*1321219cSEthan Coon    (ghost nodes filled by the opposite edge of the domain).
64ce00eea3SSatish Balay 
65*1321219cSEthan Coon .seealso: DMDASetBoundaryType(), DMDACreate1d(), DMDACreate2d(), DMDACreate3d(), DMDACreate()
66e1589f56SBarry Smith E*/
67*1321219cSEthan Coon typedef enum { DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_GHOSTED, DMDA_BOUNDARY_MIRROR, DMDA_BOUNDARY_PERIODIC } DMDABoundaryType;
68ce00eea3SSatish Balay 
69db87c5ecSEthan Coon extern const char *DMDABoundaryTypes[];
70e1589f56SBarry Smith 
71e1589f56SBarry Smith /*E
72e1589f56SBarry Smith     DMDAInterpolationType - Defines the type of interpolation that will be returned by
73e1589f56SBarry Smith        DMGetInterpolation.
74e1589f56SBarry Smith 
75e1589f56SBarry Smith    Level: beginner
76e1589f56SBarry Smith 
77e1589f56SBarry Smith .seealso: DMDACreate1d(), DMDACreate2d(), DMDACreate3d(), DMGetInterpolation(), DMDASetInterpolationType(), DMDACreate()
78e1589f56SBarry Smith E*/
79e1589f56SBarry Smith typedef enum { DMDA_Q0, DMDA_Q1 } DMDAInterpolationType;
80e1589f56SBarry Smith 
817087cfbeSBarry Smith extern PetscErrorCode   DMDASetInterpolationType(DM,DMDAInterpolationType);
82e1589f56SBarry Smith 
83e1589f56SBarry Smith /*E
84e1589f56SBarry Smith     DMDAElementType - Defines the type of elements that will be returned by
85e1589f56SBarry Smith        DMGetElements()
86e1589f56SBarry Smith 
87e1589f56SBarry Smith    Level: beginner
88e1589f56SBarry Smith 
89e1589f56SBarry Smith .seealso: DMDACreate1d(), DMDACreate2d(), DMDACreate3d(), DMGetInterpolation(), DMDASetInterpolationType(),
90e1589f56SBarry Smith           DMDASetElementType(), DMGetElements(), DMRestoreElements(), DMDACreate()
91e1589f56SBarry Smith E*/
92e1589f56SBarry Smith typedef enum { DMDA_ELEMENT_P1, DMDA_ELEMENT_Q1 } DMDAElementType;
93e1589f56SBarry Smith 
947087cfbeSBarry Smith extern PetscErrorCode   DMDASetElementType(DM,DMDAElementType);
957087cfbeSBarry Smith extern PetscErrorCode   DMDAGetElementType(DM,DMDAElementType*);
96e1589f56SBarry Smith 
97e1589f56SBarry Smith typedef enum { DMDA_X,DMDA_Y,DMDA_Z } DMDADirection;
98e1589f56SBarry Smith 
997087cfbeSBarry Smith extern PetscClassId  DM_CLASSID;
100e1589f56SBarry Smith 
101e1589f56SBarry Smith #define MATSEQUSFFT        "sequsfft"
102e1589f56SBarry Smith 
1037087cfbeSBarry Smith extern PetscErrorCode  DMDACreate(MPI_Comm,DM*);
1047087cfbeSBarry Smith extern PetscErrorCode  DMDASetDim(DM,PetscInt);
1057087cfbeSBarry Smith extern PetscErrorCode  DMDASetSizes(DM,PetscInt,PetscInt,PetscInt);
106db87c5ecSEthan Coon extern PetscErrorCode     DMDACreate1d(MPI_Comm,DMDABoundaryType,PetscInt,PetscInt,PetscInt,const PetscInt[],DM *);
107*1321219cSEthan Coon extern PetscErrorCode     DMDACreate2d(MPI_Comm,DMDABoundaryType,DMDABoundaryType,DMDAStencilType,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],const PetscInt[],DM*);
108*1321219cSEthan Coon extern PetscErrorCode     DMDACreate3d(MPI_Comm,DMDABoundaryType,DMDABoundaryType,DMDABoundaryType,DMDAStencilType,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],const PetscInt[],const PetscInt[],DM*);
1097087cfbeSBarry Smith extern PetscErrorCode  DMSetOptionsPrefix(DM,const char []);
1107087cfbeSBarry Smith extern PetscErrorCode  DMSetVecType(DM,const VecType);
111e1589f56SBarry Smith 
1127087cfbeSBarry Smith extern PetscErrorCode     DMDAGlobalToNaturalBegin(DM,Vec,InsertMode,Vec);
1137087cfbeSBarry Smith extern PetscErrorCode     DMDAGlobalToNaturalEnd(DM,Vec,InsertMode,Vec);
1147087cfbeSBarry Smith extern PetscErrorCode     DMDANaturalToGlobalBegin(DM,Vec,InsertMode,Vec);
1157087cfbeSBarry Smith extern PetscErrorCode     DMDANaturalToGlobalEnd(DM,Vec,InsertMode,Vec);
1167087cfbeSBarry Smith extern PetscErrorCode     DMDALocalToLocalBegin(DM,Vec,InsertMode,Vec);
1177087cfbeSBarry Smith extern PetscErrorCode     DMDALocalToLocalEnd(DM,Vec,InsertMode,Vec);
1187087cfbeSBarry Smith extern PetscErrorCode     DMDACreateNaturalVector(DM,Vec *);
119e1589f56SBarry Smith 
1207087cfbeSBarry Smith extern PetscErrorCode     DMDALoad(PetscViewer,PetscInt,PetscInt,PetscInt,DM *);
1217087cfbeSBarry Smith extern PetscErrorCode     DMDAGetCorners(DM,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*);
1227087cfbeSBarry Smith extern PetscErrorCode     DMDAGetGhostCorners(DM,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*);
123*1321219cSEthan Coon extern PetscErrorCode     DMDAGetInfo(DM,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,DMDABoundaryType*,DMDABoundaryType*,DMDABoundaryType*,DMDAStencilType*);
1247087cfbeSBarry Smith extern PetscErrorCode     DMDAGetProcessorSubset(DM,DMDADirection,PetscInt,MPI_Comm*);
1257087cfbeSBarry Smith extern PetscErrorCode     DMDAGetProcessorSubsets(DM,DMDADirection,MPI_Comm*);
126e1589f56SBarry Smith 
1277087cfbeSBarry Smith extern PetscErrorCode     DMDAGlobalToNaturalAllCreate(DM,VecScatter*);
1287087cfbeSBarry Smith extern PetscErrorCode     DMDANaturalAllToGlobalCreate(DM,VecScatter*);
129e1589f56SBarry Smith 
1307087cfbeSBarry Smith extern PetscErrorCode     DMDAGetGlobalIndices(DM,PetscInt*,PetscInt**);
131e1589f56SBarry Smith 
1327087cfbeSBarry Smith extern PetscErrorCode     DMDAGetScatter(DM,VecScatter*,VecScatter*,VecScatter*);
1337087cfbeSBarry Smith extern PetscErrorCode     DMDAGetNeighbors(DM,const PetscMPIInt**);
134e1589f56SBarry Smith 
1357087cfbeSBarry Smith extern PetscErrorCode     DMDAGetAO(DM,AO*);
1367087cfbeSBarry Smith extern PetscErrorCode     DMDASetCoordinates(DM,Vec);
137ce00eea3SSatish Balay extern PetscErrorCode     DMDASetGhostedCoordinates(DM,Vec);
1387087cfbeSBarry Smith extern PetscErrorCode     DMDAGetCoordinates(DM,Vec *);
1397087cfbeSBarry Smith extern PetscErrorCode     DMDAGetGhostedCoordinates(DM,Vec *);
1407087cfbeSBarry Smith extern PetscErrorCode     DMDAGetCoordinateDA(DM,DM *);
1417087cfbeSBarry Smith extern PetscErrorCode     DMDASetUniformCoordinates(DM,PetscReal,PetscReal,PetscReal,PetscReal,PetscReal,PetscReal);
1427087cfbeSBarry Smith extern PetscErrorCode     DMDAGetBoundingBox(DM,PetscReal[],PetscReal[]);
1437087cfbeSBarry Smith extern PetscErrorCode     DMDAGetLocalBoundingBox(DM,PetscReal[],PetscReal[]);
1447087cfbeSBarry Smith extern PetscErrorCode     DMDASetFieldName(DM,PetscInt,const char[]);
1457087cfbeSBarry Smith extern PetscErrorCode     DMDAGetFieldName(DM,PetscInt,const char**);
146e1589f56SBarry Smith 
147*1321219cSEthan Coon extern PetscErrorCode  DMDASetBoundaryType(DM,DMDABoundaryType,DMDABoundaryType,DMDABoundaryType);
1487087cfbeSBarry Smith extern PetscErrorCode  DMDASetDof(DM, int);
1497087cfbeSBarry Smith extern PetscErrorCode  DMDASetStencilWidth(DM, PetscInt);
1507087cfbeSBarry Smith extern PetscErrorCode  DMDASetOwnershipRanges(DM,const PetscInt[],const PetscInt[],const PetscInt[]);
1517087cfbeSBarry Smith extern PetscErrorCode  DMDAGetOwnershipRanges(DM,const PetscInt**,const PetscInt**,const PetscInt**);
1527087cfbeSBarry Smith extern PetscErrorCode  DMDASetNumProcs(DM, PetscInt, PetscInt, PetscInt);
1537087cfbeSBarry Smith extern PetscErrorCode  DMDASetStencilType(DM, DMDAStencilType);
154e1589f56SBarry Smith 
1557087cfbeSBarry Smith extern PetscErrorCode     DMDAVecGetArray(DM,Vec,void *);
1567087cfbeSBarry Smith extern PetscErrorCode     DMDAVecRestoreArray(DM,Vec,void *);
157e1589f56SBarry Smith 
1587087cfbeSBarry Smith extern PetscErrorCode     DMDAVecGetArrayDOF(DM,Vec,void *);
1597087cfbeSBarry Smith extern PetscErrorCode     DMDAVecRestoreArrayDOF(DM,Vec,void *);
160e1589f56SBarry Smith 
1617087cfbeSBarry Smith extern PetscErrorCode     DMDASplitComm2d(MPI_Comm,PetscInt,PetscInt,PetscInt,MPI_Comm*);
162e1589f56SBarry Smith 
163e1589f56SBarry Smith /*E
164e1589f56SBarry Smith     DMType - String with the name of a PETSc DM or the creation function
165e1589f56SBarry Smith        with an optional dynamic library name, for example
166e1589f56SBarry Smith        http://www.mcs.anl.gov/petsc/lib.a:myveccreate()
167e1589f56SBarry Smith 
168e1589f56SBarry Smith    Level: beginner
169e1589f56SBarry Smith 
170e1589f56SBarry Smith .seealso: DMSetType(), DM
171e1589f56SBarry Smith E*/
172e1589f56SBarry Smith 
173e1589f56SBarry Smith #define DMType char*
174e1589f56SBarry Smith #define DMDA        "da"
175e1589f56SBarry Smith #define DMADDA      "adda"
176e1589f56SBarry Smith #define DMCOMPOSITE "composite"
177e1589f56SBarry Smith #define DMSLICED    "sliced"
178e1589f56SBarry Smith 
179e1589f56SBarry Smith extern PetscFList DMList;
180e1589f56SBarry Smith extern PetscBool  DMRegisterAllCalled;
1817087cfbeSBarry Smith extern PetscErrorCode  DMCreate(MPI_Comm,DM*);
1827087cfbeSBarry Smith extern PetscErrorCode  DMSetType(DM, const DMType);
1837087cfbeSBarry Smith extern PetscErrorCode  DMGetType(DM, const DMType *);
1847087cfbeSBarry Smith extern PetscErrorCode  DMRegister(const char[],const char[],const char[],PetscErrorCode (*)(DM));
1857087cfbeSBarry Smith extern PetscErrorCode  DMRegisterAll(const char []);
1867087cfbeSBarry Smith extern PetscErrorCode  DMRegisterDestroy(void);
187e1589f56SBarry Smith 
188e1589f56SBarry Smith /*MC
189e1589f56SBarry Smith   DMRegisterDynamic - Adds a new DM component implementation
190e1589f56SBarry Smith 
191e1589f56SBarry Smith   Synopsis:
192e1589f56SBarry Smith   PetscErrorCode DMRegisterDynamic(const char *name,const char *path,const char *func_name, PetscErrorCode (*create_func)(DM))
193e1589f56SBarry Smith 
194e1589f56SBarry Smith   Not Collective
195e1589f56SBarry Smith 
196e1589f56SBarry Smith   Input Parameters:
197e1589f56SBarry Smith + name        - The name of a new user-defined creation routine
198e1589f56SBarry Smith . path        - The path (either absolute or relative) of the library containing this routine
199e1589f56SBarry Smith . func_name   - The name of routine to create method context
200e1589f56SBarry Smith - create_func - The creation routine itself
201e1589f56SBarry Smith 
202e1589f56SBarry Smith   Notes:
203e1589f56SBarry Smith   DMRegisterDynamic() may be called multiple times to add several user-defined DMs
204e1589f56SBarry Smith 
205e1589f56SBarry Smith   If dynamic libraries are used, then the fourth input argument (routine_create) is ignored.
206e1589f56SBarry Smith 
207e1589f56SBarry Smith   Sample usage:
208e1589f56SBarry Smith .vb
209e1589f56SBarry Smith     DMRegisterDynamic("my_da","/home/username/my_lib/lib/libO/solaris/libmy.a", "MyDMCreate", MyDMCreate);
210e1589f56SBarry Smith .ve
211e1589f56SBarry Smith 
212e1589f56SBarry Smith   Then, your DM type can be chosen with the procedural interface via
213e1589f56SBarry Smith .vb
214e1589f56SBarry Smith     DMCreate(MPI_Comm, DM *);
215e1589f56SBarry Smith     DMSetType(DM,"my_da_name");
216e1589f56SBarry Smith .ve
217e1589f56SBarry Smith    or at runtime via the option
218e1589f56SBarry Smith .vb
219e1589f56SBarry Smith     -da_type my_da_name
220e1589f56SBarry Smith .ve
221e1589f56SBarry Smith 
222e1589f56SBarry Smith   Notes: $PETSC_ARCH occuring in pathname will be replaced with appropriate values.
223e1589f56SBarry Smith          If your function is not being put into a shared library then use DMRegister() instead
224e1589f56SBarry Smith 
225e1589f56SBarry Smith   Level: advanced
226e1589f56SBarry Smith 
227e1589f56SBarry Smith .keywords: DM, register
228e1589f56SBarry Smith .seealso: DMRegisterAll(), DMRegisterDestroy(), DMRegister()
229e1589f56SBarry Smith M*/
230e1589f56SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
231e1589f56SBarry Smith #define DMRegisterDynamic(a,b,c,d) DMRegister(a,b,c,0)
232e1589f56SBarry Smith #else
233e1589f56SBarry Smith #define DMRegisterDynamic(a,b,c,d) DMRegister(a,b,c,d)
234e1589f56SBarry Smith #endif
235e1589f56SBarry Smith 
2367087cfbeSBarry Smith extern PetscErrorCode     MatRegisterDAAD(void);
2377087cfbeSBarry Smith extern PetscErrorCode     MatCreateDAAD(DM,Mat*);
2387087cfbeSBarry Smith extern PetscErrorCode    MatCreateSeqUSFFT(Vec, DM,Mat*);
239e1589f56SBarry Smith 
240e1589f56SBarry Smith /*S
241e1589f56SBarry Smith      DMDALocalInfo - C struct that contains information about a structured grid and a processors logical
242e1589f56SBarry Smith               location in it.
243e1589f56SBarry Smith 
244e1589f56SBarry Smith    Level: beginner
245e1589f56SBarry Smith 
246e1589f56SBarry Smith   Concepts: distributed array
247e1589f56SBarry Smith 
248e1589f56SBarry Smith   Developer note: Then entries in this struct are int instead of PetscInt so that the elements may
249e1589f56SBarry Smith                   be extracted in Fortran as if from an integer array
250e1589f56SBarry Smith 
251e1589f56SBarry Smith .seealso:  DMDACreate1d(), DMDACreate2d(), DMDACreate3d(), DMDestroy(), DM, DMDAGetLocalInfo(), DMDAGetInfo()
252e1589f56SBarry Smith S*/
253e1589f56SBarry Smith typedef struct {
254e1589f56SBarry Smith   PetscInt       dim,dof,sw;
255e1589f56SBarry Smith   PetscInt       mx,my,mz;    /* global number of grid points in each direction */
256e1589f56SBarry Smith   PetscInt       xs,ys,zs;    /* starting pointd of this processor, excluding ghosts */
257e1589f56SBarry Smith   PetscInt       xm,ym,zm;    /* number of grid points on this processor, excluding ghosts */
258e1589f56SBarry Smith   PetscInt       gxs,gys,gzs;    /* starting point of this processor including ghosts */
259e1589f56SBarry Smith   PetscInt       gxm,gym,gzm;    /* number of grid points on this processor including ghosts */
260*1321219cSEthan Coon   DMDABoundaryType bx,by,bz; /* type of ghost nodes at boundary */
261e1589f56SBarry Smith   DMDAStencilType  st;
262e1589f56SBarry Smith   DM             da;
263e1589f56SBarry Smith } DMDALocalInfo;
264e1589f56SBarry Smith 
265e1589f56SBarry Smith /*MC
266e1589f56SBarry Smith       DMDAForEachPointBegin2d - Starts a loop over the local part of a two dimensional DMDA
267e1589f56SBarry Smith 
268e1589f56SBarry Smith    Synopsis:
269e1589f56SBarry Smith    void  DMDAForEachPointBegin2d(DALocalInfo *info,PetscInt i,PetscInt j);
270e1589f56SBarry Smith 
271e1589f56SBarry Smith    Not Collective
272e1589f56SBarry Smith 
273e1589f56SBarry Smith    Level: intermediate
274e1589f56SBarry Smith 
275e1589f56SBarry Smith .seealso: DMDAForEachPointEnd2d(), DMDAVecGetArray()
276e1589f56SBarry Smith M*/
277e1589f56SBarry Smith #define DMDAForEachPointBegin2d(info,i,j) {\
278e1589f56SBarry Smith   PetscInt _xints = info->xs,_xinte = info->xs+info->xm,_yints = info->ys,_yinte = info->ys+info->ym;\
279e1589f56SBarry Smith   for (j=_yints; j<_yinte; j++) {\
280e1589f56SBarry Smith     for (i=_xints; i<_xinte; i++) {\
281e1589f56SBarry Smith 
282e1589f56SBarry Smith /*MC
283e1589f56SBarry Smith       DMDAForEachPointEnd2d - Ends a loop over the local part of a two dimensional DMDA
284e1589f56SBarry Smith 
285e1589f56SBarry Smith    Synopsis:
286e1589f56SBarry Smith    void  DMDAForEachPointEnd2d;
287e1589f56SBarry Smith 
288e1589f56SBarry Smith    Not Collective
289e1589f56SBarry Smith 
290e1589f56SBarry Smith    Level: intermediate
291e1589f56SBarry Smith 
292e1589f56SBarry Smith .seealso: DMDAForEachPointBegin2d(), DMDAVecGetArray()
293e1589f56SBarry Smith M*/
294e1589f56SBarry Smith #define DMDAForEachPointEnd2d }}}
295e1589f56SBarry Smith 
296e1589f56SBarry Smith /*MC
297e1589f56SBarry Smith       DMDACoor2d - Structure for holding 2d (x and y) coordinates.
298e1589f56SBarry Smith 
299e1589f56SBarry Smith     Level: intermediate
300e1589f56SBarry Smith 
301e1589f56SBarry Smith     Sample Usage:
302e1589f56SBarry Smith       DMDACoor2d **coors;
303e1589f56SBarry Smith       Vec      vcoors;
304e1589f56SBarry Smith       DM       cda;
305e1589f56SBarry Smith 
306e1589f56SBarry Smith       DMDAGetCoordinates(da,&vcoors);
307e1589f56SBarry Smith       DMDAGetCoordinateDA(da,&cda);
308e1589f56SBarry Smith       DMDAVecGetArray(cda,vcoors,&coors);
309e1589f56SBarry Smith       DMDAGetCorners(cda,&mstart,&nstart,0,&m,&n,0)
310e1589f56SBarry Smith       for (i=mstart; i<mstart+m; i++) {
311e1589f56SBarry Smith         for (j=nstart; j<nstart+n; j++) {
312e1589f56SBarry Smith           x = coors[j][i].x;
313e1589f56SBarry Smith           y = coors[j][i].y;
314e1589f56SBarry Smith           ......
315e1589f56SBarry Smith         }
316e1589f56SBarry Smith       }
317e1589f56SBarry Smith       DMDAVecRestoreArray(dac,vcoors,&coors);
318e1589f56SBarry Smith 
319e1589f56SBarry Smith .seealso: DMDACoor3d, DMDAForEachPointBegin(), DMDAGetCoordinateDA(), DMDAGetCoordinates(), DMDAGetGhostCoordinates()
320e1589f56SBarry Smith M*/
321e1589f56SBarry Smith typedef struct {PetscScalar x,y;} DMDACoor2d;
322e1589f56SBarry Smith 
323e1589f56SBarry Smith /*MC
324e1589f56SBarry Smith       DMDACoor3d - Structure for holding 3d (x, y and z) coordinates.
325e1589f56SBarry Smith 
326e1589f56SBarry Smith     Level: intermediate
327e1589f56SBarry Smith 
328e1589f56SBarry Smith     Sample Usage:
329e1589f56SBarry Smith       DMDACoor3d ***coors;
330e1589f56SBarry Smith       Vec      vcoors;
331e1589f56SBarry Smith       DM       cda;
332e1589f56SBarry Smith 
333e1589f56SBarry Smith       DMDAGetCoordinates(da,&vcoors);
334e1589f56SBarry Smith       DMDAGetCoordinateDA(da,&cda);
335e1589f56SBarry Smith       DMDAVecGetArray(cda,vcoors,&coors);
336e1589f56SBarry Smith       DMDAGetCorners(cda,&mstart,&nstart,&pstart,&m,&n,&p)
337e1589f56SBarry Smith       for (i=mstart; i<mstart+m; i++) {
338e1589f56SBarry Smith         for (j=nstart; j<nstart+n; j++) {
339e1589f56SBarry Smith           for (k=pstart; k<pstart+p; k++) {
340e1589f56SBarry Smith             x = coors[k][j][i].x;
341e1589f56SBarry Smith             y = coors[k][j][i].y;
342e1589f56SBarry Smith             z = coors[k][j][i].z;
343e1589f56SBarry Smith           ......
344e1589f56SBarry Smith         }
345e1589f56SBarry Smith       }
346e1589f56SBarry Smith       DMDAVecRestoreArray(dac,vcoors,&coors);
347e1589f56SBarry Smith 
348e1589f56SBarry Smith .seealso: DMDACoor2d, DMDAForEachPointBegin(), DMDAGetCoordinateDA(), DMDAGetCoordinates(), DMDAGetGhostCoordinates()
349e1589f56SBarry Smith M*/
350e1589f56SBarry Smith typedef struct {PetscScalar x,y,z;} DMDACoor3d;
351e1589f56SBarry Smith 
3527087cfbeSBarry Smith extern PetscErrorCode   DMDAGetLocalInfo(DM,DMDALocalInfo*);
353e1589f56SBarry Smith typedef PetscErrorCode (*DMDALocalFunction1)(DMDALocalInfo*,void*,void*,void*);
3547087cfbeSBarry Smith extern PetscErrorCode   DMDAFormFunctionLocal(DM, DMDALocalFunction1, Vec, Vec, void *);
3557087cfbeSBarry Smith extern PetscErrorCode   DMDAFormFunctionLocalGhost(DM, DMDALocalFunction1, Vec, Vec, void *);
3567087cfbeSBarry Smith extern PetscErrorCode   DMDAFormJacobianLocal(DM, DMDALocalFunction1, Vec, Mat, void *);
3577087cfbeSBarry Smith extern PetscErrorCode   DMDAFormFunction1(DM,Vec,Vec,void*);
3587087cfbeSBarry Smith extern PetscErrorCode   DMDAFormFunction(DM,PetscErrorCode (*)(void),Vec,Vec,void*);
3597087cfbeSBarry Smith extern PetscErrorCode   DMDAFormFunctioni1(DM,PetscInt,Vec,PetscScalar*,void*);
3607087cfbeSBarry Smith extern PetscErrorCode   DMDAFormFunctionib1(DM,PetscInt,Vec,PetscScalar*,void*);
3617087cfbeSBarry Smith extern PetscErrorCode   DMDAComputeJacobian1WithAdic(DM,Vec,Mat,void*);
3627087cfbeSBarry Smith extern PetscErrorCode   DMDAComputeJacobian1WithAdifor(DM,Vec,Mat,void*);
3637087cfbeSBarry Smith extern PetscErrorCode   DMDAMultiplyByJacobian1WithAdic(DM,Vec,Vec,Vec,void*);
3647087cfbeSBarry Smith extern PetscErrorCode   DMDAMultiplyByJacobian1WithAdifor(DM,Vec,Vec,Vec,void*);
3657087cfbeSBarry Smith extern PetscErrorCode   DMDAMultiplyByJacobian1WithAD(DM,Vec,Vec,Vec,void*);
3667087cfbeSBarry Smith extern PetscErrorCode   DMDAComputeJacobian1(DM,Vec,Mat,void*);
3677087cfbeSBarry Smith extern PetscErrorCode   DMDAGetLocalFunction(DM,DMDALocalFunction1*);
3687087cfbeSBarry Smith extern PetscErrorCode   DMDASetLocalFunction(DM,DMDALocalFunction1);
3697087cfbeSBarry Smith extern PetscErrorCode   DMDASetLocalFunctioni(DM,PetscErrorCode (*)(DMDALocalInfo*,MatStencil*,void*,PetscScalar*,void*));
3707087cfbeSBarry Smith extern PetscErrorCode   DMDASetLocalFunctionib(DM,PetscErrorCode (*)(DMDALocalInfo*,MatStencil*,void*,PetscScalar*,void*));
3717087cfbeSBarry Smith extern PetscErrorCode   DMDAGetLocalJacobian(DM,DMDALocalFunction1*);
3727087cfbeSBarry Smith extern PetscErrorCode   DMDASetLocalJacobian(DM,DMDALocalFunction1);
3737087cfbeSBarry Smith extern PetscErrorCode   DMDASetLocalAdicFunction_Private(DM,DMDALocalFunction1);
374e1589f56SBarry Smith 
3757087cfbeSBarry Smith extern PetscErrorCode   MatSetDA(Mat,DM);
376e1589f56SBarry Smith 
377e1589f56SBarry Smith /*MC
378e1589f56SBarry Smith        DMDASetLocalAdicFunction - Caches in a DM a local function computed by ADIC/ADIFOR
379e1589f56SBarry Smith 
380e1589f56SBarry Smith    Synopsis:
381e1589f56SBarry Smith    PetscErrorCode DMDASetLocalAdicFunction(DM da,DMDALocalFunction1 ad_lf)
382e1589f56SBarry Smith 
383e1589f56SBarry Smith    Logically Collective on DM
384e1589f56SBarry Smith 
385e1589f56SBarry Smith    Input Parameter:
386e1589f56SBarry Smith +  da - initial distributed array
387e1589f56SBarry Smith -  ad_lf - the local function as computed by ADIC/ADIFOR
388e1589f56SBarry Smith 
389e1589f56SBarry Smith    Level: intermediate
390e1589f56SBarry Smith 
391e1589f56SBarry Smith .keywords:  distributed array, refine
392e1589f56SBarry Smith 
393e1589f56SBarry Smith .seealso: DMDACreate1d(), DMDACreate2d(), DMDACreate3d(), DMDestroy(), DMDAGetLocalFunction(), DMDASetLocalFunction(),
394e1589f56SBarry Smith           DMDASetLocalJacobian()
395e1589f56SBarry Smith M*/
396e1589f56SBarry Smith #if defined(PETSC_HAVE_ADIC)
397e1589f56SBarry Smith #  define DMDASetLocalAdicFunction(a,d) DMDASetLocalAdicFunction_Private(a,(DMDALocalFunction1)d)
398e1589f56SBarry Smith #else
399e1589f56SBarry Smith #  define DMDASetLocalAdicFunction(a,d) DMDASetLocalAdicFunction_Private(a,0)
400e1589f56SBarry Smith #endif
401e1589f56SBarry Smith 
4027087cfbeSBarry Smith extern PetscErrorCode   DMDASetLocalAdicMFFunction_Private(DM,DMDALocalFunction1);
403e1589f56SBarry Smith #if defined(PETSC_HAVE_ADIC)
404e1589f56SBarry Smith #  define DMDASetLocalAdicMFFunction(a,d) DMDASetLocalAdicMFFunction_Private(a,(DMDALocalFunction1)d)
405e1589f56SBarry Smith #else
406e1589f56SBarry Smith #  define DMDASetLocalAdicMFFunction(a,d) DMDASetLocalAdicMFFunction_Private(a,0)
407e1589f56SBarry Smith #endif
4087087cfbeSBarry Smith extern PetscErrorCode   DMDASetLocalAdicFunctioni_Private(DM,PetscErrorCode (*)(DMDALocalInfo*,MatStencil*,void*,void*,void*));
409e1589f56SBarry Smith #if defined(PETSC_HAVE_ADIC)
410e1589f56SBarry Smith #  define DMDASetLocalAdicFunctioni(a,d) DMDASetLocalAdicFunctioni_Private(a,(PetscErrorCode (*)(DMDALocalInfo*,MatStencil*,void*,void*,void*))d)
411e1589f56SBarry Smith #else
412e1589f56SBarry Smith #  define DMDASetLocalAdicFunctioni(a,d) DMDASetLocalAdicFunctioni_Private(a,0)
413e1589f56SBarry Smith #endif
4147087cfbeSBarry Smith extern PetscErrorCode   DMDASetLocalAdicMFFunctioni_Private(DM,PetscErrorCode (*)(DMDALocalInfo*,MatStencil*,void*,void*,void*));
415e1589f56SBarry Smith #if defined(PETSC_HAVE_ADIC)
416e1589f56SBarry Smith #  define DMDASetLocalAdicMFFunctioni(a,d) DMDASetLocalAdicMFFunctioni_Private(a,(PetscErrorCode (*)(DMDALocalInfo*,MatStencil*,void*,void*,void*))d)
417e1589f56SBarry Smith #else
418e1589f56SBarry Smith #  define DMDASetLocalAdicMFFunctioni(a,d) DMDASetLocalAdicMFFunctioni_Private(a,0)
419e1589f56SBarry Smith #endif
420e1589f56SBarry Smith 
4217087cfbeSBarry Smith extern PetscErrorCode   DMDASetLocalAdicFunctionib_Private(DM,PetscErrorCode (*)(DMDALocalInfo*,MatStencil*,void*,void*,void*));
422e1589f56SBarry Smith #if defined(PETSC_HAVE_ADIC)
423e1589f56SBarry Smith #  define DMDASetLocalAdicFunctionib(a,d) DMDASetLocalAdicFunctionib_Private(a,(PetscErrorCode (*)(DMDALocalInfo*,MatStencil*,void*,void*,void*))d)
424e1589f56SBarry Smith #else
425e1589f56SBarry Smith #  define DMDASetLocalAdicFunctionib(a,d) DMDASetLocalAdicFunctionib_Private(a,0)
426e1589f56SBarry Smith #endif
4277087cfbeSBarry Smith extern PetscErrorCode   DMDASetLocalAdicMFFunctionib_Private(DM,PetscErrorCode (*)(DMDALocalInfo*,MatStencil*,void*,void*,void*));
428e1589f56SBarry Smith #if defined(PETSC_HAVE_ADIC)
429e1589f56SBarry Smith #  define DMDASetLocalAdicMFFunctionib(a,d) DMDASetLocalAdicMFFunctionib_Private(a,(PetscErrorCode (*)(DMDALocalInfo*,MatStencil*,void*,void*,void*))d)
430e1589f56SBarry Smith #else
431e1589f56SBarry Smith #  define DMDASetLocalAdicMFFunctionib(a,d) DMDASetLocalAdicMFFunctionib_Private(a,0)
432e1589f56SBarry Smith #endif
433e1589f56SBarry Smith 
4347087cfbeSBarry Smith extern PetscErrorCode   DMDAFormFunctioniTest1(DM,void*);
435e1589f56SBarry Smith 
436e1589f56SBarry Smith #include "petscmat.h"
437e1589f56SBarry Smith 
438e1589f56SBarry Smith 
4397087cfbeSBarry Smith extern PetscErrorCode   DMView(DM,PetscViewer);
4407087cfbeSBarry Smith extern PetscErrorCode   DMDestroy(DM);
4417087cfbeSBarry Smith extern PetscErrorCode   DMCreateGlobalVector(DM,Vec*);
4427087cfbeSBarry Smith extern PetscErrorCode   DMCreateLocalVector(DM,Vec*);
4437087cfbeSBarry Smith extern PetscErrorCode   DMGetLocalVector(DM,Vec *);
4447087cfbeSBarry Smith extern PetscErrorCode   DMRestoreLocalVector(DM,Vec *);
4457087cfbeSBarry Smith extern PetscErrorCode   DMGetGlobalVector(DM,Vec *);
4467087cfbeSBarry Smith extern PetscErrorCode   DMRestoreGlobalVector(DM,Vec *);
4477087cfbeSBarry Smith extern PetscErrorCode   DMGetLocalToGlobalMapping(DM,ISLocalToGlobalMapping*);
4487087cfbeSBarry Smith extern PetscErrorCode   DMGetLocalToGlobalMappingBlock(DM,ISLocalToGlobalMapping*);
4497087cfbeSBarry Smith extern PetscErrorCode   DMGetBlockSize(DM,PetscInt*);
4507087cfbeSBarry Smith extern PetscErrorCode   DMGetColoring(DM,ISColoringType,const MatType,ISColoring*);
4517087cfbeSBarry Smith extern PetscErrorCode   DMGetMatrix(DM, const MatType,Mat*);
4527087cfbeSBarry Smith extern PetscErrorCode   DMGetInterpolation(DM,DM,Mat*,Vec*);
4537087cfbeSBarry Smith extern PetscErrorCode   DMGetInjection(DM,DM,VecScatter*);
4547087cfbeSBarry Smith extern PetscErrorCode   DMRefine(DM,MPI_Comm,DM*);
4557087cfbeSBarry Smith extern PetscErrorCode   DMCoarsen(DM,MPI_Comm,DM*);
4567087cfbeSBarry Smith extern PetscErrorCode   DMRefineHierarchy(DM,PetscInt,DM[]);
4577087cfbeSBarry Smith extern PetscErrorCode   DMCoarsenHierarchy(DM,PetscInt,DM[]);
4587087cfbeSBarry Smith extern PetscErrorCode   DMSetFromOptions(DM);
4597087cfbeSBarry Smith extern PetscErrorCode   DMSetUp(DM);
4607087cfbeSBarry Smith extern PetscErrorCode   DMGetInterpolationScale(DM,DM,Mat,Vec*);
4617087cfbeSBarry Smith extern PetscErrorCode   DMGetAggregates(DM,DM,Mat*);
4627087cfbeSBarry Smith extern PetscErrorCode   DMGlobalToLocalBegin(DM,Vec,InsertMode,Vec);
4637087cfbeSBarry Smith extern PetscErrorCode   DMGlobalToLocalEnd(DM,Vec,InsertMode,Vec);
4647087cfbeSBarry Smith extern PetscErrorCode   DMLocalToGlobalBegin(DM,Vec,InsertMode,Vec);
4657087cfbeSBarry Smith extern PetscErrorCode   DMLocalToGlobalEnd(DM,Vec,InsertMode,Vec);
4667087cfbeSBarry Smith extern PetscErrorCode   DMGetElements(DM,PetscInt *,PetscInt *,const PetscInt*[]);
4677087cfbeSBarry Smith extern PetscErrorCode   DMRestoreElements(DM,PetscInt *,PetscInt *,const PetscInt*[]);
468e1589f56SBarry Smith 
4697087cfbeSBarry Smith extern PetscErrorCode   DMSetContext(DM,void*);
4707087cfbeSBarry Smith extern PetscErrorCode   DMGetContext(DM,void**);
4717087cfbeSBarry Smith extern PetscErrorCode   DMSetInitialGuess(DM,PetscErrorCode (*)(DM,Vec));
4727087cfbeSBarry Smith extern PetscErrorCode   DMSetFunction(DM,PetscErrorCode (*)(DM,Vec,Vec));
4737087cfbeSBarry Smith extern PetscErrorCode   DMSetJacobian(DM,PetscErrorCode (*)(DM,Vec,Mat,Mat,MatStructure *));
4747087cfbeSBarry Smith extern PetscErrorCode   DMHasInitialGuess(DM,PetscBool *);
4757087cfbeSBarry Smith extern PetscErrorCode   DMHasFunction(DM,PetscBool *);
4767087cfbeSBarry Smith extern PetscErrorCode   DMHasJacobian(DM,PetscBool *);
4777087cfbeSBarry Smith extern PetscErrorCode   DMComputeInitialGuess(DM,Vec);
4787087cfbeSBarry Smith extern PetscErrorCode   DMComputeFunction(DM,Vec,Vec);
4797087cfbeSBarry Smith extern PetscErrorCode   DMComputeJacobian(DM,Vec,Mat,Mat,MatStructure *);
4807087cfbeSBarry Smith extern PetscErrorCode   DMComputeJacobianDefault(DM,Vec,Mat,Mat,MatStructure *);
4817087cfbeSBarry Smith extern PetscErrorCode   DMFinalizePackage(void);
482e1589f56SBarry Smith 
4837087cfbeSBarry Smith extern PetscErrorCode   DMDASetGetMatrix(DM,PetscErrorCode (*)(DM, const MatType,Mat *));
4847087cfbeSBarry Smith extern PetscErrorCode   DMDASetBlockFills(DM,PetscInt*,PetscInt*);
4857087cfbeSBarry Smith extern PetscErrorCode   DMDASetMatPreallocateOnly(DM,PetscBool );
4867087cfbeSBarry Smith extern PetscErrorCode   DMDASetRefinementFactor(DM,PetscInt,PetscInt,PetscInt);
4877087cfbeSBarry Smith extern PetscErrorCode   DMDAGetRefinementFactor(DM,PetscInt*,PetscInt*,PetscInt*);
488e1589f56SBarry Smith 
4897087cfbeSBarry Smith extern PetscErrorCode   DMDAGetAdicArray(DM,PetscBool ,void*,void*,PetscInt*);
4907087cfbeSBarry Smith extern PetscErrorCode   DMDARestoreAdicArray(DM,PetscBool ,void*,void*,PetscInt*);
4917087cfbeSBarry Smith extern PetscErrorCode   DMDAGetAdicMFArray(DM,PetscBool ,void*,void*,PetscInt*);
4927087cfbeSBarry Smith extern PetscErrorCode   DMDAGetAdicMFArray4(DM,PetscBool ,void*,void*,PetscInt*);
4937087cfbeSBarry Smith extern PetscErrorCode   DMDAGetAdicMFArray9(DM,PetscBool ,void*,void*,PetscInt*);
4947087cfbeSBarry Smith extern PetscErrorCode   DMDAGetAdicMFArrayb(DM,PetscBool ,void*,void*,PetscInt*);
4957087cfbeSBarry Smith extern PetscErrorCode   DMDARestoreAdicMFArray(DM,PetscBool ,void*,void*,PetscInt*);
4967087cfbeSBarry Smith extern PetscErrorCode   DMDAGetArray(DM,PetscBool ,void*);
4977087cfbeSBarry Smith extern PetscErrorCode   DMDARestoreArray(DM,PetscBool ,void*);
4987087cfbeSBarry Smith extern PetscErrorCode   ad_DAGetArray(DM,PetscBool ,void*);
4997087cfbeSBarry Smith extern PetscErrorCode   ad_DARestoreArray(DM,PetscBool ,void*);
5007087cfbeSBarry Smith extern PetscErrorCode   admf_DAGetArray(DM,PetscBool ,void*);
5017087cfbeSBarry Smith extern PetscErrorCode   admf_DARestoreArray(DM,PetscBool ,void*);
502e1589f56SBarry Smith 
503e1589f56SBarry Smith #include "petscpf.h"
5047087cfbeSBarry Smith extern PetscErrorCode   DMDACreatePF(DM,PF*);
505e1589f56SBarry Smith 
5067087cfbeSBarry Smith extern PetscErrorCode   DMCompositeCreate(MPI_Comm,DM*);
5077087cfbeSBarry Smith extern PetscErrorCode   DMCompositeAddArray(DM,PetscMPIInt,PetscInt);
5087087cfbeSBarry Smith extern PetscErrorCode   DMCompositeAddDM(DM,DM);
5097087cfbeSBarry Smith extern PetscErrorCode   DMCompositeSetCoupling(DM,PetscErrorCode (*)(DM,Mat,PetscInt*,PetscInt*,PetscInt,PetscInt,PetscInt,PetscInt));
5107087cfbeSBarry Smith extern PetscErrorCode   DMCompositeSetContext(DM,void*);
5117087cfbeSBarry Smith extern PetscErrorCode   DMCompositeGetContext(DM,void**);
5127087cfbeSBarry Smith extern PetscErrorCode   DMCompositeAddVecScatter(DM,VecScatter);
5137087cfbeSBarry Smith extern PetscErrorCode   DMCompositeScatter(DM,Vec,...);
5147087cfbeSBarry Smith extern PetscErrorCode   DMCompositeGather(DM,Vec,InsertMode,...);
5157087cfbeSBarry Smith extern PetscErrorCode   DMCompositeGetAccess(DM,Vec,...);
5167087cfbeSBarry Smith extern PetscErrorCode   DMCompositeGetNumberDM(DM,PetscInt*);
5177087cfbeSBarry Smith extern PetscErrorCode   DMCompositeRestoreAccess(DM,Vec,...);
5187087cfbeSBarry Smith extern PetscErrorCode   DMCompositeGetLocalVectors(DM,...);
5197087cfbeSBarry Smith extern PetscErrorCode   DMCompositeGetEntries(DM,...);
5207087cfbeSBarry Smith extern PetscErrorCode   DMCompositeRestoreLocalVectors(DM,...);
5217087cfbeSBarry Smith extern PetscErrorCode   DMCompositeGetGlobalISs(DM,IS*[]);
5227087cfbeSBarry Smith extern PetscErrorCode   DMCompositeGetLocalISs(DM,IS**);
5237087cfbeSBarry Smith extern PetscErrorCode   DMCompositeGetISLocalToGlobalMappings(DM,ISLocalToGlobalMapping**);
524e1589f56SBarry Smith 
5257087cfbeSBarry Smith extern PetscErrorCode   DMSlicedCreate(MPI_Comm,DM*);
5267087cfbeSBarry Smith extern PetscErrorCode   DMSlicedGetGlobalIndices(DM,PetscInt*[]);
5277087cfbeSBarry Smith extern PetscErrorCode   DMSlicedSetPreallocation(DM,PetscInt,const PetscInt[],PetscInt,const PetscInt[]);
5287087cfbeSBarry Smith extern PetscErrorCode   DMSlicedSetBlockFills(DM,const PetscInt*,const PetscInt*);
5297087cfbeSBarry Smith extern PetscErrorCode   DMSlicedSetGhosts(DM,PetscInt,PetscInt,PetscInt,const PetscInt[]);
530e1589f56SBarry Smith 
531e1589f56SBarry Smith 
532e1589f56SBarry Smith typedef struct NLF_DAAD* NLF;
533e1589f56SBarry Smith 
534e1589f56SBarry Smith #include <petscbag.h>
535e1589f56SBarry Smith 
5367087cfbeSBarry Smith extern PetscErrorCode  PetscViewerBinaryMatlabOpen(MPI_Comm, const char [], PetscViewer*);
5377087cfbeSBarry Smith extern PetscErrorCode  PetscViewerBinaryMatlabDestroy(PetscViewer);
5387087cfbeSBarry Smith extern PetscErrorCode  PetscViewerBinaryMatlabOutputBag(PetscViewer, const char [], PetscBag);
5397087cfbeSBarry Smith extern PetscErrorCode  PetscViewerBinaryMatlabOutputVec(PetscViewer, const char [], Vec);
5407087cfbeSBarry Smith extern PetscErrorCode  PetscViewerBinaryMatlabOutputVecDA(PetscViewer, const char [], Vec, DM);
541e1589f56SBarry Smith 
542e1589f56SBarry Smith 
5437087cfbeSBarry Smith PetscErrorCode  DMADDACreate(MPI_Comm,PetscInt,PetscInt*,PetscInt*,PetscInt,PetscBool *,DM*);
5447087cfbeSBarry Smith PetscErrorCode  DMADDASetParameters(DM,PetscInt,PetscInt*,PetscInt*,PetscInt,PetscBool*);
5457087cfbeSBarry Smith PetscErrorCode  DMADDASetRefinement(DM, PetscInt *,PetscInt);
5467087cfbeSBarry Smith PetscErrorCode  DMADDAGetCorners(DM, PetscInt **, PetscInt **);
5477087cfbeSBarry Smith PetscErrorCode  DMADDAGetGhostCorners(DM, PetscInt **, PetscInt **);
5487087cfbeSBarry Smith PetscErrorCode  DMADDAGetMatrixNS(DM, DM, const MatType , Mat *);
549e1589f56SBarry Smith 
550e1589f56SBarry Smith /* functions to set values in vectors and matrices */
551e1589f56SBarry Smith struct _ADDAIdx_s {
552e1589f56SBarry Smith   PetscInt     *x;               /* the coordinates, user has to make sure it is the correct size! */
553e1589f56SBarry Smith   PetscInt     d;                /* indexes the dof */
554e1589f56SBarry Smith };
555e1589f56SBarry Smith typedef struct _ADDAIdx_s ADDAIdx;
556e1589f56SBarry Smith 
5577087cfbeSBarry Smith PetscErrorCode  DMADDAMatSetValues(Mat, DM, PetscInt, const ADDAIdx[], DM, PetscInt, const ADDAIdx[], const PetscScalar[], InsertMode);
558e1589f56SBarry Smith PetscBool  ADDAHCiterStartup(const PetscInt, const PetscInt *const, const PetscInt *const, PetscInt *const);
559e1589f56SBarry Smith PetscBool  ADDAHCiter(const PetscInt, const PetscInt *const, const PetscInt *const, PetscInt *const);
560e1589f56SBarry Smith 
561e1589f56SBarry Smith PETSC_EXTERN_CXX_END
562e1589f56SBarry Smith #endif
563