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*db87c5ecSEthan Coon DMDABoundaryType - Is the domain periodic or ghosted in one or more directions 58e1589f56SBarry Smith 59e1589f56SBarry Smith Level: beginner 60e1589f56SBarry Smith 61ce00eea3SSatish Balay Each dimension may be non-periodic, ghosted (meaning ghost nodes are added outside 62ce00eea3SSatish Balay of the boundary, but not filled by DMDAGlobalToLocal()), or periodic. Dimensions 63ce00eea3SSatish Balay may be composed using the bitwise or operator, i.e.: 64ce00eea3SSatish Balay 65ce00eea3SSatish Balay DMDA_XYPERIODIC = DMDA_XPERIODIC | DMDA_YPERIODIC 66e1589f56SBarry Smith 67e1589f56SBarry Smith .seealso: DMDACreate1d(), DMDACreate2d(), DMDACreate3d(), DMDACreate() 68e1589f56SBarry Smith E*/ 69ce00eea3SSatish Balay typedef enum { 70ce00eea3SSatish Balay DMDA_NONGHOSTED = 0x0, 71ce00eea3SSatish Balay DMDA_NONPERIODIC = 0x0, /* kept for backwards compatiblity, though it's not precise */ 72ce00eea3SSatish Balay DMDA_XGHOSTED = 0x1, 73ce00eea3SSatish Balay DMDA_XPERIODIC = 0x3, 74ce00eea3SSatish Balay DMDA_YGHOSTED = 0x4, 75ce00eea3SSatish Balay DMDA_YPERIODIC = 0xc, 76ce00eea3SSatish Balay DMDA_ZGHOSTED = 0x10, 77ce00eea3SSatish Balay DMDA_ZPERIODIC = 0x30, 78ce00eea3SSatish Balay DMDA_XYPERIODIC = 0xf, 79ce00eea3SSatish Balay DMDA_XZPERIODIC = 0x33, 80ce00eea3SSatish Balay DMDA_YZPERIODIC = 0x3c, 81ce00eea3SSatish Balay DMDA_XYZPERIODIC = 0x3f, 82*db87c5ecSEthan Coon DMDA_XYZGHOSTED = 0x15} DMDABoundaryType; 83ce00eea3SSatish Balay 84*db87c5ecSEthan Coon extern const char *DMDABoundaryTypes[]; 85e1589f56SBarry Smith 86e1589f56SBarry Smith /*E 87e1589f56SBarry Smith DMDAInterpolationType - Defines the type of interpolation that will be returned by 88e1589f56SBarry Smith DMGetInterpolation. 89e1589f56SBarry Smith 90e1589f56SBarry Smith Level: beginner 91e1589f56SBarry Smith 92e1589f56SBarry Smith .seealso: DMDACreate1d(), DMDACreate2d(), DMDACreate3d(), DMGetInterpolation(), DMDASetInterpolationType(), DMDACreate() 93e1589f56SBarry Smith E*/ 94e1589f56SBarry Smith typedef enum { DMDA_Q0, DMDA_Q1 } DMDAInterpolationType; 95e1589f56SBarry Smith 967087cfbeSBarry Smith extern PetscErrorCode DMDASetInterpolationType(DM,DMDAInterpolationType); 97e1589f56SBarry Smith 98e1589f56SBarry Smith /*E 99e1589f56SBarry Smith DMDAElementType - Defines the type of elements that will be returned by 100e1589f56SBarry Smith DMGetElements() 101e1589f56SBarry Smith 102e1589f56SBarry Smith Level: beginner 103e1589f56SBarry Smith 104e1589f56SBarry Smith .seealso: DMDACreate1d(), DMDACreate2d(), DMDACreate3d(), DMGetInterpolation(), DMDASetInterpolationType(), 105e1589f56SBarry Smith DMDASetElementType(), DMGetElements(), DMRestoreElements(), DMDACreate() 106e1589f56SBarry Smith E*/ 107e1589f56SBarry Smith typedef enum { DMDA_ELEMENT_P1, DMDA_ELEMENT_Q1 } DMDAElementType; 108e1589f56SBarry Smith 1097087cfbeSBarry Smith extern PetscErrorCode DMDASetElementType(DM,DMDAElementType); 1107087cfbeSBarry Smith extern PetscErrorCode DMDAGetElementType(DM,DMDAElementType*); 111e1589f56SBarry Smith 112*db87c5ecSEthan Coon #define DMDAXPeriodic(pt) ((pt) & (DMDA_XPERIODIC ^ DMDA_XGHOSTED)) 113*db87c5ecSEthan Coon #define DMDAYPeriodic(pt) ((pt) & (DMDA_YPERIODIC ^ DMDA_YGHOSTED)) 114*db87c5ecSEthan Coon #define DMDAZPeriodic(pt) ((pt) & (DMDA_ZPERIODIC ^ DMDA_ZGHOSTED)) 115ce00eea3SSatish Balay #define DMDAXGhosted(pt) ((pt) & DMDA_XGHOSTED) 116ce00eea3SSatish Balay #define DMDAYGhosted(pt) ((pt) & DMDA_YGHOSTED) 117ce00eea3SSatish Balay #define DMDAZGhosted(pt) ((pt) & DMDA_ZGHOSTED) 118e1589f56SBarry Smith 119e1589f56SBarry Smith typedef enum { DMDA_X,DMDA_Y,DMDA_Z } DMDADirection; 120e1589f56SBarry Smith 1217087cfbeSBarry Smith extern PetscClassId DM_CLASSID; 122e1589f56SBarry Smith 123e1589f56SBarry Smith #define MATSEQUSFFT "sequsfft" 124e1589f56SBarry Smith 1257087cfbeSBarry Smith extern PetscErrorCode DMDACreate(MPI_Comm,DM*); 1267087cfbeSBarry Smith extern PetscErrorCode DMDASetDim(DM,PetscInt); 1277087cfbeSBarry Smith extern PetscErrorCode DMDASetSizes(DM,PetscInt,PetscInt,PetscInt); 128*db87c5ecSEthan Coon extern PetscErrorCode DMDACreate1d(MPI_Comm,DMDABoundaryType,PetscInt,PetscInt,PetscInt,const PetscInt[],DM *); 129*db87c5ecSEthan Coon extern PetscErrorCode DMDACreate2d(MPI_Comm,DMDABoundaryType,DMDAStencilType,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],const PetscInt[],DM*); 130*db87c5ecSEthan Coon extern PetscErrorCode DMDACreate3d(MPI_Comm,DMDABoundaryType,DMDAStencilType,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],const PetscInt[],const PetscInt[],DM*); 1317087cfbeSBarry Smith extern PetscErrorCode DMSetOptionsPrefix(DM,const char []); 1327087cfbeSBarry Smith extern PetscErrorCode DMSetVecType(DM,const VecType); 133e1589f56SBarry Smith 1347087cfbeSBarry Smith extern PetscErrorCode DMDAGlobalToNaturalBegin(DM,Vec,InsertMode,Vec); 1357087cfbeSBarry Smith extern PetscErrorCode DMDAGlobalToNaturalEnd(DM,Vec,InsertMode,Vec); 1367087cfbeSBarry Smith extern PetscErrorCode DMDANaturalToGlobalBegin(DM,Vec,InsertMode,Vec); 1377087cfbeSBarry Smith extern PetscErrorCode DMDANaturalToGlobalEnd(DM,Vec,InsertMode,Vec); 1387087cfbeSBarry Smith extern PetscErrorCode DMDALocalToLocalBegin(DM,Vec,InsertMode,Vec); 1397087cfbeSBarry Smith extern PetscErrorCode DMDALocalToLocalEnd(DM,Vec,InsertMode,Vec); 1407087cfbeSBarry Smith extern PetscErrorCode DMDACreateNaturalVector(DM,Vec *); 141e1589f56SBarry Smith 1427087cfbeSBarry Smith extern PetscErrorCode DMDALoad(PetscViewer,PetscInt,PetscInt,PetscInt,DM *); 1437087cfbeSBarry Smith extern PetscErrorCode DMDAGetCorners(DM,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*); 1447087cfbeSBarry Smith extern PetscErrorCode DMDAGetGhostCorners(DM,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*); 145*db87c5ecSEthan Coon extern PetscErrorCode DMDAGetInfo(DM,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,DMDABoundaryType*,DMDAStencilType*); 1467087cfbeSBarry Smith extern PetscErrorCode DMDAGetProcessorSubset(DM,DMDADirection,PetscInt,MPI_Comm*); 1477087cfbeSBarry Smith extern PetscErrorCode DMDAGetProcessorSubsets(DM,DMDADirection,MPI_Comm*); 148e1589f56SBarry Smith 1497087cfbeSBarry Smith extern PetscErrorCode DMDAGlobalToNaturalAllCreate(DM,VecScatter*); 1507087cfbeSBarry Smith extern PetscErrorCode DMDANaturalAllToGlobalCreate(DM,VecScatter*); 151e1589f56SBarry Smith 1527087cfbeSBarry Smith extern PetscErrorCode DMDAGetGlobalIndices(DM,PetscInt*,PetscInt**); 153e1589f56SBarry Smith 1547087cfbeSBarry Smith extern PetscErrorCode DMDAGetScatter(DM,VecScatter*,VecScatter*,VecScatter*); 1557087cfbeSBarry Smith extern PetscErrorCode DMDAGetNeighbors(DM,const PetscMPIInt**); 156e1589f56SBarry Smith 1577087cfbeSBarry Smith extern PetscErrorCode DMDAGetAO(DM,AO*); 1587087cfbeSBarry Smith extern PetscErrorCode DMDASetCoordinates(DM,Vec); 159ce00eea3SSatish Balay extern PetscErrorCode DMDASetGhostedCoordinates(DM,Vec); 1607087cfbeSBarry Smith extern PetscErrorCode DMDAGetCoordinates(DM,Vec *); 1617087cfbeSBarry Smith extern PetscErrorCode DMDAGetGhostedCoordinates(DM,Vec *); 1627087cfbeSBarry Smith extern PetscErrorCode DMDAGetCoordinateDA(DM,DM *); 1637087cfbeSBarry Smith extern PetscErrorCode DMDASetUniformCoordinates(DM,PetscReal,PetscReal,PetscReal,PetscReal,PetscReal,PetscReal); 1647087cfbeSBarry Smith extern PetscErrorCode DMDAGetBoundingBox(DM,PetscReal[],PetscReal[]); 1657087cfbeSBarry Smith extern PetscErrorCode DMDAGetLocalBoundingBox(DM,PetscReal[],PetscReal[]); 1667087cfbeSBarry Smith extern PetscErrorCode DMDASetFieldName(DM,PetscInt,const char[]); 1677087cfbeSBarry Smith extern PetscErrorCode DMDAGetFieldName(DM,PetscInt,const char**); 168e1589f56SBarry Smith 169*db87c5ecSEthan Coon extern PetscErrorCode DMDASetPeriodicity(DM, DMDABoundaryType); 1707087cfbeSBarry Smith extern PetscErrorCode DMDASetDof(DM, int); 1717087cfbeSBarry Smith extern PetscErrorCode DMDASetStencilWidth(DM, PetscInt); 1727087cfbeSBarry Smith extern PetscErrorCode DMDASetOwnershipRanges(DM,const PetscInt[],const PetscInt[],const PetscInt[]); 1737087cfbeSBarry Smith extern PetscErrorCode DMDAGetOwnershipRanges(DM,const PetscInt**,const PetscInt**,const PetscInt**); 1747087cfbeSBarry Smith extern PetscErrorCode DMDASetNumProcs(DM, PetscInt, PetscInt, PetscInt); 1757087cfbeSBarry Smith extern PetscErrorCode DMDASetStencilType(DM, DMDAStencilType); 176e1589f56SBarry Smith 1777087cfbeSBarry Smith extern PetscErrorCode DMDAVecGetArray(DM,Vec,void *); 1787087cfbeSBarry Smith extern PetscErrorCode DMDAVecRestoreArray(DM,Vec,void *); 179e1589f56SBarry Smith 1807087cfbeSBarry Smith extern PetscErrorCode DMDAVecGetArrayDOF(DM,Vec,void *); 1817087cfbeSBarry Smith extern PetscErrorCode DMDAVecRestoreArrayDOF(DM,Vec,void *); 182e1589f56SBarry Smith 1837087cfbeSBarry Smith extern PetscErrorCode DMDASplitComm2d(MPI_Comm,PetscInt,PetscInt,PetscInt,MPI_Comm*); 184e1589f56SBarry Smith 185e1589f56SBarry Smith /*E 186e1589f56SBarry Smith DMType - String with the name of a PETSc DM or the creation function 187e1589f56SBarry Smith with an optional dynamic library name, for example 188e1589f56SBarry Smith http://www.mcs.anl.gov/petsc/lib.a:myveccreate() 189e1589f56SBarry Smith 190e1589f56SBarry Smith Level: beginner 191e1589f56SBarry Smith 192e1589f56SBarry Smith .seealso: DMSetType(), DM 193e1589f56SBarry Smith E*/ 194e1589f56SBarry Smith 195e1589f56SBarry Smith #define DMType char* 196e1589f56SBarry Smith #define DMDA "da" 197e1589f56SBarry Smith #define DMADDA "adda" 198e1589f56SBarry Smith #define DMCOMPOSITE "composite" 199e1589f56SBarry Smith #define DMSLICED "sliced" 200e1589f56SBarry Smith 201e1589f56SBarry Smith extern PetscFList DMList; 202e1589f56SBarry Smith extern PetscBool DMRegisterAllCalled; 2037087cfbeSBarry Smith extern PetscErrorCode DMCreate(MPI_Comm,DM*); 2047087cfbeSBarry Smith extern PetscErrorCode DMSetType(DM, const DMType); 2057087cfbeSBarry Smith extern PetscErrorCode DMGetType(DM, const DMType *); 2067087cfbeSBarry Smith extern PetscErrorCode DMRegister(const char[],const char[],const char[],PetscErrorCode (*)(DM)); 2077087cfbeSBarry Smith extern PetscErrorCode DMRegisterAll(const char []); 2087087cfbeSBarry Smith extern PetscErrorCode DMRegisterDestroy(void); 209e1589f56SBarry Smith 210e1589f56SBarry Smith /*MC 211e1589f56SBarry Smith DMRegisterDynamic - Adds a new DM component implementation 212e1589f56SBarry Smith 213e1589f56SBarry Smith Synopsis: 214e1589f56SBarry Smith PetscErrorCode DMRegisterDynamic(const char *name,const char *path,const char *func_name, PetscErrorCode (*create_func)(DM)) 215e1589f56SBarry Smith 216e1589f56SBarry Smith Not Collective 217e1589f56SBarry Smith 218e1589f56SBarry Smith Input Parameters: 219e1589f56SBarry Smith + name - The name of a new user-defined creation routine 220e1589f56SBarry Smith . path - The path (either absolute or relative) of the library containing this routine 221e1589f56SBarry Smith . func_name - The name of routine to create method context 222e1589f56SBarry Smith - create_func - The creation routine itself 223e1589f56SBarry Smith 224e1589f56SBarry Smith Notes: 225e1589f56SBarry Smith DMRegisterDynamic() may be called multiple times to add several user-defined DMs 226e1589f56SBarry Smith 227e1589f56SBarry Smith If dynamic libraries are used, then the fourth input argument (routine_create) is ignored. 228e1589f56SBarry Smith 229e1589f56SBarry Smith Sample usage: 230e1589f56SBarry Smith .vb 231e1589f56SBarry Smith DMRegisterDynamic("my_da","/home/username/my_lib/lib/libO/solaris/libmy.a", "MyDMCreate", MyDMCreate); 232e1589f56SBarry Smith .ve 233e1589f56SBarry Smith 234e1589f56SBarry Smith Then, your DM type can be chosen with the procedural interface via 235e1589f56SBarry Smith .vb 236e1589f56SBarry Smith DMCreate(MPI_Comm, DM *); 237e1589f56SBarry Smith DMSetType(DM,"my_da_name"); 238e1589f56SBarry Smith .ve 239e1589f56SBarry Smith or at runtime via the option 240e1589f56SBarry Smith .vb 241e1589f56SBarry Smith -da_type my_da_name 242e1589f56SBarry Smith .ve 243e1589f56SBarry Smith 244e1589f56SBarry Smith Notes: $PETSC_ARCH occuring in pathname will be replaced with appropriate values. 245e1589f56SBarry Smith If your function is not being put into a shared library then use DMRegister() instead 246e1589f56SBarry Smith 247e1589f56SBarry Smith Level: advanced 248e1589f56SBarry Smith 249e1589f56SBarry Smith .keywords: DM, register 250e1589f56SBarry Smith .seealso: DMRegisterAll(), DMRegisterDestroy(), DMRegister() 251e1589f56SBarry Smith M*/ 252e1589f56SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 253e1589f56SBarry Smith #define DMRegisterDynamic(a,b,c,d) DMRegister(a,b,c,0) 254e1589f56SBarry Smith #else 255e1589f56SBarry Smith #define DMRegisterDynamic(a,b,c,d) DMRegister(a,b,c,d) 256e1589f56SBarry Smith #endif 257e1589f56SBarry Smith 2587087cfbeSBarry Smith extern PetscErrorCode MatRegisterDAAD(void); 2597087cfbeSBarry Smith extern PetscErrorCode MatCreateDAAD(DM,Mat*); 2607087cfbeSBarry Smith extern PetscErrorCode MatCreateSeqUSFFT(Vec, DM,Mat*); 261e1589f56SBarry Smith 262e1589f56SBarry Smith /*S 263e1589f56SBarry Smith DMDALocalInfo - C struct that contains information about a structured grid and a processors logical 264e1589f56SBarry Smith location in it. 265e1589f56SBarry Smith 266e1589f56SBarry Smith Level: beginner 267e1589f56SBarry Smith 268e1589f56SBarry Smith Concepts: distributed array 269e1589f56SBarry Smith 270e1589f56SBarry Smith Developer note: Then entries in this struct are int instead of PetscInt so that the elements may 271e1589f56SBarry Smith be extracted in Fortran as if from an integer array 272e1589f56SBarry Smith 273e1589f56SBarry Smith .seealso: DMDACreate1d(), DMDACreate2d(), DMDACreate3d(), DMDestroy(), DM, DMDAGetLocalInfo(), DMDAGetInfo() 274e1589f56SBarry Smith S*/ 275e1589f56SBarry Smith typedef struct { 276e1589f56SBarry Smith PetscInt dim,dof,sw; 277e1589f56SBarry Smith PetscInt mx,my,mz; /* global number of grid points in each direction */ 278e1589f56SBarry Smith PetscInt xs,ys,zs; /* starting pointd of this processor, excluding ghosts */ 279e1589f56SBarry Smith PetscInt xm,ym,zm; /* number of grid points on this processor, excluding ghosts */ 280e1589f56SBarry Smith PetscInt gxs,gys,gzs; /* starting point of this processor including ghosts */ 281e1589f56SBarry Smith PetscInt gxm,gym,gzm; /* number of grid points on this processor including ghosts */ 282*db87c5ecSEthan Coon DMDABoundaryType pt; 283e1589f56SBarry Smith DMDAStencilType st; 284e1589f56SBarry Smith DM da; 285e1589f56SBarry Smith } DMDALocalInfo; 286e1589f56SBarry Smith 287e1589f56SBarry Smith /*MC 288e1589f56SBarry Smith DMDAForEachPointBegin2d - Starts a loop over the local part of a two dimensional DMDA 289e1589f56SBarry Smith 290e1589f56SBarry Smith Synopsis: 291e1589f56SBarry Smith void DMDAForEachPointBegin2d(DALocalInfo *info,PetscInt i,PetscInt j); 292e1589f56SBarry Smith 293e1589f56SBarry Smith Not Collective 294e1589f56SBarry Smith 295e1589f56SBarry Smith Level: intermediate 296e1589f56SBarry Smith 297e1589f56SBarry Smith .seealso: DMDAForEachPointEnd2d(), DMDAVecGetArray() 298e1589f56SBarry Smith M*/ 299e1589f56SBarry Smith #define DMDAForEachPointBegin2d(info,i,j) {\ 300e1589f56SBarry Smith PetscInt _xints = info->xs,_xinte = info->xs+info->xm,_yints = info->ys,_yinte = info->ys+info->ym;\ 301e1589f56SBarry Smith for (j=_yints; j<_yinte; j++) {\ 302e1589f56SBarry Smith for (i=_xints; i<_xinte; i++) {\ 303e1589f56SBarry Smith 304e1589f56SBarry Smith /*MC 305e1589f56SBarry Smith DMDAForEachPointEnd2d - Ends a loop over the local part of a two dimensional DMDA 306e1589f56SBarry Smith 307e1589f56SBarry Smith Synopsis: 308e1589f56SBarry Smith void DMDAForEachPointEnd2d; 309e1589f56SBarry Smith 310e1589f56SBarry Smith Not Collective 311e1589f56SBarry Smith 312e1589f56SBarry Smith Level: intermediate 313e1589f56SBarry Smith 314e1589f56SBarry Smith .seealso: DMDAForEachPointBegin2d(), DMDAVecGetArray() 315e1589f56SBarry Smith M*/ 316e1589f56SBarry Smith #define DMDAForEachPointEnd2d }}} 317e1589f56SBarry Smith 318e1589f56SBarry Smith /*MC 319e1589f56SBarry Smith DMDACoor2d - Structure for holding 2d (x and y) coordinates. 320e1589f56SBarry Smith 321e1589f56SBarry Smith Level: intermediate 322e1589f56SBarry Smith 323e1589f56SBarry Smith Sample Usage: 324e1589f56SBarry Smith DMDACoor2d **coors; 325e1589f56SBarry Smith Vec vcoors; 326e1589f56SBarry Smith DM cda; 327e1589f56SBarry Smith 328e1589f56SBarry Smith DMDAGetCoordinates(da,&vcoors); 329e1589f56SBarry Smith DMDAGetCoordinateDA(da,&cda); 330e1589f56SBarry Smith DMDAVecGetArray(cda,vcoors,&coors); 331e1589f56SBarry Smith DMDAGetCorners(cda,&mstart,&nstart,0,&m,&n,0) 332e1589f56SBarry Smith for (i=mstart; i<mstart+m; i++) { 333e1589f56SBarry Smith for (j=nstart; j<nstart+n; j++) { 334e1589f56SBarry Smith x = coors[j][i].x; 335e1589f56SBarry Smith y = coors[j][i].y; 336e1589f56SBarry Smith ...... 337e1589f56SBarry Smith } 338e1589f56SBarry Smith } 339e1589f56SBarry Smith DMDAVecRestoreArray(dac,vcoors,&coors); 340e1589f56SBarry Smith 341e1589f56SBarry Smith .seealso: DMDACoor3d, DMDAForEachPointBegin(), DMDAGetCoordinateDA(), DMDAGetCoordinates(), DMDAGetGhostCoordinates() 342e1589f56SBarry Smith M*/ 343e1589f56SBarry Smith typedef struct {PetscScalar x,y;} DMDACoor2d; 344e1589f56SBarry Smith 345e1589f56SBarry Smith /*MC 346e1589f56SBarry Smith DMDACoor3d - Structure for holding 3d (x, y and z) coordinates. 347e1589f56SBarry Smith 348e1589f56SBarry Smith Level: intermediate 349e1589f56SBarry Smith 350e1589f56SBarry Smith Sample Usage: 351e1589f56SBarry Smith DMDACoor3d ***coors; 352e1589f56SBarry Smith Vec vcoors; 353e1589f56SBarry Smith DM cda; 354e1589f56SBarry Smith 355e1589f56SBarry Smith DMDAGetCoordinates(da,&vcoors); 356e1589f56SBarry Smith DMDAGetCoordinateDA(da,&cda); 357e1589f56SBarry Smith DMDAVecGetArray(cda,vcoors,&coors); 358e1589f56SBarry Smith DMDAGetCorners(cda,&mstart,&nstart,&pstart,&m,&n,&p) 359e1589f56SBarry Smith for (i=mstart; i<mstart+m; i++) { 360e1589f56SBarry Smith for (j=nstart; j<nstart+n; j++) { 361e1589f56SBarry Smith for (k=pstart; k<pstart+p; k++) { 362e1589f56SBarry Smith x = coors[k][j][i].x; 363e1589f56SBarry Smith y = coors[k][j][i].y; 364e1589f56SBarry Smith z = coors[k][j][i].z; 365e1589f56SBarry Smith ...... 366e1589f56SBarry Smith } 367e1589f56SBarry Smith } 368e1589f56SBarry Smith DMDAVecRestoreArray(dac,vcoors,&coors); 369e1589f56SBarry Smith 370e1589f56SBarry Smith .seealso: DMDACoor2d, DMDAForEachPointBegin(), DMDAGetCoordinateDA(), DMDAGetCoordinates(), DMDAGetGhostCoordinates() 371e1589f56SBarry Smith M*/ 372e1589f56SBarry Smith typedef struct {PetscScalar x,y,z;} DMDACoor3d; 373e1589f56SBarry Smith 3747087cfbeSBarry Smith extern PetscErrorCode DMDAGetLocalInfo(DM,DMDALocalInfo*); 375e1589f56SBarry Smith typedef PetscErrorCode (*DMDALocalFunction1)(DMDALocalInfo*,void*,void*,void*); 3767087cfbeSBarry Smith extern PetscErrorCode DMDAFormFunctionLocal(DM, DMDALocalFunction1, Vec, Vec, void *); 3777087cfbeSBarry Smith extern PetscErrorCode DMDAFormFunctionLocalGhost(DM, DMDALocalFunction1, Vec, Vec, void *); 3787087cfbeSBarry Smith extern PetscErrorCode DMDAFormJacobianLocal(DM, DMDALocalFunction1, Vec, Mat, void *); 3797087cfbeSBarry Smith extern PetscErrorCode DMDAFormFunction1(DM,Vec,Vec,void*); 3807087cfbeSBarry Smith extern PetscErrorCode DMDAFormFunction(DM,PetscErrorCode (*)(void),Vec,Vec,void*); 3817087cfbeSBarry Smith extern PetscErrorCode DMDAFormFunctioni1(DM,PetscInt,Vec,PetscScalar*,void*); 3827087cfbeSBarry Smith extern PetscErrorCode DMDAFormFunctionib1(DM,PetscInt,Vec,PetscScalar*,void*); 3837087cfbeSBarry Smith extern PetscErrorCode DMDAComputeJacobian1WithAdic(DM,Vec,Mat,void*); 3847087cfbeSBarry Smith extern PetscErrorCode DMDAComputeJacobian1WithAdifor(DM,Vec,Mat,void*); 3857087cfbeSBarry Smith extern PetscErrorCode DMDAMultiplyByJacobian1WithAdic(DM,Vec,Vec,Vec,void*); 3867087cfbeSBarry Smith extern PetscErrorCode DMDAMultiplyByJacobian1WithAdifor(DM,Vec,Vec,Vec,void*); 3877087cfbeSBarry Smith extern PetscErrorCode DMDAMultiplyByJacobian1WithAD(DM,Vec,Vec,Vec,void*); 3887087cfbeSBarry Smith extern PetscErrorCode DMDAComputeJacobian1(DM,Vec,Mat,void*); 3897087cfbeSBarry Smith extern PetscErrorCode DMDAGetLocalFunction(DM,DMDALocalFunction1*); 3907087cfbeSBarry Smith extern PetscErrorCode DMDASetLocalFunction(DM,DMDALocalFunction1); 3917087cfbeSBarry Smith extern PetscErrorCode DMDASetLocalFunctioni(DM,PetscErrorCode (*)(DMDALocalInfo*,MatStencil*,void*,PetscScalar*,void*)); 3927087cfbeSBarry Smith extern PetscErrorCode DMDASetLocalFunctionib(DM,PetscErrorCode (*)(DMDALocalInfo*,MatStencil*,void*,PetscScalar*,void*)); 3937087cfbeSBarry Smith extern PetscErrorCode DMDAGetLocalJacobian(DM,DMDALocalFunction1*); 3947087cfbeSBarry Smith extern PetscErrorCode DMDASetLocalJacobian(DM,DMDALocalFunction1); 3957087cfbeSBarry Smith extern PetscErrorCode DMDASetLocalAdicFunction_Private(DM,DMDALocalFunction1); 396e1589f56SBarry Smith 3977087cfbeSBarry Smith extern PetscErrorCode MatSetDA(Mat,DM); 398e1589f56SBarry Smith 399e1589f56SBarry Smith /*MC 400e1589f56SBarry Smith DMDASetLocalAdicFunction - Caches in a DM a local function computed by ADIC/ADIFOR 401e1589f56SBarry Smith 402e1589f56SBarry Smith Synopsis: 403e1589f56SBarry Smith PetscErrorCode DMDASetLocalAdicFunction(DM da,DMDALocalFunction1 ad_lf) 404e1589f56SBarry Smith 405e1589f56SBarry Smith Logically Collective on DM 406e1589f56SBarry Smith 407e1589f56SBarry Smith Input Parameter: 408e1589f56SBarry Smith + da - initial distributed array 409e1589f56SBarry Smith - ad_lf - the local function as computed by ADIC/ADIFOR 410e1589f56SBarry Smith 411e1589f56SBarry Smith Level: intermediate 412e1589f56SBarry Smith 413e1589f56SBarry Smith .keywords: distributed array, refine 414e1589f56SBarry Smith 415e1589f56SBarry Smith .seealso: DMDACreate1d(), DMDACreate2d(), DMDACreate3d(), DMDestroy(), DMDAGetLocalFunction(), DMDASetLocalFunction(), 416e1589f56SBarry Smith DMDASetLocalJacobian() 417e1589f56SBarry Smith M*/ 418e1589f56SBarry Smith #if defined(PETSC_HAVE_ADIC) 419e1589f56SBarry Smith # define DMDASetLocalAdicFunction(a,d) DMDASetLocalAdicFunction_Private(a,(DMDALocalFunction1)d) 420e1589f56SBarry Smith #else 421e1589f56SBarry Smith # define DMDASetLocalAdicFunction(a,d) DMDASetLocalAdicFunction_Private(a,0) 422e1589f56SBarry Smith #endif 423e1589f56SBarry Smith 4247087cfbeSBarry Smith extern PetscErrorCode DMDASetLocalAdicMFFunction_Private(DM,DMDALocalFunction1); 425e1589f56SBarry Smith #if defined(PETSC_HAVE_ADIC) 426e1589f56SBarry Smith # define DMDASetLocalAdicMFFunction(a,d) DMDASetLocalAdicMFFunction_Private(a,(DMDALocalFunction1)d) 427e1589f56SBarry Smith #else 428e1589f56SBarry Smith # define DMDASetLocalAdicMFFunction(a,d) DMDASetLocalAdicMFFunction_Private(a,0) 429e1589f56SBarry Smith #endif 4307087cfbeSBarry Smith extern PetscErrorCode DMDASetLocalAdicFunctioni_Private(DM,PetscErrorCode (*)(DMDALocalInfo*,MatStencil*,void*,void*,void*)); 431e1589f56SBarry Smith #if defined(PETSC_HAVE_ADIC) 432e1589f56SBarry Smith # define DMDASetLocalAdicFunctioni(a,d) DMDASetLocalAdicFunctioni_Private(a,(PetscErrorCode (*)(DMDALocalInfo*,MatStencil*,void*,void*,void*))d) 433e1589f56SBarry Smith #else 434e1589f56SBarry Smith # define DMDASetLocalAdicFunctioni(a,d) DMDASetLocalAdicFunctioni_Private(a,0) 435e1589f56SBarry Smith #endif 4367087cfbeSBarry Smith extern PetscErrorCode DMDASetLocalAdicMFFunctioni_Private(DM,PetscErrorCode (*)(DMDALocalInfo*,MatStencil*,void*,void*,void*)); 437e1589f56SBarry Smith #if defined(PETSC_HAVE_ADIC) 438e1589f56SBarry Smith # define DMDASetLocalAdicMFFunctioni(a,d) DMDASetLocalAdicMFFunctioni_Private(a,(PetscErrorCode (*)(DMDALocalInfo*,MatStencil*,void*,void*,void*))d) 439e1589f56SBarry Smith #else 440e1589f56SBarry Smith # define DMDASetLocalAdicMFFunctioni(a,d) DMDASetLocalAdicMFFunctioni_Private(a,0) 441e1589f56SBarry Smith #endif 442e1589f56SBarry Smith 4437087cfbeSBarry Smith extern PetscErrorCode DMDASetLocalAdicFunctionib_Private(DM,PetscErrorCode (*)(DMDALocalInfo*,MatStencil*,void*,void*,void*)); 444e1589f56SBarry Smith #if defined(PETSC_HAVE_ADIC) 445e1589f56SBarry Smith # define DMDASetLocalAdicFunctionib(a,d) DMDASetLocalAdicFunctionib_Private(a,(PetscErrorCode (*)(DMDALocalInfo*,MatStencil*,void*,void*,void*))d) 446e1589f56SBarry Smith #else 447e1589f56SBarry Smith # define DMDASetLocalAdicFunctionib(a,d) DMDASetLocalAdicFunctionib_Private(a,0) 448e1589f56SBarry Smith #endif 4497087cfbeSBarry Smith extern PetscErrorCode DMDASetLocalAdicMFFunctionib_Private(DM,PetscErrorCode (*)(DMDALocalInfo*,MatStencil*,void*,void*,void*)); 450e1589f56SBarry Smith #if defined(PETSC_HAVE_ADIC) 451e1589f56SBarry Smith # define DMDASetLocalAdicMFFunctionib(a,d) DMDASetLocalAdicMFFunctionib_Private(a,(PetscErrorCode (*)(DMDALocalInfo*,MatStencil*,void*,void*,void*))d) 452e1589f56SBarry Smith #else 453e1589f56SBarry Smith # define DMDASetLocalAdicMFFunctionib(a,d) DMDASetLocalAdicMFFunctionib_Private(a,0) 454e1589f56SBarry Smith #endif 455e1589f56SBarry Smith 4567087cfbeSBarry Smith extern PetscErrorCode DMDAFormFunctioniTest1(DM,void*); 457e1589f56SBarry Smith 458e1589f56SBarry Smith #include "petscmat.h" 459e1589f56SBarry Smith 460e1589f56SBarry Smith 4617087cfbeSBarry Smith extern PetscErrorCode DMView(DM,PetscViewer); 4627087cfbeSBarry Smith extern PetscErrorCode DMDestroy(DM); 4637087cfbeSBarry Smith extern PetscErrorCode DMCreateGlobalVector(DM,Vec*); 4647087cfbeSBarry Smith extern PetscErrorCode DMCreateLocalVector(DM,Vec*); 4657087cfbeSBarry Smith extern PetscErrorCode DMGetLocalVector(DM,Vec *); 4667087cfbeSBarry Smith extern PetscErrorCode DMRestoreLocalVector(DM,Vec *); 4677087cfbeSBarry Smith extern PetscErrorCode DMGetGlobalVector(DM,Vec *); 4687087cfbeSBarry Smith extern PetscErrorCode DMRestoreGlobalVector(DM,Vec *); 4697087cfbeSBarry Smith extern PetscErrorCode DMGetLocalToGlobalMapping(DM,ISLocalToGlobalMapping*); 4707087cfbeSBarry Smith extern PetscErrorCode DMGetLocalToGlobalMappingBlock(DM,ISLocalToGlobalMapping*); 4717087cfbeSBarry Smith extern PetscErrorCode DMGetBlockSize(DM,PetscInt*); 4727087cfbeSBarry Smith extern PetscErrorCode DMGetColoring(DM,ISColoringType,const MatType,ISColoring*); 4737087cfbeSBarry Smith extern PetscErrorCode DMGetMatrix(DM, const MatType,Mat*); 4747087cfbeSBarry Smith extern PetscErrorCode DMGetInterpolation(DM,DM,Mat*,Vec*); 4757087cfbeSBarry Smith extern PetscErrorCode DMGetInjection(DM,DM,VecScatter*); 4767087cfbeSBarry Smith extern PetscErrorCode DMRefine(DM,MPI_Comm,DM*); 4777087cfbeSBarry Smith extern PetscErrorCode DMCoarsen(DM,MPI_Comm,DM*); 4787087cfbeSBarry Smith extern PetscErrorCode DMRefineHierarchy(DM,PetscInt,DM[]); 4797087cfbeSBarry Smith extern PetscErrorCode DMCoarsenHierarchy(DM,PetscInt,DM[]); 4807087cfbeSBarry Smith extern PetscErrorCode DMSetFromOptions(DM); 4817087cfbeSBarry Smith extern PetscErrorCode DMSetUp(DM); 4827087cfbeSBarry Smith extern PetscErrorCode DMGetInterpolationScale(DM,DM,Mat,Vec*); 4837087cfbeSBarry Smith extern PetscErrorCode DMGetAggregates(DM,DM,Mat*); 4847087cfbeSBarry Smith extern PetscErrorCode DMGlobalToLocalBegin(DM,Vec,InsertMode,Vec); 4857087cfbeSBarry Smith extern PetscErrorCode DMGlobalToLocalEnd(DM,Vec,InsertMode,Vec); 4867087cfbeSBarry Smith extern PetscErrorCode DMLocalToGlobalBegin(DM,Vec,InsertMode,Vec); 4877087cfbeSBarry Smith extern PetscErrorCode DMLocalToGlobalEnd(DM,Vec,InsertMode,Vec); 4887087cfbeSBarry Smith extern PetscErrorCode DMGetElements(DM,PetscInt *,PetscInt *,const PetscInt*[]); 4897087cfbeSBarry Smith extern PetscErrorCode DMRestoreElements(DM,PetscInt *,PetscInt *,const PetscInt*[]); 490e1589f56SBarry Smith 4917087cfbeSBarry Smith extern PetscErrorCode DMSetContext(DM,void*); 4927087cfbeSBarry Smith extern PetscErrorCode DMGetContext(DM,void**); 4937087cfbeSBarry Smith extern PetscErrorCode DMSetInitialGuess(DM,PetscErrorCode (*)(DM,Vec)); 4947087cfbeSBarry Smith extern PetscErrorCode DMSetFunction(DM,PetscErrorCode (*)(DM,Vec,Vec)); 4957087cfbeSBarry Smith extern PetscErrorCode DMSetJacobian(DM,PetscErrorCode (*)(DM,Vec,Mat,Mat,MatStructure *)); 4967087cfbeSBarry Smith extern PetscErrorCode DMHasInitialGuess(DM,PetscBool *); 4977087cfbeSBarry Smith extern PetscErrorCode DMHasFunction(DM,PetscBool *); 4987087cfbeSBarry Smith extern PetscErrorCode DMHasJacobian(DM,PetscBool *); 4997087cfbeSBarry Smith extern PetscErrorCode DMComputeInitialGuess(DM,Vec); 5007087cfbeSBarry Smith extern PetscErrorCode DMComputeFunction(DM,Vec,Vec); 5017087cfbeSBarry Smith extern PetscErrorCode DMComputeJacobian(DM,Vec,Mat,Mat,MatStructure *); 5027087cfbeSBarry Smith extern PetscErrorCode DMComputeJacobianDefault(DM,Vec,Mat,Mat,MatStructure *); 5037087cfbeSBarry Smith extern PetscErrorCode DMFinalizePackage(void); 504e1589f56SBarry Smith 5057087cfbeSBarry Smith extern PetscErrorCode DMDASetGetMatrix(DM,PetscErrorCode (*)(DM, const MatType,Mat *)); 5067087cfbeSBarry Smith extern PetscErrorCode DMDASetBlockFills(DM,PetscInt*,PetscInt*); 5077087cfbeSBarry Smith extern PetscErrorCode DMDASetMatPreallocateOnly(DM,PetscBool ); 5087087cfbeSBarry Smith extern PetscErrorCode DMDASetRefinementFactor(DM,PetscInt,PetscInt,PetscInt); 5097087cfbeSBarry Smith extern PetscErrorCode DMDAGetRefinementFactor(DM,PetscInt*,PetscInt*,PetscInt*); 510e1589f56SBarry Smith 5117087cfbeSBarry Smith extern PetscErrorCode DMDAGetAdicArray(DM,PetscBool ,void*,void*,PetscInt*); 5127087cfbeSBarry Smith extern PetscErrorCode DMDARestoreAdicArray(DM,PetscBool ,void*,void*,PetscInt*); 5137087cfbeSBarry Smith extern PetscErrorCode DMDAGetAdicMFArray(DM,PetscBool ,void*,void*,PetscInt*); 5147087cfbeSBarry Smith extern PetscErrorCode DMDAGetAdicMFArray4(DM,PetscBool ,void*,void*,PetscInt*); 5157087cfbeSBarry Smith extern PetscErrorCode DMDAGetAdicMFArray9(DM,PetscBool ,void*,void*,PetscInt*); 5167087cfbeSBarry Smith extern PetscErrorCode DMDAGetAdicMFArrayb(DM,PetscBool ,void*,void*,PetscInt*); 5177087cfbeSBarry Smith extern PetscErrorCode DMDARestoreAdicMFArray(DM,PetscBool ,void*,void*,PetscInt*); 5187087cfbeSBarry Smith extern PetscErrorCode DMDAGetArray(DM,PetscBool ,void*); 5197087cfbeSBarry Smith extern PetscErrorCode DMDARestoreArray(DM,PetscBool ,void*); 5207087cfbeSBarry Smith extern PetscErrorCode ad_DAGetArray(DM,PetscBool ,void*); 5217087cfbeSBarry Smith extern PetscErrorCode ad_DARestoreArray(DM,PetscBool ,void*); 5227087cfbeSBarry Smith extern PetscErrorCode admf_DAGetArray(DM,PetscBool ,void*); 5237087cfbeSBarry Smith extern PetscErrorCode admf_DARestoreArray(DM,PetscBool ,void*); 524e1589f56SBarry Smith 525e1589f56SBarry Smith #include "petscpf.h" 5267087cfbeSBarry Smith extern PetscErrorCode DMDACreatePF(DM,PF*); 527e1589f56SBarry Smith 5287087cfbeSBarry Smith extern PetscErrorCode DMCompositeCreate(MPI_Comm,DM*); 5297087cfbeSBarry Smith extern PetscErrorCode DMCompositeAddArray(DM,PetscMPIInt,PetscInt); 5307087cfbeSBarry Smith extern PetscErrorCode DMCompositeAddDM(DM,DM); 5317087cfbeSBarry Smith extern PetscErrorCode DMCompositeSetCoupling(DM,PetscErrorCode (*)(DM,Mat,PetscInt*,PetscInt*,PetscInt,PetscInt,PetscInt,PetscInt)); 5327087cfbeSBarry Smith extern PetscErrorCode DMCompositeSetContext(DM,void*); 5337087cfbeSBarry Smith extern PetscErrorCode DMCompositeGetContext(DM,void**); 5347087cfbeSBarry Smith extern PetscErrorCode DMCompositeAddVecScatter(DM,VecScatter); 5357087cfbeSBarry Smith extern PetscErrorCode DMCompositeScatter(DM,Vec,...); 5367087cfbeSBarry Smith extern PetscErrorCode DMCompositeGather(DM,Vec,InsertMode,...); 5377087cfbeSBarry Smith extern PetscErrorCode DMCompositeGetAccess(DM,Vec,...); 5387087cfbeSBarry Smith extern PetscErrorCode DMCompositeGetNumberDM(DM,PetscInt*); 5397087cfbeSBarry Smith extern PetscErrorCode DMCompositeRestoreAccess(DM,Vec,...); 5407087cfbeSBarry Smith extern PetscErrorCode DMCompositeGetLocalVectors(DM,...); 5417087cfbeSBarry Smith extern PetscErrorCode DMCompositeGetEntries(DM,...); 5427087cfbeSBarry Smith extern PetscErrorCode DMCompositeRestoreLocalVectors(DM,...); 5437087cfbeSBarry Smith extern PetscErrorCode DMCompositeGetGlobalISs(DM,IS*[]); 5447087cfbeSBarry Smith extern PetscErrorCode DMCompositeGetLocalISs(DM,IS**); 5457087cfbeSBarry Smith extern PetscErrorCode DMCompositeGetISLocalToGlobalMappings(DM,ISLocalToGlobalMapping**); 546e1589f56SBarry Smith 5477087cfbeSBarry Smith extern PetscErrorCode DMSlicedCreate(MPI_Comm,DM*); 5487087cfbeSBarry Smith extern PetscErrorCode DMSlicedGetGlobalIndices(DM,PetscInt*[]); 5497087cfbeSBarry Smith extern PetscErrorCode DMSlicedSetPreallocation(DM,PetscInt,const PetscInt[],PetscInt,const PetscInt[]); 5507087cfbeSBarry Smith extern PetscErrorCode DMSlicedSetBlockFills(DM,const PetscInt*,const PetscInt*); 5517087cfbeSBarry Smith extern PetscErrorCode DMSlicedSetGhosts(DM,PetscInt,PetscInt,PetscInt,const PetscInt[]); 552e1589f56SBarry Smith 553e1589f56SBarry Smith 554e1589f56SBarry Smith typedef struct NLF_DAAD* NLF; 555e1589f56SBarry Smith 556e1589f56SBarry Smith #include <petscbag.h> 557e1589f56SBarry Smith 5587087cfbeSBarry Smith extern PetscErrorCode PetscViewerBinaryMatlabOpen(MPI_Comm, const char [], PetscViewer*); 5597087cfbeSBarry Smith extern PetscErrorCode PetscViewerBinaryMatlabDestroy(PetscViewer); 5607087cfbeSBarry Smith extern PetscErrorCode PetscViewerBinaryMatlabOutputBag(PetscViewer, const char [], PetscBag); 5617087cfbeSBarry Smith extern PetscErrorCode PetscViewerBinaryMatlabOutputVec(PetscViewer, const char [], Vec); 5627087cfbeSBarry Smith extern PetscErrorCode PetscViewerBinaryMatlabOutputVecDA(PetscViewer, const char [], Vec, DM); 563e1589f56SBarry Smith 564e1589f56SBarry Smith 5657087cfbeSBarry Smith PetscErrorCode DMADDACreate(MPI_Comm,PetscInt,PetscInt*,PetscInt*,PetscInt,PetscBool *,DM*); 5667087cfbeSBarry Smith PetscErrorCode DMADDASetParameters(DM,PetscInt,PetscInt*,PetscInt*,PetscInt,PetscBool*); 5677087cfbeSBarry Smith PetscErrorCode DMADDASetRefinement(DM, PetscInt *,PetscInt); 5687087cfbeSBarry Smith PetscErrorCode DMADDAGetCorners(DM, PetscInt **, PetscInt **); 5697087cfbeSBarry Smith PetscErrorCode DMADDAGetGhostCorners(DM, PetscInt **, PetscInt **); 5707087cfbeSBarry Smith PetscErrorCode DMADDAGetMatrixNS(DM, DM, const MatType , Mat *); 571e1589f56SBarry Smith 572e1589f56SBarry Smith /* functions to set values in vectors and matrices */ 573e1589f56SBarry Smith struct _ADDAIdx_s { 574e1589f56SBarry Smith PetscInt *x; /* the coordinates, user has to make sure it is the correct size! */ 575e1589f56SBarry Smith PetscInt d; /* indexes the dof */ 576e1589f56SBarry Smith }; 577e1589f56SBarry Smith typedef struct _ADDAIdx_s ADDAIdx; 578e1589f56SBarry Smith 5797087cfbeSBarry Smith PetscErrorCode DMADDAMatSetValues(Mat, DM, PetscInt, const ADDAIdx[], DM, PetscInt, const ADDAIdx[], const PetscScalar[], InsertMode); 580e1589f56SBarry Smith PetscBool ADDAHCiterStartup(const PetscInt, const PetscInt *const, const PetscInt *const, PetscInt *const); 581e1589f56SBarry Smith PetscBool ADDAHCiter(const PetscInt, const PetscInt *const, const PetscInt *const, PetscInt *const); 582e1589f56SBarry Smith 583e1589f56SBarry Smith PETSC_EXTERN_CXX_END 584e1589f56SBarry Smith #endif 585