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

PatchMap Class Reference

#include <PatchMap.h>

List of all members.

Public Types

enum  { MaxTwoAway = 5*5*5 - 3*3*3 }
enum  { MaxOneAway = 3*3*3 - 1 }
enum  { MaxOneOrTwoAway = MaxOneAway + MaxTwoAway }

Public Member Functions

int sizeGrid (ScaledPosition xmin, ScaledPosition xmax, const Lattice &lattice, BigReal patchSize, double maxNumPatches, int asplit, int bsplit, int csplit)
void makePatches (ScaledPosition xmin, ScaledPosition xmax, const Lattice &lattice, BigReal patchSize, double maxNumPatches, int asplit, int bsplit, int csplit)
void checkMap ()
 ~PatchMap (void)
HomePatchListhomePatchList ()
void homePatchIDList (PatchIDList &)
void basePatchIDList (int pe, PatchIDList &)
int numHomePatches (void)
int numPatches (void) const
int numPatchesOnNode (int node)
int numNodesWithPatches (void)
int gridsize_a (void) const
int gridsize_b (void) const
int gridsize_c (void) const
int numaway_a (void) const
int numaway_b (void) const
int numaway_c (void) const
int periodic_a (void) const
int periodic_b (void) const
int periodic_c (void) const
ScaledPosition origin (void) const
int pid (int aIndex, int bIndex, int cIndex)
int index_a (int pid) const
int index_b (int pid) const
int index_c (int pid) const
BigReal min_a (int pid) const
BigReal max_a (int pid) const
BigReal min_b (int pid) const
BigReal max_b (int pid) const
BigReal min_c (int pid) const
BigReal max_c (int pid) const
PatchID assignToPatch (Position p, const Lattice &l)
int downstream (int pid1, int pid2)
int downstream2 (int pid1, int pid2)
int node (int pid) const
int basenode (int pid) const
int numCids (int pid) const
int cid (int pid, int i) const
void assignNode (PatchID, NodeID)
void assignBaseNode (PatchID, NodeID)
void assignBaseNode (PatchID)
void newCid (int pid, int cid)
int oneAwayNeighbors (int pid, PatchID *neighbor_ids=0, int *transform_ids=0)
int oneOrTwoAwayNeighbors (int pid, PatchID *neighbor_ids, int *transform_ids=0)
int upstreamNeighbors (int pid, PatchID *neighbor_ids, int *transform_ids=0)
int downstreamNeighbors (int pid, PatchID *neighbor_ids, int *transform_ids=0)
void printPatchMap (void)
Patchpatch (PatchID pid)
HomePatchhomePatch (PatchID pid)
void registerPatch (PatchID pid, HomePatch *pptr)
void unregisterPatch (PatchID pid, HomePatch *pptr)
void registerPatch (PatchID pid, Patch *pptr)
void unregisterPatch (PatchID pid, Patch *pptr)
void initTmpPatchAtomsList ()
void delTmpPatchAtomsList ()
vector< int > * getTmpPatchAtomsList ()

Static Public Member Functions

PatchMapInstance ()
PatchMapObject ()
void registerPatchMgr (PatchMgr *pmgr)

Protected Member Functions

int packSize (void)
void pack (char *buf)
void unpack (char *buf)
 PatchMap (void)

Friends

class WorkDistrib


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
MaxTwoAway 

Definition at line 42 of file PatchMap.h.

00042 { MaxTwoAway = 5*5*5 - 3*3*3 };

anonymous enum
 

Enumeration values:
MaxOneAway 

Definition at line 43 of file PatchMap.h.

00043 { MaxOneAway = 3*3*3 - 1 };

anonymous enum
 

Enumeration values:
MaxOneOrTwoAway 

Definition at line 44 of file PatchMap.h.


Constructor & Destructor Documentation

PatchMap::~PatchMap void   ) 
 

Definition at line 199 of file PatchMap.C.

00200 {
00201   if (patchData)
00202   {
00203     int i;
00204 
00205     if ( ! computeIdArena ) {
00206       for (i=0; i<nPatches; i++) {
00207         delete [] patchData[i].cids;
00208       }
00209     }
00210     delete [] patchData;
00211     patchData=NULL;
00212     nPatches=0;
00213   }
00214   delete [] nPatchesOnNode;
00215   delete computeIdArena;
00216 }

PatchMap::PatchMap void   )  [protected]
 

Definition at line 35 of file PatchMap.C.

00036 {
00037   nPatches = 0;
00038   nNodesWithPatches = 0;
00039   int npes = CkNumPes();
00040   nPatchesOnNode = new int[npes];
00041   for ( int i=0; i<npes; ++i ) {
00042     nPatchesOnNode[i] = 0;
00043   }
00044   patchData = NULL;
00045   computeIdArena = NULL;
00046   aDim = bDim = cDim = 0;
00047   aAway = bAway = cAway = 1;
00048   aPeriodic = bPeriodic = cPeriodic = 0;
00049   aMaxIndex = bMaxIndex = cMaxIndex = 0;
00050 }


Member Function Documentation

void PatchMap::assignBaseNode PatchID   ) 
 

Definition at line 354 of file PatchMap.C.

References node(), and NodeID.

00354                                          {
00355   
00356   int i = 1;
00357 
00358   NodeID node = patchData[pid].node;
00359 
00360   if ( CkNumPes() > 2*nPatches+1 ) {
00361 
00362     int newnode =  ( CkNumPes() + node - 1 ) % CkNumPes();    
00363     bool success = 0;
00364 
00365     while ( i < CkNumPes() && !success) {
00366       if ( nPatchesOnNode[newnode] == 0 )
00367         success = 1;
00368 
00369       //we know till pid, we have assigned all base nodes
00370       for (int count = 0; count < pid; count ++)
00371         if (patchData[count].basenode > 0 && patchData[count].basenode == newnode) {
00372           success = 0;
00373           break;
00374         }
00375           
00376       //no patch or a patche's base node on this newnode. this is a good node
00377       if (success) break;
00378 
00379       newnode = ( CkNumPes() + node - i - 1 ) % CkNumPes();
00380       i ++;
00381     }
00382     patchData[pid].basenode = newnode;
00383 
00384   } else {
00385     patchData[pid].basenode=node;
00386   }
00387 }

void PatchMap::assignBaseNode PatchID  ,
NodeID 
 

Definition at line 350 of file PatchMap.C.

00350                                                       {
00351   patchData[pid].basenode=node;
00352 }

void PatchMap::assignNode PatchID  ,
NodeID 
 

Definition at line 343 of file PatchMap.C.

00343                                                   {
00344   patchData[pid].node=node;
00345   if ( nPatchesOnNode[node] == 0 ) nNodesWithPatches += 1;
00346   nPatchesOnNode[node] += 1;
00347 }

PatchID PatchMap::assignToPatch Position  p,
const Lattice l
[inline]
 

Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000 by The Board of Trustees of the University of Illinois. All rights reserved.

Definition at line 14 of file PatchMap.inl.

References BigReal, PatchID, pid(), Position, Lattice::scale(), ScaledPosition, Vector::x, Vector::y, and Vector::z.

Referenced by WorkDistrib::caclNumAtomsInEachPatch(), and WorkDistrib::createAtomLists().

00015 {
00016   int ai, bi, ci;
00017   ScaledPosition s = l.scale(p);
00018   ai = (int)floor(((BigReal)aDim)*((s.x-aOrigin)/aLength));
00019   bi = (int)floor(((BigReal)bDim)*((s.y-bOrigin)/bLength));
00020   ci = (int)floor(((BigReal)cDim)*((s.z-cOrigin)/cLength));
00021   return pid(ai,bi,ci);
00022 }

int PatchMap::basenode int  pid  )  const [inline]
 

Definition at line 110 of file PatchMap.h.

Referenced by LdbCoordinator::requiredProxies().

00110 { return patchData[pid].basenode; }

void PatchMap::basePatchIDList int  pe,
PatchIDList
 

Definition at line 332 of file PatchMap.C.

References ResizeArray< Elem >::add(), PatchIDList, and ResizeArray< Elem >::resize().

Referenced by ProxyMgr::createProxies().

00332                                                         {
00333   pids.resize(0);
00334   int i;
00335   for ( i=0; i<nPatches; ++i ) {
00336     if ( patchData[i].basenode == pe ) {
00337       pids.add(i);
00338     }
00339   }
00340 }

void PatchMap::checkMap  ) 
 

Definition at line 182 of file PatchMap.C.

References DebugM.

Referenced by ComputeMgr::updateLocalComputes3().

00183 {
00184   int patchCount=0;
00185   for (int i=0; i<nPatches; i++) {
00186     if (patchData[i].myPatch) {
00187       patchCount++;
00188       if ( patchData[i].myPatch->getPatchID() != i) {
00189         DebugM(4, "patchID("<<patchData[i].myPatch->getPatchID()
00190           <<") != patchID(" 
00191           <<i<<")\n");
00192       }
00193     }
00194   }
00195   DebugM(4, "Patch Count = " <<patchCount<<"\n");
00196 }

int PatchMap::cid int  pid,
int  i
const [inline]
 

Definition at line 116 of file PatchMap.h.

Referenced by Sync::holdComputes().

00116 { return patchData[pid].cids[i]; }

void PatchMap::delTmpPatchAtomsList  )  [inline]
 

Definition at line 195 of file PatchMap.h.

Referenced by WorkDistrib::initAndSendHomePatch().

00195                               {
00196       for(int i=0; i<nPatches; i++){
00197           tmpPatchAtomsList[i].clear();
00198       }
00199       delete [] tmpPatchAtomsList;
00200       tmpPatchAtomsList = NULL;
00201   }

int PatchMap::downstream int  pid1,
int  pid2
[inline]
 

Definition at line 51 of file PatchMap.inl.

References notUsed.

Referenced by ComputeHomeTuples< BondElem, Bond, BondValue >::loadTuples().

00052 {
00053   register int ds;
00054 
00055   if ( pid1 == pid2 ) { ds = pid1; }
00056 
00057   else if ( pid1 == notUsed || pid2 == notUsed ) { ds =  notUsed; }
00058 
00059   else {
00060     register PatchData *pdat1 = &(patchData[pid1]);
00061     register PatchData *pdat2 = &(patchData[pid2]);
00062 
00063     // c
00064     register int k = pdat1->cIndex;
00065     register int k2 = pdat2->cIndex;
00066     if ( ( k ? k : cMaxIndex ) == k2 + 1 ) k = k2;
00067 
00068     // b
00069     register int j = pdat1->bIndex;
00070     register int j2 = pdat2->bIndex;
00071     if ( ( j ? j : bMaxIndex ) == j2 + 1 ) j = j2;
00072 
00073     // a
00074     register int i = pdat1->aIndex;
00075     register int i2 = pdat2->aIndex;
00076     if ( ( i ? i : aMaxIndex ) == i2 + 1 ) i = i2;
00077 
00078     ds = ((k*bDim)+j)*aDim + i;
00079   }
00080 
00081   return ds;
00082 }

int PatchMap::downstream2 int  pid1,
int  pid2
[inline]
 

Definition at line 85 of file PatchMap.inl.

References notUsed.

00086 {
00087   register int ds;
00088 
00089   if ( pid1 == pid2 ) { ds = pid1; }
00090 
00091   else if ( pid1 == notUsed || pid2 == notUsed ) { ds =  notUsed; }
00092 
00093   else {
00094     register PatchData *pdat1 = &(patchData[pid1]);
00095     register PatchData *pdat2 = &(patchData[pid2]);
00096 
00097     // c
00098     register int k = pdat1->cIndex;
00099     register int k2 = pdat2->cIndex;
00100     if ( ( k ? k : cMaxIndex ) == k2 + 1  ||
00101          ( k >= cAway ? k : cMaxIndex + k ) == k2 + cAway ) k = k2;
00102 
00103     // b
00104     register int j = pdat1->bIndex;
00105     register int j2 = pdat2->bIndex;
00106     if ( ( j ? j : bMaxIndex ) == j2 + 1  ||
00107          ( j >= bAway ? j : bMaxIndex + j ) == j2 + bAway ) j = j2;
00108 
00109     // a
00110     register int i = pdat1->aIndex;
00111     register int i2 = pdat2->aIndex;
00112     if ( ( i ? i : aMaxIndex ) == i2 + 1  ||
00113          ( i >= aAway ? i : aMaxIndex + i ) == i2 + aAway ) i = i2;
00114 
00115     ds = ((k*bDim)+j)*aDim + i;
00116   }
00117 
00118   return ds;
00119 }

int PatchMap::downstreamNeighbors int  pid,
PatchID neighbor_ids,
int *  transform_ids = 0
 

Definition at line 539 of file PatchMap.C.

References DebugM, Lattice::index(), and pid().

Referenced by LdbCoordinator::requiredProxies().

00541 {
00542   int xi, yi, zi;
00543   int xinc, yinc, zinc;
00544   int n=0;
00545 
00546   for(zinc=-1;zinc<=0;zinc++)
00547   {
00548     zi = patchData[pid].cIndex + zinc;
00549     if ((zi < 0) || (zi >= cDim))
00550       if ( ! cPeriodic ) continue;
00551     for(yinc=-1;yinc<=0;yinc++)
00552     {
00553       yi = patchData[pid].bIndex + yinc;
00554       if ((yi < 0) || (yi >= bDim))
00555         if ( ! bPeriodic ) continue;
00556       for(xinc=-1;xinc<=0;xinc++)
00557       {
00558         if ((xinc==0) && (yinc==0) && (zinc==0))
00559           continue;
00560 
00561         xi = patchData[pid].aIndex + xinc;
00562         if ((xi < 0) || (xi >= aDim))
00563           if ( ! aPeriodic ) continue;
00564 
00565         if (neighbor_ids)
00566           neighbor_ids[n]=this->pid(xi,yi,zi);
00567         if ( transform_ids )
00568         {
00569           int xt = 0; if ( xi < 0 ) xt = -1; if ( xi >= aDim ) xt = 1;
00570           int yt = 0; if ( yi < 0 ) yt = -1; if ( yi >= bDim ) yt = 1;
00571           int zt = 0; if ( zi < 0 ) zt = -1; if ( zi >= cDim ) zt = 1;
00572           transform_ids[n] = Lattice::index(xt,yt,zt);
00573         }
00574         n++;
00575       }
00576     }
00577   }
00578   DebugM(3,"Patch " << pid << " has " << n << " upstream neighbors.\n");
00579   return n;
00580 }

vector<int>* PatchMap::getTmpPatchAtomsList  )  [inline]
 

Definition at line 202 of file PatchMap.h.

Referenced by WorkDistrib::caclNumAtomsInEachPatch(), and WorkDistrib::fillOnePatchAtoms().

00202                                      {
00203       return tmpPatchAtomsList;
00204   }

int PatchMap::gridsize_a void   )  const [inline]
 

Definition at line 61 of file PatchMap.h.

Referenced by RecBisection::partition().

00061 { return aDim; }

int PatchMap::gridsize_b void   )  const [inline]
 

Definition at line 62 of file PatchMap.h.

Referenced by RecBisection::partition().

00062 { return bDim; }

int PatchMap::gridsize_c void   )  const [inline]
 

Definition at line 63 of file PatchMap.h.

Referenced by RecBisection::partition().

00063 { return cDim; }

HomePatch * PatchMap::homePatch PatchID  pid  ) 
 

Definition at line 652 of file PatchMap.C.

Referenced by ProxyMgr::buildProxySpanningTree(), ProxyMgr::buildProxySpanningTree2(), MigrateAtomsCombinedMsg::distribute(), dumpbench(), PatchMgr::fillHomePatchAtomList(), ComputeHomePatch::initialize(), PatchMgr::moveAtom(), PatchMgr::recvAtoms(), ProxyMgr::recvImmediateResults(), PatchMgr::recvMigrateAtoms(), ProxyMgr::recvNodeAwareSpanningTree(), ProxyMgr::recvNodeAwareSpanningTreeOnHomePatch(), ProxyMgr::recvRegisterProxy(), ProxyMgr::recvResults(), ProxyMgr::recvSpanningTree(), ProxyMgr::recvSpanningTreeOnHomePatch(), ProxyMgr::recvUnregisterProxy(), and PatchMgr::setHomePatchFixedAtomNum().

00653 {
00654   return patchData[pid].myHomePatch;
00655 }

void PatchMap::homePatchIDList PatchIDList  ) 
 

Definition at line 321 of file PatchMap.C.

References ResizeArray< Elem >::add(), PatchIDList, and ResizeArray< Elem >::resize().

Referenced by ProxyMgr::buildProxySpanningTree(), and ProxyMgr::buildProxySpanningTree2().

00321                                                 {
00322   pids.resize(0);
00323   int i;
00324   for ( i=0; i<nPatches; ++i ) {
00325     if ( patchData[i].node == CkMyPe() ) {
00326       pids.add(i);
00327     }
00328   }
00329 }

HomePatchList * PatchMap::homePatchList  ) 
 

Definition at line 316 of file PatchMap.C.

References HomePatchList.

Referenced by ComputeHomePatches::initialize(), LdbCoordinator::ResumeFromSync(), and Node::run().

00316                                        {
00317   return &(CkpvAccess(PatchMap_patchMgr)->homePatches);
00318 }

int PatchMap::index_a int  pid  )  const [inline]
 

Definition at line 84 of file PatchMap.h.

Referenced by makePatches().

00084 { return pid % aDim; }

int PatchMap::index_b int  pid  )  const [inline]
 

Definition at line 85 of file PatchMap.h.

Referenced by makePatches().

00085 { return (pid / aDim) % bDim; }

int PatchMap::index_c int  pid  )  const [inline]
 

Definition at line 86 of file PatchMap.h.

Referenced by makePatches().

00086 { return pid / (aDim*bDim); }

void PatchMap::initTmpPatchAtomsList  )  [inline]
 

Definition at line 192 of file PatchMap.h.

Referenced by WorkDistrib::preCreateHomePatches().

00192                               {
00193       tmpPatchAtomsList = new vector<int>[nPatches];
00194   }

PatchMap * PatchMap::Instance  )  [static]
 

Definition at line 27 of file PatchMap.C.

Referenced by Node::Node(), and PatchMgr::PatchMgr().

00027                              {
00028   if (CkpvAccess(PatchMap_instance) == 0) {
00029      CkpvAccess(PatchMap_instance) = new PatchMap;
00030   }
00031   return(CkpvAccess(PatchMap_instance));
00032 }

void PatchMap::makePatches ScaledPosition  xmin,
ScaledPosition  xmax,
const Lattice lattice,
BigReal  patchSize,
double  maxNumPatches,
int  asplit,
int  bsplit,
int  csplit
 

Definition at line 119 of file PatchMap.C.

References iINFO(), index_a(), index_b(), index_c(), iout, ScaledPosition, sizeGrid(), Vector::x, Vector::y, and Vector::z.

Referenced by WorkDistrib::patchMapInit().

00123 {
00124   sizeGrid(xmin,xmax,lattice,patchSize,maxNumPatches,asplit,bsplit,csplit);
00125 
00126   iout << iINFO << "PATCH GRID IS ";
00127   iout << aDim;
00128   if ( aPeriodic ) iout << " (PERIODIC)";
00129   iout << " BY ";
00130   iout << bDim;
00131   if ( bPeriodic ) iout << " (PERIODIC)";
00132   iout << " BY ";
00133   iout << cDim;
00134   if ( cPeriodic ) iout << " (PERIODIC)";
00135   iout << "\n";
00136   iout << iINFO << "PATCH GRID IS ";
00137   iout << aAway << "-AWAY BY ";
00138   iout << bAway << "-AWAY BY ";
00139   iout << cAway << "-AWAY\n";
00140   iout << endi;
00141 
00142   aMaxIndex = ( ! aPeriodic || aDim == 2 ) ? 10000 : aDim;
00143   bMaxIndex = ( ! bPeriodic || bDim == 2 ) ? 10000 : bDim;
00144   cMaxIndex = ( ! cPeriodic || cDim == 2 ) ? 10000 : cDim;
00145 
00146   aLength = aPeriodic ? 1.0 : aDim * patchSize;
00147   bLength = bPeriodic ? 1.0 : bDim * patchSize;
00148   cLength = cPeriodic ? 1.0 : cDim * patchSize;
00149 
00150   aOrigin = aPeriodic ? -0.5 : 0.5 * (xmin.x + xmax.x - aLength);
00151   bOrigin = bPeriodic ? -0.5 : 0.5 * (xmin.y + xmax.y - bLength);
00152   cOrigin = cPeriodic ? -0.5 : 0.5 * (xmin.z + xmax.z - cLength);
00153 
00154   nPatches=aDim*bDim*cDim;
00155   patchData = new PatchData[nPatches];
00156 
00157   for(int i=0; i<nPatches; ++i)
00158   {
00159     PatchData &p = patchData[i];
00160     p.basenode = -1;
00161     p.numCids = 0;
00162     p.aIndex = index_a(i);
00163     p.bIndex = index_b(i);
00164     p.cIndex = index_c(i);
00165     p.myPatch = 0;
00166     p.myHomePatch = 0;
00167     p.aMin = ((float)p.aIndex/(float)aDim) * aLength + aOrigin;
00168     p.bMin = ((float)p.bIndex/(float)bDim) * bLength + bOrigin;
00169     p.cMin = ((float)p.cIndex/(float)cDim) * cLength + cOrigin;
00170     p.aMax = ((float)(p.aIndex+1)/(float)aDim) * aLength + aOrigin;
00171     p.bMax = ((float)(p.bIndex+1)/(float)bDim) * bLength + bOrigin;
00172     p.cMax = ((float)(p.cIndex+1)/(float)cDim) * cLength + cOrigin;
00173     p.numCids = 0;
00174     int max_computes = 200;
00175     p.cids = new int[max_computes];
00176     for ( int j = 0; j < max_computes; ++j ) p.cids[j] = -1;
00177     p.numCidsAllocated = max_computes;
00178   }
00179 
00180 }

BigReal PatchMap::max_a int  pid  )  const [inline]
 

Definition at line 90 of file PatchMap.h.

References BigReal.

Referenced by WorkDistrib::createAtomLists(), WorkDistrib::fillOnePatchAtoms(), ComputePmeMgr::initialize(), and ComputePmeMgr::initialize_pencils().

00090 { return patchData[pid].aMax; }

BigReal PatchMap::max_b int  pid  )  const [inline]
 

Definition at line 92 of file PatchMap.h.

References BigReal.

Referenced by WorkDistrib::createAtomLists(), WorkDistrib::fillOnePatchAtoms(), and ComputePmeMgr::initialize_pencils().

00092 { return patchData[pid].bMax; }

BigReal PatchMap::max_c int  pid  )  const [inline]
 

Definition at line 94 of file PatchMap.h.

References BigReal.

Referenced by WorkDistrib::createAtomLists(), and WorkDistrib::fillOnePatchAtoms().

00094 { return patchData[pid].cMax; }

BigReal PatchMap::min_a int  pid  )  const [inline]
 

Definition at line 89 of file PatchMap.h.

References BigReal.

Referenced by WorkDistrib::createAtomLists(), WorkDistrib::fillOnePatchAtoms(), ComputePmeMgr::initialize(), and ComputePmeMgr::initialize_pencils().

00089 { return patchData[pid].aMin; }

BigReal PatchMap::min_b int  pid  )  const [inline]
 

Definition at line 91 of file PatchMap.h.

References BigReal.

Referenced by WorkDistrib::createAtomLists(), WorkDistrib::fillOnePatchAtoms(), and ComputePmeMgr::initialize_pencils().

00091 { return patchData[pid].bMin; }

BigReal PatchMap::min_c int  pid  )  const [inline]
 

Definition at line 93 of file PatchMap.h.

References BigReal.

Referenced by WorkDistrib::createAtomLists(), and WorkDistrib::fillOnePatchAtoms().

00093 { return patchData[pid].cMin; }

void PatchMap::newCid int  pid,
int  cid
 

Definition at line 390 of file PatchMap.C.

References ComputeID.

00391 {
00392   if (patchData[pid].numCids >= patchData[pid].numCidsAllocated)
00393   { // allocate more
00394 //    NAMD_die("PatchMap::newCid - not enough compute ID's allocated.");
00395     ComputeID *old = patchData[pid].cids;
00396     patchData[pid].numCidsAllocated += 200;
00397     patchData[pid].cids = new int[patchData[pid].numCidsAllocated];
00398     int i;
00399     for (i=0; i<patchData[pid].numCids; i++) 
00400         patchData[pid].cids[i] = old[i];
00401     for (i=patchData[pid].numCids; i<patchData[pid].numCidsAllocated; i++) 
00402         patchData[pid].cids[i] = -1;
00403     delete [] old;
00404   }
00405   patchData[pid].cids[patchData[pid].numCids]=cid;
00406   patchData[pid].numCids++;
00407 }

int PatchMap::node int  pid  )  const [inline]
 

Definition at line 107 of file PatchMap.h.

Referenced by assignBaseNode(), WorkDistrib::assignNodeToPatch(), ProxyMgr::buildSpanningTree0(), ProxyMgr::createProxies(), Rebalancer::createSpanningTree(), WorkDistrib::distributeHomePatches(), WorkDistrib::initAndSendHomePatch(), LdbCoordinator::initialize(), ComputeSelfTuples< CrosstermElem, Crossterm, CrosstermValue >::initialize(), ComputePmeMgr::initialize(), ComputePatchPair::initialize(), ComputePatch::initialize(), ComputeHomePatch::initialize(), ComputePmeMgr::initialize_pencils(), pack(), Patch::positionsReady(), printPatchMap(), ProxyMgr::registerProxy(), LdbCoordinator::requiredProxies(), PatchMgr::sendAtoms(), ProxyMgr::sendNodeAwareSpanningTreeToHomePatch(), ProxyMgr::sendResults(), ProxyMgr::sendSpanningTreeToHomePatch(), unpack(), and ProxyMgr::unregisterProxy().

00107 { return patchData[pid].node; }

int PatchMap::numaway_a void   )  const [inline]
 

Definition at line 66 of file PatchMap.h.

00066 { return aAway; }

int PatchMap::numaway_b void   )  const [inline]
 

Definition at line 67 of file PatchMap.h.

00067 { return bAway; }

int PatchMap::numaway_c void   )  const [inline]
 

Definition at line 68 of file PatchMap.h.

00068 { return cAway; }

int PatchMap::numCids int  pid  )  const [inline]
 

Definition at line 113 of file PatchMap.h.

Referenced by printPatchMap().

00113 { return patchData[pid].numCids; }

int PatchMap::numHomePatches void   ) 
 

Definition at line 310 of file PatchMap.C.

Referenced by LdbCoordinator::initialize(), Sync::openSync(), CollectionMgr::CollectVectorInstance::reset(), ComputeMgr::sendComputeEwaldData(), and PatchMgr::sendMigrationMsgs().

00311 {
00312   return CkpvAccess(PatchMap_patchMgr)->homePatches.size();
00313 }

int PatchMap::numNodesWithPatches void   )  [inline]
 

Definition at line 58 of file PatchMap.h.

Referenced by HomePatch::buildSpanningTree(), ComputePmeMgr::initialize(), and HomePatch::positionsReady().

00058 { return nNodesWithPatches; }

int PatchMap::numPatches void   )  const [inline]
 

Definition at line 56 of file PatchMap.h.

Referenced by WorkDistrib::assignNodeToPatch(), LdbCoordinator::awakenSequencers(), ProxyMgr::buildSpanningTree0(), WorkDistrib::caclNumAtomsInEachPatch(), ComputeHomeTuples< BondElem, Bond, BondValue >::ComputeHomeTuples(), WorkDistrib::createAtomLists(), WorkDistrib::createHomePatches(), ProxyMgr::createProxies(), WorkDistrib::distributeHomePatches(), dumpbench(), WorkDistrib::initAndSendHomePatch(), LdbCoordinator::initialize(), ComputePmeMgr::initialize(), ComputeHomeTuples< BondElem, Bond, BondValue >::initialize(), ComputePmeMgr::initialize_pencils(), WorkDistrib::preCreateHomePatches(), LdbCoordinator::printLocalLdbReport(), RecBisection::RecBisection(), ProxyMgr::recvProxies(), ComputeGlobal::recvResults(), WorkDistrib::reinitAtoms(), WorkDistrib::saveMaps(), WorkDistrib::sendMaps(), ProxyMgr::sendSpanningTrees(), and Sequencer::Sequencer().

00056 { return nPatches; }

int PatchMap::numPatchesOnNode int  node  )  [inline]
 

Definition at line 57 of file PatchMap.h.

Referenced by HomePatch::buildSpanningTree(), ComputePmeMgr::initialize(), and HomePatch::positionsReady().

00057 { return nPatchesOnNode[node]; }

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

Definition at line 28 of file PatchMap.h.

Referenced by WorkDistrib::assignNodeToPatch(), ProxyMgr::buildProxySpanningTree(), ProxyMgr::buildProxySpanningTree2(), HomePatch::buildSpanningTree(), ProxyMgr::buildSpanningTree0(), WorkDistrib::caclNumAtomsInEachPatch(), ComputeEwald::ComputeEwald(), ComputeHomePatches::ComputeHomePatches(), ComputeHomeTuples< BondElem, Bond, BondValue >::ComputeHomeTuples(), WorkDistrib::createAtomLists(), WorkDistrib::createHomePatches(), ProxyMgr::createProxies(), ProxyMgr::createProxy(), Rebalancer::createSpanningTree(), MigrateAtomsCombinedMsg::distribute(), WorkDistrib::distributeHomePatches(), ComputeFullDirect::doWork(), dumpbench(), WorkDistrib::fillOnePatchAtoms(), Sync::holdComputes(), WorkDistrib::initAndSendHomePatch(), ComputeSelfTuples< CrosstermElem, Crossterm, CrosstermValue >::initialize(), ComputePmeMgr::initialize(), ComputePatchPair::initialize(), ComputePatch::initialize(), ComputeHomePatch::initialize(), ComputePmeMgr::initialize_pencils(), WorkDistrib::mapComputes(), Sync::openSync(), WorkDistrib::patchMapInit(), Patch::positionsReady(), HomePatch::positionsReady(), WorkDistrib::preCreateHomePatches(), ComputeMgr::recvComputeDPMEData(), ComputeMgr::recvComputeDPMEResults(), ComputeMgr::recvComputeEwaldResults(), ComputeMgr::recvComputeGlobalConfig(), ComputeMgr::recvComputeGlobalResults(), ComputeExtMgr::recvCoord(), ProxyMgr::recvImmediateProxyAll(), ProxyMgr::recvImmediateProxyData(), ProxyMgr::recvImmediateResults(), PatchMgr::recvMigrateAtoms(), ProxyMgr::recvNodeAwareSpanningTree(), ProxyMgr::recvNodeAwareSpanningTreeOnHomePatch(), ProxyMgr::recvNodeAwareSTParent(), ProxyMgr::recvProxies(), ProxyMgr::recvProxyAll(), ProxyMgr::recvProxyData(), ProxyMgr::recvRegisterProxy(), ProxyMgr::recvResults(), ComputeGlobal::recvResults(), ProxyMgr::recvSpanningTree(), ProxyMgr::recvSpanningTreeOnHomePatch(), ProxyMgr::recvUnregisterProxy(), ProxyMgr::registerProxy(), WorkDistrib::reinitAtoms(), ProxyMgr::removeProxy(), CollectionMgr::CollectVectorInstance::reset(), CollectionMaster::CollectVectorInstance::reset(), LdbCoordinator::ResumeFromSync(), Node::run(), WorkDistrib::saveMaps(), ComputeMgr::sendComputeDPMEData(), ComputeMgr::sendComputeEwaldData(), WorkDistrib::sendMaps(), ProxyMgr::sendNodeAwareSpanningTreeToHomePatch(), ProxyMgr::sendResults(), ProxyMgr::sendSpanningTrees(), ProxyMgr::sendSpanningTreeToHomePatch(), Sequencer::Sequencer(), ProxyMgr::unregisterProxy(), ComputeMgr::updateLocalComputes3(), ComputeHomePatch::~ComputeHomePatch(), ComputePatch::~ComputePatch(), and ComputePatchPair::~ComputePatchPair().

00028 { return CkpvAccess(PatchMap_instance); }

int PatchMap::oneAwayNeighbors int  pid,
PatchID neighbor_ids = 0,
int *  transform_ids = 0
 

Definition at line 410 of file PatchMap.C.

References DebugM, Lattice::index(), and pid().

00411 {
00412   int xi, yi, zi;
00413   int xinc, yinc, zinc;
00414   int n=0;
00415 
00416   for(zinc=-1;zinc<=1;zinc++)
00417   {
00418     zi = patchData[pid].cIndex + zinc;
00419     if ((zi < 0) || (zi >= cDim))
00420       if ( ! cPeriodic ) continue;
00421     for(yinc=-1;yinc<=1;yinc++)
00422     {
00423       yi = patchData[pid].bIndex + yinc;
00424       if ((yi < 0) || (yi >= bDim))
00425         if ( ! bPeriodic ) continue;
00426       for(xinc=-1;xinc<=1;xinc++)
00427       {
00428         if ((xinc==0) && (yinc==0) && (zinc==0))
00429           continue;
00430 
00431         xi = patchData[pid].aIndex + xinc;
00432         if ((xi < 0) || (xi >= aDim))
00433           if ( ! aPeriodic ) continue;
00434 
00435         if (neighbor_ids)
00436           neighbor_ids[n]=this->pid(xi,yi,zi);
00437         if ( transform_ids )
00438         {
00439           int xt = 0; if ( xi < 0 ) xt = -1; if ( xi >= aDim ) xt = 1;
00440           int yt = 0; if ( yi < 0 ) yt = -1; if ( yi >= bDim ) yt = 1;
00441           int zt = 0; if ( zi < 0 ) zt = -1; if ( zi >= cDim ) zt = 1;
00442           transform_ids[n] = Lattice::index(xt,yt,zt);
00443         }
00444         n++;
00445       }
00446     }
00447   }
00448   DebugM(3,"Patch " << pid << " has " << n << " first neighbors.\n");
00449   return n;
00450 }

int PatchMap::oneOrTwoAwayNeighbors int  pid,
PatchID neighbor_ids,
int *  transform_ids = 0
 

Definition at line 455 of file PatchMap.C.

References DebugM, Lattice::index(), and pid().

00456 {
00457   int xi, yi, zi;
00458   int xinc, yinc, zinc;
00459   int n=0;
00460 
00461   for(zinc=0;zinc<=cAway;zinc++)
00462   {
00463     zi = patchData[pid].cIndex + zinc;
00464     if ((zi < 0) || (zi >= cDim))
00465       if ( ! cPeriodic ) continue;
00466     for(yinc=(zinc>0 ? -bAway : 0);yinc<=bAway;yinc++)
00467     {
00468       yi = patchData[pid].bIndex + yinc;
00469       if ((yi < 0) || (yi >= bDim))
00470         if ( ! bPeriodic ) continue;
00471       for(xinc=((zinc>0 || yinc>0) ? -aAway : 0);xinc<=aAway;xinc++)
00472       {
00473         if ((xinc==0) && (yinc==0) && (zinc==0))
00474           continue;
00475 
00476         xi = patchData[pid].aIndex + xinc;
00477         if ((xi < 0) || (xi >= aDim))
00478           if ( ! aPeriodic ) continue;
00479 
00480         neighbor_ids[n]=this->pid(xi,yi,zi);
00481         if ( transform_ids )
00482         {
00483           int xt = 0; if ( xi < 0 ) xt = -1; if ( xi >= aDim ) xt = 1;
00484           int yt = 0; if ( yi < 0 ) yt = -1; if ( yi >= bDim ) yt = 1;
00485           int zt = 0; if ( zi < 0 ) zt = -1; if ( zi >= cDim ) zt = 1;
00486           transform_ids[n] = Lattice::index(xt,yt,zt);
00487         }
00488         n++;
00489       }
00490     }
00491   }
00492   DebugM(3,"Patch " << pid << " has " << n << " second neighbors.\n");
00493   return n;
00494 }

ScaledPosition PatchMap::origin void   )  const [inline]
 

Definition at line 76 of file PatchMap.h.

References ScaledPosition.

00076                                            {
00077     return ScaledPosition(aOrigin,bOrigin,cOrigin);
00078   }

void PatchMap::pack char *  buf  )  [protected]
 

Definition at line 235 of file PatchMap.C.

References BigReal, ComputeID, DebugM, node(), PACK, and PACKN.

Referenced by WorkDistrib::sendMaps().

00236 {
00237   DebugM(4,"Packing PatchMap on node " << CkMyPe() << std::endl);
00238   int i,j;
00239 
00240   // fill in the data
00241   char *b = buffer;
00242   PACK(int,nPatches);
00243   DebugM(3,"nPatches = " << nPatches << std::endl);
00244   PACK(int,aDim); PACK(int,bDim); PACK(int,cDim);
00245   PACK(int,aAway); PACK(int,bAway); PACK(int,cAway);
00246   PACK(int,aPeriodic); PACK(int,bPeriodic); PACK(int,cPeriodic);
00247   PACK(int,aMaxIndex); PACK(int,bMaxIndex); PACK(int,cMaxIndex);
00248   PACK(BigReal,aOrigin); PACK(BigReal,bOrigin); PACK(BigReal,cOrigin);
00249   PACK(BigReal,aLength); PACK(BigReal,bLength); PACK(BigReal,cLength);
00250   PACK(int,nNodesWithPatches);
00251   PACKN(int,nPatchesOnNode,CkNumPes());
00252   for(i=0;i<nPatches;++i)
00253   {
00254     DebugM(3,"Packing Patch " << i << " is on node " << patchData[i].node << 
00255         " with " << patchData[i].numCidsAllocated << " allocated.\n");
00256     PACK(PatchData,patchData[i]);
00257     for(j=0;j<patchData[i].numCidsAllocated;++j)
00258       PACK(ComputeID,patchData[i].cids[j]);
00259   }
00260   //DebugM(3,buffer + size - b << " == 0 ?" << std::endl);
00261 }

int PatchMap::packSize void   )  [protected]
 

Definition at line 222 of file PatchMap.C.

Referenced by WorkDistrib::sendMaps().

00223 {
00224   int i, size = 0;
00225   size += 14 * sizeof(int) + 6 * sizeof(BigReal);
00226   size += CkNumPes() * sizeof(int);
00227   for(i=0;i<nPatches;++i)
00228   {
00229     size += sizeof(PatchData);
00230     size += patchData[i].numCidsAllocated * sizeof(ComputeID);
00231   }
00232   return size;
00233 }

Patch * PatchMap::patch PatchID