NAMD
Public Member Functions | Static Public Member Functions | Friends | List of all members
PatchMgr Class Reference

#include <PatchMgr.h>

Inheritance diagram for PatchMgr:

Public Member Functions

 PatchMgr ()
 
 ~PatchMgr ()
 
void createHomePatch (PatchID pid, FullAtomList &a)
 
void movePatch (PatchID, NodeID)
 
void sendMovePatches ()
 
void recvMovePatches (MovePatchesMsg *msg)
 
void sendAtoms (PatchID pid, FullAtomList &a)
 
void recvAtoms (MovePatchesMsg *msg)
 
HomePatchhomePatch (PatchID pid)
 
void sendMigrationMsgs (PatchID, MigrationInfo *, int)
 
void recvMigrateAtomsCombined (MigrateAtomsCombinedMsg *)
 
void moveAtom (MoveAtomMsg *msg)
 
void moveAllBy (MoveAllByMsg *msg)
 
void setLattice (SetLatticeMsg *msg)
 
void sendCheckpointReq (int pid, int remote, const char *key, int task)
 
void recvCheckpointReq (CheckpointAtomsReqMsg *msg)
 
void sendCheckpointLoad (CheckpointAtomsMsg *msg, int dst, int dstpe)
 
void recvCheckpointLoad (CheckpointAtomsMsg *msg)
 
void sendCheckpointStore (CheckpointAtomsMsg *msg, int dst, int dstpe)
 
void recvCheckpointStore (CheckpointAtomsMsg *msg)
 
void sendCheckpointAck (int pid, int dst, int dstpe)
 
void recvCheckpointAck (CheckpointAtomsReqMsg *msg)
 
void sendExchangeReq (int pid, int src)
 
void recvExchangeReq (ExchangeAtomsReqMsg *msg)
 
void sendExchangeMsg (ExchangeAtomsMsg *msg, int dst, int dstpe)
 
void recvExchangeMsg (ExchangeAtomsMsg *msg)
 
void setHomePatchFixedAtomNum (int patchId, int numFixed)
 
void sendOneHomePatch (int patchId, int nodeId)
 

Static Public Member Functions

static PatchMgrObject ()
 

Friends

class PatchMap
 

Detailed Description

Definition at line 145 of file PatchMgr.h.

Constructor & Destructor Documentation

PatchMgr::PatchMgr ( )

Definition at line 34 of file PatchMgr.C.

References PatchMap::Instance(), NAMD_bug(), recvCheckpointAck_handler(), recvCheckpointLoad_handler(), recvCheckpointReq_handler(), recvCheckpointStore_handler(), recvExchangeMsg_handler(), recvExchangeReq_handler(), and PatchMap::registerPatchMgr().

35 {
36  // CkPrintf("[%d] PatchMgr Created\n", CkMyPe());
37 
38  // Singleton pattern
39  if (CkpvAccess(PatchMgr_instance) == NULL) {
40  CkpvAccess(PatchMgr_instance) = this;
41  } else {
42  NAMD_bug("PatchMgr instanced twice on same processor!");
43  }
44 
45  // Get PatchMap singleton started
46  patchMap = PatchMap::Instance();
47  patchMap->registerPatchMgr(this);
48 
49  recvCheckpointReq_index = CmiRegisterHandler((CmiHandler)recvCheckpointReq_handler);
50  recvCheckpointLoad_index = CmiRegisterHandler((CmiHandler)recvCheckpointLoad_handler);
51  recvCheckpointStore_index = CmiRegisterHandler((CmiHandler)recvCheckpointStore_handler);
52  recvCheckpointAck_index = CmiRegisterHandler((CmiHandler)recvCheckpointAck_handler);
53 
54  recvExchangeReq_index = CmiRegisterHandler((CmiHandler)recvExchangeReq_handler);
55  recvExchangeMsg_index = CmiRegisterHandler((CmiHandler)recvExchangeMsg_handler);
56 
57  // Message combining initialization
58  migrationCountdown = 0;
59  combineMigrationMsgs = new MigrateAtomsCombinedMsg*[CkNumPes()];
60  int numPes = CkNumPes();
61  for ( int i = 0; i < numPes; ++i ) combineMigrationMsgs[i] = 0;
62 }
void recvCheckpointReq_handler(envelope *env)
Definition: PatchMgr.C:288
void recvExchangeReq_handler(envelope *env)
Definition: PatchMgr.C:400
void NAMD_bug(const char *err_msg)
Definition: common.C:129
void recvCheckpointLoad_handler(envelope *env)
Definition: PatchMgr.C:320
void recvCheckpointAck_handler(envelope *env)
Definition: PatchMgr.C:372
void recvCheckpointStore_handler(envelope *env)
Definition: PatchMgr.C:345
static void registerPatchMgr(PatchMgr *pmgr)
Definition: PatchMap.h:49
static PatchMap * Instance()
Definition: PatchMap.C:32
void recvExchangeMsg_handler(envelope *env)
Definition: PatchMgr.C:428
PatchMgr::~PatchMgr ( )

Definition at line 64 of file PatchMgr.C.

References ResizeArrayIter< Type >::begin(), ResizeArrayIter< Type >::end(), SortedArray< Type >::find(), and HomePatchElem::patch.

65 {
66  HomePatchListIter hi(homePatches);
67  for ( hi = hi.begin(); hi != hi.end(); hi++) {
68  HomePatchElem* elem = homePatches.find(HomePatchElem(hi->pid));
69  delete elem->patch;
70  }
71  delete [] combineMigrationMsgs;
72 }
HomePatch * patch
Definition: HomePatchList.h:23
Elem * find(const Elem &elem)

Member Function Documentation

void PatchMgr::createHomePatch ( PatchID  pid,
FullAtomList a 
)

Definition at line 74 of file PatchMgr.C.

References SortedArray< Type >::load(), and PatchMap::registerPatch().

Referenced by WorkDistrib::createHomePatches(), ParallelIOMgr::createHomePatches(), and recvMovePatches().

75 {
76  HomePatch *patch = new HomePatch(pid, a);
77  homePatches.load(HomePatchElem(pid, patch));
78  patchMap->registerPatch(pid, patch);
79 }
void registerPatch(PatchID pid, HomePatch *pptr)
Definition: PatchMap.C:786
int load(const Elem &elem)
Definition: SortedArray.h:50
HomePatch* PatchMgr::homePatch ( PatchID  pid)
inline

Definition at line 165 of file PatchMgr.h.

References SortedArray< Type >::find().

Referenced by sendMovePatches(), and sendOneHomePatch().

165  {
166  return homePatches.find(HomePatchElem(pid))->patch;
167  }
Elem * find(const Elem &elem)
void PatchMgr::moveAllBy ( MoveAllByMsg msg)

Definition at line 244 of file PatchMgr.C.

References Lattice::apply_transform(), ResizeArray< T >::begin(), ResizeArray< T >::end(), FullAtom::fixedPosition, Patch::getNumAtoms(), Patch::lattice, MoveAllByMsg::offset, CompAtom::position, Lattice::reverse_transform(), and FullAtom::transform.

244  {
245  // loop over homePatches, moving every atom
246  for (HomePatchElem *elem = homePatches.begin(); elem != homePatches.end(); elem++) {
247  HomePatch *hp = elem->patch;
248  for (int i=0; i<hp->getNumAtoms(); i++) {
249  FullAtom &a = hp->atom[i];
251  a.fixedPosition += msg->offset;
253  }
254  }
255  delete msg;
256 }
Position fixedPosition
Definition: NamdTypes.h:102
Lattice & lattice
Definition: Patch.h:126
Position position
Definition: NamdTypes.h:53
Vector offset
Definition: PatchMgr.h:62
iterator end(void)
Definition: ResizeArray.h:37
Position apply_transform(Position data, const Transform &t) const
Definition: Lattice.h:132
Position reverse_transform(Position data, const Transform &t) const
Definition: Lattice.h:138
int getNumAtoms()
Definition: Patch.h:105
Transform transform
Definition: NamdTypes.h:116
iterator begin(void)
Definition: ResizeArray.h:36
void PatchMgr::moveAtom ( MoveAtomMsg msg)

Definition at line 226 of file PatchMgr.C.

References Lattice::apply_transform(), MoveAtomMsg::atomid, MoveAtomMsg::coord, FullAtom::fixedPosition, PatchMap::homePatch(), LocalID::index, Patch::lattice, AtomMap::localID(), MoveAtomMsg::moveto, notUsed, AtomMap::Object(), LocalID::pid, CompAtom::position, Lattice::reverse_transform(), and FullAtom::transform.

226  {
227  LocalID lid = AtomMap::Object()->localID(msg->atomid);
228  if ( lid.pid != notUsed ) {
229  HomePatch *hp = patchMap->homePatch(lid.pid);
230  if ( hp ) {
231  FullAtom &a = hp->atom[lid.index];
232  if ( msg->moveto ) {
233  a.fixedPosition = msg->coord;
234  } else {
236  a.fixedPosition += msg->coord;
237  }
239  }
240  }
241  delete msg;
242 }
Position fixedPosition
Definition: NamdTypes.h:102
Lattice & lattice
Definition: Patch.h:126
int atomid
Definition: PatchMgr.h:55
Position position
Definition: NamdTypes.h:53
HomePatch * homePatch(PatchID pid)
Definition: PatchMap.h:240
int index
Definition: NamdTypes.h:195
LocalID localID(AtomID id)
Definition: AtomMap.h:74
int moveto
Definition: PatchMgr.h:56
PatchID pid
Definition: NamdTypes.h:194
static AtomMap * Object()
Definition: AtomMap.h:36
Position apply_transform(Position data, const Transform &t) const
Definition: Lattice.h:132
Position reverse_transform(Position data, const Transform &t) const
Definition: Lattice.h:138
Vector coord
Definition: PatchMgr.h:57
Transform transform
Definition: NamdTypes.h:116
void PatchMgr::movePatch ( PatchID  pid,
NodeID  nodeID 
)

Definition at line 84 of file PatchMgr.C.

References SortedArray< Type >::load().

Referenced by WorkDistrib::distributeHomePatches().

85 {
86  move.load(MovePatch(pid,nodeID));
87 }
int load(const Elem &elem)
Definition: SortedArray.h:50
static PatchMgr* PatchMgr::Object ( )
inlinestatic
void PatchMgr::recvAtoms ( MovePatchesMsg msg)

Definition at line 168 of file PatchMgr.C.

References MovePatchesMsg::atom, PatchMap::homePatch(), and MovePatchesMsg::pid.

168  {
169  patchMap->homePatch(msg->pid)->reinitAtoms(msg->atom);
170  delete msg;
171 }
HomePatch * homePatch(PatchID pid)
Definition: PatchMap.h:240
FullAtomList atom
Definition: PatchMgr.h:38
PatchID pid
Definition: PatchMgr.h:37
void PatchMgr::recvCheckpointAck ( CheckpointAtomsReqMsg msg)

Definition at line 378 of file PatchMgr.C.

References PatchMap::homePatch(), NAMD_bug(), CheckpointAtomsReqMsg::pid, and HomePatch::recvCheckpointAck().

Referenced by recvCheckpointAck_handler().

378  {
379  HomePatch *hp = patchMap->homePatch(msg->pid);
380  if ( ! hp ) NAMD_bug("null HomePatch pointer in PatchMgr::recvCheckpointAck");
381  hp->recvCheckpointAck();
382  delete msg;
383 }
HomePatch * homePatch(PatchID pid)
Definition: PatchMap.h:240
void recvCheckpointAck()
Definition: HomePatch.C:3569
void NAMD_bug(const char *err_msg)
Definition: common.C:129
void PatchMgr::recvCheckpointLoad ( CheckpointAtomsMsg msg)

Definition at line 326 of file PatchMgr.C.

References PatchMap::homePatch(), CheckpointAtomsMsg::pid, and HomePatch::recvCheckpointLoad().

Referenced by recvCheckpointLoad_handler().

326  {
327  HomePatch *hp = patchMap->homePatch(msg->pid);
328  hp->recvCheckpointLoad(msg);
329 }
void recvCheckpointLoad(CheckpointAtomsMsg *msg)
Definition: HomePatch.C:3516
HomePatch * homePatch(PatchID pid)
Definition: PatchMap.h:240
void PatchMgr::recvCheckpointReq ( CheckpointAtomsReqMsg msg)

Definition at line 294 of file PatchMgr.C.

References PatchMap::homePatch(), CheckpointAtomsReqMsg::key, NAMD_bug(), PatchMap::node(), CheckpointAtomsReqMsg::pe, CheckpointAtomsReqMsg::pid, HomePatch::recvCheckpointReq(), CheckpointAtomsReqMsg::replica, and CheckpointAtomsReqMsg::task.

Referenced by recvCheckpointReq_handler().

294  {
295  int patchnode = patchMap->node(msg->pid);
296  if ( CkMyPe() != patchnode ) {
297  thisProxy[patchnode].recvCheckpointReq(msg);
298  } else {
299  HomePatch *hp = patchMap->homePatch(msg->pid);
300  if ( ! hp ) NAMD_bug("null HomePatch pointer in PatchMgr::recvCheckpointReq");
301  hp->recvCheckpointReq(msg->task, msg->key, msg->replica, msg->pe);
302  delete msg;
303  }
304 }
HomePatch * homePatch(PatchID pid)
Definition: PatchMap.h:240
void recvCheckpointReq(int task, const char *key, int replica, int pe)
Definition: HomePatch.C:3486
void NAMD_bug(const char *err_msg)
Definition: common.C:129
int node(int pid) const
Definition: PatchMap.h:114
void PatchMgr::recvCheckpointStore ( CheckpointAtomsMsg msg)

Definition at line 351 of file PatchMgr.C.

References PatchMap::homePatch(), CheckpointAtomsMsg::pid, and HomePatch::recvCheckpointStore().

Referenced by recvCheckpointStore_handler().

351  {
352  HomePatch *hp = patchMap->homePatch(msg->pid);
353  hp->recvCheckpointStore(msg);
354 }
HomePatch * homePatch(PatchID pid)
Definition: PatchMap.h:240
void recvCheckpointStore(CheckpointAtomsMsg *msg)
Definition: HomePatch.C:3555
void PatchMgr::recvExchangeMsg ( ExchangeAtomsMsg msg)

Definition at line 433 of file PatchMgr.C.

References PatchMap::homePatch(), ExchangeAtomsMsg::pid, and HomePatch::recvExchangeMsg().

Referenced by recvExchangeMsg_handler().

433  {
434  HomePatch *hp = patchMap->homePatch(msg->pid);
435  hp->recvExchangeMsg(msg);
436 }
HomePatch * homePatch(PatchID pid)
Definition: PatchMap.h:240
void recvExchangeMsg(ExchangeAtomsMsg *msg)
Definition: HomePatch.C:3606
void PatchMgr::recvExchangeReq ( ExchangeAtomsReqMsg msg)

Definition at line 405 of file PatchMgr.C.

References ExchangeAtomsReqMsg::dstpe, PatchMap::homePatch(), NAMD_bug(), PatchMap::node(), ExchangeAtomsReqMsg::pid, and HomePatch::recvExchangeReq().

Referenced by recvExchangeReq_handler().

405  {
406  int patchnode = patchMap->node(msg->pid);
407  if ( CkMyPe() != patchnode ) {
408  thisProxy[patchnode].recvExchangeReq(msg);
409  } else {
410  HomePatch *hp = patchMap->homePatch(msg->pid);
411  if ( ! hp ) NAMD_bug("null HomePatch pointer in PatchMgr::recvExchangeReq");
412  hp->recvExchangeReq(msg->dstpe);
413  delete msg;
414  }
415 }
HomePatch * homePatch(PatchID pid)
Definition: PatchMap.h:240
void NAMD_bug(const char *err_msg)
Definition: common.C:129
int node(int pid) const
Definition: PatchMap.h:114
void recvExchangeReq(int req)
Definition: HomePatch.C:3595
void PatchMgr::recvMigrateAtomsCombined ( MigrateAtomsCombinedMsg msg)

Definition at line 219 of file PatchMgr.C.

References DebugM, MigrateAtomsCombinedMsg::distribute(), ResizeArray< T >::size(), and MigrateAtomsCombinedMsg::srcPatchID.

220 {
221  DebugM(3,"Received MigrateAtomsCombinedMsg with " << msg->srcPatchID.size() << " messages.\n");
222  msg->distribute();
223  delete msg;
224 }
#define DebugM(x, y)
Definition: Debug.h:59
ResizeArray< PatchID > srcPatchID
int size(void) const
Definition: ResizeArray.h:127
void PatchMgr::recvMovePatches ( MovePatchesMsg msg)

Definition at line 137 of file PatchMgr.C.

References MovePatchesMsg::atom, createHomePatch(), and MovePatchesMsg::pid.

137  {
138  // Make a new HomePatch
139  createHomePatch(msg->pid, msg->atom);
140  delete msg;
141 
142  // Tell sending PatchMgr we received MovePatchMsg
143 // AckMovePatchesMsg *ackmsg =
144 // new AckMovePatchesMsg;
145 // CSendMsgBranch(PatchMgr,ackMovePatches, ackmsg, thisgroup, msg->fromNodeID);
146 }
void createHomePatch(PatchID pid, FullAtomList &a)
Definition: PatchMgr.C:74
FullAtomList atom
Definition: PatchMgr.h:38
PatchID pid
Definition: PatchMgr.h:37
void PatchMgr::sendAtoms ( PatchID  pid,
FullAtomList a 
)

Definition at line 157 of file PatchMgr.C.

References MovePatchesMsg::atom, NAMD_bug(), PatchMap::node(), and ResizeArray< T >::shared().

Referenced by WorkDistrib::reinitAtoms().

157  {
158 
159  MovePatchesMsg *msg = new MovePatchesMsg(pid, a);
160 
161  if ( msg->atom.shared() ) NAMD_bug("shared message array in PatchMgr::sendAtoms");
162 
163  CProxy_PatchMgr cp(thisgroup);
164  cp[patchMap->node(pid)].recvAtoms(msg);
165 
166 }
FullAtomList atom
Definition: PatchMgr.h:38
bool shared() const
Definition: ResizeArray.h:72
void NAMD_bug(const char *err_msg)
Definition: common.C:129
int node(int pid) const
Definition: PatchMap.h:114
void PatchMgr::sendCheckpointAck ( int  pid,
int  dst,
int  dstpe 
)

Definition at line 358 of file PatchMgr.C.

References CheckpointAtomsReqMsg::pid.

Referenced by HomePatch::recvCheckpointReq(), and HomePatch::recvCheckpointStore().

358  {
360  msg->pid = pid;
361  envelope *env = UsrToEnv(CheckpointAtomsReqMsg::pack(msg));
362  CmiSetHandler(env,recvCheckpointAck_index);
363 #if CMK_HAS_PARTITION
364  CmiInterSyncSendAndFree(dstpe,dst,env->getTotalsize(),(char*)env);
365 #else
366  CmiSyncSendAndFree(dstpe,env->getTotalsize(),(char*)env);
367 #endif
368 }
void PatchMgr::sendCheckpointLoad ( CheckpointAtomsMsg msg,
int  dst,
int  dstpe 
)

Definition at line 308 of file PatchMgr.C.

Referenced by HomePatch::recvCheckpointReq().

308  {
309  envelope *env = UsrToEnv(CheckpointAtomsMsg::pack(msg));
310  CmiSetHandler(env,recvCheckpointLoad_index);
311 #if CMK_HAS_PARTITION
312  CmiInterSyncSendAndFree(dstpe,dst,env->getTotalsize(),(char*)env);
313 #else
314  CmiSyncSendAndFree(dstpe,env->getTotalsize(),(char*)env);
315 #endif
316 }
void PatchMgr::sendCheckpointReq ( int  pid,
int  remote,
const char *  key,
int  task 
)

Definition at line 270 of file PatchMgr.C.

References CheckpointAtomsReqMsg::key, CheckpointAtomsReqMsg::pe, CheckpointAtomsReqMsg::pid, CheckpointAtomsReqMsg::replica, and CheckpointAtomsReqMsg::task.

Referenced by HomePatch::exchangeCheckpoint().

270  {
271  CheckpointAtomsReqMsg *msg = new (1+strlen(key),0) CheckpointAtomsReqMsg;
272  msg->pid = pid;
273  msg->pe = CkMyPe();
274  msg->replica = CmiMyPartition();
275  msg->task = task;
276  strcpy(msg->key,key);
277  envelope *env = UsrToEnv(CheckpointAtomsReqMsg::pack(msg));
278  CmiSetHandler(env,recvCheckpointReq_index);
279 #if CMK_HAS_PARTITION
280  CmiInterSyncSendAndFree(CkMyPe(),remote,env->getTotalsize(),(char*)env);
281 #else
282  CmiSyncSendAndFree(CkMyPe(),env->getTotalsize(),(char*)env);
283 #endif
284 }
void PatchMgr::sendCheckpointStore ( CheckpointAtomsMsg msg,
int  dst,
int  dstpe 
)

Definition at line 333 of file PatchMgr.C.

Referenced by HomePatch::recvCheckpointLoad().

333  {
334  envelope *env = UsrToEnv(CheckpointAtomsMsg::pack(msg));
335  CmiSetHandler(env,recvCheckpointStore_index);
336 #if CMK_HAS_PARTITION
337  CmiInterSyncSendAndFree(dstpe,dst,env->getTotalsize(),(char*)env);
338 #else
339  CmiSyncSendAndFree(dstpe,env->getTotalsize(),(char*)env);
340 #endif
341 }
void PatchMgr::sendExchangeMsg ( ExchangeAtomsMsg msg,
int  dst,
int  dstpe 
)

Definition at line 417 of file PatchMgr.C.

Referenced by HomePatch::recvExchangeReq().

417  {
418  envelope *env = UsrToEnv(ExchangeAtomsMsg::pack(msg));
419  CmiSetHandler(env,recvExchangeMsg_index);
420 #if CMK_HAS_PARTITION
421  CmiInterSyncSendAndFree(dstpe,dst,env->getTotalsize(),(char*)env);
422 #else
423  CmiSyncSendAndFree(dstpe,env->getTotalsize(),(char*)env);
424 #endif
425 }
void PatchMgr::sendExchangeReq ( int  pid,
int  src 
)

Definition at line 386 of file PatchMgr.C.

References ExchangeAtomsReqMsg::dstpe, and ExchangeAtomsReqMsg::pid.

Referenced by HomePatch::exchangeAtoms().

386  {
388  msg->pid = pid;
389  msg->dstpe = CkMyPe();
390  envelope *env = UsrToEnv(ExchangeAtomsReqMsg::pack(msg));
391  CmiSetHandler(env,recvExchangeReq_index);
392 #if CMK_HAS_PARTITION
393  CmiInterSyncSendAndFree(CkMyPe(),src,env->getTotalsize(),(char*)env);
394 #else
395  CmiSyncSendAndFree(CkMyPe(),env->getTotalsize(),(char*)env);
396 #endif
397 }
void PatchMgr::sendMigrationMsgs ( PatchID  src,
MigrationInfo m,
int  numMsgs 
)

Definition at line 175 of file PatchMgr.C.

References MigrateAtomsCombinedMsg::add(), ResizeArray< T >::add(), DebugM, MigrationInfo::destNodeID, PatchMap::numHomePatches(), ResizeArray< T >::resize(), and ResizeArray< T >::size().

Referenced by HomePatch::doAtomMigration().

175  {
176 /*
177  for (int i=0; i < numMsgs; i++) {
178  PatchMgr::Object()->sendMigrationMsg(src, m[i]);
179  }
180 */
181  if ( ! migrationCountdown ) // (re)initialize
182  {
183  // DebugM(3,"migrationCountdown (re)initialize\n");
184  numHomePatches = patchMap->numHomePatches();
185  migrationCountdown = numHomePatches;
186  combineMigrationDestPes.resize(0);
187  }
188  for (int i=0; i < numMsgs; i++) { // buffer messages
189  int destNodeID = m[i].destNodeID;
190  if ( 1 ) // destNodeID != CkMyPe() )
191  {
192  if ( ! combineMigrationMsgs[destNodeID] )
193  {
194  combineMigrationMsgs[destNodeID] = new MigrateAtomsCombinedMsg();
195  combineMigrationDestPes.add(destNodeID);
196  }
197  combineMigrationMsgs[destNodeID]->add(src,m[i].destPatchID,m[i].mList);
198  }
199  else
200  {
201  // for now buffer local messages too
202  }
203  }
204  migrationCountdown -= 1;
205  // DebugM(3,"migrationCountdown = " << migrationCountdown << "\n");
206  if ( ! migrationCountdown ) // send out combined messages
207  {
208  int n = combineMigrationDestPes.size();
209  for ( int i = 0; i < n; ++i ) {
210  int destNodeID = combineMigrationDestPes[i];
211  DebugM(3,"Sending MigrateAtomsCombinedMsg to node " << destNodeID << "\n");
212  CProxy_PatchMgr cp(thisgroup);
213  cp[destNodeID].recvMigrateAtomsCombined(combineMigrationMsgs[destNodeID]);
214  combineMigrationMsgs[destNodeID] = 0;
215  }
216  }
217 }
void add(PatchID source, PatchID destination, MigrationList &m)
#define DebugM(x, y)
Definition: Debug.h:59
NodeID destNodeID
Definition: Migration.h:21
int add(const Elem &elem)
Definition: ResizeArray.h:97
void resize(int i)
Definition: ResizeArray.h:84
int numHomePatches(void)
Definition: PatchMap.C:432
int size(void) const
Definition: ResizeArray.h:127
void PatchMgr::sendMovePatches ( )

Definition at line 110 of file PatchMgr.C.

References MovePatchesMsg::atom, ResizeArrayIter< Type >::begin(), SortedArray< Type >::del(), ResizeArrayIter< Type >::end(), homePatch(), NAMD_bug(), ResizeArray< T >::resize(), ResizeArray< T >::shared(), ResizeArray< T >::size(), and PatchMap::unregisterPatch().

Referenced by WorkDistrib::distributeHomePatches().

111 {
112  if (! move.size())
113  return;
114 
115  MovePatchListIter m(move);
116  for ( m = m.begin(); m != m.end(); m++) {
117  HomePatch *p = homePatch(m->pid);
118  patchMap->unregisterPatch(m->pid, p);
119 
120  MovePatchesMsg *msg = new MovePatchesMsg(m->pid, p->atom);
121 
122  // Deleting the HomePatchElem will call a destructor for clean up
123  // but the msg elements are safe since they use a container template
124  // that uses ref counting.
125  delete p;
126  homePatches.del(HomePatchElem(m->pid));
127 
128  if ( msg->atom.shared() ) NAMD_bug("shared message array in PatchMgr::sendMovePatches");
129 
130  // Sending to PatchMgr::recvMovePatches on remote node
131  CProxy_PatchMgr cp(thisgroup);
132  cp[m->nodeID].recvMovePatches(msg);
133  }
134  move.resize(0);
135 }
FullAtomList atom
Definition: PatchMgr.h:38
void unregisterPatch(PatchID pid, HomePatch *pptr)
Definition: PatchMap.C:796
bool shared() const
Definition: ResizeArray.h:72
void NAMD_bug(const char *err_msg)
Definition: common.C:129
void resize(int i)
Definition: ResizeArray.h:84
void del(const Elem &elem)
Definition: SortedArray.h:59
int size(void) const
Definition: ResizeArray.h:127
HomePatch * homePatch(PatchID pid)
Definition: PatchMgr.h:165
void PatchMgr::sendOneHomePatch ( int  patchId,
int  nodeId 
)

Definition at line 89 of file PatchMgr.C.

References MovePatchesMsg::atom, SortedArray< Type >::del(), homePatch(), NAMD_bug(), ResizeArray< T >::shared(), and PatchMap::unregisterPatch().

89  {
90  HomePatch *p = homePatch(patchId);
91  patchMap->unregisterPatch(patchId, p);
92 
93  MovePatchesMsg *msg = new MovePatchesMsg(patchId, p->atom);
94 
95  // Deleting the HomePatchElem will call a destructor for clean up
96  // but the msg elements are safe since they use a container template
97  // that uses ref counting.
98  delete p;
99  homePatches.del(HomePatchElem(patchId));
100 
101  if ( msg->atom.shared() ) NAMD_bug("shared message array in PatchMgr::sendOneHomePatch");
102 
103  // Sending to PatchMgr::recvMovePatches on remote node
104  CProxy_PatchMgr cp(thisgroup);
105  cp[nodeId].recvMovePatches(msg);
106 }
FullAtomList atom
Definition: PatchMgr.h:38
void unregisterPatch(PatchID pid, HomePatch *pptr)
Definition: PatchMap.C:796
bool shared() const
Definition: ResizeArray.h:72
void NAMD_bug(const char *err_msg)
Definition: common.C:129
void del(const Elem &elem)
Definition: SortedArray.h:59
HomePatch * homePatch(PatchID pid)
Definition: PatchMgr.h:165
void PatchMgr::setHomePatchFixedAtomNum ( int  patchId,
int  numFixed 
)
inline

Definition at line 220 of file PatchMgr.h.

References PatchMap::homePatch(), and Patch::setNumFixedAtoms().

220  {
221  HomePatch *thisHomePatch = patchMap->homePatch(patchId);
222  thisHomePatch->setNumFixedAtoms(numFixed);
223  }
HomePatch * homePatch(PatchID pid)
Definition: PatchMap.h:240
void setNumFixedAtoms(int numFixed)
Definition: Patch.h:113
void PatchMgr::setLattice ( SetLatticeMsg msg)

Definition at line 258 of file PatchMgr.C.

References ResizeArray< T >::begin(), ResizeArray< T >::end(), SetLatticeMsg::lattice, Patch::lattice, SimParameters::lattice, Node::Object(), and Node::simParameters.

258  {
259  // loop over homePatches, setting the lattice to the new value.
260  for (HomePatchElem *elem = homePatches.begin(); elem != homePatches.end(); elem++) {
261  HomePatch *hp = elem->patch;
262  hp->lattice = msg->lattice;
263  }
264  // Must also do this for SimParameters in order for pressure profile to work!
266 }
static Node * Object()
Definition: Node.h:86
Lattice & lattice
Definition: Patch.h:126
SimParameters * simParameters
Definition: Node.h:178
iterator end(void)
Definition: ResizeArray.h:37
Lattice lattice
Definition: PatchMgr.h:67
iterator begin(void)
Definition: ResizeArray.h:36

Friends And Related Function Documentation

friend class PatchMap
friend

Definition at line 193 of file PatchMgr.h.


The documentation for this class was generated from the following files: