00001 // Reference class for PMAF3D Framework 00002 // Created by: Terry L. Wilmarth 00003 #ifndef REF_H 00004 #define REF_H 00005 #include "charm.h" 00006 00007 class node; 00008 00009 class objRef { // a reference to a piece of data that may be remotely located 00010 public: 00011 int cid, idx; 00012 objRef() { cid = -1; idx = -1; } 00013 objRef(int chunkId, int objIdx) { cid = chunkId; idx = objIdx; } 00014 void set(int chunkId, int objIdx) { cid = chunkId; idx = objIdx; } 00015 void reset() { cid = -1; idx = -1; } 00016 bool operator==(const objRef& o) const { return((cid == o.cid) && (idx == o.idx)); } 00017 bool operator>(const objRef& o) const { return((idx > o.idx) || 00018 ((idx == o.idx) && (cid > o.cid))); } 00019 bool operator<(const objRef& o) const { return((idx < o.idx) || 00020 ((idx == o.idx) && (cid < o.cid))); } 00021 objRef& operator=(const objRef& o) { cid=o.cid; idx=o.idx; return *this; } 00022 void pup(PUP::er &p) { p|cid; p|idx; } 00023 }; 00024 00025 class node; 00026 00027 class nodeRef : public objRef { 00028 public: 00029 nodeRef() { cid = -1; idx = -1; } 00030 nodeRef(int chunkId, int objIdx) { cid = chunkId; idx = objIdx; } 00031 node get(); 00032 void update(node& m); 00033 void pup(PUP::er &p) { p|cid; p|idx; } 00034 }; 00035 00036 class elemRef : public objRef { 00037 public: 00038 elemRef() { cid = -1; idx = -1; } 00039 elemRef(int chunkId, int objIdx) { cid = chunkId; idx = objIdx; } 00040 double getVolume(); 00041 void setTargetVolume(double ta); 00042 void resetTargetVolume(double ta); 00043 void pup(PUP::er &p) { p|cid; p|idx; } 00044 }; 00045 00046 #endif