Actual source code: petscda.h

  1: /*
  2:       Regular array object, for easy parallelism of simple grid 
  3:    problems on regular distributed arrays.
  4: */
 7:  #include petscvec.h
 8:  #include petscao.h

 11: /*S
 12:      DA - Abstract PETSc object that manages distributed field data for a single structured grid

 14:    Level: beginner

 16:   Concepts: distributed array

 18: .seealso:  DACreate1d(), DACreate2d(), DACreate3d(), DADestroy(), VecScatter, DACreate()
 19: S*/
 20: typedef struct _p_DA* DA;

 22: /*E
 23:     DAStencilType - Determines if the stencil extends only along the coordinate directions, or also
 24:       to the northeast, northwest etc

 26:    Level: beginner

 28: .seealso: DACreate1d(), DACreate2d(), DACreate3d(), DA, DACreate()
 29: E*/
 30: typedef enum { DA_STENCIL_STAR,DA_STENCIL_BOX } DAStencilType;

 32: /*M
 33:      DA_STENCIL_STAR - "Star"-type stencil. In logical grid coordinates, only (i,j,k), (i+s,j,k), (i,j+s,k),
 34:                        (i,j,k+s) are in the stencil  NOT, for example, (i+s,j+s,k)

 36:      Level: beginner

 38: .seealso: DA_STENCIL_BOX, DAStencilType
 39: M*/

 41: /*M
 42:      DA_STENCIL_Box - "Box"-type stencil. In logical grid coordinates, any of (i,j,k), (i+s,j+r,k+t) may 
 43:                       be in the stencil.

 45:      Level: beginner

 47: .seealso: DA_STENCIL_STAR, DAStencilType
 48: M*/

 50: /*E
 51:     DAPeriodicType - Is the domain periodic in one or more directions

 53:    Level: beginner

 55: .seealso: DACreate1d(), DACreate2d(), DACreate3d(), DA, DACreate()
 56: E*/
 57: typedef enum { DA_NONPERIODIC,DA_XPERIODIC,DA_YPERIODIC,DA_XYPERIODIC,
 58:                DA_XYZPERIODIC,DA_XZPERIODIC,DA_YZPERIODIC,DA_ZPERIODIC}
 59:                DAPeriodicType;

 61: /*E
 62:     DAInterpolationType - Defines the type of interpolation that will be returned by 
 63:        DAGetInterpolation.

 65:    Level: beginner

 67: .seealso: DACreate1d(), DACreate2d(), DACreate3d(), DA, DAGetInterpolation(), DASetInterpolationType(), DACreate()
 68: E*/
 69: typedef enum { DA_Q0, DA_Q1 } DAInterpolationType;

 71: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DASetInterpolationType(DA,DAInterpolationType);

 73: /*E
 74:     DAElementType - Defines the type of elements that will be returned by 
 75:        DAGetElements.

 77:    Level: beginner

 79: .seealso: DACreate1d(), DACreate2d(), DACreate3d(), DA, DAGetInterpolation(), DASetInterpolationType(), 
 80:           DASetElementType(), DAGetElements(), DARestoreElements(), DACreate()
 81: E*/
 82: typedef enum { DA_ELEMENT_P1, DA_ELEMENT_Q1 } DAElementType;

 84: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DASetElementType(DA,DAElementType);
 85: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DAGetElements(DA,PetscInt *,const PetscInt*[]);
 86: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DARestoreElements(DA,PetscInt *,const PetscInt*[]);


 89: #define DAXPeriodic(pt) ((pt)==DA_XPERIODIC||(pt)==DA_XYPERIODIC||(pt)==DA_XZPERIODIC||(pt)==DA_XYZPERIODIC)
 90: #define DAYPeriodic(pt) ((pt)==DA_YPERIODIC||(pt)==DA_XYPERIODIC||(pt)==DA_YZPERIODIC||(pt)==DA_XYZPERIODIC)
 91: #define DAZPeriodic(pt) ((pt)==DA_ZPERIODIC||(pt)==DA_XZPERIODIC||(pt)==DA_YZPERIODIC||(pt)==DA_XYZPERIODIC)

 93: typedef enum { DA_X,DA_Y,DA_Z } DADirection;


 98: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DACreate1d(MPI_Comm,DAPeriodicType,PetscInt,PetscInt,PetscInt,PetscInt*,DA *);
 99: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DACreate2d(MPI_Comm,DAPeriodicType,DAStencilType,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt*,PetscInt*,DA *);
100: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DACreate3d(MPI_Comm,DAPeriodicType,DAStencilType,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt*,PetscInt*,PetscInt*,DA*);
101: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DACreate(MPI_Comm,PetscInt,DAPeriodicType,DAStencilType,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt*,PetscInt*,PetscInt*,DA*);
102: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DADestroy(DA);
103: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DAView(DA,PetscViewer);
104: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DAPrintHelp(DA);

106: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DAGlobalToLocalBegin(DA,Vec,InsertMode,Vec);
107: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DAGlobalToLocalEnd(DA,Vec,InsertMode,Vec);
108: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DAGlobalToNaturalBegin(DA,Vec,InsertMode,Vec);
109: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DAGlobalToNaturalEnd(DA,Vec,InsertMode,Vec);
110: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DANaturalToGlobalBegin(DA,Vec,InsertMode,Vec);
111: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DANaturalToGlobalEnd(DA,Vec,InsertMode,Vec);
112: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DALocalToLocalBegin(DA,Vec,InsertMode,Vec);
113: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DALocalToLocalEnd(DA,Vec,InsertMode,Vec);
114: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DALocalToGlobal(DA,Vec,InsertMode,Vec);
115: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DALocalToGlobalBegin(DA,Vec,Vec);
116: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DALocalToGlobalEnd(DA,Vec,Vec);
117: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DAGetOwnershipRange(DA,PetscInt **,PetscInt **,PetscInt **);
118: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DACreateGlobalVector(DA,Vec *);
119: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DACreateNaturalVector(DA,Vec *);
120: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DACreateLocalVector(DA,Vec *);
121: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DAGetLocalVector(DA,Vec *);
122: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DARestoreLocalVector(DA,Vec *);
123: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DAGetGlobalVector(DA,Vec *);
124: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DARestoreGlobalVector(DA,Vec *);
125: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DALoad(PetscViewer,PetscInt,PetscInt,PetscInt,DA *);
126: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DAGetCorners(DA,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*);
127: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DAGetGhostCorners(DA,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*);
128: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DAGetInfo(DA,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,DAPeriodicType*,DAStencilType*);
129: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DAGetProcessorSubset(DA,DADirection,PetscInt,MPI_Comm*);
130: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DARefine(DA,MPI_Comm,DA*);

132: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DAGlobalToNaturalAllCreate(DA,VecScatter*);
133: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DANaturalAllToGlobalCreate(DA,VecScatter*);

135: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DAGetGlobalIndices(DA,PetscInt*,PetscInt**);
136: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DAGetISLocalToGlobalMapping(DA,ISLocalToGlobalMapping*);
137: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DAGetISLocalToGlobalMappingBlck(DA,ISLocalToGlobalMapping*);

139: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DAGetScatter(DA,VecScatter*,VecScatter*,VecScatter*);

141: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DAGetAO(DA,AO*);
142: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DASetCoordinates(DA,Vec);
143: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DAGetCoordinates(DA,Vec *);
144: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DAGetGhostedCoordinates(DA,Vec *);
145: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DAGetCoordinateDA(DA,DA *);
146: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DASetUniformCoordinates(DA,PetscReal,PetscReal,PetscReal,PetscReal,PetscReal,PetscReal);
147: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DASetFieldName(DA,PetscInt,const char[]);
148: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DAGetFieldName(DA,PetscInt,char **);

150: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DAVecGetArray(DA,Vec,void *);
151: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DAVecRestoreArray(DA,Vec,void *);

153: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DAVecGetArrayDOF(DA,Vec,void *);
154: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DAVecRestoreArrayDOF(DA,Vec,void *);

156: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    DASplitComm2d(MPI_Comm,PetscInt,PetscInt,PetscInt,MPI_Comm*);

158: /*S
159:      SDA - This provides a simplified interface to the DA distributed
160:            array object in PETSc. This is intended for people who are
161:            NOT using PETSc vectors or objects but just want to distribute
162:            simple rectangular arrays amoung a number of procesors and have
163:            PETSc handle moving the ghost-values when needed.

165:           In certain applications this can serve as a replacement for 
166:           BlockComm (which is apparently being phased out?).


169:    Level: beginner

171:   Concepts: simplified distributed array

173: .seealso:  SDACreate1d(), SDACreate2d(), SDACreate3d(), SDADestroy(), DA, SDALocalToLocalBegin(),
174:            SDALocalToLocalEnd(), SDAGetCorners(), SDAGetGhostCorners()
175: S*/
176: typedef struct _SDA* SDA;

178: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    SDACreate3d(MPI_Comm,DAPeriodicType,DAStencilType,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt*,PetscInt*,PetscInt*,SDA*);
179: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    SDACreate2d(MPI_Comm,DAPeriodicType,DAStencilType,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt*,PetscInt*,SDA*);
180: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    SDACreate1d(MPI_Comm,DAPeriodicType,PetscInt,PetscInt,PetscInt,PetscInt*,SDA*);
181: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    SDADestroy(SDA);
182: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    SDALocalToLocalBegin(SDA,PetscScalar*,InsertMode,PetscScalar*);
183: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    SDALocalToLocalEnd(SDA,PetscScalar*,InsertMode,PetscScalar*);
184: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    SDAGetCorners(SDA,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*);
185: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    SDAGetGhostCorners(SDA,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*);

187: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    MatRegisterDAAD(void);
188: EXTERN PetscErrorCode PETSCDM_DLLEXPORT    MatCreateDAAD(DA,Mat*);

190: /*S
191:      DALocalInfo - C struct that contains information about a structured grid and a processors logical
192:               location in it.

194:    Level: beginner

196:   Concepts: distributed array

198:   Developer note: Then entries in this struct are int instead of PetscInt so that the elements may
199:                   be extracted in Fortran as if from an integer array

201: .seealso:  DACreate1d(), DACreate2d(), DACreate3d(), DADestroy(), DA, DAGetLocalInfo(), DAGetInfo()
202: S*/
203: typedef struct {
204:   PetscInt       dim,dof,sw;
205:   DAPeriodicType pt;
206:   DAStencilType  st;
207:   PetscInt       mx,my,mz;    /* global number of grid points in each direction */
208:   PetscInt       xs,ys,zs;    /* starting pointd of this processor, excluding ghosts */
209:   PetscInt       xm,ym,zm;    /* number of grid points on this processor, excluding ghosts */
210:   PetscInt       gxs,gys,gzs;    /* starting point of this processor including ghosts */
211:   PetscInt       gxm,gym,gzm;    /* number of grid points on this processor including ghosts */
212:   DA             da;
213: } DALocalInfo;

215: /*MC
216:       DAForEachPointBegin2d - Starts a loop over the local part of a two dimensional DA

218:    Synopsis:
219:    void  DAForEachPointBegin2d(DALocalInfo *info,PetscInt i,PetscInt j);
220:    
221:    Level: intermediate

223: .seealso: DAForEachPointEnd2d(), DAVecGetArray()
224: M*/
225: #define DAForEachPointBegin2d(info,i,j) {\
226:   PetscInt _xints = info->xs,_xinte = info->xs+info->xm,_yints = info->ys,_yinte = info->ys+info->ym;\
227:   for (j=_yints; j<_yinte; j++) {\
228:     for (i=_xints; i<_xinte; i++) {\

230: /*MC
231:       DAForEachPointEnd2d - Ends a loop over the local part of a two dimensional DA

233:    Synopsis:
234:    void  DAForEachPointEnd2d;
235:    
236:    Level: intermediate

238: .seealso: DAForEachPointBegin2d(), DAVecGetArray()
239: M*/
240: #define DAForEachPointEnd2d }}}

242: /*MC
243:       DACoor2d - Structure for holding 2d (x and y) coordinates.

245:     Level: intermediate

247:     Sample Usage:
248:       DACoor2d **coors;
249:       Vec      vcoors;
250:       DA       cda;     

252:       DAGetCoordinates(da,&vcoors); 
253:       DAGetCoordinateDA(da,&cda);
254:       DAVecGetArray(dac,vcoors,&coors);
255:       DAGetCorners(dac,&mstart,&nstart,0,&m,&n,0)
256:       for (i=mstart; i<mstart+m; i++) {
257:         for (j=nstart; j<nstart+n; j++) {
258:           x = coors[j][i].x;
259:           y = coors[j][i].y;
260:           ......
261:         }
262:       }
263:       DAVecRestoreArray(dac,vcoors,&coors);

265: .seealso: DACoor3d, DAForEachPointBegin(), DAGetCoordinateDA(), DAGetCoordinates(), DAGetGhostCoordinates()
266: M*/
267: typedef struct {PetscScalar x,y;} DACoor2d;

269: /*MC
270:       DACoor3d - Structure for holding 3d (x, y and z) coordinates.

272:     Level: intermediate

274:     Sample Usage:
275:       DACoor3d **coors;
276:       Vec      vcoors;
277:       DA       cda;     

279:       DAGetCoordinates(da,&vcoors); 
280:       DAGetCoordinateDA(da,&cda);
281:       DAVecGetArray(dac,vcoors,&coors);
282:       DAGetCorners(dac,&mstart,&nstart,&pstart,&m,&n,&p)
283:       for (i=mstart; i<mstart+m; i++) {
284:         for (j=nstart; j<nstart+n; j++) {
285:           for (k=pstart; k<pstart+p; k++) {
286:             x = coors[k][j][i].x;
287:             y = coors[k][j][i].y;
288:             z = coors[k][j][i].z;
289:           ......
290:         }
291:       }
292:       DAVecRestoreArray(dac,vcoors,&coors);

294: .seealso: DACoor2d, DAForEachPointBegin(), DAGetCoordinateDA(), DAGetCoordinates(), DAGetGhostCoordinates()
295: M*/
296: typedef struct {PetscScalar x,y,z;} DACoor3d;
297: 
298: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DAGetLocalInfo(DA,DALocalInfo*);
299: typedef PetscErrorCode (*DALocalFunction1)(DALocalInfo*,void*,void*,void*);
300: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DAFormFunction1(DA,Vec,Vec,void*);
301: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DAFormFunctioni1(DA,PetscInt,Vec,PetscScalar*,void*);
302: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DAComputeJacobian1WithAdic(DA,Vec,Mat,void*);
303: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DAComputeJacobian1WithAdifor(DA,Vec,Mat,void*);
304: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DAMultiplyByJacobian1WithAdic(DA,Vec,Vec,Vec,void*);
305: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DAMultiplyByJacobian1WithAdifor(DA,Vec,Vec,Vec,void*);
306: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DAMultiplyByJacobian1WithAD(DA,Vec,Vec,Vec,void*);
307: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DAComputeJacobian1(DA,Vec,Mat,void*);
308: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DAGetLocalFunction(DA,DALocalFunction1*);
309: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DASetLocalFunction(DA,DALocalFunction1);
310: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DASetLocalFunctioni(DA,PetscErrorCode (*)(DALocalInfo*,MatStencil*,void*,PetscScalar*,void*));
311: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DASetLocalJacobian(DA,DALocalFunction1);
312: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DASetLocalAdicFunction_Private(DA,DALocalFunction1);

314: /*MC
315:        DASetLocalAdicFunction - Caches in a DA a local function computed by ADIC/ADIFOR

317:    Collective on DA

319:    Synopsis:
320:    PetscErrorCode DASetLocalAdicFunction(DA da,DALocalFunction1 ad_lf)
321:    
322:    Input Parameter:
323: +  da - initial distributed array
324: -  ad_lf - the local function as computed by ADIC/ADIFOR

326:    Level: intermediate

328: .keywords:  distributed array, refine

330: .seealso: DACreate1d(), DACreate2d(), DACreate3d(), DADestroy(), DAGetLocalFunction(), DASetLocalFunction(),
331:           DASetLocalJacobian()
332: M*/
333: #if defined(PETSC_HAVE_ADIC)
334: #  define DASetLocalAdicFunction(a,d) DASetLocalAdicFunction_Private(a,(DALocalFunction1)d)
335: #else
336: #  define DASetLocalAdicFunction(a,d) DASetLocalAdicFunction_Private(a,0)
337: #endif

339: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DASetLocalAdicMFFunction_Private(DA,DALocalFunction1);
340: #if defined(PETSC_HAVE_ADIC)
341: #  define DASetLocalAdicMFFunction(a,d) DASetLocalAdicMFFunction_Private(a,(DALocalFunction1)d)
342: #else
343: #  define DASetLocalAdicMFFunction(a,d) DASetLocalAdicMFFunction_Private(a,0)
344: #endif
345: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DASetLocalAdicFunctioni_Private(DA,PetscErrorCode (*)(DALocalInfo*,MatStencil*,void*,void*,void*));
346: #if defined(PETSC_HAVE_ADIC)
347: #  define DASetLocalAdicFunctioni(a,d) DASetLocalAdicFunctioni_Private(a,(PetscErrorCode (*)(DALocalInfo*,MatStencil*,void*,void*,void*))d)
348: #else
349: #  define DASetLocalAdicFunctioni(a,d) DASetLocalAdicFunctioni_Private(a,0)
350: #endif
351: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DASetLocalAdicMFFunctioni_Private(DA,PetscErrorCode (*)(DALocalInfo*,MatStencil*,void*,void*,void*));
352: #if defined(PETSC_HAVE_ADIC)
353: #  define DASetLocalAdicMFFunctioni(a,d) DASetLocalAdicMFFunctioni_Private(a,(PetscErrorCode (*)(DALocalInfo*,MatStencil*,void*,void*,void*))d)
354: #else
355: #  define DASetLocalAdicMFFunctioni(a,d) DASetLocalAdicMFFunctioni_Private(a,0)
356: #endif
357: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DAFormFunctioniTest1(DA,void*);

359:  #include petscmat.h
360: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DAGetColoring(DA,ISColoringType,ISColoring *);
361: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DAGetMatrix(DA, MatType,Mat *);
362: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DASetGetMatrix(DA,PetscErrorCode (*)(DA, MatType,Mat *));
363: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DAGetInterpolation(DA,DA,Mat*,Vec*);
364: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DAGetInjection(DA,DA,VecScatter*);
365: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DASetBlockFills(DA,PetscInt*,PetscInt*);
366: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DASetRefinementFactor(DA,PetscInt,PetscInt,PetscInt);
367: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DAGetRefinementFactor(DA,PetscInt*,PetscInt*,PetscInt*);

369: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DAGetAdicArray(DA,PetscTruth,void**,void**,PetscInt*);
370: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DARestoreAdicArray(DA,PetscTruth,void**,void**,PetscInt*);
371: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DAGetAdicMFArray(DA,PetscTruth,void**,void**,PetscInt*);
372: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DARestoreAdicMFArray(DA,PetscTruth,void**,void**,PetscInt*);
373: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DAGetArray(DA,PetscTruth,void**);
374: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DARestoreArray(DA,PetscTruth,void**);
375: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  ad_DAGetArray(DA,PetscTruth,void**);
376: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  ad_DARestoreArray(DA,PetscTruth,void**);
377: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  admf_DAGetArray(DA,PetscTruth,void**);
378: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  admf_DARestoreArray(DA,PetscTruth,void**);

380:  #include petscpf.h
381: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DACreatePF(DA,PF*);

383: /*S
384:      VecPack - Abstract PETSc object that manages treating several distinct vectors as if they
385:         were one.   The VecPack routines allow one to manage a nonlinear solver that works on a
386:         vector that consists of several distinct parts. This is mostly used for LNKS solvers, 
387:         that is design optimization problems that are written as a nonlinear system

389:    Level: beginner

391:   Concepts: multi-component, LNKS solvers

393: .seealso:  VecPackCreate(), VecPackDestroy()
394: S*/
395: typedef struct _p_VecPack *VecPack;

397: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  VecPackCreate(MPI_Comm,VecPack*);
398: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  VecPackDestroy(VecPack);
399: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  VecPackAddArray(VecPack,PetscInt);
400: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  VecPackAddDA(VecPack,DA);
401: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  VecPackAddVecScatter(VecPack,VecScatter);
402: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  VecPackScatter(VecPack,Vec,...);
403: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  VecPackGather(VecPack,Vec,...);
404: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  VecPackGetAccess(VecPack,Vec,...);
405: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  VecPackRestoreAccess(VecPack,Vec,...);
406: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  VecPackGetLocalVectors(VecPack,...);
407: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  VecPackGetEntries(VecPack,...);
408: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  VecPackRestoreLocalVectors(VecPack,...);
409: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  VecPackCreateGlobalVector(VecPack,Vec*);
410: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  VecPackGetGlobalIndices(VecPack,...);
411: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  VecPackRefine(VecPack,MPI_Comm,VecPack*);
412: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  VecPackGetInterpolation(VecPack,VecPack,Mat*,Vec*);

414: /*S
415:      DM - Abstract PETSc object that manages an abstract grid object
416:           
417:    Level: intermediate

419:   Concepts: grids, grid refinement

421:    Notes: The DA object and the VecPack object are examples of DMs

423:           Though the DA objects require the petscsnes.h include files the DM library is
424:     NOT dependent on the SNES or KSP library. In fact, the KSP and SNES libraries depend on
425:     DM. (This is not great design, but not trivial to fix).

427: .seealso:  VecPackCreate(), DA, VecPack
428: S*/
429: typedef struct _p_DM* DM;

431: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DMView(DM,PetscViewer);
432: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DMDestroy(DM);
433: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DMCreateGlobalVector(DM,Vec*);
434: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DMGetColoring(DM,ISColoringType,ISColoring*);
435: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DMGetMatrix(DM, MatType,Mat*);
436: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DMGetInterpolation(DM,DM,Mat*,Vec*);
437: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DMGetInjection(DM,DM,VecScatter*);
438: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DMRefine(DM,MPI_Comm,DM*);
439: EXTERN PetscErrorCode PETSCDM_DLLEXPORT  DMGetInterpolationScale(DM,DM,Mat,Vec*);

441: typedef struct NLF_DAAD* NLF;


445: #endif