00001
00007 #ifndef PATCH_H
00008 #define PATCH_H
00009
00010 #include "NamdTypes.h"
00011 #include "OwnerBox.h"
00012 #include "Box.h"
00013 #include "UniqueSortedArray.h"
00014 #include "Lattice.h"
00015 #include "PatchTypes.h"
00016
00017 typedef SortedArray<ComputeID> ComputeIDList;
00018
00019 class Compute;
00020 class Sequencer;
00021 class PatchMap;
00022 class AtomMapper;
00023
00024
00025
00026
00027
00028 class Patch
00029 {
00030 public:
00031
00032 Patch(PatchID pd);
00033 int hasNewAtoms() { return _hasNewAtoms; }
00034 virtual ~Patch();
00035
00036
00037 Box<Patch,CompAtom>* registerPositionPickup(ComputeID cid);
00038 void unregisterPositionPickup(ComputeID cid,
00039 Box<Patch,CompAtom>**const box);
00040 Box<Patch,CompAtom>* registerAvgPositionPickup(ComputeID cid);
00041 void unregisterAvgPositionPickup(ComputeID cid,
00042 Box<Patch,CompAtom>**const box);
00043
00044 Box<Patch,CompAtom>* registerVelocityPickup(ComputeID cid);
00045 void unregisterVelocityPickup(ComputeID cid,
00046 Box<Patch,CompAtom>**const box);
00047
00048
00049
00050 Box<Patch,Real>* registerIntRadPickup(ComputeID cid);
00051 void unregisterIntRadPickup(ComputeID cid, Box<Patch,Real>**const box);
00052
00053 Box<Patch,GBReal>* registerPsiSumDeposit(ComputeID cid);
00054 void unregisterPsiSumDeposit(ComputeID cid, Box<Patch,GBReal>**const box);
00055
00056 Box<Patch,Real>* registerBornRadPickup(ComputeID cid);
00057 void unregisterBornRadPickup(ComputeID cid, Box<Patch,Real>**const box);
00058
00059 Box<Patch,GBReal>* registerDEdaSumDeposit(ComputeID cid);
00060 void unregisterDEdaSumDeposit(ComputeID cid,Box<Patch,GBReal> **const box);
00061
00062 Box<Patch,Real>* registerDHdrPrefixPickup(ComputeID cid);
00063 void unregisterDHdrPrefixPickup(ComputeID cid, Box<Patch,Real>**const box);
00064
00065
00066 Box<Patch,Results>* registerForceDeposit(ComputeID cid);
00067 void unregisterForceDeposit(ComputeID cid, Box<Patch,Results> **const box);
00068
00069
00070
00071 void positionsReady(int n=0);
00072
00073
00074 void positionBoxClosed(void);
00075 void forceBoxClosed(void);
00076 void avgPositionBoxClosed(void);
00077
00078 void velocityBoxClosed(void);
00079
00080
00081
00082 void intRadBoxClosed(void);
00083 void psiSumBoxClosed(void);
00084 void bornRadBoxClosed(void);
00085 void dEdaSumBoxClosed(void);
00086 void dHdrPrefixBoxClosed(void);
00087 void gbisP2Ready();
00088 void gbisP3Ready();
00089
00090
00091 int getNumAtoms() { return numAtoms; }
00092
00093
00094 #if NAMD_SeparateWaters != 0
00095 int getNumWaterAtoms() { return numWaterAtoms; }
00096 #endif
00097
00098 int getNumFixedAtoms() { return numFixedAtoms; }
00099 void setNumFixedAtoms(int numFixed) { numFixedAtoms=numFixed; }
00100 PatchID getPatchID() { return patchID; }
00101 int getNumComputes() { return positionComputeList.size(); }
00102
00103 CompAtomExt* getCompAtomExtInfo() { return pExt.begin(); }
00104
00105 Lattice &lattice;
00106 Flags flags;
00107
00108 protected:
00109
00110 const PatchID patchID;
00111 int numAtoms;
00112 int numFixedAtoms;
00113 CompAtomList p;
00114 CompAtomList p_avg;
00115
00116 CompAtomList v;
00117
00118
00119 AtomMapper *atomMapper;
00120
00121
00122 RealList intRad;
00123 GBRealList psiSum;
00124 GBRealList psiFin;
00125 RealList bornRad;
00126 RealList dHdrPrefix;
00127 GBRealList dEdaSum;
00128
00129
00130
00131 #if NAMD_SeparateWaters != 0
00132 int numWaterAtoms;
00133
00134
00135
00136 #endif
00137
00138 CompAtomExtList pExt;
00139
00140 #ifdef REMOVE_PROXYDATAMSG_EXTRACOPY
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152 CompAtom *positionPtrBegin;
00153 CompAtom *positionPtrEnd;
00154 #endif
00155 CompAtom *avgPositionPtrBegin;
00156 CompAtom *avgPositionPtrEnd;
00157
00158
00159 CompAtom *velocityPtrBegin;
00160 CompAtom *velocityPtrEnd;
00161
00162
00163 ForceList f[Results::maxNumForces];
00164 Results results;
00165
00166 OwnerBox<Patch,CompAtom> positionBox;
00167 ComputeIDList positionComputeList;
00168 OwnerBox<Patch,CompAtom> avgPositionBox;
00169 ComputeIDList avgPositionComputeList;
00170
00171 OwnerBox<Patch,CompAtom> velocityBox;
00172 ComputeIDList velocityComputeList;
00173
00174
00175
00176 OwnerBox<Patch,Real> intRadBox;
00177 ComputeIDList intRadComputeList;
00178 OwnerBox<Patch,GBReal> psiSumBox;
00179 ComputeIDList psiSumComputeList;
00180 OwnerBox<Patch,Real> bornRadBox;
00181 ComputeIDList bornRadComputeList;
00182 OwnerBox<Patch,GBReal> dEdaSumBox;
00183 ComputeIDList dEdaSumComputeList;
00184 OwnerBox<Patch,Real> dHdrPrefixBox;
00185 ComputeIDList dHdrPrefixComputeList;
00186
00187
00188 OwnerBox<Patch,Results> forceBox;
00189 ComputeIDList forceComputeList;
00190
00191 virtual void boxClosed(int ) = 0;
00192 int boxesOpen;
00193
00194 int _hasNewAtoms;
00195
00196 #ifdef NODEAWARE_PROXY_SPANNINGTREE
00197
00198 #ifdef USE_NODEPATCHMGR
00199
00200
00201
00202
00203
00204
00205
00206
00207 int *nodeChildren;
00208 int numNodeChild;
00209 #endif
00210 #endif
00211 int *child;
00212 int nChild;
00213
00214 private:
00215
00216
00217 };
00218
00219
00220 #endif
00221