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], 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],
Results r[2]
[protected, virtual]
 

Reimplemented in ComputeNonbondedPair.

Definition at line 116 of file ComputePatchPair.C.

Referenced by doWork().

00118 {
00119     CkPrintf("ComputePatchPair::doForce() - Dummy eval was sent\n");
00120     CkPrintf(" %d patch 1 atoms and %d patch 2 atoms\n", numAtoms[0], numAtoms[1] );
00121 }

void ComputePatchPair::doWork  )  [virtual]
 

Reimplemented from Compute.

Definition at line 127 of file ComputePatchPair.C.

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

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

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 54 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(), initialize(), and ~ComputePatchPair().

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

Definition at line 48 of file ComputePatchPair.h.

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

PatchID ComputePatchPair::patchID[2] [protected]
 

Definition at line 51 of file ComputePatchPair.h.

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

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

Definition at line 53 of file ComputePatchPair.h.

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

int ComputePatchPair::trans[2] [protected]
 

Definition at line 52 of file ComputePatchPair.h.

Referenced by ComputePatchPair(), and initialize().


The documentation for this class was generated from the following files:
Generated on Mon Oct 13 04:07:45 2008 for NAMD by  doxygen 1.3.9.1