5 #include "ckvector3d.h"
14 class objRef
{ // a reference to a piece of data that may be remotely located
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)); }
35 class edgeRef
: public objRef
{
38 edgeRef(int chunkId
, int objIdx
) { cid
= chunkId
; idx
= objIdx
; }
39 void update(elemRef
& oldval
, elemRef
& newval
, int b
);
40 elemRef
getNbr(elemRef m
);
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
,
47 int flipPrevent(elemRef requester
, int kIdx
, int dIdx
, elemRef kNbr
,
48 elemRef dNbr
, edgeRef kEdge
, edgeRef dEdge
, node newN
);
50 int isPending(elemRef e
);
52 void checkPending(elemRef e
);
53 void checkPending(elemRef e
, elemRef ne
);
56 class elemRef
: public objRef
{
59 elemRef(int chunkId
, int objIdx
) { cid
= chunkId
; idx
= objIdx
; }
60 void update(edgeRef
& oldval
, edgeRef
& newval
);
62 void setTargetArea(double ta
);
63 void resetTargetArea(double ta
);
65 //void collapseHelp(edgeRef er, nodeRef nr1, nodeRef nr2);
68 static elemRef
nullRef(-1,-1);