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
00022
00023
00024 typedef Vector Force;
00025
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
00042
00043
00044
00045
00046
00047
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 : 4;
00057 unsigned int isWater : 1;
00058 };
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072 typedef int SigIndex;
00073 typedef int AtomSigID;
00074 typedef int ExclSigID;
00075
00076 struct CompAtomExt {
00077 #ifdef MEM_OPT_VERSION
00078 AtomSigID sigId;
00079 ExclSigID exclId;
00080 #endif
00081 #ifdef NAMD_CUDA
00082 int sortOrder;
00083 #endif
00084 int id : 30;
00085 unsigned int atomFixed : 1;
00086 unsigned int groupFixed : 1;
00087 };
00088
00089 struct FullAtom : CompAtom, CompAtomExt{
00090 Velocity velocity;
00091 Position fixedPosition;
00092 Mass mass;
00093 union{
00094 Real langevinParam;
00095 #ifdef MEM_OPT_VERSION
00096 int hydVal;
00097 #endif
00098 };
00099 int32 status;
00100 Transform transform;
00101 int migrationGroupSize;
00102 Real rigidBondLength;
00103
00104 #ifdef MEM_OPT_VERSION
00105 int outputRank;
00106 #endif
00107
00108 #ifdef MEM_OPT_VERSION
00109
00110
00111
00112
00113
00114
00115
00116 int operator < (const FullAtom &a) const {
00117 return hydVal < a.hydVal;
00118 }
00119 #endif
00120 };
00121
00122
00123
00124 struct InputAtom: FullAtom{
00125 bool isValid;
00126 short isGP;
00127 short isMP;
00128 int hydList;
00129 int GPID;
00130 int MPID;
00131
00132 int operator < (const InputAtom &a) const{
00133 return hydList < a.hydList;
00134 }
00135 };
00136
00137 struct CudaAtom {
00138 float x,y,z,q;
00139 };
00140
00141 typedef ResizeArray<CudaAtom> CudaAtomList;
00142 typedef ResizeArray<CompAtom> CompAtomList;
00143 typedef ResizeArray<CompAtomExt> CompAtomExtList;
00144 typedef ResizeArray<FullAtom> FullAtomList;
00145 typedef ResizeArray<InputAtom> InputAtomList;
00146 typedef ResizeArray<Position> PositionList;
00147 typedef ResizeArray<Velocity> VelocityList;
00148 typedef ResizeArray<Force> ForceList;
00149 typedef ResizeArray<Transform> TransformList;
00150
00151 typedef ResizeArray<AtomID> AtomIDList;
00152 typedef ResizeArray<BigReal> BigRealList;
00153 typedef ResizeArray<Real> RealList;
00154 typedef float GBReal;
00155 typedef ResizeArray<GBReal> GBRealList;
00156 typedef ResizeArray<int> IntList;
00157
00158 typedef int PatchID;
00159 typedef int ComputeID;
00160 typedef int NodeID;
00161
00162 typedef ResizeArray<PatchID> PatchIDList;
00163 typedef ResizeArray<Patch *> PatchList;
00164
00165 typedef ResizeArray<Compute *> ComputeList;
00166
00167
00168 struct LocalID
00169 {
00170 PatchID pid;
00171 int index;
00172 };
00173
00174 typedef ResizeArray<NodeID> NodeIDList;
00175
00176 struct ExtForce {
00177 int replace;
00178 Force force;
00179 ExtForce() : replace(0) {;}
00180 };
00181
00182
00183
00184 #if NAMD_ComputeNonbonded_SortAtoms != 0
00185
00186 typedef struct __sort_entry {
00187 int index;
00188 BigReal sortValue;
00189 } SortEntry;
00190
00191 #endif
00192
00193
00194
00195
00196
00197 struct proxyTreeNode{
00198 int nodeID;
00199 int *peIDs;
00200 int numPes;
00201
00202 proxyTreeNode(){
00203 nodeID = -1;
00204 peIDs = NULL;
00205 numPes = 0;
00206 }
00207 proxyTreeNode(int nid, int numPes_, int *pes){
00208 nodeID = nid;
00209 numPes = numPes_;
00210 peIDs = new int[numPes];
00211 memcpy(peIDs, pes, sizeof(int)*numPes);
00212 }
00213
00214 inline proxyTreeNode(const proxyTreeNode &n){
00215 nodeID = n.nodeID;
00216 numPes = n.numPes;
00217 if(numPes==0) {
00218 peIDs = NULL;
00219 }else{
00220 peIDs = new int[n.numPes];
00221 memcpy(peIDs, n.peIDs, sizeof(int)*numPes);
00222 }
00223 }
00224 inline proxyTreeNode &operator=(const proxyTreeNode &n){
00225 nodeID = n.nodeID;
00226 numPes = n.numPes;
00227 delete [] peIDs;
00228 if(numPes==0) {
00229 peIDs = NULL;
00230 return (*this);
00231 }
00232 peIDs = new int[n.numPes];
00233 memcpy(peIDs, n.peIDs, sizeof(int)*numPes);
00234 return (*this);
00235 }
00236 ~proxyTreeNode(){
00237 delete [] peIDs;
00238 }
00239 };
00240
00241 typedef ResizeArray<proxyTreeNode> proxyTreeNodeList;
00242
00243 #endif
00244