00001 /* File: fem_lock.h 00002 * Authors: Nilesh Choudhury 00003 * 00004 */ 00005 00006 #ifndef __CHARM_FEM_BLOCK_H 00007 #define __CHARM_FEM_BLOCK_H 00008 00009 #include "charm-api.h" 00010 #include "ckvector3d.h" 00011 #include "fem.h" 00012 #include "fem_mesh.h" 00013 00014 #define _LOCKCHUNKS 00015 00016 class femMeshModify; 00017 00018 //there is one fem_lock associated with every FEM_Mesh. 00019 class FEM_lock { 00020 int idx; 00021 int owner; 00022 bool isOwner; 00023 bool isLocked; 00024 bool hasLocks; 00025 bool isLocking; 00026 bool isUnlocking; 00027 CkVec<int> lockedChunks; 00028 femMeshModify *mmod; 00029 00030 private: 00031 bool existsChunk(int index); 00032 00033 public: 00034 FEM_lock() {}; 00035 FEM_lock(int i, femMeshModify *m); 00036 ~FEM_lock(); 00037 00038 //locks all chunks which contain all the nodes and elements that are passed 00039 //in this function 00040 //locking of the chunks is blocking and is strictly in ascending order. 00041 int lock(int numNodes, int *nodes, int numElems, int* elems, int elemType=0); 00042 //unlock all the concerned chunks. 00043 //since at one point of time one chunk can only lock one set of chunks for 00044 //one operation, one does not need to pass arguments to unlock. 00045 int unlock(); 00046 int lock(int chunkNo, int own); 00047 int unlock(int chunkNo, int own); 00048 int getIdx() { return idx; } 00049 }; 00050 00051 #endif