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
00023
00024
00025
00026
00027
00028 class Patch
00029 {
00030 public:
00031
00032 Patch(PatchID pd);
00033 int hasNewAtoms() { return _hasNewAtoms; }
00034 virtual ~Patch(void) { };
00035
00036
00037 Box<Patch,CompAtom>* registerPositionPickup(ComputeID cid, int trans = 13);
00038 void unregisterPositionPickup(ComputeID cid,
00039 Box<Patch,CompAtom>**const box);
00040 Box<Patch,CompAtom>* registerAvgPositionPickup(ComputeID cid, int trans = 13);
00041 void unregisterAvgPositionPickup(ComputeID cid,
00042 Box<Patch,CompAtom>**const box);
00043 Box<Patch,Results>* registerForceDeposit(ComputeID cid);
00044 void unregisterForceDeposit(ComputeID cid, Box<Patch,Results> **const box);
00045
00046
00047
00048 void positionsReady(int n=0);
00049
00050
00051 void positionBoxClosed(void);
00052 void forceBoxClosed(void);
00053 void avgPositionBoxClosed(void);
00054
00055 int getNumAtoms() { return numAtoms; }
00056
00057
00058 #if NAMD_SeparateWaters != 0
00059 int getNumWaterAtoms() { return numWaterAtoms; }
00060 #endif
00061
00062 int getNumFixedAtoms() { return numFixedAtoms; }
00063 void setNumFixedAtoms(int numFixed) { numFixedAtoms=numFixed; }
00064 PatchID getPatchID() { return patchID; }
00065 int getNumComputes() { return positionComputeList.size(); }
00066
00067 #ifdef MEM_OPT_VERSION
00068 CompAtomExt* getCompAtomExtInfo() { return pExt.begin(); }
00069 #endif
00070
00071 Lattice &lattice;
00072 Flags flags;
00073
00074 protected:
00075
00076 const PatchID patchID;
00077 int numAtoms;
00078 int numFixedAtoms;
00079 CompAtomList p;
00080 CompAtomList p_avg;
00081
00082
00083 #if NAMD_SeparateWaters != 0
00084 int numWaterAtoms;
00085
00086
00087
00088 #endif
00089
00090 #ifdef MEM_OPT_VERSION
00091 CompAtomExtList pExt;
00092 #endif
00093
00094 #ifdef REMOVE_PROXYDATAMSG_EXTRACOPY
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106 CompAtom *positionPtrBegin;
00107 CompAtom *positionPtrEnd;
00108 #endif
00109 CompAtom *avgPositionPtrBegin;
00110 CompAtom *avgPositionPtrEnd;
00111
00112 ForceList f[Results::maxNumForces];
00113 Results results;
00114
00115 OwnerBox<Patch,CompAtom> positionBox;
00116 ComputeIDList positionComputeList;
00117 OwnerBox<Patch,CompAtom> avgPositionBox;
00118 ComputeIDList avgPositionComputeList;
00119 OwnerBox<Patch,Results> forceBox;
00120 ComputeIDList forceComputeList;
00121
00122 virtual void boxClosed(int ) = 0;
00123 int boxesOpen;
00124
00125 int _hasNewAtoms;
00126
00127 #ifdef NODEAWARE_PROXY_SPANNINGTREE
00128
00129 int *children;
00130 int numChild;
00131 #ifdef USE_NODEPATCHMGR
00132
00133
00134
00135
00136
00137
00138
00139
00140 int *nodeChildren;
00141 int numNodeChild;
00142 #endif
00143 #endif
00144
00145
00146 private:
00147
00148
00149 };
00150
00151
00152 #endif
00153