00001 // Reference class for PMAF3D Framework 00002 // Created by: Terry L. Wilmarth 00003 #include "ref.h" 00004 #include "node.h" 00005 #include "PMAF.decl.h" 00006 #include "messages.h" 00007 00008 extern CProxy_chunk mesh; 00009 00010 // nodeRef methods 00011 node nodeRef::get() 00012 { 00013 node n; 00014 nodeMsg *nm; 00015 nm = mesh[cid].getNode(idx); 00016 n.set(nm->coord[0], nm->coord[1], nm->coord[2]); 00017 CkFreeMsg(nm); 00018 return n; 00019 } 00020 00021 void nodeRef::update(node& m) 00022 { 00023 nodeMsg *nm = new nodeMsg; 00024 nm->idx = idx; 00025 nm->coord[0] = m.getCoord(0); 00026 nm->coord[1] = m.getCoord(1); 00027 nm->coord[2] = m.getCoord(2); 00028 mesh[cid].updateNodeCoord(nm); 00029 } 00030 00031 // elemRef methods 00032 double elemRef::getVolume() 00033 { 00034 doubleMsg *dm; 00035 double result; 00036 if (idx > 100000) 00037 CkPrintf("---------------> idx is %d before getVolume!\n", idx); 00038 intMsg *im = new intMsg; 00039 im->anInt = idx; 00040 dm = mesh[cid].getVolume(im); 00041 result = dm->aDouble; 00042 CkFreeMsg(dm); 00043 return result; 00044 } 00045 00046 void elemRef::setTargetVolume(double ta) 00047 { 00048 doubleMsg *dm = new doubleMsg; 00049 dm->idx = idx; 00050 dm->aDouble = ta; 00051 mesh[cid].setTargetVolume(dm); 00052 } 00053 00054 void elemRef::resetTargetVolume(double ta) 00055 { 00056 doubleMsg *dm = new doubleMsg; 00057 dm->idx = idx; 00058 dm->aDouble = ta; 00059 mesh[cid].resetTargetVolume(dm); 00060 }