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

ComputePatch Class Reference

#include <ComputePatch.h>

Inheritance diagram for ComputePatch:

Compute ComputeCylindricalBC ComputeNonbondedSelf ComputeRestraints ComputeSphericalBC List of all members.

Public Member Functions

 ComputePatch (ComputeID c, PatchID pid)
virtual ~ComputePatch ()
virtual void initialize ()
virtual void atomUpdate ()
virtual void doWork ()

Protected Member Functions

virtual void doForce (CompAtom *p, Results *r)=0

Protected Attributes

int numAtoms
Patchpatch

Constructor & Destructor Documentation

ComputePatch::ComputePatch ComputeID  c,
PatchID  pid
 

Definition at line 22 of file ComputePatch.C.

References patch, and Compute::setNumPatches().

00022                                                  : Compute(c) {
00023     setNumPatches(1);
00024     patchID = p;
00025     patch = NULL;
00026     positionBox = NULL;
00027     forceBox = NULL;
00028 }

ComputePatch::~ComputePatch  )  [virtual]
 

Definition at line 30 of file ComputePatch.C.

References DebugM, numAtoms, PatchMap::Object(), PatchMap::patch(), Patch::unregisterForceDeposit(), and Patch::unregisterPositionPickup().

00030                             {
00031   DebugM(4, "~ComputePatch("<<cid<<") numAtoms("<<patchID<<") = " 
00032     << numAtoms << "\n");
00033     if (positionBox != NULL) {
00034       PatchMap::Object()->patch(patchID)->unregisterPositionPickup(cid,
00035          &positionBox);
00036     }
00037     if (forceBox != NULL) {
00038       PatchMap::Object()->patch(patchID)->unregisterForceDeposit(cid,
00039                 &forceBox);
00040     }
00041 }


Member Function Documentation

void ComputePatch::atomUpdate  )  [virtual]
 

Reimplemented from Compute.

Definition at line 72 of file ComputePatch.C.

References Patch::getNumAtoms(), numAtoms, and patch.

00072                               {
00073     // How can we tell if BoxOwner has packed up and left?  Need a mechanism
00074     // to handle this or do we assume the Boxes have been dumped?
00075     numAtoms = patch->getNumAtoms();
00076 
00077     // DMK - Atom Separation (water vs. non-water)
00078     #if NAMD_SeparateWaters != 0
00079       numWaterAtoms = patch->getNumWaterAtoms();
00080     #endif
00081 }

virtual void ComputePatch::doForce CompAtom p,
Results r
[protected, pure virtual]
 

Implemented in ComputeCylindricalBC, ComputeNonbondedSelf, ComputeRestraints, and ComputeSphericalBC.

Referenced by doWork().

void ComputePatch::doWork  )  [virtual]
 

Reimplemented from Compute.

Definition at line 83 of file ComputePatch.C.

References Box< Owner, Data >::close(), DebugM, doForce(), Box< Owner, Data >::open(), and patch.

00083                           {
00084   CompAtom* p;
00085   Results* r;
00086 
00087   DebugM(3,patchID << ": doWork() called.\n");
00088 
00089   // Open up positionBox, forceBox
00090   p = positionBox->open();
00091   r = forceBox->open();
00092 
00093   // Pass pointers to doForce
00094 #ifdef MEM_OPT_VERSION
00095   doForce(p, patch->getCompAtomExtInfo(), r);
00096 #else
00097   doForce(p,r);
00098 #endif
00099 
00100   // Close up boxes
00101   positionBox->close(&p);
00102   forceBox->close(&r);
00103 
00104   DebugM(2,patchID << ": doWork() completed.\n");
00105 }

void ComputePatch::initialize  )  [virtual]
 

Reimplemented from Compute.

Reimplemented in ComputeNonbondedSelf.

Definition at line 43 of file ComputePatch.C.

References COMPUTE_HOME_PRIORITY, COMPUTE_PROXY_PRIORITY, DebugM, Patch::getNumAtoms(), Patch::getPatchID(), Compute::initialize(), NAMD_bug(), PatchMap::node(), numAtoms, PatchMap::Object(), PatchMap::patch(), patch, PATCH_PRIORITY, Patch::registerForceDeposit(), and Patch::registerPositionPickup().

Referenced by ComputeNonbondedSelf::initialize().

00043                               {
00044     // How can we tell if BoxOwner has packed up and left?  Need a mechanism
00045     // to handle this or do we assume the Boxes have been dumped?
00046 
00047         if (positionBox == NULL) { // We have yet to get boxes
00048             if (!(patch = PatchMap::Object()->patch(patchID))) {
00049               NAMD_bug("ComputePatch used with unknown patch.");
00050             }
00051             DebugM(3, "initialize(" << cid <<")  patchid = "<<patch->getPatchID()<<"\n");
00052             positionBox = patch->registerPositionPickup(cid);
00053             forceBox = patch->registerForceDeposit(cid);
00054         }
00055         numAtoms = patch->getNumAtoms();
00056 
00057   DebugM(3, "initialize("<<cid<<") numAtoms("<<patchID<<") = " 
00058     << numAtoms  << " patchAddr=" << patch << "\n");
00059     Compute::initialize();
00060 
00061     int myNode = CkMyPe();
00062     if ( PatchMap::Object()->node(patchID) != myNode )
00063     {
00064       basePriority = COMPUTE_PROXY_PRIORITY + PATCH_PRIORITY(patchID);
00065     }
00066     else
00067     {
00068       basePriority = COMPUTE_HOME_PRIORITY + PATCH_PRIORITY(patchID);
00069     }
00070 }


Member Data Documentation

int ComputePatch::numAtoms [protected]
 

Definition at line 35 of file ComputePatch.h.

Referenced by atomUpdate(), initialize(), and ~ComputePatch().

Patch* ComputePatch::patch [protected]
 

Definition at line 47 of file ComputePatch.h.

Referenced by atomUpdate(), ComputePatch(), doWork(), and initialize().


The documentation for this class was generated from the following files:
Generated on Fri Sep 5 04:07:17 2008 for NAMD by  doxygen 1.3.9.1