Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

AtomMap Class Reference

#include <AtomMap.h>

List of all members.

Public Member Functions

 ~AtomMap (void)
void checkMap ()
void allocateMap (int nAtomIDs)
int registerIDs (PatchID pid, const CompAtom *begin, const CompAtom *end)
int unregisterIDs (PatchID pid, const CompAtom *begin, const CompAtom *end)
LocalID localID (AtomID id)
void clearMap (void)
void print (void)

Static Public Member Functions

AtomMapInstance ()
AtomMapObject ()

Protected Member Functions

 AtomMap (void)


Constructor & Destructor Documentation

AtomMap::~AtomMap void   ) 
 

Definition at line 40 of file AtomMap.C.

00041 {
00042   delete [] localIDTable;  // Delete on a NULL pointer should be ok
00043 }

AtomMap::AtomMap void   )  [protected]
 

Definition at line 28 of file AtomMap.C.

00029 {
00030   localIDTable = NULL;
00031   cleared = false;
00032 }


Member Function Documentation

void AtomMap::allocateMap int  nAtomIDs  ) 
 

Definition at line 47 of file AtomMap.C.

References LocalID::index, and LocalID::pid.

Referenced by Node::startup().

00048 {
00049   localIDTable = new LocalID[nAtomIds];
00050   tableSz = nAtomIds;
00051   for(int i=0; i < nAtomIds; i++)
00052     localIDTable[i].pid = localIDTable[i].index = notUsed;
00053   cleared = true;
00054 }

void AtomMap::checkMap  ) 
 

Definition at line 35 of file AtomMap.C.

00036 { }

void AtomMap::clearMap void   ) 
 

Definition at line 94 of file AtomMap.C.

References LocalID::index, and LocalID::pid.

00095 {
00096   if (!cleared && localIDTable != NULL)
00097   {
00098     for(int i=0; i < tableSz; i++)
00099       localIDTable[i].pid = localIDTable[i].index = notUsed;
00100     cleared = true;
00101   }
00102 }

AtomMap * AtomMap::Instance  )  [static]
 

Definition at line 20 of file AtomMap.C.

Referenced by Node::Node().

00020                            {
00021   if (CpvAccess(AtomMap_instance) == 0) {
00022     CpvAccess(AtomMap_instance) = new AtomMap;  // this is never deleted!
00023   }
00024   return CpvAccess(AtomMap_instance);
00025 }

LocalID AtomMap::localID AtomID  id  )  [inline]
 

Definition at line 47 of file AtomMap.h.

Referenced by ComputeHomeTuples< BondElem, Bond, BondValue >::loadTuples(), PatchMgr::moveAtom(), and ComputeGlobal::recvResults().

00048 {
00049   return localIDTable[id];
00050 }

AtomMap* AtomMap::Object  )  [inline, static]
 

Definition at line 18 of file AtomMap.h.

Referenced by ComputeHomeTuples< BondElem, Bond, BondValue >::ComputeHomeTuples(), HomePatch::doAtomMigration(), PatchMgr::moveAtom(), Patch::positionsReady(), ProxyPatch::receiveAll(), ComputeGlobal::recvResults(), Node::startup(), and ProxyPatch::~ProxyPatch().

00018 {return CpvAccess(AtomMap_instance);}

void AtomMap::print void   ) 
 

Definition at line 104 of file AtomMap.C.

00105 {
00106   for (int i=0; i<tableSz; i++) {
00107     CkPrintf("AtomMap on node %d\n", CkMyPe());
00108     CkPrintf("AtomID %d -> PatchID %d:Index %d\n", i, localIDTable[i].pid,
00109       localIDTable[i].index);
00110   }
00111 }

int AtomMap::registerIDs PatchID  pid,
const CompAtom begin,
const CompAtom end
 

Definition at line 75 of file AtomMap.C.

References CompAtom::id, LocalID::index, and LocalID::pid.

Referenced by Patch::positionsReady().

00076 {
00077   if (localIDTable == NULL)
00078     return -1;
00079   else 
00080   {
00081     for(const CompAtom *a = begin; a != end; ++a)
00082     {
00083         unsigned int ali = a->id;
00084         localIDTable[ali].pid = pid;
00085         localIDTable[ali].index = a - begin;
00086     }
00087     cleared = false;
00088     return 0;
00089   }
00090 }

int AtomMap::unregisterIDs PatchID  pid,
const CompAtom begin,
const CompAtom end
 

Definition at line 57 of file AtomMap.C.

References CompAtom::id, LocalID::index, and LocalID::pid.

Referenced by HomePatch::doAtomMigration(), ProxyPatch::receiveAll(), and ProxyPatch::~ProxyPatch().

00058 {
00059   if (localIDTable == NULL)
00060     return -1;
00061   else 
00062   {
00063     for(const CompAtom *a = begin; a != end; ++a)
00064     {
00065         unsigned int ali = a->id;
00066         if (localIDTable[ali].pid == pid) {
00067             localIDTable[ali].pid = notUsed;
00068             localIDTable[ali].index = notUsed;
00069         }
00070     }
00071     return 0;
00072   }
00073 }


The documentation for this class was generated from the following files:
Generated on Thu Jul 3 04:08:14 2008 for NAMD by  doxygen 1.3.9.1