-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdat.hpp
258 lines (186 loc) · 9.87 KB
/
dat.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
#ifndef DAT_HPP
#define DAT_HPP
#include <string>
#include <vector>
#include "readwrite.hpp"
/////////////
// CLASSES //
/////////////
class Dat;
class Dat0;
class DatR;
/* DAT
* ---
* Read files as defined by the System class (see particle.hpp).
*/
class Dat {
public:
// CONSTRUCTORS
Dat(std::string filename, bool loadWork = true);
// DESTRUCTORS
~Dat();
// METHODS
int getNumberParticles() const; // returns number of particles
double getPersistenceLength() const; // returns persistence length
double getPackingFraction() const; // returns packing fraction
double getSystemSize() const; // returns system size
double getTorqueParameter() const; // returns torque parameter
int getRandomSeed() const; // returns random seed
double getTimeStep() const; // returns time step
int getFramesWork() const; // returns number of frames on which to sum the active work before dumping
long int getNumberWork() const; // returns number of computed work sums
long int getFrames() const; // returns number of frames
std::vector<double> getActiveWork(); // returns vector of computed active work sums
std::vector<double> getActiveWorkForce(); // returns vector of computed active work (force) sums
std::vector<double> getActiveWorkOri(); // returns vector of computed active work (orientation) sums
std::vector<double> getOrderParameter(); // returns vector of computed order parameter sums
std::vector<double> getOrderParameter0(); // returns vector of computed order parameter along x-axis sums
std::vector<double> getOrderParameter1(); // returns vector of computed order parameter along y-axis sums
std::vector<double> getTorqueIntegral1(); // returns vector of computed first torque integrals
std::vector<double> getTorqueIntegral2(); // returns vector of computed second torque integrals
double getPosition(
int const& frame, int const& particle, int const& dimension);
// Returns position of a given particle at a given frame.
double getOrientation(int const& frame, int const& particle);
// Returns position of a given particle at a given frame.
double getVelocity(
int const& frame, int const& particle, int const& dimension);
// Returns velocity of a given particle at a given frame.
void close() { input.close(); } // close file stream
void open() { input.open(); } // open file stream
private:
// ATTRIBUTES
int const numberParticles; // number of particles
double const persistenceLength; // persistence length
double const packingFraction; // packing fraction
double const systemSize; // size of the system
double const torqueParameter; // torque parameter
int const randomSeed; // random seed
double const timeStep; // time step
int const framesWork; // number of frames on which to sum the active work before dumping
bool const dumpParticles; // positions and orientations dumped in file
int const dumpPeriod; // period of dumping of positions and orientations in number of frames
Read input; // input class
long int headerLength; // length of header in input file
long int particleLength; // length the data of a single particle takes in a frame
long int frameLength; // length the data of a single frame takes in a file
long int workLength; // length the data of a single work dump takes in a file
long int numberWork; // number of computed work sums
long int frames; // number of frames
std::vector<double> activeWork; // computed active work sums
std::vector<double> activeWorkForce; // computed active work (force) sums
std::vector<double> activeWorkOri; // computed active work (orientation) sums
std::vector<double> orderParameter; // computer order parameter sums
std::vector<double> orderParameter0; // computer order parameter along x-axis sums
std::vector<double> orderParameter1; // computer order parameter along y-axis sums
std::vector<double> torqueIntegral1; // computed first torque integrals
std::vector<double> torqueIntegral2; // computed second torque integrals
};
/* DAT0
* ----
* Read files as defined by the System0 class (see particle.hpp).
*/
class Dat0 {
public:
// CONSTRUCTORS
Dat0(std::string filename, bool loadWork = true);
// DESTRUCTORS
~Dat0();
// METHODS
int getNumberParticles() const; // returns number of particles
double getPotentialParameter() const; // returns coefficient parameter of potential
double getPropulsionVelocity() const; // returns self-propulsion velocity
double getTransDiffusivity() const; // returns translational diffusivity
double getRotDiffusivity() const; // returns rotational diffusivity
double getPersistenceLength() const; // returns persistence length
double getPackingFraction() const; // returns packing fraction
double getSystemSize() const; // returns system size
int getRandomSeed() const; // returns random seed
double getTimeStep() const; // returns time step
int getFramesWork() const; // returns number of frames on which to sum the active work before dumping
long int getNumberWork() const; // returns number of computed work sums
long int getFrames() const; // returns number of frames
std::vector<double> getDiameters(); // returns vector of diameters
std::vector<double> getActiveWork(); // returns vector of computed active work sums
std::vector<double> getActiveWorkForce(); // returns vector of computed active work (force) sums
std::vector<double> getActiveWorkOri(); // returns vector of computed active work (orientation) sums
std::vector<double> getOrderParameter(); // returns vector of computed order parameter sums
double getPosition(
int const& frame, int const& particle, int const& dimension);
// Returns position of a given particle at a given frame.
double getOrientation(int const& frame, int const& particle);
// Returns position of a given particle at a given frame.
double getVelocity(
int const& frame, int const& particle, int const& dimension);
// Returns velocity of a given particle at a given frame.
private:
// ATTRIBUTES
int const numberParticles; // number of particles
double const potentialParameter; // coefficient parameter of potential
double const propulsionVelocity; // self-propulsion velocity
double const transDiffusivity; // translational diffusivity
double const rotDiffusivity; // rotational diffusivity
double const persistenceLength; // persistence length
double const packingFraction; // packing fraction
double const systemSize; // size of the system
int const randomSeed; // random seed
double const timeStep; // time step
int const framesWork; // number of frames on which to sum the active work before dumping
bool const dumpParticles; // positions and orientations dumped in file
int const dumpPeriod; // period of dumping of positions and orientations in number of frames
Read input; // input class
long int headerLength; // length of header in input file
long int particleLength; // length the data of a single particle takes in a frame
long int frameLength; // length the data of a single frame takes in a file
long int workLength; // length the data of a single work dump takes in a file
long int numberWork; // number of computed work sums
long int frames; // number of frames
std::vector<double> diameters; // array of diameters
std::vector<double> activeWork; // computed active work sums
std::vector<double> activeWorkForce; // computed active work (force) sums
std::vector<double> activeWorkOri; // computed active work (orientation) sums
std::vector<double> orderParameter; // computer order parameter sums
};
/* DATR
* ----
* Read files as defined by the Rotors class (see particle.hpp).
*/
class DatR {
public:
// CONSTRUCTORS
DatR(std::string filename, bool loadOrder = true);
// DESTRUCTORS
~DatR();
// METHODS
int getNumberParticles() const; // returns number of rotors
double getRotDiffusivity() const; // returns rotational diffusivity
double getTorqueParameter() const; // returns aligning torque parameter
double getTimeStep() const; // returns time step
int getDumpPeriod() const; // returns period of dumping of orientations in number of frames
int getRandomSeed() const; // returns random seed
long int getFrames() const; // returns number of frames
std::vector<double> getOrderParameter(); // returns vector of computed order parameter sums
std::vector<double> getOrderParameterSq(); // returns vector of computed squared order parameter sums
double getOrientation(int const& frame, int const& rotor);
// Returns position of a given rotor at a given frame.
private:
// ATTRIBUTES
int const numberParticles; // number of rotors
double const rotDiffusivity; // rotational diffusivity
double const torqueParameter; // aligning torque parameter
double const timeStep; // time step
int const framesOrder; // number of frames on which to average the order parameter before dumping
bool const dumpRotors; // orientations dumped in file
int const dumpPeriod; // period of dumping of orientations in number of frames
int const randomSeed; // random seed
Read input; // input class
long int headerLength; // length of header in input file
long int rotorLength; // length the data of a single rotor takes in a frame
long int frameLength; // length the data of a single frame takes in a file
long int orderLength; // length the data of a single order dump takes in a file
long int numberOrder; // number of computed order parameter sums
long int frames; // number of frames
std::vector<double> orderParameter; // computed order parameter sums
std::vector<double> orderParameterSq; // computed squared order parameter sums
};
#endif