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

ComputePatchPair Class Reference

#include <ComputePatchPair.h>

Inheritance diagram for ComputePatchPair:

Compute ComputeNonbondedPair List of all members.

Public Member Functions

 ComputePatchPair (ComputeID c, PatchID pid[], int t[])
virtual ~ComputePatchPair ()
virtual void initialize ()
virtual void atomUpdate ()
virtual void doWork ()

Protected Member Functions

virtual void doForce (CompAtom *p[2], CompAtomExt *pExt[2], Results *r[2])

Protected Attributes

int numAtoms [2]
Patchpatch [2]
PatchID patchID [2]
int trans [2]
Box< Patch, CompAtom > * positionBox [2]
Box< Patch, Results > * forceBox [2]

Constructor & Destructor Documentation

ComputePatchPair::ComputePatchPair ComputeID  c,
PatchID  pid[],
int  t[]
 

Definition at line 18 of file ComputePatchPair.C.

References forceBox, patch, patchID, positionBox, Compute::setNumPatches(), and trans.

00019     : Compute(c) {
00020 
00021   setNumPatches(2);
00022 
00023   for (int i=0; i<2; i++) {
00024       patchID[i] = p[i];
00025       trans[i] = t[i];
00026       patch[i] = NULL;
00027       positionBox[i] = NULL;
00028       forceBox[i] = NULL;
00029   }
00030 }

ComputePatchPair::~ComputePatchPair  )  [virtual]
 

Definition at line 32 of file ComputePatchPair.C.

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

00032                                     {
00033   DebugM(4, "~ComputePatchPair("<<cid<<") numAtoms("<<patchID[0]<<") = " 
00034     << numAtoms[0] 
00035     << " numAtoms("<<patchID[1]<<") = " << numAtoms[1] << "\n" );
00036   DebugM(4, "~ComputePatchPair("<<cid<<") addr("<<patchID[0]<<") = " 
00037     << PatchMap::Object()->patch(patchID[0]) << " addr("<<patchID[1]<<") = "
00038     << PatchMap::Object()->patch(patchID[1]) << "\n");
00039   for (int i=0; i<2; i++) {
00040     if (positionBox[i] != NULL) {
00041       PatchMap::Object()->patch(patchID[i])->unregisterPositionPickup(cid,
00042          &positionBox[i]);
00043     }
00044     if (forceBox[i] != NULL) {
00045       PatchMap::Object()->patch(patchID[i])->unregisterForceDeposit(cid,
00046                 &forceBox[i]);
00047     }
00048   }
00049 
00050 }


Member Function Documentation

void ComputePatchPair::atomUpdate  )  [virtual]
 

Reimplemented from Compute.

Definition at line 92 of file ComputePatchPair.C.

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

00092                                   {
00093     // How can we tell if BoxOwner has packed up and left?  Need a mechanism
00094     // to handle this or do we assume the Boxes have been dumped?
00095 
00096     // DebugM(4,"atomUpdate() - positionBox[0] is " << positionBox[0] << "\n");
00097     for (int i=0; i<2; i++) {
00098 
00099         numAtoms[i] = patch[i]->getNumAtoms();
00100 
00101         // DMK - Atom Separation (water vs. non-water)
00102         #if NAMD_SeparateWaters != 0
00103           numWaterAtoms[i] = patch[i]->getNumWaterAtoms();
00104         #endif
00105     }
00106 
00107 
00108 
00109     // Compute::atomUpdate();
00110 }

void ComputePatchPair::doForce CompAtom p[2],
CompAtomExt pExt[2],
Results r[2]
[protected, virtual]
 

Reimplemented in ComputeNonbondedPair.

Definition at line 113 of file ComputePatchPair.C.

References numAtoms.

Referenced by doWork().

00114 {
00115     CkPrintf("ComputePatchPair::doForce() - Dummy eval was sent\n");
00116     CkPrintf(" %d patch 1 atoms and %d patch 2 atoms\n", numAtoms[0], numAtoms[1] );
00117 }

void ComputePatchPair::doWork  )  [virtual]
 

Reimplemented from Compute.

Definition at line 123 of file ComputePatchPair.C.

References Box< Owner, Data >::close(), doForce(), forceBox, Patch::getCompAtomExtInfo(), Box< Owner, Data >::open(), patch, and positionBox.

00123                               {
00124   CompAtom* p[2];
00125   Results* r[2];
00126   int i;
00127 
00128   // Open up positionBox, forceBox, and atomBox
00129   for (i=0; i<2; i++) {
00130       p[i] = positionBox[i]->open();
00131       r[i] = forceBox[i]->open();
00132   }
00133 
00134   // Pass pointers to doForce
00135 
00136   //Just for debugging
00137 /*
00138   Patch *patch0 = positionBox[0]->getOwner();
00139   Patch *patch1 = positionBox[1]->getOwner();
00140   CmiAssert(patch0 == patch[0]);
00141   CmiAssert(patch1 == patch[1]);
00142 */
00143 
00144   CompAtomExt *pExt[2];
00145   pExt[0] = patch[0]->getCompAtomExtInfo();
00146   pExt[1] = patch[1]->getCompAtomExtInfo();
00147   doForce(p, pExt, r);
00148 
00149   // Close up boxes
00150   for (i=0; i<2; i++) {
00151       positionBox[i]->close(&p[i]);
00152       forceBox[i]->close(&r[i]);
00153   }
00154 }

void ComputePatchPair::initialize  )  [virtual]
 

Reimplemented from Compute.

Reimplemented in ComputeNonbondedPair.

Definition at line 52 of file ComputePatchPair.C.

References DebugM, forceBox, Patch::getNumAtoms(), Compute::initialize(), PatchMap::node(), numAtoms, PatchMap::Object(), PatchMap::patch(), patch, PATCH_PRIORITY, patchID, positionBox, Patch::registerForceDeposit(), Patch::registerPositionPickup(), and trans.

Referenced by ComputeNonbondedPair::initialize().

00052                                   {
00053     // How can we tell if BoxOwner has packed up and left?  Need a mechanism
00054     // to handle this or do we assume the Boxes have been dumped?
00055 
00056     for (int i=0; i<2; i++) {
00057         if (positionBox[i] == NULL) { // We have yet to get boxes
00058             if (!(patch[i] = PatchMap::Object()->patch(patchID[i]))) {
00059               DebugM(5,"invalid patch(" << patchID[i] 
00060                    << ")  pointer!\n");
00061             }
00062             positionBox[i] = patch[i]->registerPositionPickup(cid,trans[i]);
00063             forceBox[i] = patch[i]->registerForceDeposit(cid);
00064         }
00065         numAtoms[i] = patch[i]->getNumAtoms();
00066     }
00067 
00068   DebugM(4, "initialize("<<cid<<") numAtoms("<<patchID[0]<<") = " 
00069     << numAtoms[0] 
00070     << " numAtoms(" <<patchID[1]<<") = " << numAtoms[1] << "\n" );
00071 
00072     Compute::initialize();
00073 
00074     // proxies are more urgent (lower priority) than patches
00075     int myNode = CkMyPe();
00076     int p0 = PATCH_PRIORITY(patchID[0]);
00077     if ( PatchMap::Object()->node(patchID[0]) == myNode ) {
00078       p0 += COMPUTE_HOME_PRIORITY;
00079     } else {
00080       p0 += COMPUTE_PROXY_PRIORITY;
00081     }
00082     int p1 = PATCH_PRIORITY(patchID[1]);
00083     if ( PatchMap::Object()->node(patchID[1]) == myNode ) {
00084       p1 += COMPUTE_HOME_PRIORITY;
00085     } else {
00086       p1 += COMPUTE_PROXY_PRIORITY;
00087     }
00088     basePriority = ((p0<p1)?p0:p1);   // most urgent wins
00089 
00090 }


Member Data Documentation

Box<Patch,Results>* ComputePatchPair::forceBox[2] [protected]
 

Definition at line 50 of file ComputePatchPair.h.

Referenced by ComputePatchPair(), doWork(), initialize(), and ~ComputePatchPair().

int ComputePatchPair::numAtoms[2] [protected]
 

Definition at line 36 of file ComputePatchPair.h.

Referenced by atomUpdate(), doForce(), initialize(), and ~ComputePatchPair().

Patch* ComputePatchPair::patch[2] [protected]
 

Definition at line 44 of file ComputePatchPair.h.

Referenced by atomUpdate(), ComputePatchPair(), doWork(), initialize(), and ~ComputePatchPair().

PatchID ComputePatchPair::patchID[2] [protected]
 

Definition at line 47 of file ComputePatchPair.h.

Referenced by ComputePatchPair(), initialize(), and ~ComputePatchPair().

Box<Patch,CompAtom>* ComputePatchPair::positionBox[2] [protected]
 

Definition at line 49 of file ComputePatchPair.h.

Referenced by ComputePatchPair(), doWork(), initialize(), and ~ComputePatchPair().

int ComputePatchPair::trans[2] [protected]
 

Definition at line 48 of file ComputePatchPair.h.

Referenced by ComputePatchPair(), 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