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 CompAtomExt* getCompAtomExtInfo() { return pExt.begin(); }
00068
00069 Lattice &lattice;
00070 Flags flags;
00071
00072 protected:
00073
00074 const PatchID patchID;
00075 int numAtoms;
00076 int numFixedAtoms;
00077 CompAtomList p;
00078 CompAtomList p_avg;
00079
00080
00081 #if NAMD_SeparateWaters != 0
00082 int numWaterAtoms;
00083
00084
00085
00086 #endif
00087
00088 CompAtomExtList pExt;
00089
00090 #ifdef REMOVE_PROXYDATAMSG_EXTRACOPY
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102 CompAtom *positionPtrBegin;
00103 CompAtom *positionPtrEnd;
00104 #endif
00105 CompAtom *avgPositionPtrBegin;
00106 CompAtom *avgPositionPtrEnd;
00107
00108 ForceList f[Results::maxNumForces];
00109 Results results;
00110
00111 OwnerBox<Patch,CompAtom> positionBox;
00112 ComputeIDList positionComputeList;
00113 OwnerBox<Patch,CompAtom> avgPositionBox;
00114 ComputeIDList avgPositionComputeList;
00115 OwnerBox<Patch,Results> forceBox;
00116 ComputeIDList forceComputeList;
00117
00118 virtual void boxClosed(int ) = 0;
00119 int boxesOpen;
00120
00121 int _hasNewAtoms;
00122
00123 #ifdef NODEAWARE_PROXY_SPANNINGTREE
00124
00125 int *children;
00126 int numChild;
00127 #ifdef USE_NODEPATCHMGR
00128
00129
00130
00131
00132
00133
00134
00135
00136 int *nodeChildren;
00137 int numNodeChild;
00138 #endif
00139 #endif
00140
00141
00142 private:
00143
00144
00145 };
00146
00147
00148 #endif
00149