Actual source code: dmimpl.h


  3: #if !defined(_DMIMPL_H)
  4: #define _DMIMPL_H

 6:  #include petscda.h

  8: /*  
  9:     Operations shared by all DM implementations
 10: */
 11: #define DMOPS(type)        \
 12:   PetscErrorCode (*view)(type,PetscViewer); \
 13:   PetscErrorCode (*createglobalvector)(type,Vec*);\
 14:   PetscErrorCode (*createlocalvector)(type,Vec*);\
 15: \
 16:   PetscErrorCode (*getcoloring)(type,ISColoringType,ISColoring*);\
 17:   PetscErrorCode (*getmatrix)(type, const MatType,Mat*);\
 18:   PetscErrorCode (*getinterpolation)(type,type,Mat*,Vec*);\
 19:   PetscErrorCode (*getaggregates)(type,type,Mat*);\
 20:   PetscErrorCode (*getinjection)(type,type,VecScatter*);\
 21: \
 22:   PetscErrorCode (*refine)(type,MPI_Comm,type*);\
 23:   PetscErrorCode (*coarsen)(type,MPI_Comm,type*);\
 24:   PetscErrorCode (*refinehierarchy)(type,PetscInt,type**);\
 25:   PetscErrorCode (*coarsenhierarchy)(type,PetscInt,type**);\
 26: \
 27:   PetscErrorCode (*forminitialguess)(type,PetscErrorCode (*)(void),Vec,void*);\
 28:   PetscErrorCode (*formfunction)(type,PetscErrorCode (*)(void),Vec,Vec);\
 29: \
 30:   PetscErrorCode (*globaltolocalbegin)(type,Vec,InsertMode,Vec);                \
 31:   PetscErrorCode (*globaltolocalend)(type,Vec,InsertMode,Vec); \
 32:   PetscErrorCode (*localtoglobal)(type,Vec,InsertMode,Vec); \
 33: \
 34:   PetscErrorCode (*getelements)(type,PetscInt*,const PetscInt*[]);   \
 35:   PetscErrorCode (*restoreelements)(type,PetscInt*,const PetscInt*[]); \
 36: \
 37:   PetscErrorCode (*destroy)(type);


 40: typedef struct _DMOps *DMOps;
 41: struct _DMOps {
 42:   DMOPS(DM)
 43: };

 45: #define DM_MAX_WORK_VECTORS 100 /* work vectors available to users  via DMGetGlobalVector(), DMGetLocalVector() */

 47: #define DMHEADER \
 48:   Vec   localin[DM_MAX_WORK_VECTORS],localout[DM_MAX_WORK_VECTORS];   \
 49:   Vec   globalin[DM_MAX_WORK_VECTORS],globalout[DM_MAX_WORK_VECTORS]; 


 52: struct _p_DM {
 53:   PETSCHEADER(struct _DMOps);
 54:   DMHEADER
 55: };

 57: /*

 59:           Composite Vectors 

 61:       Single global representation
 62:       Individual global representations
 63:       Single local representation
 64:       Individual local representations

 66:       Subsets of individual as a single????? Do we handle this by having DMComposite inside composite??????

 68:        DA da_u, da_v, da_p

 70:        DMComposite dm_velocities

 72:        DMComposite dm

 74:        DACreate(,&da_u);
 75:        DACreate(,&da_v);
 76:        DMCompositeCreate(,&dm_velocities);
 77:        DMCompositeAddDM(dm_velocities,(DM)du);
 78:        DMCompositeAddDM(dm_velocities,(DM)dv);

 80:        DACreate(,&da_p);
 81:        DMCompositeCreate(,&dm_velocities);
 82:        DMCompositeAddDM(dm,(DM)dm_velocities);     
 83:        DMCompositeAddDM(dm,(DM)dm_p);     


 86:     Access parts of composite vectors (DMComposite only)
 87:     ---------------------------------
 88:       DMCompositeGetAccess  - access the global vector as subvectors and array (for redundant arrays)
 89:       ADD for local vector - 

 91:     Element access
 92:     --------------
 93:       From global vectors 
 94:          -DAVecGetArray   - for DA
 95:          -VecGetArray - for Sliced
 96:          ADD for DMComposite???  maybe

 98:       From individual vector
 99:           -DAVecGetArray - for DA
100:           -VecGetArray -for sliced  
101:          ADD for DMComposite??? maybe

103:       From single local vector
104:           ADD         * single local vector as arrays?

106:    Communication 
107:    -------------
108:       DMGlobalToLocal - global vector to single local vector

110:       DMCompositeScatter/Gather - direct to individual local vectors and arrays   CHANGE name closer to GlobalToLocal?

112:    Obtaining vectors
113:    ----------------- 
114:       DMCreateGlobal/Local 
115:       DMGetGlobal/Local 
116:       DMCompositeGetLocalVectors   - gives individual local work vectors and arrays
117:          

119: ?????   individual global vectors   ????

121: */

123: #endif