NAMD
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ComputeHomePatch Class Referenceabstract

#include <ComputeHomePatch.h>

Inheritance diagram for ComputeHomePatch:
Compute ComputeConsForce ComputeConsTorque ComputeCylindricalBC ComputeEField ComputeGridForce ComputeRestraints ComputeSphericalBC ComputeStir

Public Member Functions

 ComputeHomePatch (ComputeID c, PatchID pid)
 
virtual ~ComputeHomePatch ()
 
virtual void initialize ()
 
virtual void atomUpdate ()
 
virtual void doWork ()
 
- Public Member Functions inherited from Compute
 Compute (ComputeID)
 
int type ()
 
virtual ~Compute ()
 
void setNumPatches (int n)
 
int getNumPatches ()
 
virtual void patchReady (PatchID, int doneMigration, int seq)
 
virtual int noWork ()
 
virtual void finishPatch (int)
 
int sequence (void)
 
int priority (void)
 
int getGBISPhase (void)
 
virtual void gbisP2PatchReady (PatchID, int seq)
 
virtual void gbisP3PatchReady (PatchID, int seq)
 

Protected Member Functions

virtual void doForce (FullAtom *p, Results *r)=0
 
- Protected Member Functions inherited from Compute
void enqueueWork ()
 

Protected Attributes

int numAtoms
 
Patchpatch
 
HomePatchhomePatch
 
- Protected Attributes inherited from Compute
int computeType
 
int basePriority
 
int gbisPhase
 
int gbisPhasePriority [3]
 

Additional Inherited Members

- Public Attributes inherited from Compute
const ComputeID cid
 
LDObjHandle ldObjHandle
 
LocalWorkMsg *const localWorkMsg
 

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().

23  : Compute(c) {
24  setNumPatches(1);
25  patchID = p;
26  patch = NULL;
27  homePatch = NULL;
28  positionBox = NULL;
29  forceBox = NULL;
30 }
void setNumPatches(int n)
Definition: Compute.h:52
Compute(ComputeID)
Definition: Compute.C:33
HomePatch * homePatch
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().

32  {
33  DebugM(4, "~ComputeHomePatch("<<cid<<") numAtoms("<<patchID<<") = "
34  << numAtoms << "\n");
35  if (positionBox != NULL) {
37  &positionBox);
38  }
39  if (forceBox != NULL) {
41  &forceBox);
42  }
43 }
static PatchMap * Object()
Definition: PatchMap.h:27
#define DebugM(x, y)
Definition: Debug.h:59
void unregisterForceDeposit(Compute *cid, Box< Patch, Results > **const box)
Definition: Patch.C:239
Patch * patch(PatchID pid)
Definition: PatchMap.h:235
void unregisterPositionPickup(Compute *cid, Box< Patch, CompAtom > **const box)
Definition: Patch.C:122
const ComputeID cid
Definition: Compute.h:43

Member Function Documentation

void ComputeHomePatch::atomUpdate ( void  )
virtual

Reimplemented from Compute.

Definition at line 70 of file ComputeHomePatch.C.

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

70  {
71  // How can we tell if BoxOwner has packed up and left? Need a mechanism
72  // to handle this or do we assume the Boxes have been dumped?
74 }
int getNumAtoms()
Definition: Patch.h:105
virtual void ComputeHomePatch::doForce ( FullAtom p,
Results r 
)
protectedpure virtual
void ComputeHomePatch::doWork ( void  )
virtual

Reimplemented from Compute.

Definition at line 76 of file ComputeHomePatch.C.

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

76  {
77  CompAtom* p;
78  Results* r;
80 
81  DebugM(3,patchID << ": doWork() called.\n");
82 
83  // Open up positionBox, forceBox, and atomBox
84  p = positionBox->open();
85  r = forceBox->open();
86 
87  // Pass pointers to doForce
88  doForce(a,r);
89 
90  // Close up boxes
91  positionBox->close(&p);
92  forceBox->close(&r);
93 
94  DebugM(2,patchID << ": doWork() completed.\n");
95 }
#define DebugM(x, y)
Definition: Debug.h:59
FullAtomList & getAtomList()
Definition: HomePatch.h:455
virtual void doForce(FullAtom *p, Results *r)=0
Data * open(void)
Definition: Box.h:39
void close(Data **const t)
Definition: Box.h:49
HomePatch * homePatch
iterator begin(void)
Definition: ResizeArray.h:36
void ComputeHomePatch::initialize ( void  )
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().

45  {
46  // How can we tell if BoxOwner has packed up and left? Need a mechanism
47  // to handle this or do we assume the Boxes have been dumped?
48 
49  if (positionBox == NULL) { // We have yet to get boxes
50  if (!(patch = PatchMap::Object()->patch(patchID))) {
51  NAMD_bug("ComputeHomePatch used with unknown patch.");
52  }
53  if (!(homePatch = PatchMap::Object()->homePatch(patchID))) {
54  NAMD_bug("ComputeHomePatch used with proxy.");
55  }
56  DebugM(3, "initialize(" << cid <<") patchid = "<<patch->getPatchID()<<"\n");
57  positionBox = patch->registerPositionPickup(this);
58  forceBox = patch->registerForceDeposit(this);
59  }
61 
62  DebugM(3, "initialize("<<cid<<") numAtoms("<<patchID<<") = "
63  << numAtoms << " patchAddr=" << patch << "\n");
65 
66  int myNode = CkMyPe();
68 }
static PatchMap * Object()
Definition: PatchMap.h:27
#define DebugM(x, y)
Definition: Debug.h:59
virtual void initialize()
Definition: Compute.h:56
#define COMPUTE_HOME_PRIORITY
Definition: Priorities.h:76
void NAMD_bug(const char *err_msg)
Definition: common.C:123
PatchID getPatchID()
Definition: Patch.h:114
int getNumAtoms()
Definition: Patch.h:105
int basePriority
Definition: Compute.h:37
const ComputeID cid
Definition: Compute.h:43
Box< Patch, CompAtom > * registerPositionPickup(Compute *cid)
Definition: Patch.C:107
HomePatch * homePatch
#define PATCH_PRIORITY(PID)
Definition: Priorities.h:25
Box< Patch, Results > * registerForceDeposit(Compute *cid)
Definition: Patch.C:228

Member Data Documentation

HomePatch* ComputeHomePatch::homePatch
protected
int ComputeHomePatch::numAtoms
protected
Patch* ComputeHomePatch::patch
protected

The documentation for this class was generated from the following files: