ComputeHomePatch Class Reference

#include <ComputeHomePatch.h>

Inheritance diagram for ComputeHomePatch:

Compute ComputeConsForce ComputeConsTorque ComputeCylindricalBC ComputeEField ComputeGridForce ComputeRestraints ComputeSphericalBC 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

Detailed Description

Definition at line 25 of file ComputeHomePatch.h.


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 Compute::cid, 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(this,
00037          &positionBox);
00038     }
00039     if (forceBox != NULL) {
00040       PatchMap::Object()->patch(patchID)->unregisterForceDeposit(this,
00041                 &forceBox);
00042     }
00043 }


Member Function Documentation

void ComputeHomePatch::atomUpdate (  )  [virtual]

Reimplemented from Compute.

Definition at line 70 of file ComputeHomePatch.C.

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

00070                                   {
00071     // How can we tell if BoxOwner has packed up and left?  Need a mechanism
00072     // to handle this or do we assume the Boxes have been dumped?
00073     numAtoms = patch->getNumAtoms();
00074 }

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

Implemented in ComputeConsForce, ComputeConsTorque, ComputeCylindricalBC, ComputeEField, ComputeGridForce, ComputeRestraints, ComputeSphericalBC, and ComputeStir.

Referenced by doWork().

void ComputeHomePatch::doWork (  )  [virtual]

Reimplemented from Compute.

Definition at line 76 of file ComputeHomePatch.C.

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

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

void ComputeHomePatch::initialize (  )  [virtual]

Reimplemented from Compute.

Definition at line 45 of file ComputeHomePatch.C.

References Compute::basePriority, Compute::cid, COMPUTE_HOME_PRIORITY, DebugM, Patch::getNumAtoms(), Patch::getPatchID(), homePatch, Compute::initialize(), NAMD_bug(), numAtoms, PatchMap::Object(), 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(this);
00058             forceBox = patch->registerForceDeposit(this);
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     basePriority = COMPUTE_HOME_PRIORITY + PATCH_PRIORITY(patchID);
00068 }


Member Data Documentation

HomePatch* ComputeHomePatch::homePatch [protected]

Definition at line 39 of file ComputeHomePatch.h.

Referenced by ComputeHomePatch(), ComputeGridForce::do_calc(), ComputeStir::doForce(), ComputeGridForce::doForce(), ComputeEField::doForce(), ComputeConsTorque::doForce(), ComputeConsForce::doForce(), doWork(), and initialize().

int ComputeHomePatch::numAtoms [protected]

Definition at line 36 of file ComputeHomePatch.h.

Referenced by atomUpdate(), ComputeStir::doForce(), ComputeSphericalBC::doForce(), ComputeRestraints::doForce(), ComputeGridForce::doForce(), ComputeEField::doForce(), ComputeCylindricalBC::doForce(), ComputeConsTorque::doForce(), ComputeConsForce::doForce(), initialize(), and ~ComputeHomePatch().

Patch* ComputeHomePatch::patch [protected]

Definition at line 38 of file ComputeHomePatch.h.

Referenced by atomUpdate(), ComputeHomePatch(), ComputeStir::doForce(), ComputeRestraints::doForce(), ComputeEField::doForce(), and initialize().


The documentation for this class was generated from the following files:
Generated on Sat Sep 23 01:17:18 2017 for NAMD by  doxygen 1.4.7