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

Patch Class Reference

#include <Patch.h>

Inheritance diagram for Patch:

HomePatch ProxyPatch List of all members.

Public Member Functions

 Patch (PatchID pd)
int hasNewAtoms ()
virtual ~Patch (void)
Box< Patch, CompAtom > * registerPositionPickup (ComputeID cid, int trans=13)
void unregisterPositionPickup (ComputeID cid, Box< Patch, CompAtom > **const box)
Box< Patch, CompAtom > * registerAvgPositionPickup (ComputeID cid, int trans=13)
void unregisterAvgPositionPickup (ComputeID cid, Box< Patch, CompAtom > **const box)
Box< Patch, Results > * registerForceDeposit (ComputeID cid)
void unregisterForceDeposit (ComputeID cid, Box< Patch, Results > **const box)
void positionsReady (int n=0)
void positionBoxClosed (void)
void forceBoxClosed (void)
void avgPositionBoxClosed (void)
int getNumAtoms ()
int getNumFixedAtoms ()
void setNumFixedAtoms (int numFixed)
PatchID getPatchID ()
int getNumComputes ()
CompAtomExtgetCompAtomExtInfo ()

Public Attributes

Latticelattice
Flags flags

Protected Member Functions

virtual void boxClosed (int)=0

Protected Attributes

const PatchID patchID
int numAtoms
int numFixedAtoms
CompAtomList p
CompAtomList p_avg
CompAtomExtList pExt
CompAtomavgPositionPtrBegin
CompAtomavgPositionPtrEnd
ForceList f [Results::maxNumForces]
Results results
OwnerBox< Patch, CompAtompositionBox
ComputeIDList positionComputeList
OwnerBox< Patch, CompAtomavgPositionBox
ComputeIDList avgPositionComputeList
OwnerBox< Patch, ResultsforceBox
ComputeIDList forceComputeList
int boxesOpen
int _hasNewAtoms

Constructor & Destructor Documentation

Patch::Patch PatchID  pd  ) 
 

Definition at line 27 of file Patch.C.

References SimParameters::lattice, lattice, NAMD_SeparateWaters, Node::Object(), and Node::simParameters.

00027                        :
00028    lattice(flags.lattice),
00029    patchID(pd), numAtoms(0), numFixedAtoms(0),
00030    avgPositionPtrBegin(0), avgPositionPtrEnd(0),
00031    positionBox(this,&Patch::positionBoxClosed),
00032    avgPositionBox(this,&Patch::avgPositionBoxClosed),
00033    forceBox(this,&Patch::forceBoxClosed),
00034    boxesOpen(0), _hasNewAtoms(0)
00035 
00036    // DMK - Atom Separation (water vs. non-water)
00037    #if NAMD_SeparateWaters != 0
00038      ,numWaterAtoms(-1)
00039    #endif
00040 {
00041 #ifdef REMOVE_PROXYDATAMSG_EXTRACOPY
00042     positionPtrBegin = 0;
00043     positionPtrEnd = 0;
00044 #endif
00045 
00046 #ifdef NODEAWARE_PROXY_SPANNINGTREE
00047   numChild = 0;
00048   children = NULL;
00049   #ifdef USE_NODEPATCHMGR
00050   nodeChildren = NULL;
00051   numNodeChild = 0;
00052   #endif
00053 #endif
00054 
00055   lattice = Node::Object()->simParameters->lattice;
00056 }

virtual Patch::~Patch void   )  [inline, virtual]
 

Definition at line 34 of file Patch.h.

00034 { };


Member Function Documentation

void Patch::avgPositionBoxClosed void   ) 
 

Definition at line 125 of file Patch.C.

References avgPositionPtrBegin, and boxClosed().

00126 {
00127    avgPositionPtrBegin = 0;
00128    this->boxClosed(3);
00129 }

virtual void Patch::boxClosed int   )  [protected, pure virtual]
 

Implemented in HomePatch, and ProxyPatch.

Referenced by avgPositionBoxClosed(), forceBoxClosed(), and positionBoxClosed().

void Patch::forceBoxClosed void   ) 
 

Definition at line 115 of file Patch.C.

References boxClosed(), DebugM, Results::f, j, patchID, and results.

00116 {
00117    DebugM(4, "patchID("<<patchID<<") forceBoxClosed! call\n");
00118    for (int j = 0; j < Results::maxNumForces; ++j )
00119    {
00120      results.f[j] = 0;
00121    }
00122    this->boxClosed(1);
00123 }

CompAtomExt* Patch::getCompAtomExtInfo  )  [inline]
 

Definition at line 67 of file Patch.h.

Referenced by ComputePatchPair::doWork(), ComputePatch::doWork(), and ComputeNonbondedCUDA::doWork().

00067 { return pExt.begin(); }

int Patch::getNumAtoms  )  [inline]
 

Definition at line 55 of file Patch.h.

Referenced by WorkDistrib::assignNodeToPatch(), ComputePatchPair::atomUpdate(), ComputePatch::atomUpdate(), ComputeHomePatch::atomUpdate(), ComputeGridForce::doForce(), ComputeNonbondedCUDA::doWork(), dumpbench(), ComputeGridForce::finishForce(), ComputePatchPair::initialize(), ComputePatch::initialize(), ComputeHomePatch::initialize(), ComputeHomeTuples< ExclElem, Exclusion, int >::loadTuples(), and PatchMgr::moveAllBy().

00055 { return numAtoms; }

int Patch::getNumComputes  )  [inline]
 

Definition at line 65 of file Patch.h.

00065 { return positionComputeList.size(); }

int Patch::getNumFixedAtoms  )  [inline]
 

Definition at line 62 of file Patch.h.

00062 { return numFixedAtoms; }  // not updated

PatchID Patch::getPatchID  )  [inline]
 

Definition at line 64 of file Patch.h.

References PatchID.

Referenced by ProxyMgr::createProxy(), ComputePatch::initialize(), ComputeHomePatch::initialize(), PatchElem::PatchElem(), Sequencer::rebalanceLoad(), Sequencer::Sequencer(), and TuplePatchElem::TuplePatchElem().

00064 { return patchID; }

int Patch::hasNewAtoms  )  [inline]
 

Definition at line 33 of file Patch.h.

00033 { return _hasNewAtoms; }

void Patch::positionBoxClosed void   ) 
 

Definition at line 109 of file Patch.C.

References boxClosed().

00110 {
00111    //positionPtrBegin = 0;
00112    this->boxClosed(0);
00113 }

void Patch::positionsReady int  n = 0  ) 
 

Reimplemented in HomePatch.

Definition at line 133 of file Patch.C.

References _hasNewAtoms, avgPositionBox, avgPositionPtrBegin, ResizeArrayPrimIter< T >::begin(), ResizeArray< Elem >::begin(), boxesOpen, ComputeMap::compute(), ComputeIDListIter, DebugM, Flags::doMolly, ResizeArrayPrimIter< T >::end(), ResizeArray< Elem >::end(), Results::f, f, flags, Force, forceBox, Sync::holdComputes(), iINFO(), iout, j, PatchMap::node(), numAtoms, PatchMap::Object(), Sync::Object(), AtomMap::Object(), ComputeMap::Object(), OwnerBox< Owner, Data >::open(), p, patchID, Compute::patchReady(), pExt, positionBox, positionComputeList, AtomMap::registerIDs(), ResizeArray< Elem >::resize(), results, and Flags::sequence.

Referenced by HomePatch::positionsReady(), ProxyPatch::receiveAll(), and ProxyPatch::receiveData().

00134 {
00135    DebugM(4,"Patch::positionsReady() - patchID(" << patchID <<")"<<std::endl );
00136    ComputeMap *computeMap = ComputeMap::Object();
00137 
00138    if ( doneMigration ){
00139 // #ifdef REMOVE_PROXYDATAMSG_EXTRACOPY
00140 //       AtomMap::Object()->registerIDs(patchID,positionPtrBegin,positionPtrEnd);       
00141 // #else
00142        AtomMap::Object()->registerIDs(patchID,pExt.begin(),pExt.end());
00143 // #endif
00144    }
00145 
00146    boxesOpen = 2;
00147    if ( flags.doMolly ) boxesOpen++;
00148    _hasNewAtoms = (doneMigration != 0);
00149 
00150 #if CMK_BLUEGENEL
00151    CmiNetworkProgressAfter (0);
00152 #endif
00153 
00154    // Give all position pickup boxes access to positions
00155    //positionPtrBegin = p.begin();
00156 #ifdef REMOVE_PROXYDATAMSG_EXTRACOPY
00157    positionBox.open(positionPtrBegin);
00158 #else
00159    positionBox.open(p.begin());
00160 #endif
00161    if ( flags.doMolly ) {
00162      //avgPositionPtrBegin = p_avg.begin();
00163      avgPositionBox.open(avgPositionPtrBegin);
00164    }
00165 
00166 #if CMK_BLUEGENEL
00167    CmiNetworkProgressAfter (0);
00168 #endif
00169    
00170    // Give all force deposit boxes access to forces
00171    Force *forcePtr;
00172    for ( int j = 0; j < Results::maxNumForces; ++j )
00173     {
00174       f[j].resize(numAtoms);
00175       forcePtr = f[j].begin();
00176       memset (forcePtr, 0, sizeof (Force) * numAtoms);
00177       results.f[j] = forcePtr;
00178     }
00179    forceBox.open(&results);
00180 
00181    // Iterate over compute objects that need to be informed we are ready
00182    ComputeIDListIter cid(positionComputeList);
00183    // gzheng
00184    if (useSync) {
00185      if (Sync::Object()->holdComputes(patchID, cid, doneMigration))
00186        return;
00187    }
00188 
00189    int compute_count = 0;
00190    int seq = flags.sequence;
00191    for(cid = cid.begin(); cid != cid.end(); cid++)
00192    {
00193          compute_count++;
00194          computeMap->compute(*cid)->patchReady(patchID,doneMigration,seq);
00195    }
00196    if (compute_count == 0 && PatchMap::Object()->node(patchID) != CkMyPe()) {
00197        iout << iINFO << "PATCH_COUNT: Patch " << patchID 
00198             << " on PE " << CkMyPe() <<" home patch " 
00199             << PatchMap::Object()->node(patchID)
00200             << " does not have any computes\n" 
00201             << endi;
00202    }
00203 }

Box< Patch, CompAtom > * Patch::registerAvgPositionPickup ComputeID  cid,
int  trans = 13
 

Definition at line 77 of file Patch.C.

References avgPositionBox, and OwnerBox< Owner, Data >::checkOut().

Referenced by ComputeNonbondedSelf::initialize(), ComputeNonbondedPair::initialize(), PatchElem::PatchElem(), and TuplePatchElem::TuplePatchElem().

00078 {
00079    //DebugM(4, "registerAvgPositionPickup("<<patchID<<") from " << cid << "\n");
00080    return avgPositionBox.checkOut();
00081 }

Box< Patch, Results > * Patch::registerForceDeposit ComputeID  cid  ) 
 

Definition at line 90 of file Patch.C.

References SortedArray< Elem >::add(), OwnerBox< Owner, Data >::checkOut(), DebugM, forceBox, forceComputeList, and ResizeArray< Elem >::size().

Referenced by ComputePatchPair::initialize(), ComputePatch::initialize(), ComputeHomePatch::initialize(), PatchElem::PatchElem(), ComputeNonbondedCUDA::requirePatch(), and TuplePatchElem::TuplePatchElem().

00091 {
00092    if (forceComputeList.add(cid) < 0)
00093    {
00094      DebugM(7, "registerForceDeposit() failed for cid " << cid << std::endl);
00095      DebugM(7, "  size of forceCompueList " << forceComputeList.size() << std::endl);
00096      return NULL;
00097    }
00098    return forceBox.checkOut();
00099 }

Box< Patch, CompAtom > * Patch::registerPositionPickup ComputeID  cid,
int  trans = 13
 

Definition at line 58 of file Patch.C.

References SortedArray< Elem >::add(), OwnerBox< Owner, Data >::checkOut(), DebugM, positionBox, and positionComputeList.

Referenced by ComputePatchPair::initialize(), ComputePatch::initialize(), ComputeHomePatch::initialize(), PatchElem::PatchElem(), ComputeNonbondedCUDA::requirePatch(), and TuplePatchElem::TuplePatchElem().

00059 {
00060    //DebugM(4, "registerPositionPickupa("<<patchID<<") from " << cid << "\n");
00061    if (positionComputeList.add(cid) < 0)
00062    {
00063      DebugM(7, "registerPositionPickup() failed for cid " << cid << std::endl);
00064      return NULL;
00065    }
00066    return positionBox.checkOut();
00067 }

void Patch::setNumFixedAtoms int  numFixed  )  [inline]
 

Definition at line 63 of file Patch.h.

Referenced by PatchMgr::setHomePatchFixedAtomNum().

00063 { numFixedAtoms=numFixed; }  // not updated

void Patch::unregisterAvgPositionPickup ComputeID  cid,
Box< Patch, CompAtom > **const   box
 

Definition at line 83 of file Patch.C.

References avgPositionBox, OwnerBox< Owner, Data >::checkIn(), and DebugM.

Referenced by ComputeNonbondedPair::~ComputeNonbondedPair(), and ComputeNonbondedSelf::~ComputeNonbondedSelf().

00084 {
00085    DebugM(4, "UnregisterAvgPositionPickup from " << cid << "\n");
00086    avgPositionBox.checkIn(*box);
00087    *box = 0;
00088 }

void Patch::unregisterForceDeposit ComputeID  cid,
Box< Patch, Results > **const   box
 

Definition at line 101 of file Patch.C.

References OwnerBox< Owner, Data >::checkIn(), DebugM, SortedArray< Elem >::del(), forceBox, and forceComputeList.

Referenced by ComputeHomePatch::~ComputeHomePatch(), ComputePatch::~ComputePatch(), and ComputePatchPair::~ComputePatchPair().

00102 {
00103    DebugM(4, "unregisterForceDeposit() computeID("<<cid<<")"<<std::endl);
00104    forceComputeList.del(cid);
00105    forceBox.checkIn(*box);
00106    *box = 0;
00107 }

void Patch::unregisterPositionPickup ComputeID  cid,
Box< Patch, CompAtom > **const   box
 

Definition at line 69 of file Patch.C.

References OwnerBox< Owner, Data >::checkIn(), DebugM, SortedArray< Elem >::del(), positionBox, and positionComputeList.

Referenced by ComputeHomePatch::~ComputeHomePatch(), ComputePatch::~ComputePatch(), and ComputePatchPair::~ComputePatchPair().

00070 {
00071    DebugM(4, "UnregisterPositionPickup from " << cid << "\n");
00072    positionComputeList.del(cid);
00073    positionBox.checkIn(*box);
00074    *box = 0;
00075 }


Member Data Documentation

int Patch::_hasNewAtoms [protected]
 

Definition at line 121 of file Patch.h.

Referenced by positionsReady().

OwnerBox<Patch,CompAtom> Patch::avgPositionBox [protected]
 

Definition at line 113 of file Patch.h.

Referenced by positionsReady(), registerAvgPositionPickup(), and unregisterAvgPositionPickup().

ComputeIDList Patch::avgPositionComputeList [protected]
 

Definition at line 114 of file Patch.h.

CompAtom* Patch::avgPositionPtrBegin [protected]
 

Definition at line 105 of file Patch.h.

Referenced by avgPositionBoxClosed(), and positionsReady().

CompAtom* Patch::avgPositionPtrEnd [protected]
 

Definition at line 106 of file Patch.h.

int Patch::boxesOpen [protected]
 

Definition at line 119 of file Patch.h.

Referenced by positionsReady().

ForceList Patch::f[Results::maxNumForces] [protected]
 

Definition at line 108 of file Patch.h.

Referenced by Sequencer::minimizeMoveDownhill(), Sequencer::newMinimizeDirection(), positionsReady(), Sequencer::runComputeObjects(), ComputeGlobal::saveTotalForces(), Sequencer::submitMinimizeReductions(), and Sequencer::submitReductions().

Flags Patch::flags
 

Definition at line 70 of file Patch.h.

Referenced by ExclElem::computeForce(), ComputeStir::doForce(), ComputeRestraints::doForce(), ComputeNonbondedSelf::doForce(), ComputeNonbondedPair::doForce(), ComputeEField::doForce(), ComputeNonbondedCUDA::doWork(), Sync::holdComputes(), Sequencer::integrate(), Sequencer::minimize(), ComputeNonbondedPair::noWork(), positionsReady(), and Sequencer::runComputeObjects().

OwnerBox<Patch,Results> Patch::forceBox [protected]
 

Definition at line 115 of file Patch.h.

Referenced by positionsReady(), registerForceDeposit(), and unregisterForceDeposit().

ComputeIDList Patch::forceComputeList [protected]
 

Definition at line 116 of file Patch.h.

Referenced by registerForceDeposit(), and unregisterForceDeposit().

Lattice& Patch::lattice
 

Definition at line 69 of file Patch.h.

Referenced by Sequencer::berendsenPressure(), ExclElem::computeForce(), ImproperElem::computeForce(), DihedralElem::computeForce(), CrosstermElem::computeForce(), BondElem::computeForce(), AngleElem::computeForce(), ComputeStir::doForce(), ComputeRestraints::doForce(), ComputeNonbondedSelf::doForce(), ComputeNonbondedPair::doForce(), ComputeGridForce::doForce(), ComputeEField::doForce(), ComputeConsTorque::doForce(), ComputeConsForce::doForce(), ComputeGridForce::finishForce(), Sequencer::langevinPiston(), PatchMgr::moveAllBy(), PatchMgr::moveAtom(), Patch(), PatchMgr::setLattice(), Sequencer::submitCollections(), Sequencer::submitHalfstep(), and Sequencer::submitReductions().

int Patch::numAtoms [protected]
 

Definition at line 75 of file Patch.h.

Referenced by Sequencer::addMovDragToPosition(), Sequencer::addRotDragToPosition(), Sequencer::berendsenPressure(), Sequencer::correctMomentum(), Sequencer::langevinPiston(), Sequencer::langevinVelocities(), Sequencer::langevinVelocitiesBBK1(), Sequencer::langevinVelocitiesBBK2(), Sequencer::maximumMove(), Sequencer::minimizationQuenchVelocity(), Sequencer::minimizeMoveDownhill(), Sequencer::newMinimizeDirection(), Sequencer::newMinimizePosition(), positionsReady(), Sequencer::quenchVelocities(), Sequencer::reassignVelocities(), Sequencer::reinitVelocities(), Sequencer::reloadCharges(), Sequencer::rescaleVelocities(), Sequencer::rescaleVelocitiesByFactor(), Sequencer::runComputeObjects(), ComputeGlobal::saveTotalForces(), Sequencer::submitHalfstep(), Sequencer::submitMinimizeReductions(), Sequencer::submitMomentum(), Sequencer::submitReductions(), and Sequencer::tcoupleVelocities().

int Patch::numFixedAtoms [protected]
 

Definition at line 76 of file Patch.h.

CompAtomList Patch::p [protected]
 

Definition at line 77 of file Patch.h.

Referenced by ComputeGridForce::doWork(), and positionsReady().

CompAtomList Patch::p_avg [protected]
 

Definition at line 78 of file Patch.h.

const PatchID Patch::patchID [protected]
 

Definition at line 74 of file Patch.h.

Referenced by forceBoxClosed(), and positionsReady().

CompAtomExtList Patch::pExt [protected]
 

Definition at line 88 of file Patch.h.

Referenced by positionsReady().

OwnerBox<Patch,CompAtom> Patch::positionBox [protected]
 

Definition at line 111 of file Patch.h.

Referenced by positionsReady(), registerPositionPickup(), and unregisterPositionPickup().

ComputeIDList Patch::positionComputeList [protected]
 

Definition at line 112 of file Patch.h.

Referenced by positionsReady(), registerPositionPickup(), and unregisterPositionPickup().

Results Patch::results [protected]
 

Definition at line 109 of file Patch.h.

Referenced by forceBoxClosed(), and positionsReady().


The documentation for this class was generated from the following files:
Generated on Mon Nov 23 05:00:04 2009 for NAMD by  doxygen 1.3.9.1