Actual source code: petscvec.h

  1: /* 
  2:     Defines the vector component of PETSc. Vectors generally represent 
  3:   degrees of freedom for finite element/finite difference functions
  4:   on a grid. They have more mathematical structure then simple arrays.
  5: */

  7: #ifndef __PETSCVEC_H 
 9:  #include petscis.h
 10:  #include petscsys.h

 13: /*S
 14:      PetscMap - Abstract PETSc object that defines the layout of vector and
 15:   matrices across processors

 17:    Level: advanced

 19:    Notes:
 20:     Does not play a role in the PETSc design, can be ignored

 22:   Concepts: parallel decomposition

 24: .seealso:  PetscMapCreateMPI()
 25: S*/
 26: typedef struct _p_PetscMap*         PetscMap;

 28: #define MAP_SEQ "seq"
 29: #define MAP_MPI "mpi"
 30: #define PetscMapType char*

 32: /* Logging support */

 35: EXTERN PetscErrorCode PetscMapCreate(MPI_Comm,PetscMap*);
 36: EXTERN PetscErrorCode PetscMapCreateMPI(MPI_Comm,PetscInt,PetscInt,PetscMap*);
 37: EXTERN PetscErrorCode PetscMapSetFromOptions(PetscMap);
 38: EXTERN PetscErrorCode PetscMapPrintHelp(PetscMap);
 39: EXTERN PetscErrorCode PetscMapDestroy(PetscMap);

 41: EXTERN PetscErrorCode PetscMapSetLocalSize(PetscMap,PetscInt);
 42: EXTERN PetscErrorCode PetscMapGetLocalSize(PetscMap,PetscInt *);
 43: EXTERN PetscErrorCode PetscMapSetSize(PetscMap,PetscInt);
 44: EXTERN PetscErrorCode PetscMapGetSize(PetscMap,PetscInt *);
 45: EXTERN PetscErrorCode PetscMapGetLocalRange(PetscMap,PetscInt *,PetscInt *);
 46: EXTERN PetscErrorCode PetscMapGetGlobalRange(PetscMap,PetscInt *[]);

 48: /* Dynamic creation and loading functions */
 51: EXTERN PetscErrorCode PetscMapSetType(PetscMap, const PetscMapType);
 52: EXTERN PetscErrorCode PetscMapGetType(PetscMap, PetscMapType *);
 53: EXTERN PetscErrorCode PetscMapRegister(const char[],const char[],const char[],PetscErrorCode (*)(PetscMap));
 54: EXTERN PetscErrorCode PetscMapRegisterAll(const char []);
 55: EXTERN PetscErrorCode PetscMapRegisterDestroy(void);
 56: #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
 57: #define PetscMapRegisterDynamic(a,b,c,d) PetscMapRegister(a,b,c,0)
 58: #else
 59: #define PetscMapRegisterDynamic(a,b,c,d) PetscMapRegister(a,b,c,d)
 60: #endif

 62: /*S
 63:      Vec - Abstract PETSc vector object

 65:    Level: beginner

 67:   Concepts: field variables, unknowns, arrays

 69: .seealso:  VecCreate(), VecType, VecSetType()
 70: S*/
 71: typedef struct _p_Vec*         Vec;

 73: /*S
 74:      VecScatter - Object used to manage communication of data
 75:        between vectors in parallel. Manages both scatters and gathers

 77:    Level: beginner

 79:   Concepts: scatter

 81: .seealso:  VecScatterCreate(), VecScatterBegin(), VecScatterEnd()
 82: S*/
 83: typedef struct _p_VecScatter*  VecScatter;

 85: /*E
 86:     VecType - String with the name of a PETSc vector or the creation function
 87:        with an optional dynamic library name, for example
 88:        http://www.mcs.anl.gov/petsc/lib.a:myveccreate()

 90:    Level: beginner

 92: .seealso: VecSetType(), Vec
 93: E*/
 94: #define VECSEQ         "seq"
 95: #define VECMPI         "mpi"
 96: #define VECFETI        "feti"
 97: #define VECSHARED      "shared"
 98: #define VecType char*

100: /* Logging support */
101: #define    VEC_FILE_COOKIE 1211214

109: EXTERN PetscErrorCode VecInitializePackage(char *);

111: EXTERN PetscErrorCode VecCreate(MPI_Comm,Vec *);
112: EXTERN PetscErrorCode VecCreateSeq(MPI_Comm,PetscInt,Vec*);
113: EXTERN PetscErrorCode VecCreateMPI(MPI_Comm,PetscInt,PetscInt,Vec*);
114: EXTERN PetscErrorCode VecCreateSeqWithArray(MPI_Comm,PetscInt,const PetscScalar[],Vec*);
115: EXTERN PetscErrorCode VecCreateMPIWithArray(MPI_Comm,PetscInt,PetscInt,const PetscScalar[],Vec*);
116: EXTERN PetscErrorCode VecCreateShared(MPI_Comm,PetscInt,PetscInt,Vec*);
117: EXTERN PetscErrorCode VecSetFromOptions(Vec);
118: EXTERN PetscErrorCode VecPrintHelp(Vec);
119: EXTERN PetscErrorCode VecDestroy(Vec);

121: EXTERN PetscErrorCode VecSetSizes(Vec,PetscInt,PetscInt);

123: EXTERN PetscErrorCode VecDot(Vec,Vec,PetscScalar*);
124: EXTERN PetscErrorCode VecTDot(Vec,Vec,PetscScalar*);
125: EXTERN PetscErrorCode VecMDot(PetscInt,Vec,const Vec[],PetscScalar*);
126: EXTERN PetscErrorCode VecMTDot(PetscInt,Vec,const Vec[],PetscScalar*);

128: /*E
129:     NormType - determines what type of norm to compute

131:     Level: beginner

133: .seealso: VecNorm(), VecNormBegin(), VecNormEnd(), MatNorm()
134: E*/
135: typedef enum {NORM_1=1,NORM_2=2,NORM_FROBENIUS=3,NORM_INFINITY=4,NORM_1_AND_2=5} NormType;
136: #define NORM_MAX NORM_INFINITY

138: /*MC
139:      NORM_1 - the one norm, ||v|| = sum_i | v_i |. ||A|| = max_j || v_*j ||, maximum column sum

141:    Level: beginner

143: .seealso:  NormType, MatNorm(), VecNorm(), VecNormBegin(), VecNormEnd(), NORM_2, NORM_FROBENIUS, 
144:            NORM_INFINITY, NORM_1_AND_2

146: M*/

148: /*MC
149:      NORM_2 - the two norm, ||v|| = sqrt(sum_i (v_i)^2) (vectors only)

151:    Level: beginner

153: .seealso:  NormType, MatNorm(), VecNorm(), VecNormBegin(), VecNormEnd(), NORM_1, NORM_FROBENIUS, 
154:            NORM_INFINITY, NORM_1_AND_2

156: M*/

158: /*MC
159:      NORM_FROBENIUS - ||A|| = sqrt(sum_ij (A_ij)^2), same as NORM_2 for vectors

161:    Level: beginner

163: .seealso:  NormType, MatNorm(), VecNorm(), VecNormBegin(), VecNormEnd(), NORM_1, NORM_2, 
164:            NORM_INFINITY, NORM_1_AND_2

166: M*/

168: /*MC
169:      NORM_INFINITY - ||v|| = max_i |v_i|. ||A|| = max_i || v_i* ||, maximum row sum

171:    Level: beginner

173: .seealso:  NormType, MatNorm(), VecNorm(), VecNormBegin(), VecNormEnd(), NORM_1, NORM_2, 
174:            NORM_FROBINIUS, NORM_1_AND_2

176: M*/

178: /*MC
179:      NORM_1_AND_2 - computes both the 1 and 2 norm of a vector

181:    Level: beginner

183: .seealso:  NormType, MatNorm(), VecNorm(), VecNormBegin(), VecNormEnd(), NORM_1, NORM_2, 
184:            NORM_FROBINIUS, NORM_INFINITY

186: M*/

188: /*MC
189:      NORM_MAX - see NORM_INFINITY

191:    Level: beginner

193: M*/

195: EXTERN PetscErrorCode VecNorm(Vec,NormType,PetscReal *);
196: EXTERN PetscErrorCode VecNormComposedDataID(NormType,PetscInt*);
197: EXTERN PetscErrorCode VecNormalize(Vec,PetscReal *);
198: EXTERN PetscErrorCode VecSum(Vec,PetscScalar*);
199: EXTERN PetscErrorCode VecMax(Vec,PetscInt*,PetscReal *);
200: EXTERN PetscErrorCode VecMin(Vec,PetscInt*,PetscReal *);
201: EXTERN PetscErrorCode VecScale(const PetscScalar *a,Vec v);
202: EXTERN PetscErrorCode VecCopy(Vec,Vec);
203: EXTERN PetscErrorCode VecSetRandom(PetscRandom,Vec);
204: EXTERN PetscErrorCode VecSet(const PetscScalar*,Vec);
205: EXTERN PetscErrorCode VecSwap(Vec,Vec);
206: EXTERN PetscErrorCode VecAXPY(const PetscScalar*,Vec,Vec);
207: EXTERN PetscErrorCode VecAXPBY(const PetscScalar*,const PetscScalar *,Vec,Vec);
208: EXTERN PetscErrorCode VecMAXPY(PetscInt,const PetscScalar*,Vec,Vec*);
209: EXTERN PetscErrorCode VecAYPX(const PetscScalar*,Vec,Vec);
210: EXTERN PetscErrorCode VecWAXPY(const PetscScalar*,Vec,Vec,Vec);
211: EXTERN PetscErrorCode VecPointwiseMult(Vec,Vec,Vec);
212: EXTERN PetscErrorCode VecPointwiseDivide(Vec,Vec,Vec);
213: EXTERN PetscErrorCode VecMaxPointwiseDivide(Vec,Vec,PetscReal*);
214: EXTERN PetscErrorCode VecShift(const PetscScalar*,Vec);
215: EXTERN PetscErrorCode VecReciprocal(Vec);
216: EXTERN PetscErrorCode VecPermute(Vec, IS, PetscTruth);
217: EXTERN PetscErrorCode VecSqrt(Vec);
218: EXTERN PetscErrorCode VecAbs(Vec);
219: EXTERN PetscErrorCode VecDuplicate(Vec,Vec*);
220: EXTERN PetscErrorCode VecDuplicateVecs(Vec,PetscInt,Vec*[]);
221: EXTERN PetscErrorCode VecDestroyVecs(Vec[],PetscInt);
222: EXTERN PetscErrorCode VecGetPetscMap(Vec,PetscMap*);

224: EXTERN PetscErrorCode VecStrideNormAll(Vec,NormType,PetscReal*);
225: EXTERN PetscErrorCode VecStrideMaxAll(Vec,PetscInt *,PetscReal *);
226: EXTERN PetscErrorCode VecStrideMinAll(Vec,PetscInt *,PetscReal *);
227: EXTERN PetscErrorCode VecStrideScaleAll(Vec,PetscScalar*);

229: EXTERN PetscErrorCode VecStrideNorm(Vec,PetscInt,NormType,PetscReal*);
230: EXTERN PetscErrorCode VecStrideMax(Vec,PetscInt,PetscInt *,PetscReal *);
231: EXTERN PetscErrorCode VecStrideMin(Vec,PetscInt,PetscInt *,PetscReal *);
232: EXTERN PetscErrorCode VecStrideScale(Vec,PetscInt,PetscScalar*);
233: EXTERN PetscErrorCode VecStrideGather(Vec,PetscInt,Vec,InsertMode);
234: EXTERN PetscErrorCode VecStrideScatter(Vec,PetscInt,Vec,InsertMode);
235: EXTERN PetscErrorCode VecStrideGatherAll(Vec,Vec*,InsertMode);
236: EXTERN PetscErrorCode VecStrideScatterAll(Vec*,Vec,InsertMode);

238: EXTERN PetscErrorCode VecSetValues(Vec,PetscInt,const PetscInt[],const PetscScalar[],InsertMode);
239: EXTERN PetscErrorCode VecAssemblyBegin(Vec);
240: EXTERN PetscErrorCode VecAssemblyEnd(Vec);
241: EXTERN PetscErrorCode VecStashSetInitialSize(Vec,PetscInt,PetscInt);
242: EXTERN PetscErrorCode VecStashView(Vec,PetscViewer);
243: EXTERN PetscErrorCode VecStashGetInfo(Vec,PetscInt*,PetscInt*,PetscInt*,PetscInt*);

247: /*MC
248:    VecSetValue - Set a single entry into a vector.

250:    Synopsis:
251:    PetscErrorCode VecSetValue(Vec v,int row,PetscScalar value, InsertMode mode);

253:    Not Collective

255:    Input Parameters:
256: +  v - the vector
257: .  row - the row location of the entry
258: .  value - the value to insert
259: -  mode - either INSERT_VALUES or ADD_VALUES

261:    Notes:
262:    For efficiency one should use VecSetValues() and set several or 
263:    many values simultaneously if possible.

265:    These values may be cached, so VecAssemblyBegin() and VecAssemblyEnd() 
266:    MUST be called after all calls to VecSetValues() have been completed.

268:    VecSetValues() uses 0-based indices in Fortran as well as in C.

270:    Level: beginner

272: .seealso: VecSetValues(), VecAssemblyBegin(), VecAssemblyEnd(), VecSetValuesBlockedLocal(), VecSetValueLocal()
273: M*/
274: #define VecSetValue(v,i,va,mode) (VecSetValue_Row = i, VecSetValue_Value = va, VecSetValues(v,1,&VecSetValue_Row,&VecSetValue_Value,mode))

276: /*MC
277:    VecSetValueLocal - Set a single entry into a vector using the local numbering

279:    Synopsis:
280:    PetscErrorCode VecSetValueLocal(Vec v,int row,PetscScalar value, InsertMode mode);

282:    Not Collective

284:    Input Parameters:
285: +  v - the vector
286: .  row - the row location of the entry
287: .  value - the value to insert
288: -  mode - either INSERT_VALUES or ADD_VALUES

290:    Notes:
291:    For efficiency one should use VecSetValues() and set several or 
292:    many values simultaneously if possible.

294:    These values may be cached, so VecAssemblyBegin() and VecAssemblyEnd() 
295:    MUST be called after all calls to VecSetValues() have been completed.

297:    VecSetValues() uses 0-based indices in Fortran as well as in C.

299:    Level: beginner

301: .seealso: VecSetValues(), VecAssemblyBegin(), VecAssemblyEnd(), VecSetValuesBlockedLocal(), VecSetValue()
302: M*/
303: #define VecSetValueLocal(v,i,va,mode) (VecSetValue_Row = i,VecSetValue_Value = va,VecSetValuesLocal(v,1,&VecSetValue_Row,&VecSetValue_Value,mode))

305: EXTERN PetscErrorCode VecSetBlockSize(Vec,PetscInt);
306: EXTERN PetscErrorCode VecGetBlockSize(Vec,PetscInt*);
307: EXTERN PetscErrorCode VecSetValuesBlocked(Vec,PetscInt,const PetscInt[],const PetscScalar[],InsertMode);

309: /* Dynamic creation and loading functions */
312: EXTERN PetscErrorCode VecSetType(Vec, const VecType);
313: EXTERN PetscErrorCode VecGetType(Vec, VecType *);
314: EXTERN PetscErrorCode VecRegister(const char[],const char[],const char[],PetscErrorCode (*)(Vec));
315: EXTERN PetscErrorCode VecRegisterAll(const char []);
316: EXTERN PetscErrorCode VecRegisterDestroy(void);

318: /*MC
319:   VecRegisterDynamic - Adds a new vector component implementation

321:   Synopsis:
322:   PetscErrorCode VecRegisterDynamic(char *name, char *path, char *func_name, PetscErrorCode (*create_func)(Vec))

324:   Not Collective

326:   Input Parameters:
327: + name        - The name of a new user-defined creation routine
328: . path        - The path (either absolute or relative) of the library containing this routine
329: . func_name   - The name of routine to create method context
330: - create_func - The creation routine itself

332:   Notes:
333:   VecRegisterDynamic() may be called multiple times to add several user-defined vectors

335:   If dynamic libraries are used, then the fourth input argument (routine_create) is ignored.

337:   Sample usage:
338: .vb
339:     VecRegisterDynamic("my_vec","/home/username/my_lib/lib/libO/solaris/libmy.a", "MyVectorCreate", MyVectorCreate);
340: .ve

342:   Then, your vector type can be chosen with the procedural interface via
343: .vb
344:     VecCreate(MPI_Comm, Vec *);
345:     VecSetType(Vec,"my_vector_name");
346: .ve
347:    or at runtime via the option
348: .vb
349:     -vec_type my_vector_name
350: .ve

352:   Notes: $PETSC_ARCH and $BOPT occuring in pathname will be replaced with appropriate values.
353:          If your function is not being put into a shared library then use VecRegister() instead
354:         
355:   Level: advanced

357: .keywords: Vec, register
358: .seealso: VecRegisterAll(), VecRegisterDestroy(), VecRegister()
359: M*/
360: #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
361: #define VecRegisterDynamic(a,b,c,d) VecRegister(a,b,c,0)
362: #else
363: #define VecRegisterDynamic(a,b,c,d) VecRegister(a,b,c,d)
364: #endif


367: EXTERN PetscErrorCode VecScatterCreate(Vec,IS,Vec,IS,VecScatter *);
368: EXTERN PetscErrorCode VecScatterPostRecvs(Vec,Vec,InsertMode,ScatterMode,VecScatter);
369: EXTERN PetscErrorCode VecScatterBegin(Vec,Vec,InsertMode,ScatterMode,VecScatter);
370: EXTERN PetscErrorCode VecScatterEnd(Vec,Vec,InsertMode,ScatterMode,VecScatter);
371: EXTERN PetscErrorCode VecScatterDestroy(VecScatter);
372: EXTERN PetscErrorCode VecScatterCopy(VecScatter,VecScatter *);
373: EXTERN PetscErrorCode VecScatterView(VecScatter,PetscViewer);
374: EXTERN PetscErrorCode VecScatterRemap(VecScatter,PetscInt *,PetscInt*);

376: EXTERN PetscErrorCode VecGetArray_Private(Vec,PetscScalar*[]);
377: EXTERN PetscErrorCode VecRestoreArray_Private(Vec,PetscScalar*[]);
378: EXTERN PetscErrorCode VecGetArray4d(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar****[]);
379: EXTERN PetscErrorCode VecRestoreArray4d(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar****[]);
380: EXTERN PetscErrorCode VecGetArray3d(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar***[]);
381: EXTERN PetscErrorCode VecRestoreArray3d(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar***[]);
382: EXTERN PetscErrorCode VecGetArray2d(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar**[]);
383: EXTERN PetscErrorCode VecRestoreArray2d(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar**[]);
384: EXTERN PetscErrorCode VecGetArray1d(Vec,PetscInt,PetscInt,PetscScalar *[]);
385: EXTERN PetscErrorCode VecRestoreArray1d(Vec,PetscInt,PetscInt,PetscScalar *[]);

387: EXTERN PetscErrorCode VecPlaceArray(Vec,const PetscScalar[]);
388: EXTERN PetscErrorCode VecResetArray(Vec);
389: EXTERN PetscErrorCode VecReplaceArray(Vec,const PetscScalar[]);
390: EXTERN PetscErrorCode VecGetArrays(const Vec[],PetscInt,PetscScalar**[]);
391: EXTERN PetscErrorCode VecRestoreArrays(const Vec[],PetscInt,PetscScalar**[]);

393: EXTERN PetscErrorCode VecValid(Vec,PetscTruth*);
394: EXTERN PetscErrorCode VecView(Vec,PetscViewer);
395: EXTERN PetscErrorCode VecViewFromOptions(Vec, char *);
396: EXTERN PetscErrorCode VecEqual(Vec,Vec,PetscTruth*);
397: EXTERN PetscErrorCode VecLoad(PetscViewer,const VecType,Vec*);
398: EXTERN PetscErrorCode VecLoadIntoVector(PetscViewer,Vec);

400: EXTERN PetscErrorCode VecGetSize(Vec,PetscInt*);
401: EXTERN PetscErrorCode VecGetLocalSize(Vec,PetscInt*);
402: EXTERN PetscErrorCode VecGetOwnershipRange(Vec,PetscInt*,PetscInt*);

404: EXTERN PetscErrorCode VecSetLocalToGlobalMapping(Vec,ISLocalToGlobalMapping);
405: EXTERN PetscErrorCode VecSetValuesLocal(Vec,PetscInt,const PetscInt[],const PetscScalar[],InsertMode);
406: EXTERN PetscErrorCode VecSetLocalToGlobalMappingBlock(Vec,ISLocalToGlobalMapping);
407: EXTERN PetscErrorCode VecSetValuesBlockedLocal(Vec,PetscInt,const PetscInt[],const PetscScalar[],InsertMode);

409: EXTERN PetscErrorCode VecDotBegin(Vec,Vec,PetscScalar *);
410: EXTERN PetscErrorCode VecDotEnd(Vec,Vec,PetscScalar *);
411: EXTERN PetscErrorCode VecTDotBegin(Vec,Vec,PetscScalar *);
412: EXTERN PetscErrorCode VecTDotEnd(Vec,Vec,PetscScalar *);
413: EXTERN PetscErrorCode VecNormBegin(Vec,NormType,PetscReal *);
414: EXTERN PetscErrorCode VecNormEnd(Vec,NormType,PetscReal *);

416: typedef enum {VEC_IGNORE_OFF_PROC_ENTRIES,VEC_TREAT_OFF_PROC_ENTRIES} VecOption;
417: EXTERN PetscErrorCode VecSetOption(Vec,VecOption);

419: /*
420:    Expose VecGetArray()/VecRestoreArray() to users. Allows this to work without any function
421:    call overhead on any 'native' Vecs.
422: */
423:  #include vecimpl.h

425: EXTERN PetscErrorCode VecContourScale(Vec,PetscReal,PetscReal);

427: /*
428:     These numbers need to match the entries in 
429:   the function table in vecimpl.h
430: */
431: typedef enum { VECOP_VIEW = 32,
432:                VECOP_LOADINTOVECTOR = 38
433:              } VecOperation;
434: EXTERN PetscErrorCode VecSetOperation(Vec,VecOperation,void(*)(void));

436: /*
437:      Routines for dealing with ghosted vectors:
438:   vectors with ghost elements at the end of the array.
439: */
440: EXTERN PetscErrorCode VecCreateGhost(MPI_Comm,PetscInt,PetscInt,PetscInt,const PetscInt[],Vec*);
441: EXTERN PetscErrorCode VecCreateGhostWithArray(MPI_Comm,PetscInt,PetscInt,PetscInt,const PetscInt[],const PetscScalar[],Vec*);
442: EXTERN PetscErrorCode VecCreateGhostBlock(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],Vec*);
443: EXTERN PetscErrorCode VecCreateGhostBlockWithArray(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],const PetscScalar[],Vec*);
444: EXTERN PetscErrorCode VecGhostGetLocalForm(Vec,Vec*);
445: EXTERN PetscErrorCode VecGhostRestoreLocalForm(Vec,Vec*);
446: EXTERN PetscErrorCode VecGhostUpdateBegin(Vec,InsertMode,ScatterMode);
447: EXTERN PetscErrorCode VecGhostUpdateEnd(Vec,InsertMode,ScatterMode);

449: EXTERN PetscErrorCode VecConjugate(Vec);

451: EXTERN PetscErrorCode VecScatterCreateToAll(Vec,VecScatter*,Vec*);
452: EXTERN PetscErrorCode VecScatterCreateToZero(Vec,VecScatter*,Vec*);

454: EXTERN PetscErrorCode PetscViewerMathematicaGetVector(PetscViewer, Vec);
455: EXTERN PetscErrorCode PetscViewerMathematicaPutVector(PetscViewer, Vec);

457: /*S
458:      Vecs - Collection of vectors where the data for the vectors is stored in 
459:             one continquous memory

461:    Level: advanced

463:    Notes:
464:     Temporary construct for handling multiply right hand side solves

466:     This is faked by storing a single vector that has enough array space for 
467:     n vectors

469:   Concepts: parallel decomposition

471: S*/
472:         struct _p_Vecs  {PetscInt n; Vec v;};
473: typedef struct _p_Vecs* Vecs;
474: #define VecsDestroy(x)            (VecDestroy((x)->v)         || PetscFree(x))
475: #define VecsCreateSeq(comm,p,m,x) (PetscNew(struct _p_Vecs,x) || VecCreateSeq(comm,p*m,&(*(x))->v) || (-1 == ((*(x))->n = (m))))
476: #define VecsCreateSeqWithArray(comm,p,m,a,x) (PetscNew(struct _p_Vecs,x) || VecCreateSeqWithArray(comm,p*m,a,&(*(x))->v) || (-1 == ((*(x))->n = (m))))
477: #define VecsDuplicate(x,y)        (PetscNew(struct _p_Vecs,y) || VecDuplicate(x->v,&(*(y))->v) || (-1 == ((*(y))->n = (x)->n)))


481: #endif