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