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 10*7087cfbeSBarry Smith extern PetscErrorCode DMInitializePackage(const char[]); 11e1589f56SBarry Smith 12e1589f56SBarry Smith /*S 13e1589f56SBarry Smith DM - Abstract PETSc object that manages an abstract grid object 14e1589f56SBarry Smith 15e1589f56SBarry Smith Level: intermediate 16e1589f56SBarry Smith 17e1589f56SBarry Smith Concepts: grids, grid refinement 18e1589f56SBarry Smith 19325fc9f4SBarry Smith Notes: The DMDACreate() based object and the DMCompositeCreate() based object are examples of DMs 20e1589f56SBarry Smith 21325fc9f4SBarry Smith Though the DM objects require the petscsnes.h include files the DM library is 22e1589f56SBarry Smith NOT dependent on the SNES or KSP library. In fact, the KSP and SNES libraries depend on 23e1589f56SBarry Smith DM. (This is not great design, but not trivial to fix). 24e1589f56SBarry Smith 25e1589f56SBarry Smith .seealso: DMCompositeCreate(), DMDACreate() 26e1589f56SBarry Smith S*/ 27e1589f56SBarry Smith typedef struct _p_DM* DM; 28e1589f56SBarry Smith 29e1589f56SBarry Smith /*E 30e1589f56SBarry Smith DMDAStencilType - Determines if the stencil extends only along the coordinate directions, or also 31e1589f56SBarry Smith to the northeast, northwest etc 32e1589f56SBarry Smith 33e1589f56SBarry Smith Level: beginner 34e1589f56SBarry Smith 35e1589f56SBarry Smith .seealso: DMDACreate1d(), DMDACreate2d(), DMDACreate3d(), DMDACreate() 36e1589f56SBarry Smith E*/ 37e1589f56SBarry Smith typedef enum { DMDA_STENCIL_STAR,DMDA_STENCIL_BOX } DMDAStencilType; 38e1589f56SBarry Smith 39e1589f56SBarry Smith /*MC 40e1589f56SBarry Smith DMDA_STENCIL_STAR - "Star"-type stencil. In logical grid coordinates, only (i,j,k), (i+s,j,k), (i,j+s,k), 41e1589f56SBarry Smith (i,j,k+s) are in the stencil NOT, for example, (i+s,j+s,k) 42e1589f56SBarry Smith 43e1589f56SBarry Smith Level: beginner 44e1589f56SBarry Smith 45e1589f56SBarry Smith .seealso: DMDA_STENCIL_BOX, DMDAStencilType 46e1589f56SBarry Smith M*/ 47e1589f56SBarry Smith 48e1589f56SBarry Smith /*MC 49e1589f56SBarry Smith DMDA_STENCIL_BOX - "Box"-type stencil. In logical grid coordinates, any of (i,j,k), (i+s,j+r,k+t) may 50e1589f56SBarry Smith be in the stencil. 51e1589f56SBarry Smith 52e1589f56SBarry Smith Level: beginner 53e1589f56SBarry Smith 54e1589f56SBarry Smith .seealso: DMDA_STENCIL_STAR, DMDAStencilType 55e1589f56SBarry Smith M*/ 56e1589f56SBarry Smith 57e1589f56SBarry Smith /*E 58e1589f56SBarry Smith DMDAPeriodicType - Is the domain periodic in one or more directions 59e1589f56SBarry Smith 60e1589f56SBarry Smith Level: beginner 61e1589f56SBarry Smith 62e1589f56SBarry Smith DMDA_XYZGHOSTED means that ghost points are put around all the physical boundaries 63e1589f56SBarry Smith in the local representation of the Vec (i.e. DMDACreate/GetLocalVector(). 64e1589f56SBarry Smith 65e1589f56SBarry Smith .seealso: DMDACreate1d(), DMDACreate2d(), DMDACreate3d(), DMDACreate() 66e1589f56SBarry Smith E*/ 67e1589f56SBarry Smith typedef enum { DMDA_NONPERIODIC,DMDA_XPERIODIC,DMDA_YPERIODIC,DMDA_XYPERIODIC, 68e1589f56SBarry Smith DMDA_XYZPERIODIC,DMDA_XZPERIODIC,DMDA_YZPERIODIC,DMDA_ZPERIODIC,DMDA_XYZGHOSTED} DMDAPeriodicType; 69e1589f56SBarry Smith extern const char *DMDAPeriodicTypes[]; 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 81*7087cfbeSBarry 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 94*7087cfbeSBarry Smith extern PetscErrorCode DMDASetElementType(DM,DMDAElementType); 95*7087cfbeSBarry Smith extern PetscErrorCode DMDAGetElementType(DM,DMDAElementType*); 96e1589f56SBarry Smith 97e1589f56SBarry Smith #define DMDAXPeriodic(pt) ((pt)==DMDA_XPERIODIC||(pt)==DMDA_XYPERIODIC||(pt)==DMDA_XZPERIODIC||(pt)==DMDA_XYZPERIODIC) 98e1589f56SBarry Smith #define DMDAYPeriodic(pt) ((pt)==DMDA_YPERIODIC||(pt)==DMDA_XYPERIODIC||(pt)==DMDA_YZPERIODIC||(pt)==DMDA_XYZPERIODIC) 99e1589f56SBarry Smith #define DMDAZPeriodic(pt) ((pt)==DMDA_ZPERIODIC||(pt)==DMDA_XZPERIODIC||(pt)==DMDA_YZPERIODIC||(pt)==DMDA_XYZPERIODIC) 100e1589f56SBarry Smith 101e1589f56SBarry Smith typedef enum { DMDA_X,DMDA_Y,DMDA_Z } DMDADirection; 102e1589f56SBarry Smith 103*7087cfbeSBarry Smith extern PetscClassId DM_CLASSID; 104e1589f56SBarry Smith 105e1589f56SBarry Smith #define MATSEQUSFFT "sequsfft" 106e1589f56SBarry Smith 107*7087cfbeSBarry Smith extern PetscErrorCode DMDACreate(MPI_Comm,DM*); 108*7087cfbeSBarry Smith extern PetscErrorCode DMDASetDim(DM,PetscInt); 109*7087cfbeSBarry Smith extern PetscErrorCode DMDASetSizes(DM,PetscInt,PetscInt,PetscInt); 110*7087cfbeSBarry Smith extern PetscErrorCode DMDACreate1d(MPI_Comm,DMDAPeriodicType,PetscInt,PetscInt,PetscInt,const PetscInt[],DM *); 111*7087cfbeSBarry Smith extern PetscErrorCode DMDACreate2d(MPI_Comm,DMDAPeriodicType,DMDAStencilType,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],const PetscInt[],DM*); 112*7087cfbeSBarry Smith extern PetscErrorCode DMDACreate3d(MPI_Comm,DMDAPeriodicType,DMDAStencilType,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],const PetscInt[],const PetscInt[],DM*); 113*7087cfbeSBarry Smith extern PetscErrorCode DMSetOptionsPrefix(DM,const char []); 114*7087cfbeSBarry Smith extern PetscErrorCode DMSetVecType(DM,const VecType); 115e1589f56SBarry Smith 116*7087cfbeSBarry Smith extern PetscErrorCode DMDAGlobalToNaturalBegin(DM,Vec,InsertMode,Vec); 117*7087cfbeSBarry Smith extern PetscErrorCode DMDAGlobalToNaturalEnd(DM,Vec,InsertMode,Vec); 118*7087cfbeSBarry Smith extern PetscErrorCode DMDANaturalToGlobalBegin(DM,Vec,InsertMode,Vec); 119*7087cfbeSBarry Smith extern PetscErrorCode DMDANaturalToGlobalEnd(DM,Vec,InsertMode,Vec); 120*7087cfbeSBarry Smith extern PetscErrorCode DMDALocalToLocalBegin(DM,Vec,InsertMode,Vec); 121*7087cfbeSBarry Smith extern PetscErrorCode DMDALocalToLocalEnd(DM,Vec,InsertMode,Vec); 122*7087cfbeSBarry Smith extern PetscErrorCode DMDACreateNaturalVector(DM,Vec *); 123e1589f56SBarry Smith 124*7087cfbeSBarry Smith extern PetscErrorCode DMDALoad(PetscViewer,PetscInt,PetscInt,PetscInt,DM *); 125*7087cfbeSBarry Smith extern PetscErrorCode DMDAGetCorners(DM,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*); 126*7087cfbeSBarry Smith extern PetscErrorCode DMDAGetGhostCorners(DM,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*); 127*7087cfbeSBarry Smith extern PetscErrorCode DMDAGetInfo(DM,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,DMDAPeriodicType*,DMDAStencilType*); 128*7087cfbeSBarry Smith extern PetscErrorCode DMDAGetProcessorSubset(DM,DMDADirection,PetscInt,MPI_Comm*); 129*7087cfbeSBarry Smith extern PetscErrorCode DMDAGetProcessorSubsets(DM,DMDADirection,MPI_Comm*); 130e1589f56SBarry Smith 131*7087cfbeSBarry Smith extern PetscErrorCode DMDAGlobalToNaturalAllCreate(DM,VecScatter*); 132*7087cfbeSBarry Smith extern PetscErrorCode DMDANaturalAllToGlobalCreate(DM,VecScatter*); 133e1589f56SBarry Smith 134*7087cfbeSBarry Smith extern PetscErrorCode DMDAGetGlobalIndices(DM,PetscInt*,PetscInt**); 135e1589f56SBarry Smith 136*7087cfbeSBarry Smith extern PetscErrorCode DMDAGetScatter(DM,VecScatter*,VecScatter*,VecScatter*); 137*7087cfbeSBarry Smith extern PetscErrorCode DMDAGetNeighbors(DM,const PetscMPIInt**); 138e1589f56SBarry Smith 139*7087cfbeSBarry Smith extern PetscErrorCode DMDAGetAO(DM,AO*); 140*7087cfbeSBarry Smith extern PetscErrorCode DMDASetCoordinates(DM,Vec); 141*7087cfbeSBarry Smith extern PetscErrorCode DMDAGetCoordinates(DM,Vec *); 142*7087cfbeSBarry Smith extern PetscErrorCode DMDAGetGhostedCoordinates(DM,Vec *); 143*7087cfbeSBarry Smith extern PetscErrorCode DMDAGetCoordinateDA(DM,DM *); 144*7087cfbeSBarry Smith extern PetscErrorCode DMDASetUniformCoordinates(DM,PetscReal,PetscReal,PetscReal,PetscReal,PetscReal,PetscReal); 145*7087cfbeSBarry Smith extern PetscErrorCode DMDAGetBoundingBox(DM,PetscReal[],PetscReal[]); 146*7087cfbeSBarry Smith extern PetscErrorCode DMDAGetLocalBoundingBox(DM,PetscReal[],PetscReal[]); 147*7087cfbeSBarry Smith extern PetscErrorCode DMDASetFieldName(DM,PetscInt,const char[]); 148*7087cfbeSBarry Smith extern PetscErrorCode DMDAGetFieldName(DM,PetscInt,const char**); 149e1589f56SBarry Smith 150*7087cfbeSBarry Smith extern PetscErrorCode DMDASetPeriodicity(DM, DMDAPeriodicType); 151*7087cfbeSBarry Smith extern PetscErrorCode DMDASetDof(DM, int); 152*7087cfbeSBarry Smith extern PetscErrorCode DMDASetStencilWidth(DM, PetscInt); 153*7087cfbeSBarry Smith extern PetscErrorCode DMDASetOwnershipRanges(DM,const PetscInt[],const PetscInt[],const PetscInt[]); 154*7087cfbeSBarry Smith extern PetscErrorCode DMDAGetOwnershipRanges(DM,const PetscInt**,const PetscInt**,const PetscInt**); 155*7087cfbeSBarry Smith extern PetscErrorCode DMDASetNumProcs(DM, PetscInt, PetscInt, PetscInt); 156*7087cfbeSBarry Smith extern PetscErrorCode DMDASetStencilType(DM, DMDAStencilType); 157e1589f56SBarry Smith 158*7087cfbeSBarry Smith extern PetscErrorCode DMDAVecGetArray(DM,Vec,void *); 159*7087cfbeSBarry Smith extern PetscErrorCode DMDAVecRestoreArray(DM,Vec,void *); 160e1589f56SBarry Smith 161*7087cfbeSBarry Smith extern PetscErrorCode DMDAVecGetArrayDOF(DM,Vec,void *); 162*7087cfbeSBarry Smith extern PetscErrorCode DMDAVecRestoreArrayDOF(DM,Vec,void *); 163e1589f56SBarry Smith 164*7087cfbeSBarry Smith extern PetscErrorCode DMDASplitComm2d(MPI_Comm,PetscInt,PetscInt,PetscInt,MPI_Comm*); 165e1589f56SBarry Smith 166e1589f56SBarry Smith /*E 167e1589f56SBarry Smith DMType - String with the name of a PETSc DM or the creation function 168e1589f56SBarry Smith with an optional dynamic library name, for example 169e1589f56SBarry Smith http://www.mcs.anl.gov/petsc/lib.a:myveccreate() 170e1589f56SBarry Smith 171e1589f56SBarry Smith Level: beginner 172e1589f56SBarry Smith 173e1589f56SBarry Smith .seealso: DMSetType(), DM 174e1589f56SBarry Smith E*/ 175e1589f56SBarry Smith 176e1589f56SBarry Smith #define DMType char* 177e1589f56SBarry Smith #define DMDA "da" 178e1589f56SBarry Smith #define DMADDA "adda" 179e1589f56SBarry Smith #define DMCOMPOSITE "composite" 180e1589f56SBarry Smith #define DMSLICED "sliced" 181e1589f56SBarry Smith 182e1589f56SBarry Smith extern PetscFList DMList; 183e1589f56SBarry Smith extern PetscBool DMRegisterAllCalled; 184*7087cfbeSBarry Smith extern PetscErrorCode DMCreate(MPI_Comm,DM*); 185*7087cfbeSBarry Smith extern PetscErrorCode DMSetType(DM, const DMType); 186*7087cfbeSBarry Smith extern PetscErrorCode DMGetType(DM, const DMType *); 187*7087cfbeSBarry Smith extern PetscErrorCode DMRegister(const char[],const char[],const char[],PetscErrorCode (*)(DM)); 188*7087cfbeSBarry Smith extern PetscErrorCode DMRegisterAll(const char []); 189*7087cfbeSBarry Smith extern PetscErrorCode DMRegisterDestroy(void); 190e1589f56SBarry Smith 191e1589f56SBarry Smith /*MC 192e1589f56SBarry Smith DMRegisterDynamic - Adds a new DM component implementation 193e1589f56SBarry Smith 194e1589f56SBarry Smith Synopsis: 195e1589f56SBarry Smith PetscErrorCode DMRegisterDynamic(const char *name,const char *path,const char *func_name, PetscErrorCode (*create_func)(DM)) 196e1589f56SBarry Smith 197e1589f56SBarry Smith Not Collective 198e1589f56SBarry Smith 199e1589f56SBarry Smith Input Parameters: 200e1589f56SBarry Smith + name - The name of a new user-defined creation routine 201e1589f56SBarry Smith . path - The path (either absolute or relative) of the library containing this routine 202e1589f56SBarry Smith . func_name - The name of routine to create method context 203e1589f56SBarry Smith - create_func - The creation routine itself 204e1589f56SBarry Smith 205e1589f56SBarry Smith Notes: 206e1589f56SBarry Smith DMRegisterDynamic() may be called multiple times to add several user-defined DMs 207e1589f56SBarry Smith 208e1589f56SBarry Smith If dynamic libraries are used, then the fourth input argument (routine_create) is ignored. 209e1589f56SBarry Smith 210e1589f56SBarry Smith Sample usage: 211e1589f56SBarry Smith .vb 212e1589f56SBarry Smith DMRegisterDynamic("my_da","/home/username/my_lib/lib/libO/solaris/libmy.a", "MyDMCreate", MyDMCreate); 213e1589f56SBarry Smith .ve 214e1589f56SBarry Smith 215e1589f56SBarry Smith Then, your DM type can be chosen with the procedural interface via 216e1589f56SBarry Smith .vb 217e1589f56SBarry Smith DMCreate(MPI_Comm, DM *); 218e1589f56SBarry Smith DMSetType(DM,"my_da_name"); 219e1589f56SBarry Smith .ve 220e1589f56SBarry Smith or at runtime via the option 221e1589f56SBarry Smith .vb 222e1589f56SBarry Smith -da_type my_da_name 223e1589f56SBarry Smith .ve 224e1589f56SBarry Smith 225e1589f56SBarry Smith Notes: $PETSC_ARCH occuring in pathname will be replaced with appropriate values. 226e1589f56SBarry Smith If your function is not being put into a shared library then use DMRegister() instead 227e1589f56SBarry Smith 228e1589f56SBarry Smith Level: advanced 229e1589f56SBarry Smith 230e1589f56SBarry Smith .keywords: DM, register 231e1589f56SBarry Smith .seealso: DMRegisterAll(), DMRegisterDestroy(), DMRegister() 232e1589f56SBarry Smith M*/ 233e1589f56SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 234e1589f56SBarry Smith #define DMRegisterDynamic(a,b,c,d) DMRegister(a,b,c,0) 235e1589f56SBarry Smith #else 236e1589f56SBarry Smith #define DMRegisterDynamic(a,b,c,d) DMRegister(a,b,c,d) 237e1589f56SBarry Smith #endif 238e1589f56SBarry Smith 239*7087cfbeSBarry Smith extern PetscErrorCode MatRegisterDAAD(void); 240*7087cfbeSBarry Smith extern PetscErrorCode MatCreateDAAD(DM,Mat*); 241*7087cfbeSBarry Smith extern PetscErrorCode MatCreateSeqUSFFT(Vec, DM,Mat*); 242e1589f56SBarry Smith 243e1589f56SBarry Smith /*S 244e1589f56SBarry Smith DMDALocalInfo - C struct that contains information about a structured grid and a processors logical 245e1589f56SBarry Smith location in it. 246e1589f56SBarry Smith 247e1589f56SBarry Smith Level: beginner 248e1589f56SBarry Smith 249e1589f56SBarry Smith Concepts: distributed array 250e1589f56SBarry Smith 251e1589f56SBarry Smith Developer note: Then entries in this struct are int instead of PetscInt so that the elements may 252e1589f56SBarry Smith be extracted in Fortran as if from an integer array 253e1589f56SBarry Smith 254e1589f56SBarry Smith .seealso: DMDACreate1d(), DMDACreate2d(), DMDACreate3d(), DMDestroy(), DM, DMDAGetLocalInfo(), DMDAGetInfo() 255e1589f56SBarry Smith S*/ 256e1589f56SBarry Smith typedef struct { 257e1589f56SBarry Smith PetscInt dim,dof,sw; 258e1589f56SBarry Smith PetscInt mx,my,mz; /* global number of grid points in each direction */ 259e1589f56SBarry Smith PetscInt xs,ys,zs; /* starting pointd of this processor, excluding ghosts */ 260e1589f56SBarry Smith PetscInt xm,ym,zm; /* number of grid points on this processor, excluding ghosts */ 261e1589f56SBarry Smith PetscInt gxs,gys,gzs; /* starting point of this processor including ghosts */ 262e1589f56SBarry Smith PetscInt gxm,gym,gzm; /* number of grid points on this processor including ghosts */ 263e1589f56SBarry Smith DMDAPeriodicType pt; 264e1589f56SBarry Smith DMDAStencilType st; 265e1589f56SBarry Smith DM da; 266e1589f56SBarry Smith } DMDALocalInfo; 267e1589f56SBarry Smith 268e1589f56SBarry Smith /*MC 269e1589f56SBarry Smith DMDAForEachPointBegin2d - Starts a loop over the local part of a two dimensional DMDA 270e1589f56SBarry Smith 271e1589f56SBarry Smith Synopsis: 272e1589f56SBarry Smith void DMDAForEachPointBegin2d(DALocalInfo *info,PetscInt i,PetscInt j); 273e1589f56SBarry Smith 274e1589f56SBarry Smith Not Collective 275e1589f56SBarry Smith 276e1589f56SBarry Smith Level: intermediate 277e1589f56SBarry Smith 278e1589f56SBarry Smith .seealso: DMDAForEachPointEnd2d(), DMDAVecGetArray() 279e1589f56SBarry Smith M*/ 280e1589f56SBarry Smith #define DMDAForEachPointBegin2d(info,i,j) {\ 281e1589f56SBarry Smith PetscInt _xints = info->xs,_xinte = info->xs+info->xm,_yints = info->ys,_yinte = info->ys+info->ym;\ 282e1589f56SBarry Smith for (j=_yints; j<_yinte; j++) {\ 283e1589f56SBarry Smith for (i=_xints; i<_xinte; i++) {\ 284e1589f56SBarry Smith 285e1589f56SBarry Smith /*MC 286e1589f56SBarry Smith DMDAForEachPointEnd2d - Ends a loop over the local part of a two dimensional DMDA 287e1589f56SBarry Smith 288e1589f56SBarry Smith Synopsis: 289e1589f56SBarry Smith void DMDAForEachPointEnd2d; 290e1589f56SBarry Smith 291e1589f56SBarry Smith Not Collective 292e1589f56SBarry Smith 293e1589f56SBarry Smith Level: intermediate 294e1589f56SBarry Smith 295e1589f56SBarry Smith .seealso: DMDAForEachPointBegin2d(), DMDAVecGetArray() 296e1589f56SBarry Smith M*/ 297e1589f56SBarry Smith #define DMDAForEachPointEnd2d }}} 298e1589f56SBarry Smith 299e1589f56SBarry Smith /*MC 300e1589f56SBarry Smith DMDACoor2d - Structure for holding 2d (x and y) coordinates. 301e1589f56SBarry Smith 302e1589f56SBarry Smith Level: intermediate 303e1589f56SBarry Smith 304e1589f56SBarry Smith Sample Usage: 305e1589f56SBarry Smith DMDACoor2d **coors; 306e1589f56SBarry Smith Vec vcoors; 307e1589f56SBarry Smith DM cda; 308e1589f56SBarry Smith 309e1589f56SBarry Smith DMDAGetCoordinates(da,&vcoors); 310e1589f56SBarry Smith DMDAGetCoordinateDA(da,&cda); 311e1589f56SBarry Smith DMDAVecGetArray(cda,vcoors,&coors); 312e1589f56SBarry Smith DMDAGetCorners(cda,&mstart,&nstart,0,&m,&n,0) 313e1589f56SBarry Smith for (i=mstart; i<mstart+m; i++) { 314e1589f56SBarry Smith for (j=nstart; j<nstart+n; j++) { 315e1589f56SBarry Smith x = coors[j][i].x; 316e1589f56SBarry Smith y = coors[j][i].y; 317e1589f56SBarry Smith ...... 318e1589f56SBarry Smith } 319e1589f56SBarry Smith } 320e1589f56SBarry Smith DMDAVecRestoreArray(dac,vcoors,&coors); 321e1589f56SBarry Smith 322e1589f56SBarry Smith .seealso: DMDACoor3d, DMDAForEachPointBegin(), DMDAGetCoordinateDA(), DMDAGetCoordinates(), DMDAGetGhostCoordinates() 323e1589f56SBarry Smith M*/ 324e1589f56SBarry Smith typedef struct {PetscScalar x,y;} DMDACoor2d; 325e1589f56SBarry Smith 326e1589f56SBarry Smith /*MC 327e1589f56SBarry Smith DMDACoor3d - Structure for holding 3d (x, y and z) coordinates. 328e1589f56SBarry Smith 329e1589f56SBarry Smith Level: intermediate 330e1589f56SBarry Smith 331e1589f56SBarry Smith Sample Usage: 332e1589f56SBarry Smith DMDACoor3d ***coors; 333e1589f56SBarry Smith Vec vcoors; 334e1589f56SBarry Smith DM cda; 335e1589f56SBarry Smith 336e1589f56SBarry Smith DMDAGetCoordinates(da,&vcoors); 337e1589f56SBarry Smith DMDAGetCoordinateDA(da,&cda); 338e1589f56SBarry Smith DMDAVecGetArray(cda,vcoors,&coors); 339e1589f56SBarry Smith DMDAGetCorners(cda,&mstart,&nstart,&pstart,&m,&n,&p) 340e1589f56SBarry Smith for (i=mstart; i<mstart+m; i++) { 341e1589f56SBarry Smith for (j=nstart; j<nstart+n; j++) { 342e1589f56SBarry Smith for (k=pstart; k<pstart+p; k++) { 343e1589f56SBarry Smith x = coors[k][j][i].x; 344e1589f56SBarry Smith y = coors[k][j][i].y; 345e1589f56SBarry Smith z = coors[k][j][i].z; 346e1589f56SBarry Smith ...... 347e1589f56SBarry Smith } 348e1589f56SBarry Smith } 349e1589f56SBarry Smith DMDAVecRestoreArray(dac,vcoors,&coors); 350e1589f56SBarry Smith 351e1589f56SBarry Smith .seealso: DMDACoor2d, DMDAForEachPointBegin(), DMDAGetCoordinateDA(), DMDAGetCoordinates(), DMDAGetGhostCoordinates() 352e1589f56SBarry Smith M*/ 353e1589f56SBarry Smith typedef struct {PetscScalar x,y,z;} DMDACoor3d; 354e1589f56SBarry Smith 355*7087cfbeSBarry Smith extern PetscErrorCode DMDAGetLocalInfo(DM,DMDALocalInfo*); 356e1589f56SBarry Smith typedef PetscErrorCode (*DMDALocalFunction1)(DMDALocalInfo*,void*,void*,void*); 357*7087cfbeSBarry Smith extern PetscErrorCode DMDAFormFunctionLocal(DM, DMDALocalFunction1, Vec, Vec, void *); 358*7087cfbeSBarry Smith extern PetscErrorCode DMDAFormFunctionLocalGhost(DM, DMDALocalFunction1, Vec, Vec, void *); 359*7087cfbeSBarry Smith extern PetscErrorCode DMDAFormJacobianLocal(DM, DMDALocalFunction1, Vec, Mat, void *); 360*7087cfbeSBarry Smith extern PetscErrorCode DMDAFormFunction1(DM,Vec,Vec,void*); 361*7087cfbeSBarry Smith extern PetscErrorCode DMDAFormFunction(DM,PetscErrorCode (*)(void),Vec,Vec,void*); 362*7087cfbeSBarry Smith extern PetscErrorCode DMDAFormFunctioni1(DM,PetscInt,Vec,PetscScalar*,void*); 363*7087cfbeSBarry Smith extern PetscErrorCode DMDAFormFunctionib1(DM,PetscInt,Vec,PetscScalar*,void*); 364*7087cfbeSBarry Smith extern PetscErrorCode DMDAComputeJacobian1WithAdic(DM,Vec,Mat,void*); 365*7087cfbeSBarry Smith extern PetscErrorCode DMDAComputeJacobian1WithAdifor(DM,Vec,Mat,void*); 366*7087cfbeSBarry Smith extern PetscErrorCode DMDAMultiplyByJacobian1WithAdic(DM,Vec,Vec,Vec,void*); 367*7087cfbeSBarry Smith extern PetscErrorCode DMDAMultiplyByJacobian1WithAdifor(DM,Vec,Vec,Vec,void*); 368*7087cfbeSBarry Smith extern PetscErrorCode DMDAMultiplyByJacobian1WithAD(DM,Vec,Vec,Vec,void*); 369*7087cfbeSBarry Smith extern PetscErrorCode DMDAComputeJacobian1(DM,Vec,Mat,void*); 370*7087cfbeSBarry Smith extern PetscErrorCode DMDAGetLocalFunction(DM,DMDALocalFunction1*); 371*7087cfbeSBarry Smith extern PetscErrorCode DMDASetLocalFunction(DM,DMDALocalFunction1); 372*7087cfbeSBarry Smith extern PetscErrorCode DMDASetLocalFunctioni(DM,PetscErrorCode (*)(DMDALocalInfo*,MatStencil*,void*,PetscScalar*,void*)); 373*7087cfbeSBarry Smith extern PetscErrorCode DMDASetLocalFunctionib(DM,PetscErrorCode (*)(DMDALocalInfo*,MatStencil*,void*,PetscScalar*,void*)); 374*7087cfbeSBarry Smith extern PetscErrorCode DMDAGetLocalJacobian(DM,DMDALocalFunction1*); 375*7087cfbeSBarry Smith extern PetscErrorCode DMDASetLocalJacobian(DM,DMDALocalFunction1); 376*7087cfbeSBarry Smith extern PetscErrorCode DMDASetLocalAdicFunction_Private(DM,DMDALocalFunction1); 377e1589f56SBarry Smith 378*7087cfbeSBarry Smith extern PetscErrorCode MatSetDA(Mat,DM); 379e1589f56SBarry Smith 380e1589f56SBarry Smith /*MC 381e1589f56SBarry Smith DMDASetLocalAdicFunction - Caches in a DM a local function computed by ADIC/ADIFOR 382e1589f56SBarry Smith 383e1589f56SBarry Smith Synopsis: 384e1589f56SBarry Smith PetscErrorCode DMDASetLocalAdicFunction(DM da,DMDALocalFunction1 ad_lf) 385e1589f56SBarry Smith 386e1589f56SBarry Smith Logically Collective on DM 387e1589f56SBarry Smith 388e1589f56SBarry Smith Input Parameter: 389e1589f56SBarry Smith + da - initial distributed array 390e1589f56SBarry Smith - ad_lf - the local function as computed by ADIC/ADIFOR 391e1589f56SBarry Smith 392e1589f56SBarry Smith Level: intermediate 393e1589f56SBarry Smith 394e1589f56SBarry Smith .keywords: distributed array, refine 395e1589f56SBarry Smith 396e1589f56SBarry Smith .seealso: DMDACreate1d(), DMDACreate2d(), DMDACreate3d(), DMDestroy(), DMDAGetLocalFunction(), DMDASetLocalFunction(), 397e1589f56SBarry Smith DMDASetLocalJacobian() 398e1589f56SBarry Smith M*/ 399e1589f56SBarry Smith #if defined(PETSC_HAVE_ADIC) 400e1589f56SBarry Smith # define DMDASetLocalAdicFunction(a,d) DMDASetLocalAdicFunction_Private(a,(DMDALocalFunction1)d) 401e1589f56SBarry Smith #else 402e1589f56SBarry Smith # define DMDASetLocalAdicFunction(a,d) DMDASetLocalAdicFunction_Private(a,0) 403e1589f56SBarry Smith #endif 404e1589f56SBarry Smith 405*7087cfbeSBarry Smith extern PetscErrorCode DMDASetLocalAdicMFFunction_Private(DM,DMDALocalFunction1); 406e1589f56SBarry Smith #if defined(PETSC_HAVE_ADIC) 407e1589f56SBarry Smith # define DMDASetLocalAdicMFFunction(a,d) DMDASetLocalAdicMFFunction_Private(a,(DMDALocalFunction1)d) 408e1589f56SBarry Smith #else 409e1589f56SBarry Smith # define DMDASetLocalAdicMFFunction(a,d) DMDASetLocalAdicMFFunction_Private(a,0) 410e1589f56SBarry Smith #endif 411*7087cfbeSBarry Smith extern PetscErrorCode DMDASetLocalAdicFunctioni_Private(DM,PetscErrorCode (*)(DMDALocalInfo*,MatStencil*,void*,void*,void*)); 412e1589f56SBarry Smith #if defined(PETSC_HAVE_ADIC) 413e1589f56SBarry Smith # define DMDASetLocalAdicFunctioni(a,d) DMDASetLocalAdicFunctioni_Private(a,(PetscErrorCode (*)(DMDALocalInfo*,MatStencil*,void*,void*,void*))d) 414e1589f56SBarry Smith #else 415e1589f56SBarry Smith # define DMDASetLocalAdicFunctioni(a,d) DMDASetLocalAdicFunctioni_Private(a,0) 416e1589f56SBarry Smith #endif 417*7087cfbeSBarry Smith extern PetscErrorCode DMDASetLocalAdicMFFunctioni_Private(DM,PetscErrorCode (*)(DMDALocalInfo*,MatStencil*,void*,void*,void*)); 418e1589f56SBarry Smith #if defined(PETSC_HAVE_ADIC) 419e1589f56SBarry Smith # define DMDASetLocalAdicMFFunctioni(a,d) DMDASetLocalAdicMFFunctioni_Private(a,(PetscErrorCode (*)(DMDALocalInfo*,MatStencil*,void*,void*,void*))d) 420e1589f56SBarry Smith #else 421e1589f56SBarry Smith # define DMDASetLocalAdicMFFunctioni(a,d) DMDASetLocalAdicMFFunctioni_Private(a,0) 422e1589f56SBarry Smith #endif 423e1589f56SBarry Smith 424*7087cfbeSBarry Smith extern PetscErrorCode DMDASetLocalAdicFunctionib_Private(DM,PetscErrorCode (*)(DMDALocalInfo*,MatStencil*,void*,void*,void*)); 425e1589f56SBarry Smith #if defined(PETSC_HAVE_ADIC) 426e1589f56SBarry Smith # define DMDASetLocalAdicFunctionib(a,d) DMDASetLocalAdicFunctionib_Private(a,(PetscErrorCode (*)(DMDALocalInfo*,MatStencil*,void*,void*,void*))d) 427e1589f56SBarry Smith #else 428e1589f56SBarry Smith # define DMDASetLocalAdicFunctionib(a,d) DMDASetLocalAdicFunctionib_Private(a,0) 429e1589f56SBarry Smith #endif 430*7087cfbeSBarry Smith extern PetscErrorCode DMDASetLocalAdicMFFunctionib_Private(DM,PetscErrorCode (*)(DMDALocalInfo*,MatStencil*,void*,void*,void*)); 431e1589f56SBarry Smith #if defined(PETSC_HAVE_ADIC) 432e1589f56SBarry Smith # define DMDASetLocalAdicMFFunctionib(a,d) DMDASetLocalAdicMFFunctionib_Private(a,(PetscErrorCode (*)(DMDALocalInfo*,MatStencil*,void*,void*,void*))d) 433e1589f56SBarry Smith #else 434e1589f56SBarry Smith # define DMDASetLocalAdicMFFunctionib(a,d) DMDASetLocalAdicMFFunctionib_Private(a,0) 435e1589f56SBarry Smith #endif 436e1589f56SBarry Smith 437*7087cfbeSBarry Smith extern PetscErrorCode DMDAFormFunctioniTest1(DM,void*); 438e1589f56SBarry Smith 439e1589f56SBarry Smith #include "petscmat.h" 440e1589f56SBarry Smith 441e1589f56SBarry Smith 442*7087cfbeSBarry Smith extern PetscErrorCode DMView(DM,PetscViewer); 443*7087cfbeSBarry Smith extern PetscErrorCode DMDestroy(DM); 444*7087cfbeSBarry Smith extern PetscErrorCode DMCreateGlobalVector(DM,Vec*); 445*7087cfbeSBarry Smith extern PetscErrorCode DMCreateLocalVector(DM,Vec*); 446*7087cfbeSBarry Smith extern PetscErrorCode DMGetLocalVector(DM,Vec *); 447*7087cfbeSBarry Smith extern PetscErrorCode DMRestoreLocalVector(DM,Vec *); 448*7087cfbeSBarry Smith extern PetscErrorCode DMGetGlobalVector(DM,Vec *); 449*7087cfbeSBarry Smith extern PetscErrorCode DMRestoreGlobalVector(DM,Vec *); 450*7087cfbeSBarry Smith extern PetscErrorCode DMGetLocalToGlobalMapping(DM,ISLocalToGlobalMapping*); 451*7087cfbeSBarry Smith extern PetscErrorCode DMGetLocalToGlobalMappingBlock(DM,ISLocalToGlobalMapping*); 452*7087cfbeSBarry Smith extern PetscErrorCode DMGetBlockSize(DM,PetscInt*); 453*7087cfbeSBarry Smith extern PetscErrorCode DMGetColoring(DM,ISColoringType,const MatType,ISColoring*); 454*7087cfbeSBarry Smith extern PetscErrorCode DMGetMatrix(DM, const MatType,Mat*); 455*7087cfbeSBarry Smith extern PetscErrorCode DMGetInterpolation(DM,DM,Mat*,Vec*); 456*7087cfbeSBarry Smith extern PetscErrorCode DMGetInjection(DM,DM,VecScatter*); 457*7087cfbeSBarry Smith extern PetscErrorCode DMRefine(DM,MPI_Comm,DM*); 458*7087cfbeSBarry Smith extern PetscErrorCode DMCoarsen(DM,MPI_Comm,DM*); 459*7087cfbeSBarry Smith extern PetscErrorCode DMRefineHierarchy(DM,PetscInt,DM[]); 460*7087cfbeSBarry Smith extern PetscErrorCode DMCoarsenHierarchy(DM,PetscInt,DM[]); 461*7087cfbeSBarry Smith extern PetscErrorCode DMSetFromOptions(DM); 462*7087cfbeSBarry Smith extern PetscErrorCode DMSetUp(DM); 463*7087cfbeSBarry Smith extern PetscErrorCode DMGetInterpolationScale(DM,DM,Mat,Vec*); 464*7087cfbeSBarry Smith extern PetscErrorCode DMGetAggregates(DM,DM,Mat*); 465*7087cfbeSBarry Smith extern PetscErrorCode DMGlobalToLocalBegin(DM,Vec,InsertMode,Vec); 466*7087cfbeSBarry Smith extern PetscErrorCode DMGlobalToLocalEnd(DM,Vec,InsertMode,Vec); 467*7087cfbeSBarry Smith extern PetscErrorCode DMLocalToGlobalBegin(DM,Vec,InsertMode,Vec); 468*7087cfbeSBarry Smith extern PetscErrorCode DMLocalToGlobalEnd(DM,Vec,InsertMode,Vec); 469*7087cfbeSBarry Smith extern PetscErrorCode DMGetElements(DM,PetscInt *,PetscInt *,const PetscInt*[]); 470*7087cfbeSBarry Smith extern PetscErrorCode DMRestoreElements(DM,PetscInt *,PetscInt *,const PetscInt*[]); 471e1589f56SBarry Smith 472*7087cfbeSBarry Smith extern PetscErrorCode DMSetContext(DM,void*); 473*7087cfbeSBarry Smith extern PetscErrorCode DMGetContext(DM,void**); 474*7087cfbeSBarry Smith extern PetscErrorCode DMSetInitialGuess(DM,PetscErrorCode (*)(DM,Vec)); 475*7087cfbeSBarry Smith extern PetscErrorCode DMSetFunction(DM,PetscErrorCode (*)(DM,Vec,Vec)); 476*7087cfbeSBarry Smith extern PetscErrorCode DMSetJacobian(DM,PetscErrorCode (*)(DM,Vec,Mat,Mat,MatStructure *)); 477*7087cfbeSBarry Smith extern PetscErrorCode DMHasInitialGuess(DM,PetscBool *); 478*7087cfbeSBarry Smith extern PetscErrorCode DMHasFunction(DM,PetscBool *); 479*7087cfbeSBarry Smith extern PetscErrorCode DMHasJacobian(DM,PetscBool *); 480*7087cfbeSBarry Smith extern PetscErrorCode DMComputeInitialGuess(DM,Vec); 481*7087cfbeSBarry Smith extern PetscErrorCode DMComputeFunction(DM,Vec,Vec); 482*7087cfbeSBarry Smith extern PetscErrorCode DMComputeJacobian(DM,Vec,Mat,Mat,MatStructure *); 483*7087cfbeSBarry Smith extern PetscErrorCode DMComputeJacobianDefault(DM,Vec,Mat,Mat,MatStructure *); 484*7087cfbeSBarry Smith extern PetscErrorCode DMFinalizePackage(void); 485e1589f56SBarry Smith 486*7087cfbeSBarry Smith extern PetscErrorCode DMDASetGetMatrix(DM,PetscErrorCode (*)(DM, const MatType,Mat *)); 487*7087cfbeSBarry Smith extern PetscErrorCode DMDASetBlockFills(DM,PetscInt*,PetscInt*); 488*7087cfbeSBarry Smith extern PetscErrorCode DMDASetMatPreallocateOnly(DM,PetscBool ); 489*7087cfbeSBarry Smith extern PetscErrorCode DMDASetRefinementFactor(DM,PetscInt,PetscInt,PetscInt); 490*7087cfbeSBarry Smith extern PetscErrorCode DMDAGetRefinementFactor(DM,PetscInt*,PetscInt*,PetscInt*); 491e1589f56SBarry Smith 492*7087cfbeSBarry Smith extern PetscErrorCode DMDAGetAdicArray(DM,PetscBool ,void*,void*,PetscInt*); 493*7087cfbeSBarry Smith extern PetscErrorCode DMDARestoreAdicArray(DM,PetscBool ,void*,void*,PetscInt*); 494*7087cfbeSBarry Smith extern PetscErrorCode DMDAGetAdicMFArray(DM,PetscBool ,void*,void*,PetscInt*); 495*7087cfbeSBarry Smith extern PetscErrorCode DMDAGetAdicMFArray4(DM,PetscBool ,void*,void*,PetscInt*); 496*7087cfbeSBarry Smith extern PetscErrorCode DMDAGetAdicMFArray9(DM,PetscBool ,void*,void*,PetscInt*); 497*7087cfbeSBarry Smith extern PetscErrorCode DMDAGetAdicMFArrayb(DM,PetscBool ,void*,void*,PetscInt*); 498*7087cfbeSBarry Smith extern PetscErrorCode DMDARestoreAdicMFArray(DM,PetscBool ,void*,void*,PetscInt*); 499*7087cfbeSBarry Smith extern PetscErrorCode DMDAGetArray(DM,PetscBool ,void*); 500*7087cfbeSBarry Smith extern PetscErrorCode DMDARestoreArray(DM,PetscBool ,void*); 501*7087cfbeSBarry Smith extern PetscErrorCode ad_DAGetArray(DM,PetscBool ,void*); 502*7087cfbeSBarry Smith extern PetscErrorCode ad_DARestoreArray(DM,PetscBool ,void*); 503*7087cfbeSBarry Smith extern PetscErrorCode admf_DAGetArray(DM,PetscBool ,void*); 504*7087cfbeSBarry Smith extern PetscErrorCode admf_DARestoreArray(DM,PetscBool ,void*); 505e1589f56SBarry Smith 506e1589f56SBarry Smith #include "petscpf.h" 507*7087cfbeSBarry Smith extern PetscErrorCode DMDACreatePF(DM,PF*); 508e1589f56SBarry Smith 509*7087cfbeSBarry Smith extern PetscErrorCode DMCompositeCreate(MPI_Comm,DM*); 510*7087cfbeSBarry Smith extern PetscErrorCode DMCompositeAddArray(DM,PetscMPIInt,PetscInt); 511*7087cfbeSBarry Smith extern PetscErrorCode DMCompositeAddDM(DM,DM); 512*7087cfbeSBarry Smith extern PetscErrorCode DMCompositeSetCoupling(DM,PetscErrorCode (*)(DM,Mat,PetscInt*,PetscInt*,PetscInt,PetscInt,PetscInt,PetscInt)); 513*7087cfbeSBarry Smith extern PetscErrorCode DMCompositeSetContext(DM,void*); 514*7087cfbeSBarry Smith extern PetscErrorCode DMCompositeGetContext(DM,void**); 515*7087cfbeSBarry Smith extern PetscErrorCode DMCompositeAddVecScatter(DM,VecScatter); 516*7087cfbeSBarry Smith extern PetscErrorCode DMCompositeScatter(DM,Vec,...); 517*7087cfbeSBarry Smith extern PetscErrorCode DMCompositeGather(DM,Vec,InsertMode,...); 518*7087cfbeSBarry Smith extern PetscErrorCode DMCompositeGetAccess(DM,Vec,...); 519*7087cfbeSBarry Smith extern PetscErrorCode DMCompositeGetNumberDM(DM,PetscInt*); 520*7087cfbeSBarry Smith extern PetscErrorCode DMCompositeRestoreAccess(DM,Vec,...); 521*7087cfbeSBarry Smith extern PetscErrorCode DMCompositeGetLocalVectors(DM,...); 522*7087cfbeSBarry Smith extern PetscErrorCode DMCompositeGetEntries(DM,...); 523*7087cfbeSBarry Smith extern PetscErrorCode DMCompositeRestoreLocalVectors(DM,...); 524*7087cfbeSBarry Smith extern PetscErrorCode DMCompositeGetGlobalISs(DM,IS*[]); 525*7087cfbeSBarry Smith extern PetscErrorCode DMCompositeGetLocalISs(DM,IS**); 526*7087cfbeSBarry Smith extern PetscErrorCode DMCompositeGetISLocalToGlobalMappings(DM,ISLocalToGlobalMapping**); 527e1589f56SBarry Smith 528*7087cfbeSBarry Smith extern PetscErrorCode DMSlicedCreate(MPI_Comm,DM*); 529*7087cfbeSBarry Smith extern PetscErrorCode DMSlicedGetGlobalIndices(DM,PetscInt*[]); 530*7087cfbeSBarry Smith extern PetscErrorCode DMSlicedSetPreallocation(DM,PetscInt,const PetscInt[],PetscInt,const PetscInt[]); 531*7087cfbeSBarry Smith extern PetscErrorCode DMSlicedSetBlockFills(DM,const PetscInt*,const PetscInt*); 532*7087cfbeSBarry Smith extern PetscErrorCode DMSlicedSetGhosts(DM,PetscInt,PetscInt,PetscInt,const PetscInt[]); 533e1589f56SBarry Smith 534e1589f56SBarry Smith 535e1589f56SBarry Smith typedef struct NLF_DAAD* NLF; 536e1589f56SBarry Smith 537e1589f56SBarry Smith #include <petscbag.h> 538e1589f56SBarry Smith 539*7087cfbeSBarry Smith extern PetscErrorCode PetscViewerBinaryMatlabOpen(MPI_Comm, const char [], PetscViewer*); 540*7087cfbeSBarry Smith extern PetscErrorCode PetscViewerBinaryMatlabDestroy(PetscViewer); 541*7087cfbeSBarry Smith extern PetscErrorCode PetscViewerBinaryMatlabOutputBag(PetscViewer, const char [], PetscBag); 542*7087cfbeSBarry Smith extern PetscErrorCode PetscViewerBinaryMatlabOutputVec(PetscViewer, const char [], Vec); 543*7087cfbeSBarry Smith extern PetscErrorCode PetscViewerBinaryMatlabOutputVecDA(PetscViewer, const char [], Vec, DM); 544e1589f56SBarry Smith 545e1589f56SBarry Smith 546*7087cfbeSBarry Smith PetscErrorCode DMADDACreate(MPI_Comm,PetscInt,PetscInt*,PetscInt*,PetscInt,PetscBool *,DM*); 547*7087cfbeSBarry Smith PetscErrorCode DMADDASetParameters(DM,PetscInt,PetscInt*,PetscInt*,PetscInt,PetscBool*); 548*7087cfbeSBarry Smith PetscErrorCode DMADDASetRefinement(DM, PetscInt *,PetscInt); 549*7087cfbeSBarry Smith PetscErrorCode DMADDAGetCorners(DM, PetscInt **, PetscInt **); 550*7087cfbeSBarry Smith PetscErrorCode DMADDAGetGhostCorners(DM, PetscInt **, PetscInt **); 551*7087cfbeSBarry Smith PetscErrorCode DMADDAGetMatrixNS(DM, DM, const MatType , Mat *); 552e1589f56SBarry Smith 553e1589f56SBarry Smith /* functions to set values in vectors and matrices */ 554e1589f56SBarry Smith struct _ADDAIdx_s { 555e1589f56SBarry Smith PetscInt *x; /* the coordinates, user has to make sure it is the correct size! */ 556e1589f56SBarry Smith PetscInt d; /* indexes the dof */ 557e1589f56SBarry Smith }; 558e1589f56SBarry Smith typedef struct _ADDAIdx_s ADDAIdx; 559e1589f56SBarry Smith 560*7087cfbeSBarry Smith PetscErrorCode DMADDAMatSetValues(Mat, DM, PetscInt, const ADDAIdx[], DM, PetscInt, const ADDAIdx[], const PetscScalar[], InsertMode); 561e1589f56SBarry Smith PetscBool ADDAHCiterStartup(const PetscInt, const PetscInt *const, const PetscInt *const, PetscInt *const); 562e1589f56SBarry Smith PetscBool ADDAHCiter(const PetscInt, const PetscInt *const, const PetscInt *const, PetscInt *const); 563e1589f56SBarry Smith 564e1589f56SBarry Smith PETSC_EXTERN_CXX_END 565e1589f56SBarry Smith #endif 566