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(), DM, DMComposite
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: /*MC
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: /*MC
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} DAPeriodicType;
60: /*E
61: DAInterpolationType - Defines the type of interpolation that will be returned by
62: DAGetInterpolation.
64: Level: beginner
66: .seealso: DACreate1d(), DACreate2d(), DACreate3d(), DA, DAGetInterpolation(), DASetInterpolationType(), DACreate()
67: E*/
68: typedef enum { DA_Q0, DA_Q1 } DAInterpolationType;
70: EXTERN PetscErrorCode DASetInterpolationType(DA,DAInterpolationType);
72: /*E
73: DAElementType - Defines the type of elements that will be returned by
74: DAGetElements.
76: Level: beginner
78: .seealso: DACreate1d(), DACreate2d(), DACreate3d(), DA, DAGetInterpolation(), DASetInterpolationType(),
79: DASetElementType(), DAGetElements(), DARestoreElements(), DACreate()
80: E*/
81: typedef enum { DA_ELEMENT_P1, DA_ELEMENT_Q1 } DAElementType;
83: EXTERN PetscErrorCode DASetElementType(DA,DAElementType);
84: EXTERN PetscErrorCode DAGetElements(DA,PetscInt *,const PetscInt*[]);
85: EXTERN PetscErrorCode DARestoreElements(DA,PetscInt *,const PetscInt*[]);
88: #define DAXPeriodic(pt) ((pt)==DA_XPERIODIC||(pt)==DA_XYPERIODIC||(pt)==DA_XZPERIODIC||(pt)==DA_XYZPERIODIC)
89: #define DAYPeriodic(pt) ((pt)==DA_YPERIODIC||(pt)==DA_XYPERIODIC||(pt)==DA_YZPERIODIC||(pt)==DA_XYZPERIODIC)
90: #define DAZPeriodic(pt) ((pt)==DA_ZPERIODIC||(pt)==DA_XZPERIODIC||(pt)==DA_YZPERIODIC||(pt)==DA_XYZPERIODIC)
92: typedef enum { DA_X,DA_Y,DA_Z } DADirection;
96: EXTERN PetscErrorCode DACreate1d(MPI_Comm,DAPeriodicType,PetscInt,PetscInt,PetscInt,PetscInt*,DA *);
97: EXTERN PetscErrorCode DACreate2d(MPI_Comm,DAPeriodicType,DAStencilType,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt*,PetscInt*,DA *);
98: EXTERN PetscErrorCode DACreate3d(MPI_Comm,DAPeriodicType,DAStencilType,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt*,PetscInt*,PetscInt*,DA*);
99: EXTERN PetscErrorCode DACreate(MPI_Comm,PetscInt,DAPeriodicType,DAStencilType,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt*,PetscInt*,PetscInt*,DA*);
100: EXTERN PetscErrorCode DADestroy(DA);
101: EXTERN PetscErrorCode DAView(DA,PetscViewer);
103: EXTERN PetscErrorCode DAGlobalToLocalBegin(DA,Vec,InsertMode,Vec);
104: EXTERN PetscErrorCode DAGlobalToLocalEnd(DA,Vec,InsertMode,Vec);
105: EXTERN PetscErrorCode DAGlobalToNaturalBegin(DA,Vec,InsertMode,Vec);
106: EXTERN PetscErrorCode DAGlobalToNaturalEnd(DA,Vec,InsertMode,Vec);
107: EXTERN PetscErrorCode DANaturalToGlobalBegin(DA,Vec,InsertMode,Vec);
108: EXTERN PetscErrorCode DANaturalToGlobalEnd(DA,Vec,InsertMode,Vec);
109: EXTERN PetscErrorCode DALocalToLocalBegin(DA,Vec,InsertMode,Vec);
110: EXTERN PetscErrorCode DALocalToLocalEnd(DA,Vec,InsertMode,Vec);
111: EXTERN PetscErrorCode DALocalToGlobal(DA,Vec,InsertMode,Vec);
112: EXTERN PetscErrorCode DALocalToGlobalBegin(DA,Vec,Vec);
113: EXTERN PetscErrorCode DALocalToGlobalEnd(DA,Vec,Vec);
114: EXTERN PetscErrorCode DAGetOwnershipRange(DA,PetscInt **,PetscInt **,PetscInt **);
115: EXTERN PetscErrorCode DACreateGlobalVector(DA,Vec *);
116: EXTERN PetscErrorCode DACreateNaturalVector(DA,Vec *);
117: EXTERN PetscErrorCode DACreateLocalVector(DA,Vec *);
118: EXTERN PetscErrorCode DAGetLocalVector(DA,Vec *);
119: EXTERN PetscErrorCode DARestoreLocalVector(DA,Vec *);
120: EXTERN PetscErrorCode DAGetGlobalVector(DA,Vec *);
121: EXTERN PetscErrorCode DARestoreGlobalVector(DA,Vec *);
122: EXTERN PetscErrorCode DALoad(PetscViewer,PetscInt,PetscInt,PetscInt,DA *);
123: EXTERN PetscErrorCode DAGetCorners(DA,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*);
124: EXTERN PetscErrorCode DAGetGhostCorners(DA,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*);
125: EXTERN PetscErrorCode DAGetInfo(DA,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,DAPeriodicType*,DAStencilType*);
126: EXTERN PetscErrorCode DAGetProcessorSubset(DA,DADirection,PetscInt,MPI_Comm*);
127: EXTERN PetscErrorCode DARefine(DA,MPI_Comm,DA*);
129: EXTERN PetscErrorCode DAGlobalToNaturalAllCreate(DA,VecScatter*);
130: EXTERN PetscErrorCode DANaturalAllToGlobalCreate(DA,VecScatter*);
132: EXTERN PetscErrorCode DAGetGlobalIndices(DA,PetscInt*,PetscInt**);
133: EXTERN PetscErrorCode DAGetISLocalToGlobalMapping(DA,ISLocalToGlobalMapping*);
134: EXTERN PetscErrorCode DAGetISLocalToGlobalMappingBlck(DA,ISLocalToGlobalMapping*);
136: EXTERN PetscErrorCode DAGetScatter(DA,VecScatter*,VecScatter*,VecScatter*);
138: EXTERN PetscErrorCode DAGetAO(DA,AO*);
139: EXTERN PetscErrorCode DASetCoordinates(DA,Vec);
140: EXTERN PetscErrorCode DAGetCoordinates(DA,Vec *);
141: EXTERN PetscErrorCode DAGetGhostedCoordinates(DA,Vec *);
142: EXTERN PetscErrorCode DAGetCoordinateDA(DA,DA *);
143: EXTERN PetscErrorCode DASetUniformCoordinates(DA,PetscReal,PetscReal,PetscReal,PetscReal,PetscReal,PetscReal);
144: EXTERN PetscErrorCode DASetFieldName(DA,PetscInt,const char[]);
145: EXTERN PetscErrorCode DAGetFieldName(DA,PetscInt,char **);
147: EXTERN PetscErrorCode DAVecGetArray(DA,Vec,void *);
148: EXTERN PetscErrorCode DAVecRestoreArray(DA,Vec,void *);
150: EXTERN PetscErrorCode DAVecGetArrayDOF(DA,Vec,void *);
151: EXTERN PetscErrorCode DAVecRestoreArrayDOF(DA,Vec,void *);
153: EXTERN PetscErrorCode DASplitComm2d(MPI_Comm,PetscInt,PetscInt,PetscInt,MPI_Comm*);
155: /*S
156: SDA - This provides a simplified interface to the DA distributed
157: array object in PETSc. This is intended for people who are
158: NOT using PETSc vectors or objects but just want to distribute
159: simple rectangular arrays amoung a number of procesors and have
160: PETSc handle moving the ghost-values when needed.
162: In certain applications this can serve as a replacement for
163: BlockComm (which is apparently being phased out?).
166: Level: beginner
168: Concepts: simplified distributed array
170: .seealso: SDACreate1d(), SDACreate2d(), SDACreate3d(), SDADestroy(), DA, SDALocalToLocalBegin(),
171: SDALocalToLocalEnd(), SDAGetCorners(), SDAGetGhostCorners()
172: S*/
173: typedef struct _n_SDA* SDA;
175: EXTERN PetscErrorCode SDACreate3d(MPI_Comm,DAPeriodicType,DAStencilType,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt*,PetscInt*,PetscInt*,SDA*);
176: EXTERN PetscErrorCode SDACreate2d(MPI_Comm,DAPeriodicType,DAStencilType,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt*,PetscInt*,SDA*);
177: EXTERN PetscErrorCode SDACreate1d(MPI_Comm,DAPeriodicType,PetscInt,PetscInt,PetscInt,PetscInt*,SDA*);
178: EXTERN PetscErrorCode SDADestroy(SDA);
179: EXTERN PetscErrorCode SDALocalToLocalBegin(SDA,PetscScalar*,InsertMode,PetscScalar*);
180: EXTERN PetscErrorCode SDALocalToLocalEnd(SDA,PetscScalar*,InsertMode,PetscScalar*);
181: EXTERN PetscErrorCode SDAGetCorners(SDA,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*);
182: EXTERN PetscErrorCode SDAGetGhostCorners(SDA,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*);
183: EXTERN PetscErrorCode SDAArrayView(SDA,PetscScalar*,PetscViewer);
185: EXTERN PetscErrorCode MatRegisterDAAD(void);
186: EXTERN PetscErrorCode MatCreateDAAD(DA,Mat*);
188: /*S
189: DALocalInfo - C struct that contains information about a structured grid and a processors logical
190: location in it.
192: Level: beginner
194: Concepts: distributed array
196: Developer note: Then entries in this struct are int instead of PetscInt so that the elements may
197: be extracted in Fortran as if from an integer array
199: .seealso: DACreate1d(), DACreate2d(), DACreate3d(), DADestroy(), DA, DAGetLocalInfo(), DAGetInfo()
200: S*/
201: typedef struct {
202: PetscInt dim,dof,sw;
203: PetscInt mx,my,mz; /* global number of grid points in each direction */
204: PetscInt xs,ys,zs; /* starting pointd of this processor, excluding ghosts */
205: PetscInt xm,ym,zm; /* number of grid points on this processor, excluding ghosts */
206: PetscInt gxs,gys,gzs; /* starting point of this processor including ghosts */
207: PetscInt gxm,gym,gzm; /* number of grid points on this processor including ghosts */
208: DAPeriodicType pt;
209: DAStencilType st;
210: DA da;
211: } DALocalInfo;
213: /*MC
214: DAForEachPointBegin2d - Starts a loop over the local part of a two dimensional DA
216: Synopsis:
217: void DAForEachPointBegin2d(DALocalInfo *info,PetscInt i,PetscInt j);
218:
219: Level: intermediate
221: .seealso: DAForEachPointEnd2d(), DAVecGetArray()
222: M*/
223: #define DAForEachPointBegin2d(info,i,j) {\
224: PetscInt _xints = info->xs,_xinte = info->xs+info->xm,_yints = info->ys,_yinte = info->ys+info->ym;\
225: for (j=_yints; j<_yinte; j++) {\
226: for (i=_xints; i<_xinte; i++) {\
228: /*MC
229: DAForEachPointEnd2d - Ends a loop over the local part of a two dimensional DA
231: Synopsis:
232: void DAForEachPointEnd2d;
233:
234: Level: intermediate
236: .seealso: DAForEachPointBegin2d(), DAVecGetArray()
237: M*/
238: #define DAForEachPointEnd2d }}}
240: /*MC
241: DACoor2d - Structure for holding 2d (x and y) coordinates.
243: Level: intermediate
245: Sample Usage:
246: DACoor2d **coors;
247: Vec vcoors;
248: DA cda;
250: DAGetCoordinates(da,&vcoors);
251: DAGetCoordinateDA(da,&cda);
252: DAVecGetArray(cda,vcoors,&coors);
253: DAGetCorners(cda,&mstart,&nstart,0,&m,&n,0)
254: for (i=mstart; i<mstart+m; i++) {
255: for (j=nstart; j<nstart+n; j++) {
256: x = coors[j][i].x;
257: y = coors[j][i].y;
258: ......
259: }
260: }
261: DAVecRestoreArray(dac,vcoors,&coors);
263: .seealso: DACoor3d, DAForEachPointBegin(), DAGetCoordinateDA(), DAGetCoordinates(), DAGetGhostCoordinates()
264: M*/
265: typedef struct {PetscScalar x,y;} DACoor2d;
267: /*MC
268: DACoor3d - Structure for holding 3d (x, y and z) coordinates.
270: Level: intermediate
272: Sample Usage:
273: DACoor3d **coors;
274: Vec vcoors;
275: DA cda;
277: DAGetCoordinates(da,&vcoors);
278: DAGetCoordinateDA(da,&cda);
279: DAVecGetArray(cda,vcoors,&coors);
280: DAGetCorners(cda,&mstart,&nstart,&pstart,&m,&n,&p)
281: for (i=mstart; i<mstart+m; i++) {
282: for (j=nstart; j<nstart+n; j++) {
283: for (k=pstart; k<pstart+p; k++) {
284: x = coors[k][j][i].x;
285: y = coors[k][j][i].y;
286: z = coors[k][j][i].z;
287: ......
288: }
289: }
290: DAVecRestoreArray(dac,vcoors,&coors);
292: .seealso: DACoor2d, DAForEachPointBegin(), DAGetCoordinateDA(), DAGetCoordinates(), DAGetGhostCoordinates()
293: M*/
294: typedef struct {PetscScalar x,y,z;} DACoor3d;
295:
296: EXTERN PetscErrorCode DAGetLocalInfo(DA,DALocalInfo*);
297: typedef PetscErrorCode (*DALocalFunction1)(DALocalInfo*,void*,void*,void*);
298: EXTERN PetscErrorCode DAFormFunctionLocal(DA, DALocalFunction1, Vec, Vec, void *);
299: EXTERN PetscErrorCode DAFormFunctionLocalGhost(DA, DALocalFunction1, Vec, Vec, void *);
300: EXTERN PetscErrorCode DAFormJacobianLocal(DA, DALocalFunction1, Vec, Mat, void *);
301: EXTERN PetscErrorCode DAFormFunction1(DA,Vec,Vec,void*);
302: EXTERN PetscErrorCode DAFormFunction(DA,PetscErrorCode (*)(void),Vec,Vec,void*);
303: EXTERN PetscErrorCode DAFormFunctioni1(DA,PetscInt,Vec,PetscScalar*,void*);
304: EXTERN PetscErrorCode DAFormFunctionib1(DA,PetscInt,Vec,PetscScalar*,void*);
305: EXTERN PetscErrorCode DAComputeJacobian1WithAdic(DA,Vec,Mat,void*);
306: EXTERN PetscErrorCode DAComputeJacobian1WithAdifor(DA,Vec,Mat,void*);
307: EXTERN PetscErrorCode DAMultiplyByJacobian1WithAdic(DA,Vec,Vec,Vec,void*);
308: EXTERN PetscErrorCode DAMultiplyByJacobian1WithAdifor(DA,Vec,Vec,Vec,void*);
309: EXTERN PetscErrorCode DAMultiplyByJacobian1WithAD(DA,Vec,Vec,Vec,void*);
310: EXTERN PetscErrorCode DAComputeJacobian1(DA,Vec,Mat,void*);
311: EXTERN PetscErrorCode DAGetLocalFunction(DA,DALocalFunction1*);
312: EXTERN PetscErrorCode DASetLocalFunction(DA,DALocalFunction1);
313: EXTERN PetscErrorCode DASetLocalFunctioni(DA,PetscErrorCode (*)(DALocalInfo*,MatStencil*,void*,PetscScalar*,void*));
314: EXTERN PetscErrorCode DASetLocalFunctionib(DA,PetscErrorCode (*)(DALocalInfo*,MatStencil*,void*,PetscScalar*,void*));
315: EXTERN PetscErrorCode DASetLocalJacobian(DA,DALocalFunction1);
316: EXTERN PetscErrorCode DASetLocalAdicFunction_Private(DA,DALocalFunction1);
318: /*MC
319: DASetLocalAdicFunction - Caches in a DA a local function computed by ADIC/ADIFOR
321: Collective on DA
323: Synopsis:
324: PetscErrorCode DASetLocalAdicFunction(DA da,DALocalFunction1 ad_lf)
325:
326: Input Parameter:
327: + da - initial distributed array
328: - ad_lf - the local function as computed by ADIC/ADIFOR
330: Level: intermediate
332: .keywords: distributed array, refine
334: .seealso: DACreate1d(), DACreate2d(), DACreate3d(), DADestroy(), DAGetLocalFunction(), DASetLocalFunction(),
335: DASetLocalJacobian()
336: M*/
337: #if defined(PETSC_HAVE_ADIC)
338: # define DASetLocalAdicFunction(a,d) DASetLocalAdicFunction_Private(a,(DALocalFunction1)d)
339: #else
340: # define DASetLocalAdicFunction(a,d) DASetLocalAdicFunction_Private(a,0)
341: #endif
343: EXTERN PetscErrorCode DASetLocalAdicMFFunction_Private(DA,DALocalFunction1);
344: #if defined(PETSC_HAVE_ADIC)
345: # define DASetLocalAdicMFFunction(a,d) DASetLocalAdicMFFunction_Private(a,(DALocalFunction1)d)
346: #else
347: # define DASetLocalAdicMFFunction(a,d) DASetLocalAdicMFFunction_Private(a,0)
348: #endif
349: EXTERN PetscErrorCode DASetLocalAdicFunctioni_Private(DA,PetscErrorCode (*)(DALocalInfo*,MatStencil*,void*,void*,void*));
350: #if defined(PETSC_HAVE_ADIC)
351: # define DASetLocalAdicFunctioni(a,d) DASetLocalAdicFunctioni_Private(a,(PetscErrorCode (*)(DALocalInfo*,MatStencil*,void*,void*,void*))d)
352: #else
353: # define DASetLocalAdicFunctioni(a,d) DASetLocalAdicFunctioni_Private(a,0)
354: #endif
355: EXTERN PetscErrorCode DASetLocalAdicMFFunctioni_Private(DA,PetscErrorCode (*)(DALocalInfo*,MatStencil*,void*,void*,void*));
356: #if defined(PETSC_HAVE_ADIC)
357: # define DASetLocalAdicMFFunctioni(a,d) DASetLocalAdicMFFunctioni_Private(a,(PetscErrorCode (*)(DALocalInfo*,MatStencil*,void*,void*,void*))d)
358: #else
359: # define DASetLocalAdicMFFunctioni(a,d) DASetLocalAdicMFFunctioni_Private(a,0)
360: #endif
362: EXTERN PetscErrorCode DASetLocalAdicFunctionib_Private(DA,PetscErrorCode (*)(DALocalInfo*,MatStencil*,void*,void*,void*));
363: #if defined(PETSC_HAVE_ADIC)
364: # define DASetLocalAdicFunctionib(a,d) DASetLocalAdicFunctionib_Private(a,(PetscErrorCode (*)(DALocalInfo*,MatStencil*,void*,void*,void*))d)
365: #else
366: # define DASetLocalAdicFunctionib(a,d) DASetLocalAdicFunctionib_Private(a,0)
367: #endif
368: EXTERN PetscErrorCode DASetLocalAdicMFFunctionib_Private(DA,PetscErrorCode (*)(DALocalInfo*,MatStencil*,void*,void*,void*));
369: #if defined(PETSC_HAVE_ADIC)
370: # define DASetLocalAdicMFFunctionib(a,d) DASetLocalAdicMFFunctionib_Private(a,(PetscErrorCode (*)(DALocalInfo*,MatStencil*,void*,void*,void*))d)
371: #else
372: # define DASetLocalAdicMFFunctionib(a,d) DASetLocalAdicMFFunctionib_Private(a,0)
373: #endif
375: EXTERN PetscErrorCode DAFormFunctioniTest1(DA,void*);
377: #include petscmat.h
378: EXTERN PetscErrorCode DAGetColoring(DA,ISColoringType,ISColoring *);
379: EXTERN PetscErrorCode DAGetMatrix(DA, MatType,Mat *);
380: EXTERN PetscErrorCode DASetGetMatrix(DA,PetscErrorCode (*)(DA, MatType,Mat *));
381: EXTERN PetscErrorCode DAGetInterpolation(DA,DA,Mat*,Vec*);
382: EXTERN PetscErrorCode DAGetInjection(DA,DA,VecScatter*);
383: EXTERN PetscErrorCode DASetBlockFills(DA,PetscInt*,PetscInt*);
384: EXTERN PetscErrorCode DASetMatPreallocateOnly(DA,PetscTruth);
385: EXTERN PetscErrorCode DASetRefinementFactor(DA,PetscInt,PetscInt,PetscInt);
386: EXTERN PetscErrorCode DAGetRefinementFactor(DA,PetscInt*,PetscInt*,PetscInt*);
388: EXTERN PetscErrorCode DAGetAdicArray(DA,PetscTruth,void**,void**,PetscInt*);
389: EXTERN PetscErrorCode DARestoreAdicArray(DA,PetscTruth,void**,void**,PetscInt*);
390: EXTERN PetscErrorCode DAGetAdicMFArray(DA,PetscTruth,void**,void**,PetscInt*);
391: EXTERN PetscErrorCode DAGetAdicMFArray4(DA,PetscTruth,void**,void**,PetscInt*);
392: EXTERN PetscErrorCode DAGetAdicMFArray9(DA,PetscTruth,void**,void**,PetscInt*);
393: EXTERN PetscErrorCode DAGetAdicMFArrayb(DA,PetscTruth,void**,void**,PetscInt*);
394: EXTERN PetscErrorCode DARestoreAdicMFArray(DA,PetscTruth,void**,void**,PetscInt*);
395: EXTERN PetscErrorCode DAGetArray(DA,PetscTruth,void**);
396: EXTERN PetscErrorCode DARestoreArray(DA,PetscTruth,void**);
397: EXTERN PetscErrorCode ad_DAGetArray(DA,PetscTruth,void**);
398: EXTERN PetscErrorCode ad_DARestoreArray(DA,PetscTruth,void**);
399: EXTERN PetscErrorCode admf_DAGetArray(DA,PetscTruth,void**);
400: EXTERN PetscErrorCode admf_DARestoreArray(DA,PetscTruth,void**);
402: #include petscpf.h
403: EXTERN PetscErrorCode DACreatePF(DA,PF*);
405: /*S
406: DMComposite - Abstract PETSc object that manages treating several distinct vectors as if they
407: were one. The DMComposite routines allow one to manage a nonlinear solver that works on a
408: vector that consists of several distinct parts. This is mostly used for LNKS solvers,
409: that is design optimization problems that are written as a nonlinear system
411: Level: beginner
413: Concepts: multi-component, LNKS solvers
415: .seealso: DMCompositeCreate(), DMCompositeDestroy(), DM
416: S*/
417: typedef struct _p_DMComposite* DMComposite;
419: EXTERN PetscErrorCode DMCompositeCreate(MPI_Comm,DMComposite*);
420: EXTERN PetscErrorCode DMCompositeDestroy(DMComposite);
421: EXTERN PetscErrorCode DMCompositeAddArray(DMComposite,PetscMPIInt,PetscInt);
422: EXTERN PetscErrorCode DMCompositeAddDA(DMComposite,DA);
423: EXTERN PetscErrorCode DMCompositeAddVecScatter(DMComposite,VecScatter);
424: EXTERN PetscErrorCode DMCompositeScatter(DMComposite,Vec,...);
425: EXTERN PetscErrorCode DMCompositeGather(DMComposite,Vec,...);
426: EXTERN PetscErrorCode DMCompositeGetAccess(DMComposite,Vec,...);
427: EXTERN PetscErrorCode DMCompositeRestoreAccess(DMComposite,Vec,...);
428: EXTERN PetscErrorCode DMCompositeGetLocalVectors(DMComposite,...);
429: EXTERN PetscErrorCode DMCompositeGetEntries(DMComposite,...);
430: EXTERN PetscErrorCode DMCompositeRestoreLocalVectors(DMComposite,...);
431: EXTERN PetscErrorCode DMCompositeCreateGlobalVector(DMComposite,Vec*);
432: EXTERN PetscErrorCode DMCompositeGetGlobalIndices(DMComposite,...);
433: EXTERN PetscErrorCode DMCompositeRefine(DMComposite,MPI_Comm,DMComposite*);
434: EXTERN PetscErrorCode DMCompositeGetInterpolation(DMComposite,DMComposite,Mat*,Vec*);
435: EXTERN PetscErrorCode DMCompositeGetMatrix(DMComposite,MatType,Mat*);
436: EXTERN PetscErrorCode DMCompositeGetColoring(DMComposite,ISColoringType,ISColoring*);
438: /*S
439: Slice - Abstract PETSc object that manages distributed field data for a simple unstructured matrix
441: Level: beginner
443: Concepts: distributed array
445: .seealso: DACreate1d(), DACreate2d(), DACreate3d(), DADestroy(), VecScatter, DACreate(), DMCompositeCreate(), DMComposite
446: S*/
447: typedef struct _p_Sliced* Sliced;
449: EXTERN PetscErrorCode SlicedView(Sliced,PetscViewer);
450: EXTERN PetscErrorCode SlicedCreate(MPI_Comm,Sliced*);
451: EXTERN PetscErrorCode SlicedDestroy(Sliced);
452: EXTERN PetscErrorCode SlicedCreateGlobalVector(Sliced,Vec*);
453: EXTERN PetscErrorCode SlicedGetMatrix(Sliced, MatType,Mat*);
454: EXTERN PetscErrorCode SlicedGetGlobalIndices(Sliced,PetscInt*[]);
455: EXTERN PetscErrorCode SlicedSetPreallocation(Sliced,PetscInt,const PetscInt[],PetscInt,const PetscInt[]);
456: EXTERN PetscErrorCode SlicedSetGhosts(Sliced,PetscInt,PetscInt,PetscInt,const PetscInt[]);
458: /*S
459: DM - Abstract PETSc object that manages an abstract grid object
460:
461: Level: intermediate
463: Concepts: grids, grid refinement
465: Notes: The DA object and the DMComposite object are examples of DMs
467: Though the DA objects require the petscsnes.h include files the DM library is
468: NOT dependent on the SNES or KSP library. In fact, the KSP and SNES libraries depend on
469: DM. (This is not great design, but not trivial to fix).
471: .seealso: DMCompositeCreate(), DA, DMComposite
472: S*/
473: typedef struct _p_DM* DM;
475: EXTERN PetscErrorCode DMView(DM,PetscViewer);
476: EXTERN PetscErrorCode DMDestroy(DM);
477: EXTERN PetscErrorCode DMCreateGlobalVector(DM,Vec*);
478: EXTERN PetscErrorCode DMGetColoring(DM,ISColoringType,ISColoring*);
479: EXTERN PetscErrorCode DMGetMatrix(DM, MatType,Mat*);
480: EXTERN PetscErrorCode DMGetInterpolation(DM,DM,Mat*,Vec*);
481: EXTERN PetscErrorCode DMGetInjection(DM,DM,VecScatter*);
482: EXTERN PetscErrorCode DMRefine(DM,MPI_Comm,DM*);
483: EXTERN PetscErrorCode DMCoarsen(DM,MPI_Comm,DM*);
484: EXTERN PetscErrorCode DMRefineHierarchy(DM,PetscInt,DM**);
485: EXTERN PetscErrorCode DMCoarsenHierarchy(DM,PetscInt,DM**);
486: EXTERN PetscErrorCode DMGetInterpolationScale(DM,DM,Mat,Vec*);
488: typedef struct NLF_DAAD* NLF;
490: #include <petscbag.h>
492: EXTERN PetscErrorCode PetscViewerBinaryMatlabOpen(MPI_Comm, const char [], PetscViewer*);
493: EXTERN PetscErrorCode PetscViewerBinaryMatlabDestroy(PetscViewer);
494: EXTERN PetscErrorCode PetscViewerBinaryMatlabOutputBag(PetscViewer, const char [], PetscBag);
495: EXTERN PetscErrorCode PetscViewerBinaryMatlabOutputVec(PetscViewer, const char [], Vec);
496: EXTERN PetscErrorCode PetscViewerBinaryMatlabOutputVecDA(PetscViewer, const char [], Vec, DA);
499: #endif