#include <PatchMap.h>
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) | |
| HomePatchList * | homePatchList () |
| 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 |
| ScaledPosition | center (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) |
| Patch * | patch (PatchID pid) |
| HomePatch * | homePatch (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 | |
| PatchMap * | Instance () |
| PatchMap * | Object () |
| void | registerPatchMgr (PatchMgr *pmgr) |
Protected Member Functions | |
| int | packSize (void) |
| void | pack (char *buf) |
| void | unpack (char *buf) |
| PatchMap (void) | |
Friends | |
| class | WorkDistrib |
|
|
Definition at line 42 of file PatchMap.h. 00042 { MaxTwoAway = 5*5*5 - 3*3*3 };
|
|
|
Definition at line 43 of file PatchMap.h. 00043 { MaxOneAway = 3*3*3 - 1 };
|
|
|
Definition at line 44 of file PatchMap.h. 00044 { MaxOneOrTwoAway = MaxOneAway + MaxTwoAway };
|
|
|
Definition at line 202 of file PatchMap.C. 00203 {
00204 if (patchData)
00205 {
00206 int i;
00207
00208 if ( ! computeIdArena ) {
00209 for (i=0; i<nPatches; i++) {
00210 delete [] patchData[i].cids;
00211 }
00212 }
00213 delete [] patchData;
00214 patchData=NULL;
00215 nPatches=0;
00216 }
00217 delete [] nPatchesOnNode;
00218 delete computeIdArena;
00219 }
|
|
|
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 }
|
|
|
Definition at line 357 of file PatchMap.C. References node(), and NodeID. 00357 {
00358
00359 int i = 1;
00360
00361 NodeID node = patchData[pid].node;
00362
00363 if ( CkNumPes() > 2*nPatches+1 ) {
00364
00365 int newnode = ( CkNumPes() + node - 1 ) % CkNumPes();
00366 bool success = 0;
00367
00368 while ( i < CkNumPes() && !success) {
00369 if ( nPatchesOnNode[newnode] == 0 )
00370 success = 1;
00371
00372 //we know till pid, we have assigned all base nodes
00373 for (int count = 0; count < pid; count ++)
00374 if (patchData[count].basenode > 0 && patchData[count].basenode == newnode) {
00375 success = 0;
00376 break;
00377 }
00378
00379 //no patch or a patche's base node on this newnode. this is a good node
00380 if (success) break;
00381
00382 newnode = ( CkNumPes() + node - i - 1 ) % CkNumPes();
00383 i ++;
00384 }
00385 patchData[pid].basenode = newnode;
00386
00387 } else {
00388 patchData[pid].basenode=node;
00389 }
00390 }
|
|
||||||||||||
|
Definition at line 353 of file PatchMap.C. 00353 {
00354 patchData[pid].basenode=node;
00355 }
|
|
||||||||||||
|
Definition at line 346 of file PatchMap.C. 00346 {
00347 patchData[pid].node=node;
00348 if ( nPatchesOnNode[node] == 0 ) nNodesWithPatches += 1;
00349 nPatchesOnNode[node] += 1;
00350 }
|
|
||||||||||||
|
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 }
|
|
|
Definition at line 113 of file PatchMap.h. Referenced by initializePmeMap(), and LdbCoordinator::requiredProxies(). 00113 { return patchData[pid].basenode; }
|
|
||||||||||||
|
Definition at line 335 of file PatchMap.C. References ResizeArray< Elem >::add(), PatchIDList, and ResizeArray< Elem >::resize(). Referenced by ProxyMgr::createProxies(). 00335 {
00336 pids.resize(0);
00337 int i;
00338 for ( i=0; i<nPatches; ++i ) {
00339 if ( patchData[i].basenode == pe ) {
00340 pids.add(i);
00341 }
00342 }
00343 }
|
|
|
Definition at line 97 of file PatchMap.h. References ScaledPosition. Referenced by ComputeNonbondedCUDA::doWork(), and register_cuda_compute_pair(). 00097 { return patchData[pid].center; }
|
|
|
Definition at line 185 of file PatchMap.C. References DebugM. Referenced by ComputeMgr::updateLocalComputes3(). 00186 {
00187 int patchCount=0;
00188 for (int i=0; i<nPatches; i++) {
00189 if (patchData[i].myPatch) {
00190 patchCount++;
00191 if ( patchData[i].myPatch->getPatchID() != i) {
00192 DebugM(4, "patchID("<<patchData[i].myPatch->getPatchID()
00193 <<") != patchID("
00194 <<i<<")\n");
00195 }
00196 }
00197 }
00198 DebugM(4, "Patch Count = " <<patchCount<<"\n");
00199 }
|
|
||||||||||||
|
Definition at line 119 of file PatchMap.h. Referenced by Sync::holdComputes(). 00119 { return patchData[pid].cids[i]; }
|
|
|
Definition at line 199 of file PatchMap.h. Referenced by WorkDistrib::initAndSendHomePatch(). 00199 {
00200 for(int i=0; i<nPatches; i++){
00201 tmpPatchAtomsList[i].clear();
00202 }
00203 delete [] tmpPatchAtomsList;
00204 tmpPatchAtomsList = NULL;
00205 }
|
|
||||||||||||
|
Definition at line 51 of file PatchMap.inl. Referenced by ComputeHomeTuples< ExclElem, Exclusion, int >::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 }
|
|
||||||||||||
|
Definition at line 85 of file PatchMap.inl. 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 }
|
|
||||||||||||||||
|
Definition at line 542 of file PatchMap.C. References DebugM, Lattice::index(), and pid(). Referenced by LdbCoordinator::requiredProxies(). 00544 {
00545 int xi, yi, zi;
00546 int xinc, yinc, zinc;
00547 int n=0;
00548
00549 for(zinc=-1;zinc<=0;zinc++)
00550 {
00551 zi = patchData[pid].cIndex + zinc;
00552 if ((zi < 0) || (zi >= cDim))
00553 if ( ! cPeriodic ) continue;
00554 for(yinc=-1;yinc<=0;yinc++)
00555 {
00556 yi = patchData[pid].bIndex + yinc;
00557 if ((yi < 0) || (yi >= bDim))
00558 if ( ! bPeriodic ) continue;
00559 for(xinc=-1;xinc<=0;xinc++)
00560 {
00561 if ((xinc==0) && (yinc==0) && (zinc==0))
00562 continue;
00563
00564 xi = patchData[pid].aIndex + xinc;
00565 if ((xi < 0) || (xi >= aDim))
00566 if ( ! aPeriodic ) continue;
00567
00568 if (neighbor_ids)
00569 neighbor_ids[n]=this->pid(xi,yi,zi);
00570 if ( transform_ids )
00571 {
00572 int xt = 0; if ( xi < 0 ) xt = -1; if ( xi >= aDim ) xt = 1;
00573 int yt = 0; if ( yi < 0 ) yt = -1; if ( yi >= bDim ) yt = 1;
00574 int zt = 0; if ( zi < 0 ) zt = -1; if ( zi >= cDim ) zt = 1;
00575 transform_ids[n] = Lattice::index(xt,yt,zt);
00576 }
00577 n++;
00578 }
00579 }
00580 }
00581 DebugM(3,"Patch " << pid << " has " << n << " upstream neighbors.\n");
00582 return n;
00583 }
|
|
|
Definition at line 206 of file PatchMap.h. Referenced by WorkDistrib::caclNumAtomsInEachPatch(), and WorkDistrib::fillOnePatchAtoms(). 00206 {
00207 return tmpPatchAtomsList;
00208 }
|
|
|
Definition at line 61 of file PatchMap.h. Referenced by RecBisection::partition(). 00061 { return aDim; }
|
|
|
Definition at line 62 of file PatchMap.h. Referenced by RecBisection::partition(). 00062 { return bDim; }
|
|
|
Definition at line 63 of file PatchMap.h. Referenced by RecBisection::partition(). 00063 { return cDim; }
|
|
|
|
Definition at line 324 of file PatchMap.C. References ResizeArray< Elem >::add(), PatchIDList, and ResizeArray< Elem >::resize(). Referenced by ProxyMgr::buildProxySpanningTree(), and ProxyMgr::buildProxySpanningTree2(). 00324 {
00325 pids.resize(0);
00326 int i;
00327 for ( i=0; i<nPatches; ++i ) {
00328 if ( patchData[i].node == CkMyPe() ) {
00329 pids.add(i);
00330 }
00331 }
00332 }
|
|
|
Definition at line 319 of file PatchMap.C. References HomePatchList. Referenced by ComputeHomePatches::initialize(), LdbCoordinator::ResumeFromSync(), and Node::run(). 00319 {
00320 return &(CkpvAccess(PatchMap_patchMgr)->homePatches);
00321 }
|
|
|
Definition at line 84 of file PatchMap.h. Referenced by makePatches(). 00084 { return pid % aDim; }
|
|
|
Definition at line 85 of file PatchMap.h. Referenced by makePatches(). 00085 { return (pid / aDim) % bDim; }
|
|
|
Definition at line 86 of file PatchMap.h. Referenced by makePatches(). 00086 { return pid / (aDim*bDim); }
|
|
|
Definition at line 196 of file PatchMap.h. Referenced by WorkDistrib::preCreateHomePatches(). 00196 {
00197 tmpPatchAtomsList = new vector<int>[nPatches];
00198 }
|
|
|
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 }
|
|
||||||||||||||||||||||||||||||||||||
|
Definition at line 119 of file PatchMap.C. References iINFO(), index_a(), index_b(), index_c(), iout, j, 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.center.x = (((double)(p.aIndex)+0.5)/(double)aDim) * aLength + aOrigin;
00174 p.center.y = (((double)(p.bIndex)+0.5)/(double)bDim) * bLength + bOrigin;
00175 p.center.z = (((double)(p.cIndex)+0.5)/(double)cDim) * cLength + cOrigin;
00176 p.numCids = 0;
00177 int max_computes = 200;
00178 p.cids = new int[max_computes];
00179 for ( int j = 0; j < max_computes; ++j ) p.cids[j] = -1;
00180 p.numCidsAllocated = max_computes;
00181 }
00182
00183 }
|
|
|
Definition at line 90 of file PatchMap.h. References BigReal. Referenced by WorkDistrib::createAtomLists(), ComputeNonbondedPair::doForce(), WorkDistrib::fillOnePatchAtoms(), ComputePmeMgr::initialize(), OptPmeMgr::initialize_pencils(), and ComputePmeMgr::initialize_pencils(). 00090 { return patchData[pid].aMax; }
|
|
|
Definition at line 92 of file PatchMap.h. References BigReal. Referenced by WorkDistrib::createAtomLists(), ComputeNonbondedPair::doForce(), WorkDistrib::fillOnePatchAtoms(), OptPmeMgr::initialize_pencils(), and ComputePmeMgr::initialize_pencils(). 00092 { return patchData[pid].bMax; }
|
|
|
Definition at line 94 of file PatchMap.h. References BigReal. Referenced by WorkDistrib::createAtomLists(), ComputeNonbondedPair::doForce(), and WorkDistrib::fillOnePatchAtoms(). 00094 { return patchData[pid].cMax; }
|
|
|
Definition at line 89 of file PatchMap.h. References BigReal. Referenced by WorkDistrib::createAtomLists(), ComputeNonbondedPair::doForce(), WorkDistrib::fillOnePatchAtoms(), ComputePmeMgr::initialize(), OptPmeMgr::initialize_pencils(), and ComputePmeMgr::initialize_pencils(). 00089 { return patchData[pid].aMin; }
|
|
|
Definition at line 91 of file PatchMap.h. References BigReal. Referenced by WorkDistrib::createAtomLists(), ComputeNonbondedPair::doForce(), WorkDistrib::fillOnePatchAtoms(), OptPmeMgr::initialize_pencils(), and ComputePmeMgr::initialize_pencils(). 00091 { return patchData[pid].bMin; }
|
|
|
Definition at line 93 of file PatchMap.h. References BigReal. Referenced by WorkDistrib::createAtomLists(), ComputeNonbondedPair::doForce(), and WorkDistrib::fillOnePatchAtoms(). 00093 { return patchData[pid].cMin; }
|
|
||||||||||||
|
Definition at line 393 of file PatchMap.C. References ComputeID. 00394 {
00395 if (patchData[pid].numCids >= patchData[pid].numCidsAllocated)
00396 { // allocate more
00397 // NAMD_die("PatchMap::newCid - not enough compute ID's allocated.");
00398 ComputeID *old = patchData[pid].cids;
00399 patchData[pid].numCidsAllocated += 200;
00400 patchData[pid].cids = new int[patchData[pid].numCidsAllocated];
00401 int i;
00402 for (i=0; i<patchData[pid].numCids; i++)
00403 patchData[pid].cids[i] = old[i];
00404 for (i=patchData[pid].numCids; i<patchData[pid].numCidsAllocated; i++)
00405 patchData[pid].cids[i] = -1;
00406 delete [] old;
00407 }
00408 patchData[pid].cids[patchData[pid].numCids]=cid;
00409 patchData[pid].numCids++;
00410 }
|
|
|
|
Definition at line 66 of file PatchMap.h. 00066 { return aAway; }
|
|
|
Definition at line 67 of file PatchMap.h. 00067 { return bAway; }
|
|
|
Definition at line 68 of file PatchMap.h. 00068 { return cAway; }
|
|
|
Definition at line 116 of file PatchMap.h. Referenced by printPatchMap(). 00116 { return patchData[pid].numCids; }
|
|
|
Definition at line 313 of file PatchMap.C. Referenced by LdbCoordinator::initialize(), Sync::openSync(), CollectionMgr::CollectVectorInstance::reset(), ComputeMgr::sendComputeEwaldData(), and PatchMgr::sendMigrationMsgs(). 00314 {
00315 return CkpvAccess(PatchMap_patchMgr)->homePatches.size();
00316 }
|
|
|
Definition at line 58 of file PatchMap.h. Referenced by HomePatch::buildSpanningTree(), ComputePmeMgr::initialize(), and HomePatch::positionsReady(). 00058 { return nNodesWithPatches; }
|
|
|
|
Definition at line 57 of file PatchMap.h. Referenced by HomePatch::buildSpanningTree(), ComputePmeMgr::initialize(), OptPmeMgr::initialize_pencils(), initializePmeMap(), and HomePatch::positionsReady(). 00057 { return nPatchesOnNode[node]; }
|
|
|
||||||||||||||||
|
Definition at line 413 of file PatchMap.C. References DebugM, Lattice::index(), and pid(). 00414 {
00415 int xi, yi, zi;
00416 int xinc, yinc, zinc;
00417 int n=0;
00418
00419 for(zinc=-1;zinc<=1;zinc++)
00420 {
00421 zi = patchData[pid].cIndex + zinc;
00422 if ((zi < 0) || (zi >= cDim))
00423 if ( ! cPeriodic ) continue;
00424 for(yinc=-1;yinc<=1;yinc++)
00425 {
00426 yi = patchData[pid].bIndex + yinc;
00427 if ((yi < 0) || (yi >= bDim))
00428 if ( ! bPeriodic ) continue;
00429 for(xinc=-1;xinc<=1;xinc++)
00430 {
00431 if ((xinc==0) && (yinc==0) && (zinc==0))
00432 continue;
00433
00434 xi = patchData[pid].aIndex + xinc;
00435 if ((xi < 0) || (xi >= aDim))
00436 if ( ! aPeriodic ) continue;
00437
00438 if (neighbor_ids)
00439 neighbor_ids[n]=this->pid(xi,yi,zi);
00440 if ( transform_ids )
00441 {
00442 int xt = 0; if ( xi < 0 ) xt = -1; if ( xi >= aDim ) xt = 1;
00443 int yt = 0; if ( yi < 0 ) yt = -1; if ( yi >= bDim ) yt = 1;
00444 int zt = 0; if ( zi < 0 ) zt = -1; if ( zi >= cDim ) zt = 1;
00445 transform_ids[n] = Lattice::index(xt,yt,zt);
00446 }
00447 n++;
00448 }
00449 }
00450 }
00451 DebugM(3,"Patch " << pid << " has " << n << " first neighbors.\n");
00452 return n;
00453 }
|
|
||||||||||||||||
|
Definition at line 458 of file PatchMap.C. References DebugM, Lattice::index(), and pid(). 00459 {
00460 int xi, yi, zi;
00461 int xinc, yinc, zinc;
00462 int n=0;
00463
00464 for(zinc=0;zinc<=cAway;zinc++)
00465 {
00466 zi = patchData[pid].cIndex + zinc;
00467 if ((zi < 0) || (zi >= cDim))
00468 if ( ! cPeriodic ) continue;
00469 for(yinc=(zinc>0 ? -bAway : 0);yinc<=bAway;yinc++)
00470 {
00471 yi = patchData[pid].bIndex + yinc;
00472 if ((yi < 0) || (yi >= bDim))
00473 if ( ! bPeriodic ) continue;
00474 for(xinc=((zinc>0 || yinc>0) ? -aAway : 0);xinc<=aAway;xinc++)
00475 {
00476 if ((xinc==0) && (yinc==0) && (zinc==0))
00477 continue;
00478
00479 xi = patchData[pid].aIndex + xinc;
00480 if ((xi < 0) || (xi >= aDim))
00481 if ( ! aPeriodic ) continue;
00482
00483 neighbor_ids[n]=this->pid(xi,yi,zi);
00484 if ( transform_ids )
00485 {
00486 int xt = 0; if ( xi < 0 ) xt = -1; if ( xi >= aDim ) xt = 1;
00487 int yt = 0; if ( yi < 0 ) yt = -1; if ( yi >= bDim ) yt = 1;
00488 int zt = 0; if ( zi < 0 ) zt = -1; if ( zi >= cDim ) zt = 1;
00489 transform_ids[n] = Lattice::index(xt,yt,zt);
00490 }
00491 n++;
00492 }
00493 }
00494 }
00495 DebugM(3,"Patch " << pid << " has " << n << " second neighbors.\n");
00496 return n;
00497 }
|
|
|
Definition at line 76 of file PatchMap.h. References ScaledPosition. 00076 {
00077 return ScaledPosition(aOrigin,bOrigin,cOrigin);
00078 }
|
|
|
Definition at line 238 of file PatchMap.C. References BigReal, ComputeID, DebugM, j, node(), PACK, and PACKN. Referenced by WorkDistrib::sendMaps(). 00239 {
00240 DebugM(4,"Packing PatchMap on node " << CkMyPe() << std::endl);
00241 int i,j;
00242
00243 // fill in the data
00244 char *b = buffer;
00245 PACK(int,nPatches);
00246 DebugM(3,"nPatches = " << nPatches << std::endl);
00247 PACK(int,aDim); PACK(int,bDim); PACK(int,cDim);
00248 PACK(int,aAway); PACK(int,bAway); PACK(int,cAway);
00249 PACK(int,aPeriodic); PACK(int,bPeriodic); PACK(int,cPeriodic);
00250 PACK(int,aMaxIndex); PACK(int,bMaxIndex); PACK(int,cMaxIndex);
00251 PACK(BigReal,aOrigin); PACK(BigReal,bOrigin); PACK(BigReal,cOrigin);
00252 PACK(BigReal,aLength); PACK(BigReal,bLength); PACK(BigReal,cLength);
00253 PACK(int,nNodesWithPatches);
00254 PACKN(int,nPatchesOnNode,CkNumPes());
00255 for(i=0;i<nPatches;++i)
00256 {
00257 DebugM(3,"Packing Patch " << i << " is on node " << patchData[i].node <<
00258 " with " << patchData[i].numCidsAllocated << " allocated.\n");
00259 PACK(PatchData,patchData[i]);
00260 for(j=0;j<patchData[i].numCidsAllocated;++j)
00261 PACK(ComputeID,patchData[i].cids[j]);
00262 }
00263 //DebugM(3,buffer + size - b << " == 0 ?" << std::endl);
00264 }
|
|
|
Definition at line 225 of file PatchMap.C. Referenced by WorkDistrib::sendMaps(). 00226 {
00227 int i, size = 0;
00228 size += 14 * sizeof(int) + 6 * sizeof(BigReal);
00229 size += CkNumPes() * sizeof(int);
00230 for(i=0;i<nPatches;++i)
00231 {
00232 size += sizeof(PatchData);
00233 size += patchData[i].numCidsAllocated * sizeof(ComputeID);
00234 }
00235 return size;
00236 }
|
|
|
|
Definition at line 71 of file PatchMap.h. 00071 { return aPeriodic; }
|
|
|
Definition at line 72 of file PatchMap.h. 00072 { return bPeriodic; }
|
|
|
Definition at line 73 of file PatchMap.h. 00073 { return cPeriodic; }
|
|
||||||||||||||||
|
Definition at line 27 of file PatchMap.inl. References MODULO. Referenced by assignToPatch(), downstreamNeighbors(), oneAwayNeighbors(), oneOrTwoAwayNeighbors(), and upstreamNeighbors(). 00028 {
00029 if ( aPeriodic ) aIndex = MODULO(aIndex,aDim);
00030 else
00031 {
00032 if ( aIndex < 0 ) aIndex = 0;
00033 if ( aIndex >= aDim ) aIndex = aDim - 1;
00034 }
00035 if ( bPeriodic ) bIndex = MODULO(bIndex,bDim);
00036 else
00037 {
00038 if ( bIndex < 0 ) bIndex = 0;
00039 if ( bIndex >= bDim ) bIndex = bDim - 1;
00040 }
00041 if ( cPeriodic ) cIndex = MODULO(cIndex,cDim);
00042 else
00043 {
00044 if ( cIndex < 0 ) cIndex = 0;
00045 if ( cIndex >= cDim ) cIndex = cDim - 1;
00046 }
00047 return ((cIndex*bDim)+bIndex)*aDim + aIndex;
00048 }
|
|
|
Definition at line 586 of file PatchMap.C. References j, node(), and numCids(). 00587 {
00588 CkPrintf("---------------------------------------");
00589 CkPrintf("---------------------------------------\n");
00590
00591 CkPrintf("nPatches = %d\n",nPatches);
00592 for(int i=0;i<nPatches;i++)
00593 {
00594 CkPrintf("Patch %d:\n",i);
00595 CkPrintf(" node = %d\n",patchData[i].node);
00596 CkPrintf(" xi,yi,zi = %d, %d, %d\n",
00597 patchData[i].aIndex,patchData[i].bIndex,patchData[i].cIndex);
00598 CkPrintf(" x0,y0,z0 = %f, %f, %f\n",
00599 patchData[i].aMin,patchData[i].bMin,patchData[i].cMin);
00600 CkPrintf(" x1,y1,z1 = %f, %f, %f\n",
00601 patchData[i].aMax,patchData[i].bMax,patchData[i].cMax);
00602 CkPrintf(" numCids = %d\n",patchData[i].numCids);
00603 CkPrintf(" numCidsAllocated = %d\n",patchData[i].numCidsAllocated);
00604 for(int j=0; j < patchData[i].numCids; j++)
00605 {
00606 CkPrintf(" %10d ",patchData[i].cids[j]);
00607 if (!((j+1) % 6))
00608 CkPrintf("\n");
00609 }
00610 CkPrintf("\n---------------------------------------");
00611 CkPrintf("---------------------------------------\n");
00612 }
00613
00614 }
|
|
||||||||||||
|
Definition at line 636 of file PatchMap.C. References iERRORF, iout, and iPE(). 00637 {
00638 if (patchData[pid].myPatch != 0) {
00639 iout << iPE << iERRORF
00640 << "patchID("<<pid<<") is being re-registered!\n" << endi;
00641 }
00642 patchData[pid].myPatch = pptr;
00643 }
|
|
||||||||||||
|
Definition at line 617 of file PatchMap.C. References iERRORF, iout, and iPE(). Referenced by PatchMgr::createHomePatch(), ProxyMgr::createProxies(), ProxyMgr::createProxy(), and PatchMgr::preCreateHomePatch(). 00617 {
00618 registerPatch(pid,(Patch*)pptr);
00619 if (patchData[pid].myHomePatch != 0) {
00620 iout << iPE << iERRORF
00621 << "homePatchID("<<pid<<") is being re-registered!\n" << endi;
00622 }
00623 patchData[pid].myHomePatch = pptr;
00624 }
|
|
|
Definition at line 46 of file PatchMap.h. Referenced by PatchMgr::PatchMgr(). 00046 {
00047 CkpvAccess(PatchMap_patchMgr) = pmgr;
00048 }
|
|
||||||||||||||||||||||||||||||||||||
|
Definition at line 52 of file PatchMap.C. References Lattice::a(), Lattice::a_p(), Lattice::a_r(), Lattice::b(), Lattice::b_p(), Lattice::b_r(), BigReal, Lattice::c(), Lattice::c_p(), Lattice::c_r(), NAMD_die(), ScaledPosition, Vector::unit(), Vector::x, Vector::y, and Vector::z. Referenced by makePatches(), and WorkDistrib::patchMapInit(). 00056 {
00057 aPeriodic = lattice.a_p();
00058 bPeriodic = lattice.b_p();
00059 cPeriodic = lattice.c_p();
00060
00061 aAway = asplit;
00062 bAway = bsplit;
00063 cAway = csplit;
00064
00065 maxNumPatches *= aAway * bAway * cAway;
00066
00067 int minNumPatches = 1;
00068 if ( aPeriodic ) minNumPatches *= aAway;
00069 if ( bPeriodic ) minNumPatches *= bAway;
00070 if ( cPeriodic ) minNumPatches *= cAway;
00071 if ( maxNumPatches < minNumPatches ) maxNumPatches = minNumPatches;
00072
00073 do {
00074
00075 if ( aPeriodic ) {
00076 BigReal sysDim = lattice.a_r().unit() * lattice.a();
00077 aDim = (int)(sysDim * aAway / patchSize);
00078 } else {
00079 BigReal sysDim = xmax.x - xmin.x;
00080 aDim = (int)(sysDim * aAway / patchSize);
00081 if ((aDim * patchSize) < (sysDim * aAway)) aDim++;
00082 }
00083
00084 if ( bPeriodic ) {
00085 BigReal sysDim = lattice.b_r().unit() * lattice.b();
00086 bDim = (int)(sysDim * bAway / patchSize);
00087 } else {
00088 BigReal sysDim = xmax.y - xmin.y;
00089 bDim = (int)(sysDim * bAway / patchSize);
00090 if ((bDim * patchSize) < (sysDim * bAway)) bDim++;
00091 }
00092
00093 if ( cPeriodic ) {
00094 BigReal sysDim = lattice.c_r().unit() * lattice.c();
00095 cDim = (int)(sysDim * cAway / patchSize);
00096 } else {
00097 BigReal sysDim = xmax.z - xmin.z;
00098 cDim = (int)(sysDim * cAway / patchSize);
00099 if ((cDim * patchSize) < (sysDim * cAway)) cDim++;
00100 }
00101
00102 if ( aDim < 0 || bDim < 0 || cDim < 0 ) {
00103 NAMD_die("Bug in PatchMap::sizeGrid - negative grid dimension.");
00104 }
00105
00106 if ( aDim == 0 ) aDim = 1;
00107 if ( bDim == 0 ) bDim = 1;
00108 if ( cDim == 0 ) cDim = 1;
00109
00110 if ( aPeriodic && aDim < aAway ) aDim = aAway;
00111 if ( bPeriodic && bDim < bAway ) bDim = bAway;
00112 if ( cPeriodic && cDim < cAway ) cDim = cAway;
00113
00114 } while ( ( aDim*bDim*cDim > maxNumPatches ) && ( patchSize *= 1.01 ) );
00115
00116 return aDim*bDim*cDim;
00117 }
|
|
|
Definition at line 270 of file PatchMap.C. References BigReal, ComputeID, DebugM, ObjectArena< Type >::getNewArray(), j, node(), ObjectArena< Type >::setBlockSize(), UNPACK, and UNPACKN. Referenced by WorkDistrib::saveMaps(). 00271 {
00272 DebugM(4,"Unpacking PatchMap on node " << CkMyPe() << std::endl);
00273 int i,j;
00274 char *b = (char*)ptr;
00275 {
00276 // defeat some over-zealous compilers
00277 int nPatches_tmp;
00278 UNPACK(int,nPatches_tmp);
00279 nPatches = nPatches_tmp;
00280 }
00281 DebugM(3,"nPatches = " << nPatches << std::endl);
00282 UNPACK(int,aDim); UNPACK(int,bDim); UNPACK(int,cDim);
00283 UNPACK(int,aAway); UNPACK(int,bAway); UNPACK(int,cAway);
00284 UNPACK(int,aPeriodic); UNPACK(int,bPeriodic); UNPACK(int,cPeriodic);
00285 UNPACK(int,aMaxIndex); UNPACK(int,bMaxIndex); UNPACK(int,cMaxIndex);
00286 UNPACK(BigReal,aOrigin); UNPACK(BigReal,bOrigin); UNPACK(BigReal,cOrigin);
00287 UNPACK(BigReal,aLength); UNPACK(BigReal,bLength); UNPACK(BigReal,cLength);
00288 UNPACK(int,nNodesWithPatches);
00289 UNPACKN(int,nPatchesOnNode,CkNumPes());
00290 patchData = new PatchData[nPatches];
00291
00292 delete computeIdArena;
00293 computeIdArena = new ObjectArena<ComputeID>;
00294 computeIdArena->setBlockSize(256);
00295
00296 for(i=0;i<nPatches;++i)
00297 {
00298 UNPACK(PatchData,patchData[i]);
00299 if (CkMyPe()) {
00300 patchData[i].myPatch = 0;
00301 patchData[i].myHomePatch = 0;
00302 }
00303 DebugM(3,"Unpacking Patch " << i << " is on node " << patchData[i].node <<
00304 " with " << patchData[i].numCidsAllocated << " allocated.\n");
00305 patchData[i].cids = computeIdArena->getNewArray(patchData[i].numCidsAllocated);
00306 // patchData[i].cids = new ComputeID[patchData[i].numCidsAllocated];
00307 for(j=0;j<patchData[i].numCidsAllocated;++j)
00308 UNPACK(ComputeID,patchData[i].cids[j]);
00309 }
00310 }
|
|
||||||||||||
|
Definition at line 646 of file PatchMap.C. References DebugM. 00647 {
00648 if (pptr == patchData[pid].myPatch) {
00649 DebugM(4, "UnregisterPatch("<<pid<<") at " << pptr << "\n");
00650 patchData[pid].myPatch = NULL;
00651 }
00652 }
|
|
||||||||||||
|
Definition at line 627 of file PatchMap.C. References DebugM. Referenced by ProxyMgr::removeProxy(), PatchMgr::sendMovePatches(), and PatchMgr::sendOneHomePatch(). 00627 {
00628 unregisterPatch(pid,(Patch*)pptr);
00629 if (pptr == patchData[pid].myHomePatch) {
00630 DebugM(4, "UnregisterHomePatch("<<pid<<") at " << pptr << "\n");
00631 patchData[pid].myHomePatch = NULL;
00632 }
00633 }
|
|
||||||||||||||||
|
Definition at line 499 of file PatchMap.C. References DebugM, Lattice::index(), and pid(). Referenced by ProxyMgr::createProxies(), and ComputeHomeTuples< ExclElem, Exclusion, int >::initialize(). 00500 {
00501 int xi, yi, zi;
00502 int xinc, yinc, zinc;
00503 int n=0;
00504
00505 for(zinc=0;zinc<=1;zinc++)
00506 {
00507 zi = patchData[pid].cIndex + zinc;
00508 if ((zi < 0) || (zi >= cDim))
00509 if ( ! cPeriodic ) continue;
00510 for(yinc=0;yinc<=1;yinc++)
00511 {
00512 yi = patchData[pid].bIndex + yinc;
00513 if ((yi < 0) || (yi >= bDim))
00514 if ( ! bPeriodic ) continue;
00515 for(xinc=0;xinc<=1;xinc++)
00516 {
00517 if ((xinc==0) && (yinc==0) && (zinc==0))
00518 continue;
00519
00520 xi = patchData[pid].aIndex + xinc;
00521 if ((xi < 0) || (xi >= aDim))
00522 if ( ! aPeriodic ) continue;
00523
00524 if (neighbor_ids)
00525 neighbor_ids[n]=this->pid(xi,yi,zi);
00526 if ( transform_ids )
00527 {
00528 int xt = 0; if ( xi < 0 ) xt = -1; if ( xi >= aDim ) xt = 1;
00529 int yt = 0; if ( yi < 0 ) yt = -1; if ( yi >= bDim ) yt = 1;
00530 int zt = 0; if ( zi < 0 ) zt = -1; if ( zi >= cDim ) zt = 1;
00531 transform_ids[n] = Lattice::index(xt,yt,zt);
00532 }
00533 n++;
00534 }
00535 }
00536 }
00537 DebugM(3,"Patch " << pid << " has " << n << " upstream neighbors.\n");
00538 return n;
00539 }
|
|
|
Definition at line 157 of file PatchMap.h. |
1.3.9.1