Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

Patch.h

Go to the documentation of this file.
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 // This the base class of homepatches and proxy patches. It maintains
00025 // common functions of these patches. These include managing dependences
00026 // between compute (force) objects and the patch and updating atom map.
00027 
00028 class Patch
00029 {
00030   public:
00031 
00032      Patch(PatchID pd);
00033      int hasNewAtoms() { return _hasNewAtoms; }
00034      virtual ~Patch();
00035 
00036      // methods for use by Compute objects
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      // BEGIN LA
00044      Box<Patch,CompAtom>* registerVelocityPickup(ComputeID cid);
00045      void unregisterVelocityPickup(ComputeID cid,
00046                                   Box<Patch,CompAtom>**const box);
00047      // END LA
00048 
00049     //begin gbis
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      //end gbis
00065 
00066      Box<Patch,Results>* registerForceDeposit(ComputeID cid);
00067      void unregisterForceDeposit(ComputeID cid, Box<Patch,Results> **const box);
00068 
00069      // methods for use by Sequencer or ProxyManager
00070      // void positionsReady(void) { positionsReady(0); }
00071      void positionsReady(int n=0);
00072 
00073      // methods for Box callbacks
00074      void positionBoxClosed(void);
00075      void forceBoxClosed(void);
00076      void avgPositionBoxClosed(void);
00077      // BEGIN LA
00078      void velocityBoxClosed(void);
00079      // END LA
00080 
00081      //begin gbis
00082      void intRadBoxClosed(void);// intrinsic radii
00083      void psiSumBoxClosed(void);// sum screening 
00084      void bornRadBoxClosed(void);// born radius
00085      void dEdaSumBoxClosed(void);// sum dEda contributions
00086      void dHdrPrefixBoxClosed(void);//dHdr prefix
00087      void gbisP2Ready();
00088      void gbisP3Ready();
00089      //end gbis
00090 
00091      int getNumAtoms() { return numAtoms; }
00092 
00093      // DMK - Atom Separation (water vs. non-water)
00094      #if NAMD_SeparateWaters != 0
00095        int getNumWaterAtoms() { return numWaterAtoms; }
00096      #endif
00097 
00098      int getNumFixedAtoms() { return numFixedAtoms; }  // not updated
00099      void setNumFixedAtoms(int numFixed) { numFixedAtoms=numFixed; }  // not updated
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      // BEGIN LA
00116      CompAtomList  v;
00117      // END LA
00118 
00119      AtomMapper *atomMapper;
00120 
00121      // begin gbis
00122      RealList intRad;
00123      GBRealList psiSum;
00124      GBRealList psiFin;
00125      RealList bornRad;
00126      RealList dHdrPrefix;
00127      GBRealList dEdaSum;
00128      // end gbis
00129 
00130      // DMK - Atom Separation (water vs. non-water)
00131      #if NAMD_SeparateWaters != 0
00132        int numWaterAtoms;  // Set numWaters to the number of water atoms at
00133                            //   the lead of the atoms list.  If numWaters is
00134                            //   set to -1, this should indicate that
00135                            //   atoms has not been separated yet.
00136      #endif
00137 
00138      CompAtomExtList pExt;
00139 
00140 #ifdef REMOVE_PROXYDATAMSG_EXTRACOPY
00141      //1. Those fields are declared for reusing position info
00142      //inside the ProxyDataMsg msg at every step so that the
00143      //extra copy is avoided.
00144      //Regarding the CompAtomExt list inside the msg of ProxyAllMsg type
00145      //we cannot avoid the copy in the current scheme because this information
00146      //will be lost as the msg will be deleted at the next timestep. But the
00147      //overhead is amortized among the steps that atoms don't migrate
00148      //2. positionPtrBegin is better to be made 32-byte aligned so we could
00149      // have better cache performance in the force calculation part. This
00150      // is especially needed for BG/L machine.
00151      // --Chao Mei
00152      CompAtom      *positionPtrBegin;
00153      CompAtom      *positionPtrEnd;     
00154 #endif
00155      CompAtom      *avgPositionPtrBegin;
00156      CompAtom      *avgPositionPtrEnd;
00157 
00158      // BEGIN LA
00159      CompAtom      *velocityPtrBegin;
00160      CompAtom      *velocityPtrEnd;
00161      // END LA
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      // BEGIN LA
00171      OwnerBox<Patch,CompAtom> velocityBox;
00172      ComputeIDList              velocityComputeList;
00173      // END LA
00174 
00175      //begin gbis
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      //end gbis
00187 
00188      OwnerBox<Patch,Results>    forceBox;
00189      ComputeIDList              forceComputeList;
00190 
00191      virtual void boxClosed(int /* box */) = 0;
00192      int boxesOpen;
00193 
00194      int _hasNewAtoms;
00195 
00196 #ifdef NODEAWARE_PROXY_SPANNINGTREE    
00197     //its own children in proxy tree
00198     #ifdef USE_NODEPATCHMGR
00199     //the immediate children (in terms of node id) also cotains two parts
00200     //as the above variable shows
00201     //If this patch has proxies residing on the same node, then the last entry
00202     //of "nodeChildren" stores this node id. It is same with that variable
00203     //in ProxyPatch      
00204     //If this proxy resides on node A, then the last entry
00205     //of "nodeChildren" has to be A
00206     //It is same with that variable in HomePatch
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 

Generated on Sun Feb 12 04:07:55 2012 for NAMD by  doxygen 1.3.9.1