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]
CompAtomExtpExt [2]
CompAtomp [2]
Resultsr [2]
Patchpatch [2]
PatchID patchID [2]
int trans [2]
Box< Patch, CompAtom > * positionBox [2]
Box< Patch, Results > * forceBox [2]

Detailed Description

Definition at line 25 of file ComputePatchPair.h.


Constructor & Destructor Documentation

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

Definition at line 20 of file ComputePatchPair.C.

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

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

ComputePatchPair::~ComputePatchPair (  )  [virtual]

Definition at line 35 of file ComputePatchPair.C.

References Compute::cid, DebugM, forceBox, numAtoms, PatchMap::Object(), patch, patchID, and positionBox.

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


Member Function Documentation

void ComputePatchPair::atomUpdate (  )  [virtual]

Reimplemented from Compute.

Definition at line 116 of file ComputePatchPair.C.

References numAtoms, and patch.

00116                                   {
00117     // How can we tell if BoxOwner has packed up and left?  Need a mechanism
00118     // to handle this or do we assume the Boxes have been dumped?
00119 
00120     // DebugM(4,"atomUpdate() - positionBox[0] is " << positionBox[0] << "\n");
00121     for (int i=0; i<2; i++) {
00122 
00123         numAtoms[i] = patch[i]->getNumAtoms();
00124 
00125         // DMK - Atom Separation (water vs. non-water)
00126         #if NAMD_SeparateWaters != 0
00127           numWaterAtoms[i] = patch[i]->getNumWaterAtoms();
00128         #endif
00129     }
00130 
00131 
00132 
00133     // Compute::atomUpdate();
00134 }

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

Reimplemented in ComputeNonbondedPair.

Definition at line 137 of file ComputePatchPair.C.

References numAtoms.

Referenced by doWork().

00138 {
00139     CkPrintf("ComputePatchPair::doForce() - Dummy eval was sent\n");
00140     CkPrintf(" %d patch 1 atoms and %d patch 2 atoms\n", numAtoms[0], numAtoms[1] );
00141 }

void ComputePatchPair::doWork (  )  [virtual]

Reimplemented from Compute.

Definition at line 147 of file ComputePatchPair.C.

References Box< Owner, Data >::close(), computeNonbondedPairType, Compute::computeType, doForce(), LdbCoordinator::endWork(), forceBox, Compute::gbisPhase, Patch::getCompAtomExtInfo(), Compute::ldObjHandle, LdbCoordinator::Object(), Box< Owner, Data >::open(), p, patch, LdbCoordinator::pauseWork(), pExt, positionBox, r, and LdbCoordinator::startWork().

00147                               {
00148 
00149 #ifndef NAMD_CUDA
00150   LdbCoordinator::Object()->startWork(ldObjHandle);
00151 #endif
00152   if ( ( computeType != computeNonbondedPairType ) ||
00153         (!patch[0]->flags.doGBIS || gbisPhase == 1) ) {
00154     // Open up positionBox, forceBox, and atomBox
00155     for (int i=0; i<2; i++) {
00156       p[i] = positionBox[i]->open();
00157       r[i] = forceBox[i]->open();
00158       pExt[i] = patch[i]->getCompAtomExtInfo();
00159     }
00160   }
00161 
00162   doForce(p, pExt, r);
00163  // Inform load balancer
00164 #ifndef NAMD_CUDA
00165   if (patch[0]->flags.doGBIS && (gbisPhase == 1 || gbisPhase == 2)) {
00166     LdbCoordinator::Object()->pauseWork(ldObjHandle);
00167   } else {
00168     LdbCoordinator::Object()->endWork(ldObjHandle);
00169   }
00170 #endif
00171 
00172   // Close up boxes
00173   if ( ( computeType != computeNonbondedPairType ) ||
00174       (!patch[0]->flags.doGBIS || gbisPhase == 3) ) {
00175     for (int i=0; i<2; i++) {
00176       positionBox[i]->close(&p[i]);
00177       forceBox[i]->close(&r[i]);
00178     }
00179   }
00180 
00181 }

void ComputePatchPair::initialize (  )  [virtual]

Reimplemented from Compute.

Reimplemented in ComputeNonbondedPair.

Definition at line 55 of file ComputePatchPair.C.

References Compute::basePriority, Compute::cid, COMPUTE_HOME_PRIORITY, COMPUTE_PROXY_PRIORITY, DebugM, forceBox, GB1_COMPUTE_HOME_PRIORITY, GB1_COMPUTE_PROXY_PRIORITY, GB2_COMPUTE_HOME_PRIORITY, GB2_COMPUTE_PROXY_PRIORITY, Compute::gbisPhasePriority, Patch::getNumAtoms(), Compute::initialize(), numAtoms, PatchMap::Object(), patch, PATCH_PRIORITY, patchID, positionBox, Patch::registerForceDeposit(), and Patch::registerPositionPickup().

Referenced by ComputeNonbondedPair::initialize().

00055                                   {
00056     // How can we tell if BoxOwner has packed up and left?  Need a mechanism
00057     // to handle this or do we assume the Boxes have been dumped?
00058 
00059     for (int i=0; i<2; i++) {
00060         if (positionBox[i] == NULL) { // We have yet to get boxes
00061             if (!(patch[i] = PatchMap::Object()->patch(patchID[i]))) {
00062               DebugM(5,"invalid patch(" << patchID[i] 
00063                    << ")  pointer!\n");
00064             }
00065             positionBox[i] = patch[i]->registerPositionPickup(this);
00066             forceBox[i] = patch[i]->registerForceDeposit(this);
00067         }
00068         numAtoms[i] = patch[i]->getNumAtoms();
00069     }
00070 
00071   DebugM(4, "initialize("<<cid<<") numAtoms("<<patchID[0]<<") = " 
00072     << numAtoms[0] 
00073     << " numAtoms(" <<patchID[1]<<") = " << numAtoms[1] << "\n" );
00074 
00075     Compute::initialize();
00076 
00077     // proxies are more urgent (lower priority) than patches
00078     int myNode = CkMyPe();
00079     int p0 = PATCH_PRIORITY(patchID[0]);
00080     if ( PatchMap::Object()->node(patchID[0]) == myNode ) {
00081       p0 += GB1_COMPUTE_HOME_PRIORITY;
00082     } else {
00083       p0 += GB1_COMPUTE_PROXY_PRIORITY;
00084     }
00085     int p1 = PATCH_PRIORITY(patchID[1]);
00086     if ( PatchMap::Object()->node(patchID[1]) == myNode ) {
00087       p1 += GB1_COMPUTE_HOME_PRIORITY;
00088     } else {
00089       p1 += GB1_COMPUTE_PROXY_PRIORITY;
00090     }
00091     if (p0<p1) { //base phase priorities off of p0
00092       if ( PatchMap::Object()->node(patchID[0]) == myNode ) {
00093         gbisPhasePriority[0] = 0;
00094         gbisPhasePriority[1] = GB2_COMPUTE_HOME_PRIORITY-GB1_COMPUTE_HOME_PRIORITY;
00095         gbisPhasePriority[2] = COMPUTE_HOME_PRIORITY-GB1_COMPUTE_HOME_PRIORITY;
00096       } else {
00097         gbisPhasePriority[0] = 0;
00098         gbisPhasePriority[1] = GB2_COMPUTE_PROXY_PRIORITY-GB1_COMPUTE_PROXY_PRIORITY;
00099         gbisPhasePriority[2] = COMPUTE_PROXY_PRIORITY-GB1_COMPUTE_PROXY_PRIORITY;
00100       }
00101     } else { //base phase priorities off of p1
00102       if ( PatchMap::Object()->node(patchID[1]) == myNode ) {
00103         gbisPhasePriority[0] = 0;
00104         gbisPhasePriority[1] = GB2_COMPUTE_HOME_PRIORITY-GB1_COMPUTE_HOME_PRIORITY;
00105         gbisPhasePriority[2] = COMPUTE_HOME_PRIORITY-GB1_COMPUTE_HOME_PRIORITY;
00106       } else {
00107         gbisPhasePriority[0] = 0;
00108         gbisPhasePriority[1] = GB2_COMPUTE_PROXY_PRIORITY-GB1_COMPUTE_PROXY_PRIORITY;
00109         gbisPhasePriority[2] = COMPUTE_PROXY_PRIORITY-GB1_COMPUTE_PROXY_PRIORITY;
00110       }
00111     }
00112     basePriority = ((p0<p1)?p0:p1);   // most urgent wins
00113 
00114 }


Member Data Documentation

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

Definition at line 53 of file ComputePatchPair.h.

Referenced by ComputePatchPair(), doWork(), initialize(), ComputeNonbondedPair::noWork(), and ~ComputePatchPair().

int ComputePatchPair::numAtoms[2] [protected]

Definition at line 36 of file ComputePatchPair.h.

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

CompAtom* ComputePatchPair::p[2] [protected]

Definition at line 38 of file ComputePatchPair.h.

Referenced by ComputeNonbondedPair::doForce(), and doWork().

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

Definition at line 47 of file ComputePatchPair.h.

Referenced by atomUpdate(), ComputePatchPair(), ComputeNonbondedPair::doForce(), doWork(), initialize(), ComputeNonbondedPair::initialize(), ComputeNonbondedPair::noWork(), ComputeNonbondedPair::~ComputeNonbondedPair(), and ~ComputePatchPair().

PatchID ComputePatchPair::patchID[2] [protected]

Definition at line 50 of file ComputePatchPair.h.

Referenced by ComputePatchPair(), ComputeNonbondedPair::doForce(), initialize(), ComputeNonbondedPair::initialize(), and ~ComputePatchPair().

CompAtomExt* ComputePatchPair::pExt[2] [protected]

Definition at line 37 of file ComputePatchPair.h.

Referenced by ComputeNonbondedPair::doForce(), and doWork().

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

Definition at line 52 of file ComputePatchPair.h.

Referenced by ComputePatchPair(), doWork(), initialize(), ComputeNonbondedPair::noWork(), and ~ComputePatchPair().

Results* ComputePatchPair::r[2] [protected]

Definition at line 39 of file ComputePatchPair.h.

Referenced by ComputeNonbondedPair::doForce(), and doWork().

int ComputePatchPair::trans[2] [protected]

Definition at line 51 of file ComputePatchPair.h.

Referenced by ComputePatchPair(), ComputeNonbondedPair::doForce(), and ComputeNonbondedPair::initialize().


The documentation for this class was generated from the following files:
Generated on Wed Nov 22 01:17:19 2017 for NAMD by  doxygen 1.4.7