00001
00002
00003
00004
00005
00024 #ifndef __ParFUM_Mesh_Modify_H
00025 #define __ParFUM_Mesh_Modify_H
00026
00027
00028 #define MAX_CHUNK 1000000000
00029
00031 int FEM_add_node(FEM_Mesh *m, int* adjacent_nodes=0, int num_adjacent_nodes=0, int *chunks=0, int numChunks=0, int forceShared=0);
00033 void FEM_remove_node(FEM_Mesh *m, int node);
00035 int FEM_add_element(FEM_Mesh *m, int* conn, int conn_size, int elem_type=0, int chunkNo=-1);
00037 int FEM_remove_element(FEM_Mesh *m, int element, int elem_type=0, int permanent=-1, bool aggressive_node_removal=false);
00039 int FEM_purge_element(FEM_Mesh *m, int element, int elem_type=0);
00040
00041
00043 int FEM_add_node_local(FEM_Mesh *m, bool addGhost=false, bool doLocking=true, bool doAdjacencies=true);
00045 void FEM_remove_node_local(FEM_Mesh *m, int node);
00047 int FEM_add_element_local(FEM_Mesh *m, int *conn, int connSize, int elemType, bool addGhost, bool create_adjacencies=1);
00049 void FEM_remove_element_local(FEM_Mesh *m, int element, int etype);
00050 void FEM_update_new_element_e2e(FEM_Mesh *m, int newEl, int elemType);
00051
00053 int FEM_Modify_Lock(FEM_Mesh *m, int* affectedNodes=0, int numAffectedNodes=0, int* affectedElts=0, int numAffectedElts=0, int elemtype=0);
00055 int FEM_Modify_Unlock(FEM_Mesh *m);
00057 int FEM_Modify_LockN(FEM_Mesh *m, int nodeId, int readLock);
00059 int FEM_Modify_UnlockN(FEM_Mesh *m, int nodeId, int readLock);
00061 void FEM_Modify_LockAll(FEM_Mesh*m, int nodeId, bool lockall=true);
00063 void FEM_Modify_LockUpdate(FEM_Mesh*m, int nodeId, bool lockall=true);
00065 void FEM_Modify_correctLockN(FEM_Mesh *m, int nodeId);
00066
00068 void FEM_Mesh_dataP(FEM_Mesh *fem_mesh,int entity,int attr,void *data, int firstItem, int length, int datatype,int width);
00070 void FEM_Mesh_data_layoutP(FEM_Mesh *fem_mesh,int entity,int attr,void *data, int firstItem, int length, IDXL_Layout_t layout);
00072 void FEM_Mesh_data_layoutP(FEM_Mesh *fem_mesh,int entity,int attr,void *data, int firstItem,int length, const IDXL_Layout &layout);
00073
00075 void FEM_Ghost_Essential_attributes(FEM_Mesh *m, int coord_attr, int bc_attr, int nodeid);
00076
00077
00078
00080 class femMeshModMsg : public CMessage_femMeshModMsg {
00081 public:
00082 int numChunks;
00083 int myChunk;
00084
00085 femMeshModMsg() {}
00086
00087 femMeshModMsg(int num, int idx) {
00088 numChunks = num;
00089 myChunk = idx;
00090 }
00091
00092 ~femMeshModMsg() {}
00093 };
00094
00096 class boolMsg : public CMessage_boolMsg {
00097 public:
00098 bool b;
00099
00100 boolMsg(bool bo) {
00101 b = bo;
00102 }
00103
00104 ~boolMsg() {}
00105 };
00106
00108 class intMsg : public CMessage_intMsg {
00109 public:
00110 int i;
00111
00112 intMsg(int n) {
00113 i = n;
00114 }
00115
00116 ~intMsg(){}
00117 };
00118
00120 class int2Msg : public CMessage_int2Msg {
00121 public:
00122 int i, j;
00123
00124 int2Msg(int m, int n) {
00125 i = m;
00126 j = n;
00127 }
00128
00129 ~int2Msg(){}
00130 };
00131
00133 class double2Msg : public CMessage_double2Msg {
00134 public:
00135 double i,j;
00136
00137 double2Msg(double m, double n) {
00138 i = m;
00139 j = n;
00140 }
00141
00142 ~double2Msg() {}
00143 };
00144
00146 class FEMMeshMsg : public CMessage_FEMMeshMsg {
00147 public:
00148 FEM_Mesh *m;
00149 TCharm *t;
00150 int meshid;
00151
00152 FEMMeshMsg(FEM_Mesh *mh, TCharm *t1) {
00153 m = mh;
00154 t = t1;
00155 }
00156 FEMMeshMsg(FEM_Mesh *mh, TCharm *t1,int _meshid) {
00157 m = mh;
00158 t = t1;
00159 meshid = _meshid;
00160 }
00161
00162 ~FEMMeshMsg() {}
00163 };
00164
00166 class addNodeMsg : public CMessage_addNodeMsg {
00167 public:
00168 int chk;
00169 int nBetween;
00170 int *between;
00171 int *chunks;
00172 int numChunks;
00173 int forceShared;
00174
00175 ~addNodeMsg() {
00176 if(between) {
00177
00178
00179 }
00180 }
00181 };
00182
00184 class sharedNodeMsg : public CMessage_sharedNodeMsg {
00185 public:
00186 int chk;
00187 int nBetween;
00188 int *between;
00189
00190 ~sharedNodeMsg() {
00191
00192
00193
00194 }
00195 };
00196
00198 class removeSharedNodeMsg : public CMessage_removeSharedNodeMsg {
00199 public:
00200 int chk;
00201 int index;
00202 };
00203
00205 class addGhostElemMsg : public CMessage_addGhostElemMsg {
00206 public:
00207 int chk;
00208 int elemType;
00209 int *indices;
00210 int *typeOfIndex;
00211 int connSize;
00212
00213 ~addGhostElemMsg() {
00214
00215
00216
00217
00218
00219
00220 }
00221 };
00222
00224 class chunkListMsg : public CMessage_chunkListMsg {
00225 public:
00226 int numChunkList;
00227 int *chunkList;
00228 int *indexList;
00229
00230 ~chunkListMsg() {
00231 if(numChunkList>0) {
00232
00233
00234 }
00235 }
00236 };
00237
00239 class addElemMsg : public CMessage_addElemMsg {
00240 public:
00241 int chk;
00242 int elemtype;
00243 int connSize;
00244 int *conn;
00245 int numGhostIndex;
00246 int *ghostIndices;
00247
00248 ~addElemMsg() {
00249 if(conn) {
00250
00251 }
00252 if(ghostIndices) {
00253
00254 }
00255 }
00256 };
00257
00259 class removeGhostElemMsg : public CMessage_removeGhostElemMsg {
00260 public:
00261 int chk;
00262 int elemtype;
00263 int elementid;
00264 int numGhostIndex;
00265 int numGhostRNIndex;
00266 int numGhostREIndex;
00267 int numSharedIndex;
00268 int *ghostIndices;
00269 int *ghostRNIndices;
00270 int *ghostREIndices;
00271 int *sharedIndices;
00272
00273 ~removeGhostElemMsg() {
00274 if(ghostIndices!=NULL) {
00275
00276
00277
00278
00279 }
00280 }
00281 };
00282
00284 class removeElemMsg : public CMessage_removeElemMsg {
00285 public:
00286 int chk;
00287 int elementid;
00288 int elemtype;
00289 int permanent;
00290 bool aggressive_node_removal;
00291 };
00292
00294 class verifyghostsendMsg : public CMessage_verifyghostsendMsg {
00295 public:
00296 int fromChk;
00297 int sharedIdx;
00298 int numchks;
00299 int *chunks;
00300
00301 verifyghostsendMsg() {
00302 }
00303
00304 ~verifyghostsendMsg() {
00305
00306 }
00307 };
00308
00310 class findgsMsg : public CMessage_findgsMsg {
00311 public:
00312 int numchks;
00313 int *chunks;
00314
00315 ~findgsMsg() {
00316 }
00317 };
00318
00320 class entDataMsg : public CMessage_entDataMsg {
00321 public:
00322 char *data;
00323 int datasize;
00324 int memsize;
00325
00326 entDataMsg(int size, int msize) {
00327 datasize = size;
00328 memsize = msize;
00329 }
00330 };
00331
00333 class updateAttrsMsg : public CMessage_updateAttrsMsg {
00334 public:
00335 char *data;
00336 int datasize;
00337 int fromChk;
00338 int sharedIdx;
00339 bool isnode;
00340 bool isGhost;
00341 int elemType;
00342
00343 updateAttrsMsg(int size) {
00344 datasize = size;
00345 isnode = false;
00346 isGhost = false;
00347 elemType = 0;
00348 }
00349 };
00350
00351
00352
00353
00354 class FEM_Interpolate;
00355
00357
00361 class femMeshModify : public CBase_femMeshModify {
00362 friend class FEM_lock;
00363 friend class FEM_MUtil;
00364 friend class FEM_Mesh;
00365 friend class FEM_Interpolate;
00366 friend class FEM_Adapt;
00367 friend class FEM_AdaptL;
00368 friend class FEM_Adapt_Algs;
00369
00370 public:
00372 int numChunks;
00374 int idx;
00376 TCharm *tc;
00378 CProxy_TCharm tproxy;
00380 FEM_Mesh *fmMesh;
00382 FEM_lock *fmLock;
00384 CkVec<FEM_lockN> fmLockN;
00386
00388 CkVec<bool> fmIdxlLock;
00390
00392 CkVec<int> fmfixedNodes;
00394 FEM_MUtil *fmUtil;
00396 FEM_Interpolate *fmInp;
00398 FEM_Adapt *fmAdapt;
00400 FEM_AdaptL *fmAdaptL;
00402 FEM_Adapt_Algs *fmAdaptAlgs;
00403
00404 public:
00406 femMeshModify(femMeshModMsg *fm);
00408 femMeshModify(CkMigrateMessage *m);
00410 ~femMeshModify();
00411
00413 void pup(PUP::er &p);
00415 void ckJustMigrated(void);
00417 void setPointersAfterMigrate(FEM_Mesh *m);
00418
00420 void setFemMesh(FEMMeshMsg *fm);
00421
00423 intMsg *lockRemoteChunk(int2Msg *i2msg);
00425 intMsg *unlockRemoteChunk(int2Msg *i2msg);
00427 intMsg *lockRemoteNode(int sharedIdx, int fromChk, int isGhost, int readLock);
00429 intMsg *unlockRemoteNode(int sharedIdx, int fromChk, int isGhost, int readLock);
00430
00432 int getNumChunks(){return numChunks;}
00434 int getIdx(){return idx;}
00436 FEM_Mesh *getfmMesh(){return fmMesh;}
00438 FEM_lock *getfmLock(){return fmLock;}
00440 FEM_lockN getfmLockN(int nodeid){
00441
00442
00443
00444
00445
00446 CkAssert(nodeid < fmLockN.size());
00447 return fmLockN[nodeid];
00448 }
00450 FEM_MUtil *getfmUtil(){return fmUtil;}
00452 FEM_Adapt *getfmAdapt(){return fmAdapt;}
00454 FEM_AdaptL *getfmAdaptL(){return fmAdaptL;}
00456 FEM_Adapt_Algs *getfmAdaptAlgs(){return fmAdaptAlgs;}
00458 FEM_Interpolate *getfmInp(){return fmInp;}
00459
00461 chunkListMsg *getChunksSharingGhostNode(int2Msg *);
00462
00464 intMsg *addNodeRemote(addNodeMsg *fm);
00466 void addSharedNodeRemote(sharedNodeMsg *fm);
00468 void removeSharedNodeRemote(removeSharedNodeMsg *fm);
00470 void removeGhostNode(int fromChk, int sharedIdx);
00471
00473 void addGhostElem(addGhostElemMsg *fm);
00475 intMsg *addElementRemote(addElemMsg *fm);
00477 void removeGhostElem(removeGhostElemMsg *fm);
00479 void removeElementRemote(removeElemMsg *fm);
00480
00482 intMsg *eatIntoElement(int fromChk, int sharedIdx);
00483
00485 intMsg *getLockOwner(int fromChk, int sharedIdx);
00487 boolMsg *knowsAbtNode(int fromChk, int toChk, int sharedIdx);
00488
00490 void refine_flip_element_leb(int fromChk, int propElemT, int propNodeT,
00491 int newNodeT, int nbrOpNodeT, int nbrghost,
00492 double longEdgeLen);
00493
00495 void addToSharedList(int fromChk, int sharedIdx);
00497 void updateAttrs(updateAttrsMsg *umsg);
00499 void updateghostsend(verifyghostsendMsg *vmsg);
00501 findgsMsg *findghostsend(int fromChk, int sharedIdx);
00503 intMsg *getIdxGhostSend(int fromChk, int idxshared, int toChk);
00504
00506 double2Msg *getRemoteCoord(int fromChk, int ghostIdx);
00508 intMsg *getRemoteBound(int fromChk, int ghostIdx);
00509
00511 void updateIdxlList(int fromChk, int idxTrans, int transChk);
00513 void removeIDXLRemote(int fromChk, int sharedIdx, int type);
00515 void addTransIDXLRemote(int fromChk, int sharedIdx, int type);
00517 void verifyIdxlList(int fromChk, int size, int type);
00518
00520 void idxllockRemote(int fromChk, int type);
00522 void idxlunlockRemote(int fromChk, int type);
00523
00525 intMsg *hasLockRemoteNode(int sharedIdx, int fromChk, int isGhost);
00527 void modifyLockAll(int fromChk, int sharedIdx);
00529 boolMsg *verifyLock(int fromChk, int sharedIdx, int isGhost);
00531 void verifyghostsend(verifyghostsendMsg *vmsg);
00533 boolMsg *shouldLoseGhost(int fromChk, int sharedIdx, int toChk);
00534
00536 void addghostsendl(int fromChk, int sharedIdx, int toChk, int transIdx);
00538 void addghostsendl1(int fromChk, int transChk, int transIdx);
00540 void addghostsendr(int fromChk, int sharedIdx, int toChk, int transIdx);
00542 void addghostsendr1(int fromChk, int transChk, int transIdx);
00544 boolMsg *willItLose(int fromChk, int sharedIdx);
00545
00547 void interpolateElemCopy(int fromChk, int sharedIdx1, int sharedIdx2);
00549 void cleanupIDXL(int fromChk, int sharedIdx);
00551 void purgeElement(int fromChk, int sharedIdx);
00553 entDataMsg *packEntData(int fromChk, int sharedIdx, bool isnode=false, int elemType=0);
00555 boolMsg *isFixedNodeRemote(int fromChk, int sharedIdx);
00556
00557
00558 void finish1(void);
00559
00560 void finish(void);
00561 };
00562
00563
00564 #endif