37 |
|
#include <vector> |
38 |
|
|
39 |
|
#include "brains/DataStorage.hpp" |
40 |
+ |
#include "brains/Stats.hpp" |
41 |
+ |
#include "UseTheForce/DarkSide/simulation_interface.h" |
42 |
|
|
41 |
– |
using namespace std; |
42 |
– |
|
43 |
|
namespace oopse{ |
44 |
|
|
45 |
– |
class StuntDouble; |
46 |
– |
|
45 |
|
/** |
46 |
|
* @class Snapshot Snapshot.hpp "brains/Snapshot.hpp" |
47 |
|
* @brief Snapshot class is a repository class for storing dynamic data during |
48 |
|
* Simulation |
49 |
|
* Every snapshot class will contain one DataStorage for atoms and one DataStorage |
50 |
|
* for rigid bodies. |
53 |
– |
* @see SimData |
51 |
|
*/ |
52 |
|
class Snapshot { |
53 |
|
public: |
54 |
|
|
55 |
< |
Snapshot(int nAtoms, int nRigidbodies) { |
56 |
< |
atomData.resize(nAtoms); |
57 |
< |
rigidbodyData.resize(nRigidbodies); |
55 |
> |
Snapshot(int nAtoms, int nRigidbodies) : atomData(nAtoms), rigidbodyData(nRigidbodies), |
56 |
> |
currentTime_(0), chi_(0.0), integralOfChiDt_(0.0), eta_(0.0) { |
57 |
> |
|
58 |
|
} |
59 |
|
|
63 |
– |
Snapshot(const Snapshot& s); |
64 |
– |
|
65 |
– |
Snapshot& operator =(const Snapshot& s); |
60 |
|
|
61 |
|
/** Returns the id of this Snapshot */ |
62 |
|
int getID() { |
68 |
|
id_ = id; |
69 |
|
} |
70 |
|
|
77 |
– |
//template<typename T> |
78 |
– |
//static typename T::ElemPointerType getArrayPointer(vector<T>& v) { |
79 |
– |
// return v[0]->getArrayPointer(); |
80 |
– |
//} |
81 |
– |
|
71 |
|
int getSize() { |
72 |
|
return atomData.getSize() + rigidbodyData.getSize(); |
73 |
|
} |
88 |
|
} |
89 |
|
|
90 |
|
/** Sets the H-Matrix */ |
91 |
< |
void setHamt(const Mat3x3d& m) { |
91 |
> |
void setHmat(const Mat3x3d& m) { |
92 |
|
hmat_ = m; |
93 |
|
invHmat_ = hmat_.inverse(); |
94 |
+ |
|
95 |
+ |
//notify fortran Hmat is changed |
96 |
+ |
double fortranHmat[9]; |
97 |
+ |
double fortranInvHmat[9]; |
98 |
+ |
hmat_.getArray(fortranHmat); |
99 |
+ |
invHmat_.getArray(fortranInvHmat); |
100 |
+ |
setFortranBox(fortranHmat, fortranInvHmat, &orthoRhombic_); |
101 |
|
} |
102 |
|
|
103 |
+ |
double getVolume() { |
104 |
+ |
return hmat_.determinant(); |
105 |
+ |
} |
106 |
+ |
|
107 |
|
/** Returns the inverse H-Matrix */ |
108 |
|
Mat3x3d getInvHmat() { |
109 |
|
return invHmat_; |
110 |
|
} |
111 |
|
|
112 |
< |
double getTimeStamp() { |
113 |
< |
return timeStamp_; |
112 |
> |
/** Wrapping the vector according to periodic boundary condition*/ |
113 |
> |
void wrapVector(Vector3d& v); |
114 |
> |
|
115 |
> |
|
116 |
> |
double getTime() { |
117 |
> |
return currentTime_; |
118 |
|
} |
119 |
|
|
120 |
< |
void setTimeStamp(double timeStamp) { |
121 |
< |
timeStamp_ =timeStamp; |
120 |
> |
void increaseTime(double dt) { |
121 |
> |
setTime(getTime() + dt); |
122 |
|
} |
123 |
|
|
124 |
+ |
void setTime(double time) { |
125 |
+ |
currentTime_ =time; |
126 |
+ |
//time at statData is redundant |
127 |
+ |
statData[Stats::TIME] = currentTime_; |
128 |
+ |
} |
129 |
|
|
130 |
+ |
double getChi() { |
131 |
+ |
return chi_; |
132 |
+ |
} |
133 |
+ |
|
134 |
+ |
void setChi(double chi) { |
135 |
+ |
chi_ = chi; |
136 |
+ |
} |
137 |
+ |
|
138 |
+ |
double getIntegralOfChiDt() { |
139 |
+ |
return integralOfChiDt_; |
140 |
+ |
} |
141 |
+ |
|
142 |
+ |
void setIntegralOfChiDt(double integralOfChiDt) { |
143 |
+ |
integralOfChiDt_ = integralOfChiDt; |
144 |
+ |
} |
145 |
+ |
|
146 |
+ |
Mat3x3d getEta() { |
147 |
+ |
return eta_; |
148 |
+ |
} |
149 |
+ |
|
150 |
+ |
void setEta(const Mat3x3d& eta) { |
151 |
+ |
eta_ = eta; |
152 |
+ |
} |
153 |
+ |
|
154 |
|
DataStorage atomData; |
155 |
|
DataStorage rigidbodyData; |
156 |
+ |
Stats statData; |
157 |
|
|
124 |
– |
friend class StuntDouble; |
125 |
– |
|
158 |
|
private: |
159 |
< |
double timeStamp_; |
159 |
> |
double currentTime_; |
160 |
> |
|
161 |
|
Mat3x3d hmat_; |
162 |
|
Mat3x3d invHmat_; |
163 |
+ |
int orthoRhombic_; |
164 |
+ |
|
165 |
+ |
double chi_; |
166 |
+ |
double integralOfChiDt_; |
167 |
+ |
Mat3x3d eta_; |
168 |
+ |
|
169 |
|
int id_; /**< identification number of the snapshot */ |
170 |
|
}; |
171 |
|
|