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 ()

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
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   lattice = Node::Object()->simParameters->lattice;
00046 }

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 115 of file Patch.C.

References avgPositionPtrBegin, and boxClosed().

00116 {
00117    avgPositionPtrBegin = 0;
00118    this->boxClosed(3);
00119 }

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 105 of file Patch.C.

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

00106 {
00107    DebugM(4, "patchID("<<patchID<<") forceBoxClosed! call\n");
00108    for (int j = 0; j < Results::maxNumForces; ++j )
00109    {
00110      results.f[j] = 0;
00111    }
00112    this->boxClosed(1);
00113 }

int Patch::getNumAtoms  )  [inline]
 

Definition at line 55 of file Patch.h.

Referenced by WorkDistrib::assignNodeToPatch(), ComputePatchPair::atomUpdate(), ComputePatch::atomUpdate(), ComputeHomePatch::atomUpdate(), dumpbench(), ComputePatchPair::initialize(), ComputePatch::initialize(), ComputeHomePatch::initialize(), ComputeHomeTuples< BondElem, Bond, BondValue >::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 99 of file Patch.C.

References boxClosed().

00100 {
00101    //positionPtrBegin = 0;
00102    this->boxClosed(0);
00103 }

void Patch::positionsReady int  n = 0  ) 
 

Reimplemented in HomePatch.

Definition at line 123 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, PatchMap::node(), numAtoms, PatchMap::Object(), Sync::Object(), AtomMap::Object(), ComputeMap::Object(), OwnerBox< Owner, Data >::open(), p, patchID, Compute::patchReady(), positionBox, positionComputeList, AtomMap::registerIDs(), ResizeArray< Elem >::resize(), results, and Flags::sequence.

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

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

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

Definition at line 67 of file Patch.C.

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

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

00068 {
00069    //DebugM(4, "registerAvgPositionPickup("<<patchID<<") from " << cid << "\n");
00070    return avgPositionBox.checkOut();
00071 }

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

Definition at line 80 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(), and TuplePatchElem::TuplePatchElem().

00081 {
00082    if (forceComputeList.add(cid) < 0)
00083    {
00084      DebugM(7, "registerForceDeposit() failed for cid " << cid << std::endl);
00085      DebugM(7, "  size of forceCompueList " << forceComputeList.size() << std::endl);
00086      return NULL;
00087    }
00088    return forceBox.checkOut();
00089 }

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

Definition at line 48 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(), and TuplePatchElem::TuplePatchElem().

00049 {
00050    //DebugM(4, "registerPositionPickupa("<<patchID<<") from " << cid << "\n");
00051    if (positionComputeList.add(cid) < 0)
00052    {
00053      DebugM(7, "registerPositionPickup() failed for cid " << cid << std::endl);
00054      return NULL;
00055    }
00056    return positionBox.checkOut();
00057 }

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 73 of file Patch.C.

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

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

00074 {
00075    DebugM(4, "UnregisterAvgPositionPickup from " << cid << "\n");
00076    avgPositionBox.checkIn(*box);
00077    *box = 0;
00078 }

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

Definition at line 91 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().

00092 {
00093    DebugM(4, "unregisterForceDeposit() computeID("<<cid<<")"<<std::endl);
00094    forceComputeList.del(cid);
00095    forceBox.checkIn(*box);
00096    *box = 0;
00097 }

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

Definition at line 59 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().

00060 {
00061    DebugM(4, "UnregisterPositionPickup from " << cid << "\n");
00062    positionComputeList.del(cid);
00063    positionBox.checkIn(*box);
00064    *box = 0;
00065 }


Member Data Documentation

int Patch::_hasNewAtoms [protected]
 

Definition at line 125 of file Patch.h.

Referenced by positionsReady().

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

Definition at line 117 of file Patch.h.

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

ComputeIDList Patch::avgPositionComputeList [protected]
 

Definition at line 118 of file Patch.h.

CompAtom* Patch::avgPositionPtrBegin [protected]
 

Definition at line 109 of file Patch.h.

Referenced by avgPositionBoxClosed(), and positionsReady().

CompAtom* Patch::avgPositionPtrEnd [protected]
 

Definition at line 110 of file Patch.h.

int Patch::boxesOpen [protected]
 

Definition at line 123 of file Patch.h.

Referenced by positionsReady().

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

Definition at line 112 of file Patch.h.

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

Flags Patch::flags
 

Definition at line 72 of file Patch.h.

Referenced by ComputeStir::doForce(), ComputeEField::doForce(), Sync::holdComputes(), Sequencer::integrate(), Sequencer::minimize(), ComputeNonbondedPair::noWork(), positionsReady(), and Sequencer::runComputeObjects().

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

Definition at line 119 of file Patch.h.

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

ComputeIDList Patch::forceComputeList [protected]
 

Definition at line 120 of file Patch.h.

Referenced by registerForceDeposit(), and unregisterForceDeposit().

Lattice& Patch::lattice
 

Definition at line 71 of file Patch.h.

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

int Patch::numAtoms [protected]
 

Definition at line 77 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::newMinimizeDirection(), Sequencer::newMinimizePosition(), positionsReady(), Sequencer::quenchVelocities(), Sequencer::reassignVelocities(), Sequencer::reinitVelocities(), Sequencer::reloadCharges(), Sequencer::rescaleVelocities(), Sequencer::rescaleVelocitiesByFactor(), ComputeGlobal::saveTotalForces(), Sequencer::submitHalfstep(), Sequencer::submitMinimizeReductions(), Sequencer::submitMomentum(), Sequencer::submitReductions(), and Sequencer::tcoupleVelocities().

int Patch::numFixedAtoms [protected]
 

Definition at line 78 of file Patch.h.

CompAtomList Patch::p [protected]
 

Definition at line 79 of file Patch.h.

Referenced by positionsReady().

CompAtomList Patch::p_avg [protected]
 

Definition at line 80 of file Patch.h.

const PatchID Patch::patchID [protected]
 

Definition at line 76 of file Patch.h.

Referenced by forceBoxClosed(), and positionsReady().

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

Definition at line 115 of file Patch.h.

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

ComputeIDList Patch::positionComputeList [protected]
 

Definition at line 116 of file Patch.h.

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

Results Patch::results [protected]
 

Definition at line 113 of file Patch.h.

Referenced by forceBoxClosed(), and positionsReady().


The documentation for this class was generated from the following files:
Generated on Sun Jul 6 04:07:47 2008 for NAMD by  doxygen 1.3.9.1