LRTS Comm Thread Tracing in message recieve
[charm.git] / src / libs / ck-libs / TMRC2D / ref.h
blob17197c2bdcec77fc971f7b8a682eab329e5f2984
1 #ifndef REF_H
2 #define REF_H
3 #include <charm++.h>
4 #include "charm-api.h"
5 #include "ckvector3d.h"
6 #include "pup_mpi.h"
7 #include "tcharm.h"
8 #include "fem.h"
9 #include "fem_mesh.h"
11 //#define FLIPTEST
12 //#define FLIPPREVENT
14 class objRef { // a reference to a piece of data that may be remotely located
15 public:
16 int cid, idx;
17 objRef() { cid = -1; idx = -1; }
18 objRef(int chunkId, int objIdx) { cid = chunkId; idx = objIdx; }
19 void set(int chunkId, int objIdx) { cid = chunkId; idx = objIdx; }
20 void reset() { cid = -1; idx = -1; }
21 void pup(PUP::er &p) { p(cid); p(idx); }
22 int isNull() { return ((cid == -1) && (idx == -1)); }
23 bool operator==(const objRef& o) const {
24 return((cid == o.cid) && (idx == o.idx)); }
25 bool operator>(const objRef& o) const {
26 return((idx > o.idx) || ((idx == o.idx) && (cid > o.cid))); }
27 bool operator<(const objRef& o) const {
28 return((idx < o.idx) || ((idx == o.idx) && (cid < o.cid))); }
29 objRef& operator=(const objRef& o) { cid=o.cid; idx=o.idx; return *this; }
30 void sanityCheck() { CkAssert((cid >= -1) && (idx >= -1)); }
33 class node;
34 class elemRef;
35 class edgeRef : public objRef {
36 public:
37 edgeRef() { }
38 edgeRef(int chunkId, int objIdx) { cid = chunkId; idx = objIdx; }
39 void update(elemRef& oldval, elemRef& newval, int b);
40 elemRef getNbr(elemRef m);
41 void remove();
42 int split(int *m, edgeRef *e_prime, int oIdx, int fIdx,
43 elemRef requester, int *local, int *first, int *nullNbr);
44 void collapse(elemRef requester, int kIdx, int dIdx, elemRef kNbr,
45 elemRef dNbr, edgeRef kEdge, edgeRef dEdge, node newN,
46 double frac);
47 int flipPrevent(elemRef requester, int kIdx, int dIdx, elemRef kNbr,
48 elemRef dNbr, edgeRef kEdge, edgeRef dEdge, node newN);
49 void resetEdge();
50 int isPending(elemRef e);
51 int getBoundary();
52 void checkPending(elemRef e);
53 void checkPending(elemRef e, elemRef ne);
56 class elemRef : public objRef {
57 public:
58 elemRef() { }
59 elemRef(int chunkId, int objIdx) { cid = chunkId; idx = objIdx; }
60 void update(edgeRef& oldval, edgeRef& newval);
61 double getArea();
62 void setTargetArea(double ta);
63 void resetTargetArea(double ta);
64 void remove();
65 //void collapseHelp(edgeRef er, nodeRef nr1, nodeRef nr2);
68 static elemRef nullRef(-1,-1);
70 #endif