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

ComputeHomePatch Class Reference

#include <ComputeHomePatch.h>

Inheritance diagram for ComputeHomePatch:

Compute ComputeConsForce ComputeConsTorque ComputeEField ComputeStir List of all members.

Public Member Functions

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

Protected Member Functions

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

Protected Attributes

int numAtoms
Patchpatch
HomePatchhomePatch

Constructor & Destructor Documentation

ComputeHomePatch::ComputeHomePatch ComputeID  c,
PatchID  pid
 

Definition at line 23 of file ComputeHomePatch.C.

References homePatch, patch, and Compute::setNumPatches().

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

ComputeHomePatch::~ComputeHomePatch  )  [virtual]
 

Definition at line 32 of file ComputeHomePatch.C.

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

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


Member Function Documentation

void ComputeHomePatch::atomUpdate  )  [virtual]
 

Reimplemented from Compute.

Definition at line 77 of file ComputeHomePatch.C.

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

00077                                   {
00078     // How can we tell if BoxOwner has packed up and left?  Need a mechanism
00079     // to handle this or do we assume the Boxes have been dumped?
00080     numAtoms = patch->getNumAtoms();
00081 }

virtual void ComputeHomePatch::doForce FullAtom p,
Results r
[protected, pure virtual]
 

Implemented in ComputeConsForce, ComputeConsTorque, ComputeEField, and ComputeStir.

Referenced by doWork().

void ComputeHomePatch::doWork  )  [virtual]
 

Reimplemented from Compute.

Definition at line 83 of file ComputeHomePatch.C.

References ResizeArray< Elem >::begin(), Box< Owner, Data >::close(), DebugM, doForce(), HomePatch::getAtomList(), homePatch, and Box< Owner, Data >::open().

00083                               {
00084   CompAtom* p;
00085   Results* r;
00086   FullAtom* a = homePatch->getAtomList().begin();
00087 
00088   DebugM(3,patchID << ": doWork() called.\n");
00089 
00090   // Open up positionBox, forceBox, and atomBox
00091   p = positionBox->open();
00092   r = forceBox->open();
00093 
00094   // Pass pointers to doForce
00095   doForce(a,r);
00096 
00097   // Close up boxes
00098   positionBox->close(&p);
00099   forceBox->close(&r);
00100 
00101   DebugM(2,patchID << ": doWork() completed.\n");
00102 }

void ComputeHomePatch::initialize  )  [virtual]
 

Reimplemented from Compute.

Definition at line 45 of file ComputeHomePatch.C.

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

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


Member Data Documentation

HomePatch* ComputeHomePatch::homePatch [protected]
 

Definition at line 39 of file ComputeHomePatch.h.

Referenced by ComputeHomePatch(), doWork(), and initialize().

int ComputeHomePatch::numAtoms [protected]
 

Definition at line 36 of file ComputeHomePatch.h.

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

Patch* ComputeHomePatch::patch [protected]
 

Definition at line 38 of file ComputeHomePatch.h.

Referenced by atomUpdate(), ComputeHomePatch(), and initialize().


The documentation for this class was generated from the following files:
Generated on Tue Nov 24 04:07:49 2009 for NAMD by  doxygen 1.3.9.1