00001 /* File: ParFUM_locking.h 00002 * Authors: Nilesh Choudhury 00003 * 00004 */ 00005 00006 #ifndef __PARFUM_LOCKING_H 00007 #define __PARFUM_LOCKING_H 00008 00009 #define _LOCKCHUNKS 00010 00012 class FEM_lock { 00014 int idx; 00016 int owner; 00018 bool isOwner; 00020 bool isLocked; 00022 bool hasLocks; 00024 bool isLocking; 00026 bool isUnlocking; 00028 CkVec<int> lockedChunks; 00030 femMeshModify *mmod; 00031 00032 private: 00034 bool existsChunk(int index); 00035 00036 public: 00038 FEM_lock() {}; 00040 FEM_lock(int i, femMeshModify *m); 00042 FEM_lock(femMeshModify *m); 00044 ~FEM_lock(); 00046 void pup(PUP::er &p); 00047 00049 int getIdx() { return idx; } 00050 00052 int lock(int numNodes, int *nodes, int numElems, int* elems, int elemType=0); 00054 int unlock(); 00056 int lock(int chunkNo, int own); 00058 int unlock(int chunkNo, int own); 00059 }; 00060 00061 00063 class FEM_lockN { 00065 int owner; 00067 int pending; 00069 femMeshModify *theMod; 00071 int idx; 00073 int noreadLocks; 00075 int nowriteLocks; 00076 00077 public: 00079 FEM_lockN() {}; 00081 FEM_lockN(int i,femMeshModify *mod); 00083 FEM_lockN(femMeshModify *mod); 00085 ~FEM_lockN(); 00087 void pup(PUP::er &p); 00089 void setMeshModify(femMeshModify *mod); 00090 00092 int getIdx() { return idx; } 00094 void reset(int i,femMeshModify *mod); 00095 00097 int rlock(); 00099 int runlock(); 00101 int wlock(int own); 00103 int wunlock(int own); 00104 00106 bool haslocks(); 00108 bool verifyLock(void); 00110 int lockOwner(); 00111 }; 00112 00113 // end ParFUM_locking.h 00114 00115 #endif