#include <PatchMgr.h>
Inheritance diagram for PatchMgr:

Public Member Functions | |
| PatchMgr () | |
| ~PatchMgr () | |
| void | createHomePatch (PatchID pid, FullAtomList a) |
| void | preCreateHomePatch (PatchID pid, int atomCnt) |
| void | movePatch (PatchID, NodeID) |
| void | sendMovePatches () |
| void | recvMovePatches (MovePatchesMsg *msg) |
| void | sendAtoms (PatchID pid, FullAtomList a) |
| void | recvAtoms (MovePatchesMsg *msg) |
| HomePatch * | homePatch (PatchID pid) |
| void | sendMigrationMsg (PatchID, MigrationInfo) |
| void | sendMigrationMsgs (PatchID, MigrationInfo *, int) |
| void | recvMigrateAtoms (MigrateAtomsMsg *) |
| void | recvMigrateAtomsCombined (MigrateAtomsCombinedMsg *) |
| void | moveAtom (MoveAtomMsg *msg) |
| void | moveAllBy (MoveAllByMsg *msg) |
| void | setLattice (SetLatticeMsg *msg) |
| void | fillHomePatchAtomList (int patchId, FullAtomList *al) |
| void | setHomePatchFixedAtomNum (int patchId, int numFixed) |
| void | sendOneHomePatch (int patchId, int nodeId) |
Static Public Member Functions | |
| PatchMgr * | Object () |
Friends | |
| class | PatchMap |
|
|
Definition at line 37 of file PatchMgr.C. References iERROR(), iFILE, PatchMap::Instance(), iout, iPE(), and PatchMap::registerPatchMgr(). 00038 {
00039 // CkPrintf("[%d] PatchMgr Created\n", CkMyPe());
00040
00041 // Singleton pattern
00042 if (CpvAccess(PatchMgr_instance) == NULL) {
00043 CpvAccess(PatchMgr_instance) = this;
00044 } else {
00045 iout << iFILE << iERROR << iPE
00046 << "PatchMgr instanced twice on same processor!" << endi;
00047 CkExit();
00048 }
00049
00050 // Get PatchMap singleton started
00051 patchMap = PatchMap::Instance();
00052 patchMap->registerPatchMgr(this);
00053
00054 // Message combining initialization
00055 migrationCountdown = 0;
00056 combineMigrationMsgs = new MigrateAtomsCombinedMsg*[CkNumPes()];
00057 }
|
|
|
Definition at line 59 of file PatchMgr.C. References ResizeArrayIter< T >::begin(), ResizeArrayIter< T >::end(), SortedArray< Elem >::find(), HomePatchListIter, and HomePatchElem::patch. 00060 {
00061 HomePatchListIter hi(homePatches);
00062 for ( hi = hi.begin(); hi != hi.end(); hi++) {
00063 HomePatchElem* elem = homePatches.find(HomePatchElem(hi->pid));
00064 delete elem->patch;
00065 }
00066 delete [] combineMigrationMsgs;
00067 }
|
|
||||||||||||
|
Definition at line 75 of file PatchMgr.C. References FullAtomList, SortedArray< Elem >::load(), and PatchMap::registerPatch(). Referenced by WorkDistrib::createHomePatches(), and recvMovePatches(). 00076 {
00077 HomePatch *patch = new HomePatch(pid, a);
00078 homePatches.load(HomePatchElem(pid, patch));
00079 patchMap->registerPatch(pid, patch);
00080 }
|
|
||||||||||||
|
Definition at line 150 of file PatchMgr.h. References FullAtomList, PatchMap::homePatch(), and HomePatch::setAtomList(). Referenced by WorkDistrib::initAndSendHomePatch(). 00150 {
00151 HomePatch *thisHomePatch = patchMap->homePatch(patchId);
00152 thisHomePatch->setAtomList(al);
00153 }
|
|
|
Definition at line 117 of file PatchMgr.h. References SortedArray< Elem >::find(), and HomePatchElem::patch. Referenced by sendMovePatches(), and sendOneHomePatch(). 00117 {
00118 return homePatches.find(HomePatchElem(pid))->patch;
00119 }
|
|
|
Definition at line 274 of file PatchMgr.C. References Lattice::apply_transform(), HomePatch::atom, ResizeArray< Elem >::begin(), ResizeArray< Elem >::end(), FullAtom::fixedPosition, Patch::getNumAtoms(), Patch::lattice, MoveAllByMsg::offset, HomePatchElem::patch, CompAtom::position, Lattice::reverse_transform(), and FullAtom::transform. 00274 {
00275 // loop over homePatches, moving every atom
00276 for (HomePatchElem *elem = homePatches.begin(); elem != homePatches.end(); elem++) {
00277 HomePatch *hp = elem->patch;
00278 for (int i=0; i<hp->getNumAtoms(); i++) {
00279 FullAtom &a = hp->atom[i];
00280 a.fixedPosition = hp->lattice.reverse_transform(a.position,a.transform);
00281 a.fixedPosition += msg->offset;
00282 a.position = hp->lattice.apply_transform(a.fixedPosition,a.transform);
00283 }
00284 }
00285 delete msg;
00286 }
|
|
|
Definition at line 256 of file PatchMgr.C. References Lattice::apply_transform(), HomePatch::atom, MoveAtomMsg::atomid, MoveAtomMsg::coord, FullAtom::fixedPosition, PatchMap::homePatch(), LocalID::index, Patch::lattice, AtomMap::localID(), MoveAtomMsg::moveto, AtomMap::Object(), LocalID::pid, CompAtom::position, Lattice::reverse_transform(), and FullAtom::transform. 00256 {
00257 LocalID lid = AtomMap::Object()->localID(msg->atomid);
00258 if ( lid.pid != notUsed ) {
00259 HomePatch *hp = patchMap->homePatch(lid.pid);
00260 if ( hp ) {
00261 FullAtom &a = hp->atom[lid.index];
00262 if ( msg->moveto ) {
00263 a.fixedPosition = msg->coord;
00264 } else {
00265 a.fixedPosition = hp->lattice.reverse_transform(a.position,a.transform);
00266 a.fixedPosition += msg->coord;
00267 }
00268 a.position = hp->lattice.apply_transform(a.fixedPosition,a.transform);
00269 }
00270 }
00271 delete msg;
00272 }
|
|
||||||||||||
|
Definition at line 85 of file PatchMgr.C. References SortedArray< Elem >::load(). Referenced by WorkDistrib::distributeHomePatches().
|
|
|
Definition at line 101 of file PatchMgr.h. Referenced by HomePatch::doAtomMigration(). 00101 { return CpvAccess(PatchMgr_instance); }
|
|
||||||||||||
|
Definition at line 69 of file PatchMgr.C. References SortedArray< Elem >::load(), and PatchMap::registerPatch(). Referenced by WorkDistrib::preCreateHomePatches(). 00069 {
00070 HomePatch *patch = new HomePatch(pid, atomCnt);
00071 homePatches.load(HomePatchElem(pid, patch));
00072 patchMap->registerPatch(pid, patch);
00073 }
|
|
|
Definition at line 175 of file PatchMgr.C. References MovePatchesMsg::atom, PatchMap::homePatch(), MovePatchesMsg::pid, and HomePatch::reinitAtoms(). 00175 {
00176 patchMap->homePatch(msg->pid)->reinitAtoms(msg->atom);
00177 delete msg;
00178 }
|
|
|
Definition at line 244 of file PatchMgr.C. References HomePatch::depositMigration(), MigrateAtomsMsg::destPatchID, PatchMap::homePatch(), and PatchMap::Object(). 00244 {
00245 // msg must be deleted by HomePatch::depositMigrationMsg();
00246 PatchMap::Object()->homePatch(msg->destPatchID)->depositMigration(msg);
00247 }
|
|
|
Definition at line 249 of file PatchMgr.C. References DebugM, MigrateAtomsCombinedMsg::distribute(), ResizeArray< Elem >::size(), and MigrateAtomsCombinedMsg::srcPatchID. 00250 {
00251 DebugM(3,"Received MigrateAtomsCombinedMsg with " << msg->srcPatchID.size() << " messages.\n");
00252 msg->distribute();
00253 delete msg;
00254 }
|
|
|
Definition at line 142 of file PatchMgr.C. References MovePatchesMsg::atom, createHomePatch(), and MovePatchesMsg::pid. 00142 {
00143 // Make a new HomePatch
00144 createHomePatch(msg->pid, msg->atom);
00145 delete msg;
00146
00147 // Tell sending PatchMgr we received MovePatchMsg
00148 // AckMovePatchesMsg *ackmsg =
00149 // new AckMovePatchesMsg;
00150 // CSendMsgBranch(PatchMgr,ackMovePatches, ackmsg, thisgroup, msg->fromNodeID);
00151 }
|
|
||||||||||||
|
Definition at line 162 of file PatchMgr.C. References FullAtomList, and PatchMap::node(). Referenced by WorkDistrib::reinitAtoms(). 00162 {
00163
00164 MovePatchesMsg *msg = new MovePatchesMsg(pid, a);
00165
00166 CProxy_PatchMgr cp(thisgroup);
00167 #if CHARM_VERSION > 050402
00168 cp[patchMap->node(pid)].recvAtoms(msg);
00169 #else
00170 cp.recvAtoms(msg, patchMap->node(pid));
00171 #endif
00172
00173 }
|
|
||||||||||||
|
Definition at line 183 of file PatchMgr.C. References MigrationInfo::destNodeID, MigrationInfo::destPatchID, and MigrationInfo::mList. 00183 {
00184 MigrateAtomsMsg *msg = new MigrateAtomsMsg(src,m.destPatchID,m.mList);
00185 CProxy_PatchMgr cp(thisgroup);
00186 #if CHARM_VERSION > 050402
00187 cp[m.destNodeID].recvMigrateAtoms(msg);
00188 #else
00189 cp.recvMigrateAtoms(msg, m.destNodeID);
00190 #endif
00191 }
|
|
||||||||||||||||
|
Definition at line 195 of file PatchMgr.C. References MigrateAtomsCombinedMsg::add(), DebugM, MigrationInfo::destNodeID, and PatchMap::numHomePatches(). Referenced by HomePatch::doAtomMigration(). 00195 {
00196 /*
00197 for (int i=0; i < numMsgs; i++) {
00198 PatchMgr::Object()->sendMigrationMsg(src, m[i]);
00199 }
00200 */
00201 if ( ! migrationCountdown ) // (re)initialize
00202 {
00203 // DebugM(3,"migrationCountdown (re)initialize\n");
00204 numHomePatches = patchMap->numHomePatches();
00205 migrationCountdown = numHomePatches;
00206 int numPes = CkNumPes();
00207 for ( int i = 0; i < numPes; ++i ) combineMigrationMsgs[i] = 0;
00208 }
00209 for (int i=0; i < numMsgs; i++) { // buffer messages
00210 int destNodeID = m[i].destNodeID;
00211 if ( 1 ) // destNodeID != CkMyPe() )
00212 {
00213 if ( ! combineMigrationMsgs[destNodeID] )
00214 {
00215 combineMigrationMsgs[destNodeID] = new MigrateAtomsCombinedMsg();
00216 }
00217 combineMigrationMsgs[destNodeID]->add(src,m[i].destPatchID,m[i].mList);
00218 }
00219 else
00220 {
00221 // for now buffer local messages too
00222 }
00223 }
00224 migrationCountdown -= 1;
00225 // DebugM(3,"migrationCountdown = " << migrationCountdown << "\n");
00226 if ( ! migrationCountdown ) // send out combined messages
00227 {
00228 int numPes = CkNumPes();
00229 for ( int destNodeID = 0; destNodeID < numPes; ++destNodeID )
00230 if ( combineMigrationMsgs[destNodeID] )
00231 {
00232 DebugM(3,"Sending MigrateAtomsCombinedMsg to node " << destNodeID << "\n");
00233 CProxy_PatchMgr cp(thisgroup);
00234 #if CHARM_VERSION > 050402
00235 cp[destNodeID].recvMigrateAtomsCombined(combineMigrationMsgs[destNodeID]);
00236 #else
00237 cp.recvMigrateAtomsCombined(combineMigrationMsgs[destNodeID],destNodeID);
00238 #endif
00239 }
00240 }
00241 }
|
|
|
Definition at line 113 of file PatchMgr.C. References HomePatch::atom, ResizeArrayIter< T >::begin(), SortedArray< Elem >::del(), ResizeArrayIter< T >::end(), homePatch(), MovePatchListIter, ResizeArray< Elem >::resize(), ResizeArray< Elem >::size(), and PatchMap::unregisterPatch(). Referenced by WorkDistrib::distributeHomePatches(). 00114 {
00115 if (! move.size())
00116 return;
00117
00118 MovePatchListIter m(move);
00119 for ( m = m.begin(); m != m.end(); m++) {
00120 HomePatch *p = homePatch(m->pid);
00121 patchMap->unregisterPatch(m->pid, p);
00122
00123 MovePatchesMsg *msg = new MovePatchesMsg(m->pid, p->atom);
00124
00125 // Sending to PatchMgr::recvMovePatches on remote node
00126 CProxy_PatchMgr cp(thisgroup);
00127 #if CHARM_VERSION > 050402
00128 cp[m->nodeID].recvMovePatches(msg);
00129 #else
00130 cp.recvMovePatches(msg, m->nodeID);
00131 #endif
00132
00133 // Deleting the HomePatchElem will call a destructor for clean up
00134 // but the msg elements are safe since they use a container template
00135 // that uses ref counting.
00136 delete p;
00137 homePatches.del(HomePatchElem(m->pid));
00138 }
00139 move.resize(0);
00140 }
|
|
||||||||||||
|
Definition at line 90 of file PatchMgr.C. References HomePatch::atom, SortedArray< Elem >::del(), homePatch(), and PatchMap::unregisterPatch(). Referenced by WorkDistrib::initAndSendHomePatch(). 00090 {
00091 HomePatch *p = homePatch(patchId);
00092 patchMap->unregisterPatch(patchId, p);
00093
00094 MovePatchesMsg *msg = new MovePatchesMsg(patchId, p->atom);
00095
00096 // Sending to PatchMgr::recvMovePatches on remote node
00097 CProxy_PatchMgr cp(thisgroup);
00098 #if CHARM_VERSION > 050402
00099 cp[nodeId].recvMovePatches(msg);
00100 #else
00101 cp.recvMovePatches(msg, nodeId);
00102 #endif
00103
00104 // Deleting the HomePatchElem will call a destructor for clean up
00105 // but the msg elements are safe since they use a container template
00106 // that uses ref counting.
00107 delete p;
00108 homePatches.del(HomePatchElem(patchId));
00109 }
|
|
||||||||||||
|
Definition at line 154 of file PatchMgr.h. References PatchMap::homePatch(), and Patch::setNumFixedAtoms(). Referenced by WorkDistrib::fillOnePatchAtoms(). 00154 {
00155 HomePatch *thisHomePatch = patchMap->homePatch(patchId);
00156 thisHomePatch->setNumFixedAtoms(numFixed);
00157 }
|
|
|
Definition at line 288 of file PatchMgr.C. References ResizeArray< Elem >::begin(), ResizeArray< Elem >::end(), SimParameters::lattice, SetLatticeMsg::lattice, Patch::lattice, Node::Object(), HomePatchElem::patch, and Node::simParameters. 00288 {
00289 // loop over homePatches, setting the lattice to the new value.
00290 for (HomePatchElem *elem = homePatches.begin(); elem != homePatches.end(); elem++) {
00291 HomePatch *hp = elem->patch;
00292 hp->lattice = msg->lattice;
00293 }
00294 // Must also do this for SimParameters in order for pressure profile to work!
00295 Node::Object()->simParameters->lattice = msg->lattice;
00296 }
|
|
|
Definition at line 132 of file PatchMgr.h. |
1.3.9.1