#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 | sendMigrationMsgs (PatchID, MigrationInfo *, int) |
| 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 34 of file PatchMgr.C. References iERROR(), iFILE, PatchMap::Instance(), iout, iPE(), and PatchMap::registerPatchMgr(). 00035 {
00036 // CkPrintf("[%d] PatchMgr Created\n", CkMyPe());
00037
00038 // Singleton pattern
00039 if (CkpvAccess(PatchMgr_instance) == NULL) {
00040 CkpvAccess(PatchMgr_instance) = this;
00041 } else {
00042 iout << iFILE << iERROR << iPE
00043 << "PatchMgr instanced twice on same processor!" << endi;
00044 CkExit();
00045 }
00046
00047 // Get PatchMap singleton started
00048 patchMap = PatchMap::Instance();
00049 patchMap->registerPatchMgr(this);
00050
00051 // Message combining initialization
00052 migrationCountdown = 0;
00053 combineMigrationMsgs = new MigrateAtomsCombinedMsg*[CkNumPes()];
00054 int numPes = CkNumPes();
00055 for ( int i = 0; i < numPes; ++i ) combineMigrationMsgs[i] = 0;
00056 }
|
|
|
Definition at line 58 of file PatchMgr.C. References ResizeArrayIter< T >::begin(), ResizeArrayIter< T >::end(), SortedArray< Elem >::find(), HomePatchListIter, and HomePatchElem::patch. 00059 {
00060 HomePatchListIter hi(homePatches);
00061 for ( hi = hi.begin(); hi != hi.end(); hi++) {
00062 HomePatchElem* elem = homePatches.find(HomePatchElem(hi->pid));
00063 delete elem->patch;
00064 }
00065 delete [] combineMigrationMsgs;
00066 }
|
|
||||||||||||
|
Definition at line 74 of file PatchMgr.C. References FullAtomList, SortedArray< Elem >::load(), and PatchMap::registerPatch(). Referenced by WorkDistrib::createHomePatches(), ParallelIOMgr::createHomePatches(), and recvMovePatches(). 00075 {
00076 HomePatch *patch = new HomePatch(pid, a);
00077 homePatches.load(HomePatchElem(pid, patch));
00078 patchMap->registerPatch(pid, patch);
00079 }
|
|
||||||||||||
|
Definition at line 151 of file PatchMgr.h. References FullAtomList, PatchMap::homePatch(), and HomePatch::setAtomList(). 00151 {
00152 HomePatch *thisHomePatch = patchMap->homePatch(patchId);
00153 thisHomePatch->setAtomList(al);
00154 }
|
|
|
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 241 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. 00241 {
00242 // loop over homePatches, moving every atom
00243 for (HomePatchElem *elem = homePatches.begin(); elem != homePatches.end(); elem++) {
00244 HomePatch *hp = elem->patch;
00245 for (int i=0; i<hp->getNumAtoms(); i++) {
00246 FullAtom &a = hp->atom[i];
00247 a.fixedPosition = hp->lattice.reverse_transform(a.position,a.transform);
00248 a.fixedPosition += msg->offset;
00249 a.position = hp->lattice.apply_transform(a.fixedPosition,a.transform);
00250 }
00251 }
00252 delete msg;
00253 }
|
|
|
Definition at line 223 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. 00223 {
00224 LocalID lid = AtomMap::Object()->localID(msg->atomid);
00225 if ( lid.pid != notUsed ) {
00226 HomePatch *hp = patchMap->homePatch(lid.pid);
00227 if ( hp ) {
00228 FullAtom &a = hp->atom[lid.index];
00229 if ( msg->moveto ) {
00230 a.fixedPosition = msg->coord;
00231 } else {
00232 a.fixedPosition = hp->lattice.reverse_transform(a.position,a.transform);
00233 a.fixedPosition += msg->coord;
00234 }
00235 a.position = hp->lattice.apply_transform(a.fixedPosition,a.transform);
00236 }
00237 }
00238 delete msg;
00239 }
|
|
||||||||||||
|
Definition at line 84 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 CkpvAccess(PatchMgr_instance); }
|
|
||||||||||||
|
Definition at line 68 of file PatchMgr.C. References SortedArray< Elem >::load(), and PatchMap::registerPatch(). 00068 {
00069 HomePatch *patch = new HomePatch(pid, atomCnt);
00070 homePatches.load(HomePatchElem(pid, patch));
00071 patchMap->registerPatch(pid, patch);
00072 }
|
|
|
Definition at line 165 of file PatchMgr.C. References MovePatchesMsg::atom, PatchMap::homePatch(), MovePatchesMsg::pid, and HomePatch::reinitAtoms(). 00165 {
00166 patchMap->homePatch(msg->pid)->reinitAtoms(msg->atom);
00167 delete msg;
00168 }
|
|
|
Definition at line 216 of file PatchMgr.C. References DebugM, MigrateAtomsCombinedMsg::distribute(), ResizeArray< Elem >::size(), and MigrateAtomsCombinedMsg::srcPatchID. 00217 {
00218 DebugM(3,"Received MigrateAtomsCombinedMsg with " << msg->srcPatchID.size() << " messages.\n");
00219 msg->distribute();
00220 delete msg;
00221 }
|
|
|
Definition at line 133 of file PatchMgr.C. References MovePatchesMsg::atom, createHomePatch(), and MovePatchesMsg::pid. 00133 {
00134 // Make a new HomePatch
00135 createHomePatch(msg->pid, msg->atom);
00136 delete msg;
00137
00138 // Tell sending PatchMgr we received MovePatchMsg
00139 // AckMovePatchesMsg *ackmsg =
00140 // new AckMovePatchesMsg;
00141 // CSendMsgBranch(PatchMgr,ackMovePatches, ackmsg, thisgroup, msg->fromNodeID);
00142 }
|
|
||||||||||||
|
Definition at line 153 of file PatchMgr.C. References FullAtomList, and PatchMap::node(). Referenced by WorkDistrib::reinitAtoms(). 00153 {
00154
00155 MovePatchesMsg *msg = new MovePatchesMsg(pid, a);
00156
00157 FullAtomList empty;
00158 a = empty; // eliminate reference in sender
00159
00160 CProxy_PatchMgr cp(thisgroup);
00161 cp[patchMap->node(pid)].recvAtoms(msg);
00162
00163 }
|
|
||||||||||||||||
|
Definition at line 172 of file PatchMgr.C. References MigrateAtomsCombinedMsg::add(), ResizeArray< Elem >::add(), DebugM, MigrationInfo::destNodeID, PatchMap::numHomePatches(), ResizeArray< Elem >::resize(), and ResizeArray< Elem >::size(). Referenced by HomePatch::doAtomMigration(). 00172 {
00173 /*
00174 for (int i=0; i < numMsgs; i++) {
00175 PatchMgr::Object()->sendMigrationMsg(src, m[i]);
00176 }
00177 */
00178 if ( ! migrationCountdown ) // (re)initialize
00179 {
00180 // DebugM(3,"migrationCountdown (re)initialize\n");
00181 numHomePatches = patchMap->numHomePatches();
00182 migrationCountdown = numHomePatches;
00183 combineMigrationDestPes.resize(0);
00184 }
00185 for (int i=0; i < numMsgs; i++) { // buffer messages
00186 int destNodeID = m[i].destNodeID;
00187 if ( 1 ) // destNodeID != CkMyPe() )
00188 {
00189 if ( ! combineMigrationMsgs[destNodeID] )
00190 {
00191 combineMigrationMsgs[destNodeID] = new MigrateAtomsCombinedMsg();
00192 combineMigrationDestPes.add(destNodeID);
00193 }
00194 combineMigrationMsgs[destNodeID]->add(src,m[i].destPatchID,m[i].mList);
00195 }
00196 else
00197 {
00198 // for now buffer local messages too
00199 }
00200 }
00201 migrationCountdown -= 1;
00202 // DebugM(3,"migrationCountdown = " << migrationCountdown << "\n");
00203 if ( ! migrationCountdown ) // send out combined messages
00204 {
00205 int n = combineMigrationDestPes.size();
00206 for ( int i = 0; i < n; ++i ) {
00207 int destNodeID = combineMigrationDestPes[i];
00208 DebugM(3,"Sending MigrateAtomsCombinedMsg to node " << destNodeID << "\n");
00209 CProxy_PatchMgr cp(thisgroup);
00210 cp[destNodeID].recvMigrateAtomsCombined(combineMigrationMsgs[destNodeID]);
00211 combineMigrationMsgs[destNodeID] = 0;
00212 }
00213 }
00214 }
|
|
|
Definition at line 108 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(). 00109 {
00110 if (! move.size())
00111 return;
00112
00113 MovePatchListIter m(move);
00114 for ( m = m.begin(); m != m.end(); m++) {
00115 HomePatch *p = homePatch(m->pid);
00116 patchMap->unregisterPatch(m->pid, p);
00117
00118 MovePatchesMsg *msg = new MovePatchesMsg(m->pid, p->atom);
00119
00120 // Deleting the HomePatchElem will call a destructor for clean up
00121 // but the msg elements are safe since they use a container template
00122 // that uses ref counting.
00123 delete p;
00124 homePatches.del(HomePatchElem(m->pid));
00125
00126 // Sending to PatchMgr::recvMovePatches on remote node
00127 CProxy_PatchMgr cp(thisgroup);
00128 cp[m->nodeID].recvMovePatches(msg);
00129 }
00130 move.resize(0);
00131 }
|
|
||||||||||||
|
Definition at line 89 of file PatchMgr.C. References HomePatch::atom, SortedArray< Elem >::del(), homePatch(), and PatchMap::unregisterPatch(). 00089 {
00090 HomePatch *p = homePatch(patchId);
00091 patchMap->unregisterPatch(patchId, p);
00092
00093 MovePatchesMsg *msg = new MovePatchesMsg(patchId, p->atom);
00094
00095 // Deleting the HomePatchElem will call a destructor for clean up
00096 // but the msg elements are safe since they use a container template
00097 // that uses ref counting.
00098 delete p;
00099 homePatches.del(HomePatchElem(patchId));
00100
00101 // Sending to PatchMgr::recvMovePatches on remote node
00102 CProxy_PatchMgr cp(thisgroup);
00103 cp[nodeId].recvMovePatches(msg);
00104 }
|
|
||||||||||||
|
Definition at line 155 of file PatchMgr.h. References PatchMap::homePatch(), and Patch::setNumFixedAtoms(). 00155 {
00156 HomePatch *thisHomePatch = patchMap->homePatch(patchId);
00157 thisHomePatch->setNumFixedAtoms(numFixed);
00158 }
|
|
|
Definition at line 255 of file PatchMgr.C. References ResizeArray< Elem >::begin(), ResizeArray< Elem >::end(), SimParameters::lattice, SetLatticeMsg::lattice, Patch::lattice, Node::Object(), HomePatchElem::patch, and Node::simParameters. 00255 {
00256 // loop over homePatches, setting the lattice to the new value.
00257 for (HomePatchElem *elem = homePatches.begin(); elem != homePatches.end(); elem++) {
00258 HomePatch *hp = elem->patch;
00259 hp->lattice = msg->lattice;
00260 }
00261 // Must also do this for SimParameters in order for pressure profile to work!
00262 Node::Object()->simParameters->lattice = msg->lattice;
00263 }
|
|
|
Definition at line 132 of file PatchMgr.h. |
1.3.9.1