36 |
|
|
37 |
|
#include <vector> |
38 |
|
|
39 |
< |
#include "math/Vector3.hpp" |
40 |
< |
#include "math/SquareMatrix3.hpp" |
39 |
> |
#include "brains/DataStorage.hpp" |
40 |
|
|
41 |
|
using namespace std; |
42 |
|
|
43 |
|
namespace oopse{ |
44 |
|
|
45 |
< |
//forward declaration |
46 |
< |
class Snapshot; |
48 |
< |
class SnapshotManager; |
49 |
< |
|
45 |
> |
class StuntDouble; |
46 |
> |
|
47 |
|
/** |
51 |
– |
* @struct DataStorage |
52 |
– |
* @brief |
53 |
– |
*/ |
54 |
– |
class DataStorage { |
55 |
– |
public: |
56 |
– |
DataStorage() {}; |
57 |
– |
DataStorage(size_t size); |
58 |
– |
void resize(size_t size); |
59 |
– |
void reserve(size_t size); |
60 |
– |
|
61 |
– |
//friend Snapshot; |
62 |
– |
//friend SnapshotManager; |
63 |
– |
//private: |
64 |
– |
vector<Vector3d> position; /** position array */ |
65 |
– |
vector<Vector3d> velocity; /** velocity array */ |
66 |
– |
vector<RotMat3x3d> Amat; /** rotation matrix array */ |
67 |
– |
vector<Vector3d> angularMomentum;/** velocity array */ |
68 |
– |
vector<Vector3d> ul; /** the lab frame unit vector array*/ |
69 |
– |
vector<double> zAngle; /** z -angle array */ |
70 |
– |
vector<Vector3d> force; /** force array */ |
71 |
– |
vector<Vector3d> torque; /** torque array */ |
72 |
– |
|
73 |
– |
}; |
74 |
– |
|
75 |
– |
/** |
48 |
|
* @class Snapshot Snapshot.hpp "brains/Snapshot.hpp" |
49 |
|
* @brief Snapshot class is a repository class for storing dynamic data during |
50 |
|
* Simulation |
55 |
|
class Snapshot { |
56 |
|
public: |
57 |
|
|
58 |
< |
Snapshot() {} |
59 |
< |
Snapshot(int i) { |
60 |
< |
|
58 |
> |
Snapshot(int nAtoms, int nRigidbodies) { |
59 |
> |
atomData.resize(nAtoms); |
60 |
> |
rigidbodyData.resize(nRigidbodies); |
61 |
|
} |
62 |
|
|
63 |
|
Snapshot(const Snapshot& s); |
79 |
|
// return v[0]->getArrayPointer(); |
80 |
|
//} |
81 |
|
|
82 |
< |
static double* getArrayPointer(vector<Vector3d>& v) { |
83 |
< |
assert(v.size() > 0); |
112 |
< |
return v[0].getArrayPointer(); |
82 |
> |
int getSize() { |
83 |
> |
return atomData.getSize() + rigidbodyData.getSize(); |
84 |
|
} |
85 |
< |
|
86 |
< |
static double* getArrayPointer(vector<RotMat3x3d>& v) { |
87 |
< |
assert(v.size() > 0); |
88 |
< |
return v[0].getArrayPointer(); |
85 |
> |
|
86 |
> |
/** Returns the number of atoms */ |
87 |
> |
int getNumberOfAtoms() { |
88 |
> |
return atomData.getSize(); |
89 |
|
} |
90 |
< |
|
91 |
< |
static double* getArrayPointer(vector<double>& v) { |
92 |
< |
assert(v.size() > 0); |
93 |
< |
return &(v[0]); |
90 |
> |
|
91 |
> |
/** Returns the number of rigid bodies */ |
92 |
> |
int getNumberOfRigidBodies() { |
93 |
> |
return rigidbodyData.getSize(); |
94 |
|
} |
124 |
– |
|
125 |
– |
/** */ |
126 |
– |
void resize(size_t size); |
95 |
|
|
96 |
+ |
/** Returns the H-Matrix */ |
97 |
+ |
Mat3x3d getHmat() { |
98 |
+ |
return hmat_; |
99 |
+ |
} |
100 |
|
|
101 |
< |
/** */ |
102 |
< |
void reserve(size_t size); |
101 |
> |
/** Sets the H-Matrix */ |
102 |
> |
void setHamt(const Mat3x3d& m) { |
103 |
> |
hmat_ = m; |
104 |
> |
invHmat_ = hmat_.inverse(); |
105 |
> |
} |
106 |
|
|
107 |
+ |
/** Returns the inverse H-Matrix */ |
108 |
+ |
Mat3x3d getInvHmat() { |
109 |
+ |
return invHmat_; |
110 |
+ |
} |
111 |
+ |
|
112 |
+ |
double getTimeStamp() { |
113 |
+ |
return timeStamp_; |
114 |
+ |
} |
115 |
+ |
|
116 |
+ |
void setTimeStamp(double timeStamp) { |
117 |
+ |
timeStamp_ =timeStamp; |
118 |
+ |
} |
119 |
+ |
|
120 |
+ |
|
121 |
|
DataStorage atomData; |
122 |
|
DataStorage rigidbodyData; |
123 |
< |
|
124 |
< |
friend class SnapshotManager; |
123 |
> |
|
124 |
> |
friend class StuntDouble; |
125 |
> |
|
126 |
|
private: |
127 |
< |
|
127 |
> |
double timeStamp_; |
128 |
> |
Mat3x3d hmat_; |
129 |
> |
Mat3x3d invHmat_; |
130 |
|
int id_; /**< identification number of the snapshot */ |
131 |
|
}; |
132 |
|
|
133 |
< |
typedef DataStorage* (Snapshot::*DataStoragePointer); |
133 |
> |
typedef DataStorage (Snapshot::*DataStoragePointer); |
134 |
|
} |
135 |
|
#endif //BRAINS_SNAPSHOT_HPP |