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

NamdTypes.h

Go to the documentation of this file.
00001 
00007 #ifndef NAMDTYPES_H
00008 
00009 #define NAMDTYPES_H
00010 
00011 #include "common.h"
00012 #include "Vector.h"
00013 #include "ResizeArray.h"
00014 
00015 class Patch;
00016 class Compute;
00017 
00018 typedef Vector Position;
00019 typedef Vector Velocity;
00020 
00021 //#ifdef ARCH_POWERPC
00022 //typedef AlignVector Force;
00023 //#else
00024 typedef Vector Force;
00025 //#endif
00026 
00027 typedef int AtomID;
00028 typedef int AtomType;
00029 typedef float Mass;
00030 typedef float Charge;
00031 
00032 typedef double Coordinate;
00033 
00034 struct Transform
00035 {
00036   signed char i,j,k;
00037   Transform(void) { i=0; j=0; k=0; }
00038 };
00039 
00040 /*
00041  * 1. "position" field in this structure is very important since it
00042  * needs to be sent to every patch after every timestep.
00043  * 2. Anything that is static (value is decided before computation)
00044  * or only changes after atom migration should be put into the CompAtomExt structure
00045  * 3. This data structure is 32-byte long which is particularly optimized for some machines
00046  * (including BG/L) for better cache and message performance. Therefore, changes
00047  * to this structure should be cautioned for the sake of performance.
00048  */
00049 
00050 struct CompAtom {
00051   Position position;
00052   Charge charge;
00053   short vdwType;
00054   unsigned char partition;
00055   unsigned int nonbondedGroupSize : 3;
00056   unsigned int hydrogenGroupSize : 5;  // could be 4 if signed, 3 if unsigned
00057 };
00058 
00059 //CompAtomExt is now needed even in normal case
00060 //for changing the packed msg type related to
00061 //ProxyPatch into varsize msg type where
00062 // two types of proxy msgs (originally, the msg 
00063 // for the step where atoms migrate (ProxyAllMsg), 
00064 // and  the msg for normal steps (ProxyDataMsg))
00065 // are declared as the same class (ProxyDataMsg).
00066 // Note that in normal case, the class is needed
00067 // just for passing the compilation, but not involved
00068 // in the actual force calculation.
00069 // --Chao Mei
00070 
00071 typedef unsigned short AtomSigID;
00072 typedef unsigned short ExclSigID;
00073 
00074 struct CompAtomExt {
00075   #ifdef MEM_OPT_VERSION
00076   AtomSigID sigId;
00077   ExclSigID exclId;
00078   #endif
00079   int id : 30;  // minimum for 100M atoms is 28 signed, 27 unsigned
00080   unsigned int atomFixed : 1;
00081   unsigned int groupFixed : 1;
00082 };
00083 
00084 struct FullAtom : CompAtom, CompAtomExt{
00085   Velocity velocity;
00086   Position fixedPosition;
00087   Mass mass;
00088   Transform transform;
00089 };
00090 
00091 typedef ResizeArray<CompAtom> CompAtomList;
00092 
00093 typedef ResizeArray<CompAtomExt> CompAtomExtList;
00094 typedef ResizeArray<FullAtom> FullAtomList;
00095 typedef ResizeArray<Position> PositionList;
00096 typedef ResizeArray<Velocity> VelocityList;
00097 typedef ResizeArray<Force> ForceList;
00098 typedef ResizeArray<Transform> TransformList;
00099 
00100 typedef ResizeArray<AtomID> AtomIDList;
00101 
00102 typedef int PatchID;
00103 typedef int ComputeID;
00104 typedef int NodeID;
00105 
00106 typedef ResizeArray<PatchID> PatchIDList;
00107 typedef ResizeArray<Patch *> PatchList;
00108 
00109 typedef ResizeArray<Compute *> ComputeList;
00110 
00111 // See AtomMap
00112 struct LocalID
00113 {
00114   PatchID pid;
00115   int index;
00116 };
00117 
00118 typedef ResizeArray<NodeID> NodeIDList;
00119 
00120 struct ExtForce {
00121   int replace;
00122   Force force;
00123   ExtForce() : replace(0) {;}
00124 };
00125 
00126 
00127 // DMK - Atom Sort
00128 #if NAMD_ComputeNonbonded_SortAtoms != 0
00129 
00130   typedef struct __sort_entry {
00131     int index;  // Index of atom in CompAtom array
00132     BigReal sortValue;   // Distance of PAp from P0 (see calculation code)
00133   } SortEntry;
00134 
00135 #endif
00136 
00137 //This class represents a tree node of proxy spanning tree
00138 //All pes in this array have the same "nodeID". In other words,
00139 //all those pes are in the same physical node.
00140 //This is a structure for adapting NAMD to multicore processors
00141 struct proxyTreeNode{
00142     int nodeID;
00143     int *peIDs;
00144     int numPes;
00145 
00146     proxyTreeNode(){
00147         nodeID = -1;
00148         peIDs = NULL;
00149         numPes = 0;
00150     }
00151     proxyTreeNode(int nid, int numPes_, int *pes){
00152         nodeID = nid;
00153         numPes = numPes_;
00154         peIDs = new int[numPes];
00155         memcpy(peIDs, pes, sizeof(int)*numPes);
00156     }
00157 
00158     inline proxyTreeNode(const proxyTreeNode &n){
00159         nodeID = n.nodeID;
00160         numPes = n.numPes;
00161         if(numPes==0) {
00162             peIDs = NULL;
00163         }else{
00164             peIDs = new int[n.numPes];
00165             memcpy(peIDs, n.peIDs, sizeof(int)*numPes);
00166         }
00167     }
00168     inline proxyTreeNode &operator=(const proxyTreeNode &n){
00169         nodeID = n.nodeID;
00170         numPes = n.numPes;
00171         delete [] peIDs;
00172         if(numPes==0) {
00173             peIDs = NULL;
00174             return (*this);
00175         }
00176         peIDs = new int[n.numPes];
00177         memcpy(peIDs, n.peIDs, sizeof(int)*numPes);
00178         return (*this);
00179     }
00180     ~proxyTreeNode(){
00181         delete [] peIDs;
00182     }
00183 };
00184 
00185 typedef ResizeArray<proxyTreeNode> proxyTreeNodeList;
00186 
00187 #endif /* NAMDTYPES_H */
00188 

Generated on Sun Nov 22 04:07:45 2009 for NAMD by  doxygen 1.3.9.1