00001 00007 #ifndef COMPUTEHOMEPATCHES_H 00008 #define COMPUTEHOMEPATCHES_H 00009 00010 #include "NamdTypes.h" 00011 #include "common.h" 00012 #include "Compute.h" 00013 #include "HomePatch.h" 00014 00015 #include "Box.h" 00016 #include "OwnerBox.h" 00017 00018 class PatchElem { 00019 public: 00020 PatchID patchID; 00021 HomePatch *p; 00022 Box<Patch,CompAtom> *positionBox; 00023 Box<Patch,CompAtom> *avgPositionBox; 00024 Box<Patch,Results> *forceBox; 00025 CompAtom *x; 00026 Results *r; 00027 Force *f; 00028 00029 PatchElem() { 00030 patchID = -1; 00031 p = NULL; 00032 positionBox = NULL; 00033 avgPositionBox = NULL; 00034 forceBox = NULL; 00035 x = NULL; 00036 r = NULL; 00037 f = NULL; 00038 } 00039 00040 PatchElem(PatchID p_param) { 00041 patchID = p_param; 00042 } 00043 00044 PatchElem(HomePatch *p_param, ComputeID cid, int useAvgPos) { 00045 patchID = p_param->getPatchID(); 00046 p = p_param; 00047 positionBox = p_param->registerPositionPickup(cid); 00048 if ( useAvgPos ) { 00049 avgPositionBox = p_param->registerAvgPositionPickup(cid); 00050 } 00051 forceBox = p_param->registerForceDeposit(cid); 00052 x = NULL; 00053 r = NULL; 00054 f = NULL; 00055 } 00056 00057 ~PatchElem() {}; 00058 00059 int operator==(const PatchElem &elem) const { 00060 return (elem.patchID == patchID); 00061 } 00062 00063 int operator<(const PatchElem &elem) const { 00064 return (patchID < elem.patchID); 00065 } 00066 }; 00067 00068 typedef UniqueSortedArray<PatchElem> ComputeHomePatchList; 00069 00070 class ReductionMgr; 00071 00072 class ComputeHomePatches : public Compute { 00073 protected: 00074 int useAvgPositions; 00075 int hasPatchZero; // used for calculations/data needed only once 00076 00077 ComputeHomePatchList patchList; 00078 00079 PatchMap *patchMap; 00080 00081 public: 00082 ComputeHomePatches(ComputeID c); 00083 virtual ~ComputeHomePatches(); 00084 virtual void initialize(); 00085 virtual void atomUpdate(); 00086 Flags *getFlags(void) { return &(patchList[0].p->flags); } 00087 }; 00088 00089 #endif 00090
1.3.9.1