| 54 |
|
|
| 55 |
|
#include "brains/DataStorage.hpp" |
| 56 |
|
#include "brains/Stats.hpp" |
| 57 |
– |
#include "UseTheForce/DarkSide/simulation_interface.h" |
| 57 |
|
|
| 59 |
– |
|
| 58 |
|
namespace OpenMD{ |
| 59 |
|
|
| 60 |
|
/** |
| 61 |
|
* @class Snapshot Snapshot.hpp "brains/Snapshot.hpp" |
| 62 |
|
* @brief Snapshot class is a repository class for storing dynamic data during |
| 63 |
|
* Simulation |
| 64 |
< |
* Every snapshot class will contain one DataStorage for atoms and one DataStorage |
| 64 |
> |
* Every snapshot class will contain one DataStorage for atoms and one DataStorage |
| 65 |
|
* for rigid bodies. |
| 66 |
|
*/ |
| 67 |
|
class Snapshot { |
| 68 |
|
public: |
| 69 |
|
|
| 70 |
< |
Snapshot(int nAtoms, int nRigidbodies) : atomData(nAtoms), |
| 71 |
< |
rigidbodyData(nRigidbodies), |
| 72 |
< |
currentTime_(0), |
| 73 |
< |
orthoTolerance_(1e-6), |
| 74 |
< |
orthoRhombic_(0), |
| 75 |
< |
chi_(0.0), |
| 76 |
< |
integralOfChiDt_(0.0), |
| 77 |
< |
eta_(0.0), id_(-1), |
| 78 |
< |
hasCOM_(false), hasVolume_(false), volume_(0.0) { |
| 70 |
> |
Snapshot(int nAtoms, int nRigidbodies, |
| 71 |
> |
int nCutoffGroups) : atomData(nAtoms), |
| 72 |
> |
rigidbodyData(nRigidbodies), |
| 73 |
> |
cgData(nCutoffGroups, DataStorage::dslPosition), |
| 74 |
> |
currentTime_(0), |
| 75 |
> |
orthoTolerance_(1e-6), |
| 76 |
> |
orthoRhombic_(0), |
| 77 |
> |
chi_(0.0), |
| 78 |
> |
integralOfChiDt_(0.0), |
| 79 |
> |
eta_(0.0), id_(-1), hasCOM_(false), |
| 80 |
> |
hasVolume_(false), volume_(0.0) { |
| 81 |
|
|
| 82 |
|
} |
| 83 |
|
|
| 84 |
< |
Snapshot(int nAtoms, int nRigidbodies, int storageLayout) |
| 85 |
< |
: atomData(nAtoms, storageLayout), |
| 86 |
< |
rigidbodyData(nRigidbodies, storageLayout), |
| 87 |
< |
currentTime_(0), orthoTolerance_(1e-6), orthoRhombic_(0), chi_(0.0), |
| 88 |
< |
integralOfChiDt_(0.0), eta_(0.0), id_(-1), hasCOM_(false), hasVolume_(false),volume_(0.0) { |
| 89 |
< |
|
| 90 |
< |
} |
| 91 |
< |
|
| 84 |
> |
Snapshot(int nAtoms, int nRigidbodies, int nCutoffGroups, |
| 85 |
> |
int storageLayout) : atomData(nAtoms, storageLayout), |
| 86 |
> |
rigidbodyData(nRigidbodies, storageLayout), |
| 87 |
> |
cgData(nCutoffGroups, DataStorage::dslPosition), |
| 88 |
> |
currentTime_(0), orthoTolerance_(1e-6), |
| 89 |
> |
orthoRhombic_(0), chi_(0.0), |
| 90 |
> |
integralOfChiDt_(0.0), eta_(0.0), id_(-1), |
| 91 |
> |
hasCOM_(false), hasVolume_(false), |
| 92 |
> |
volume_(0.0) { |
| 93 |
> |
} |
| 94 |
> |
|
| 95 |
|
/** Returns the id of this Snapshot */ |
| 96 |
|
int getID() { |
| 97 |
|
return id_; |
| 116 |
|
return rigidbodyData.getSize(); |
| 117 |
|
} |
| 118 |
|
|
| 119 |
+ |
/** Returns the number of rigid bodies */ |
| 120 |
+ |
int getNumberOfCutoffGroups() { |
| 121 |
+ |
return cgData.getSize(); |
| 122 |
+ |
} |
| 123 |
+ |
|
| 124 |
|
/** Returns the H-Matrix */ |
| 125 |
|
Mat3x3d getHmat() { |
| 126 |
|
return hmat_; |
| 206 |
|
COMw_ = COMw; |
| 207 |
|
hasCOM_ = true; |
| 208 |
|
} |
| 209 |
< |
|
| 209 |
> |
|
| 210 |
> |
Vector3d getAtomPosByIindex(int iIndex) { |
| 211 |
> |
#ifdef IS_MPI |
| 212 |
> |
return atomIData.position[iIndex]; |
| 213 |
> |
#else |
| 214 |
> |
return atomData.position[iIndex]; |
| 215 |
> |
#endif |
| 216 |
> |
} |
| 217 |
> |
Vector3d getAtomPosByJindex(int jIndex) { |
| 218 |
> |
#ifdef IS_MPI |
| 219 |
> |
return atomJData.position[jIndex]; |
| 220 |
> |
#else |
| 221 |
> |
return atomData.position[jIndex]; |
| 222 |
> |
#endif |
| 223 |
> |
} |
| 224 |
> |
|
| 225 |
> |
Vector3d getCutoffGroupPosByIindex(int iIndex) { |
| 226 |
> |
#ifdef IS_MPI |
| 227 |
> |
return cgIData.position[iIndex]; |
| 228 |
> |
#else |
| 229 |
> |
return cgData.position[iIndex]; |
| 230 |
> |
#endif |
| 231 |
> |
} |
| 232 |
> |
Vector3d getCutoffGroupPosByJindex(int jIndex) { |
| 233 |
> |
#ifdef IS_MPI |
| 234 |
> |
return cgJData.position[jIndex]; |
| 235 |
> |
#else |
| 236 |
> |
return cgData.position[jIndex]; |
| 237 |
> |
#endif |
| 238 |
> |
} |
| 239 |
> |
|
| 240 |
|
DataStorage atomData; |
| 241 |
|
DataStorage rigidbodyData; |
| 242 |
+ |
DataStorage cgData; |
| 243 |
|
Stats statData; |
| 244 |
+ |
|
| 245 |
+ |
#ifdef IS_MPI |
| 246 |
+ |
DataStorage atomIData; |
| 247 |
+ |
DataStorage atomJData; |
| 248 |
+ |
DataStorage cgIData; |
| 249 |
+ |
DataStorage cgJData; |
| 250 |
+ |
#endif |
| 251 |
+ |
|
| 252 |
|
|
| 253 |
|
private: |
| 254 |
|
RealType currentTime_; |