AtomMapper Class Reference

#include <AtomMap.h>

List of all members.

Public Member Functions

 AtomMapper (PatchID _pid)
 ~AtomMapper ()
void registerIDsCompAtomExt (const CompAtomExt *begin, const CompAtomExt *end)
void registerIDsFullAtom (const FullAtom *begin, const FullAtom *end)
void unregisterIDsCompAtomExt (const CompAtomExt *begin, const CompAtomExt *end)
void unregisterIDsFullAtom (const FullAtom *begin, const FullAtom *end)


Detailed Description

Definition at line 81 of file AtomMap.h.


Constructor & Destructor Documentation

AtomMapper::AtomMapper ( PatchID  _pid  )  [inline]

Definition at line 83 of file AtomMap.h.

00083 : pid(_pid), mapped(0), map(AtomMap::Object()) {}

AtomMapper::~AtomMapper (  )  [inline]

Definition at line 89 of file AtomMap.h.

References NAMD_bug().

00089                 {
00090     if ( mapped ) NAMD_bug("deleted AtomMapper with atoms still mapped");
00091   }


Member Function Documentation

void AtomMapper::registerIDsCompAtomExt ( const CompAtomExt begin,
const CompAtomExt end 
)

Definition at line 24 of file AtomMap.C.

References NAMD_bug(), and AtomMap::registerIDsCompAtomExt().

Referenced by Patch::positionsReady().

00024                                                                                         {
00025   if ( mapped ) return;
00026   mapped = 1;
00027 #ifdef MEM_OPT_VERSION
00028   if ( ! map->onlyUseTbl ) {
00029     int n = end - begin;
00030     entries.resize(n);
00031     AtomMapEntry *e = entries.begin();
00032     for ( int i=0; i<n; ++i, ++e ) {
00033       e->pid = pid;
00034       e->index = i;
00035       AtomID aid = begin[i].id;
00036       short aid_upper = aid >> MAXBITS;
00037       e->aid_upper = aid_upper;
00038       int aid_hash = aid & (MAXNUMATOMS-1);
00039       AtomMapEntry **me = map->entries + aid_hash;
00040       while ( *me && (*me)->aid_upper < aid_upper ) me = &((*me)->next);
00041       e->next = *me;
00042       *me = e;
00043     }
00044   } else
00045 #endif
00046   if ( map->registerIDsCompAtomExt(pid, begin, end) ) NAMD_bug("atom map failed");
00047 }

void AtomMapper::registerIDsFullAtom ( const FullAtom begin,
const FullAtom end 
)

Definition at line 50 of file AtomMap.C.

References NAMD_bug(), and AtomMap::registerIDsFullAtom().

Referenced by Sequencer::integrate(), Sequencer::minimize(), HomePatch::recvCheckpointLoad(), HomePatch::recvExchangeMsg(), and HomePatch::revert().

00050                                                                                {
00051   if ( mapped ) return;
00052   mapped = 1;
00053 #ifdef MEM_OPT_VERSION
00054   if ( ! map->onlyUseTbl ) {
00055     int n = end - begin;
00056     entries.resize(n);
00057     AtomMapEntry *e = entries.begin();
00058     for ( int i=0; i<n; ++i, ++e ) {
00059       e->pid = pid;
00060       e->index = i;
00061       AtomID aid = begin[i].id;
00062       short aid_upper = aid >> MAXBITS;
00063       e->aid_upper = aid_upper;
00064       int aid_hash = aid & (MAXNUMATOMS-1);
00065       AtomMapEntry **me = map->entries + aid_hash;
00066       while ( *me && (*me)->aid_upper < aid_upper ) me = &((*me)->next);
00067       e->next = *me;
00068       *me = e;
00069     }
00070   } else
00071 #endif
00072   if ( map->registerIDsFullAtom(pid, begin, end) ) NAMD_bug("atom map failed");
00073 }

void AtomMapper::unregisterIDsCompAtomExt ( const CompAtomExt begin,
const CompAtomExt end 
)

Definition at line 76 of file AtomMap.C.

References NAMD_bug(), and AtomMap::unregisterIDsCompAtomExt().

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

00076                                                                                           {
00077   if ( ! mapped ) return;
00078   mapped = 0;
00079 #ifdef MEM_OPT_VERSION
00080   if ( ! map->onlyUseTbl ) {
00081     int n = end - begin;
00082     if ( entries.size() != n ) {
00083       CkPrintf("AtomMapper entries.size() %d != %d\n", entries.size(), n);
00084       NAMD_bug("AtomMapper::unregisterIDsCompAtomExt size mismatch");
00085     }
00086     AtomMapEntry *e = entries.begin();
00087     for ( int i=0; i<n; ++i, ++e ) {
00088       AtomID aid = begin[i].id;
00089       int aid_hash = aid & (MAXNUMATOMS-1);
00090       AtomMapEntry **me = map->entries + aid_hash;
00091       while ( *me != e ) me = &((*me)->next);
00092       *me = e->next;
00093     }
00094   } else
00095 #endif
00096   if ( map->unregisterIDsCompAtomExt(pid, begin, end) ) NAMD_bug("atom map failed");
00097 }

void AtomMapper::unregisterIDsFullAtom ( const FullAtom begin,
const FullAtom end 
)

Definition at line 100 of file AtomMap.C.

References NAMD_bug(), and AtomMap::unregisterIDsFullAtom().

Referenced by HomePatch::doAtomMigration(), HomePatch::recvCheckpointLoad(), HomePatch::recvExchangeMsg(), HomePatch::revert(), and HomePatch::~HomePatch().

00100                                                                                  {
00101   if ( ! mapped ) return;
00102   mapped = 0;
00103 #ifdef MEM_OPT_VERSION
00104   if ( ! map->onlyUseTbl ) {
00105     int n = end - begin;
00106     if ( entries.size() != n ) {
00107       CkPrintf("AtomMapper entries.size() %d != %d\n", entries.size(), n);
00108       NAMD_bug("AtomMapper::unregisterIDsFullAtom size mismatch");
00109     }
00110     AtomMapEntry *e = entries.begin();
00111     for ( int i=0; i<n; ++i, ++e ) {
00112       AtomID aid = begin[i].id;
00113       int aid_hash = aid & (MAXNUMATOMS-1);
00114       AtomMapEntry **me = map->entries + aid_hash;
00115       while ( *me != e ) me = &((*me)->next);
00116       *me = e->next;
00117     }
00118   } else
00119 #endif
00120   if ( map->unregisterIDsFullAtom(pid, begin, end) ) NAMD_bug("atom map failed");
00121 }


The documentation for this class was generated from the following files:
Generated on Wed Sep 20 01:17:16 2017 for NAMD by  doxygen 1.4.7