NAMD
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
MigrateAtomsCombinedMsg Class Reference

#include <MigrateAtomsMsg.h>

Inheritance diagram for MigrateAtomsCombinedMsg:

Public Member Functions

 MigrateAtomsCombinedMsg (void)
 
 ~MigrateAtomsCombinedMsg (void)
 
void add (PatchID source, PatchID destination, MigrationList &m)
 
void distribute (void)
 

Static Public Member Functions

static voidpack (MigrateAtomsCombinedMsg *msg)
 
static MigrateAtomsCombinedMsgunpack (void *ptr)
 

Public Attributes

NodeID fromNodeID
 
ResizeArray< PatchIDsrcPatchID
 
ResizeArray< PatchIDdestPatchID
 
ResizeArray< int > numAtoms
 
int totalAtoms
 
MigrationList migrationList
 

Detailed Description

Definition at line 44 of file MigrateAtomsMsg.h.

Constructor & Destructor Documentation

MigrateAtomsCombinedMsg::MigrateAtomsCombinedMsg ( void  )
MigrateAtomsCombinedMsg::~MigrateAtomsCombinedMsg ( void  )
inline

Definition at line 55 of file MigrateAtomsMsg.h.

55 { };

Member Function Documentation

void MigrateAtomsCombinedMsg::add ( PatchID  source,
PatchID  destination,
MigrationList m 
)

Definition at line 40 of file MigrateAtomsMsg.C.

References ResizeArray< T >::add(), destPatchID, migrationList, numAtoms, ResizeArray< T >::size(), srcPatchID, and totalAtoms.

Referenced by PatchMgr::sendMigrationMsgs().

41 {
42  srcPatchID.add(source);
43  destPatchID.add(destination);
44  int n = m.size();
45  numAtoms.add(n);
46  totalAtoms += n;
47  for ( int i = 0; i < n; ++i )
48  {
49  migrationList.add(m[i]);
50  }
51 }
ResizeArray< int > numAtoms
ResizeArray< PatchID > destPatchID
ResizeArray< PatchID > srcPatchID
int add(const Elem &elem)
Definition: ResizeArray.h:97
MigrationList migrationList
int size(void) const
Definition: ResizeArray.h:127
void MigrateAtomsCombinedMsg::distribute ( void  )

Definition at line 54 of file MigrateAtomsMsg.C.

References DebugM, HomePatch::depositMigration(), MigrateAtomsMsg::destPatchID, destPatchID, MigrateAtomsMsg::fromNodeID, fromNodeID, PatchMap::homePatch(), MigrateAtomsMsg::migrationList, migrationList, NAMD_bug(), numAtoms, PatchMap::Object(), ResizeArray< T >::resize(), ResizeArray< T >::size(), MigrateAtomsMsg::srcPatchID, srcPatchID, and totalAtoms.

Referenced by PatchMgr::recvMigrateAtomsCombined().

55 {
56  int n = srcPatchID.size();
57  int m = 0;
58  for ( int i = 0; i < n; ++i )
59  {
61  msg->fromNodeID = fromNodeID;
62  msg->srcPatchID = srcPatchID[i];
63  msg->destPatchID = destPatchID[i];
64  int l = numAtoms[i];
65  {
66  DebugM(3,"Distributing " << l << " atoms to patch " << msg->destPatchID << "\n");
67  msg->migrationList.resize(l);
68  for ( int j = 0; j < l; ++j ) msg->migrationList[j] = migrationList[m+j];
69  m += l;
70  }
72  }
73  if ( m != totalAtoms ) NAMD_bug("MigrateAtomsCombinedMsg::distribute bad atom count");
74 }
void depositMigration(MigrateAtomsMsg *)
Definition: HomePatch.C:3999
ResizeArray< int > numAtoms
ResizeArray< PatchID > destPatchID
static PatchMap * Object()
Definition: PatchMap.h:27
MigrationList migrationList
#define DebugM(x, y)
Definition: Debug.h:59
HomePatch * homePatch(PatchID pid)
Definition: PatchMap.h:240
void NAMD_bug(const char *err_msg)
Definition: common.C:123
ResizeArray< PatchID > srcPatchID
void resize(int i)
Definition: ResizeArray.h:84
MigrationList migrationList
int size(void) const
Definition: ResizeArray.h:127
static void* MigrateAtomsCombinedMsg::pack ( MigrateAtomsCombinedMsg msg)
static
static MigrateAtomsCombinedMsg* MigrateAtomsCombinedMsg::unpack ( void ptr)
static

Member Data Documentation

ResizeArray<PatchID> MigrateAtomsCombinedMsg::destPatchID

Definition at line 49 of file MigrateAtomsMsg.h.

Referenced by add(), and distribute().

NodeID MigrateAtomsCombinedMsg::fromNodeID

Definition at line 47 of file MigrateAtomsMsg.h.

Referenced by distribute().

MigrationList MigrateAtomsCombinedMsg::migrationList

Definition at line 52 of file MigrateAtomsMsg.h.

Referenced by add(), and distribute().

ResizeArray<int> MigrateAtomsCombinedMsg::numAtoms

Definition at line 50 of file MigrateAtomsMsg.h.

Referenced by add(), and distribute().

ResizeArray<PatchID> MigrateAtomsCombinedMsg::srcPatchID

Definition at line 48 of file MigrateAtomsMsg.h.

Referenced by add(), distribute(), and PatchMgr::recvMigrateAtomsCombined().

int MigrateAtomsCombinedMsg::totalAtoms

Definition at line 51 of file MigrateAtomsMsg.h.

Referenced by add(), and distribute().


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