takes data and fstat files and splits them into *.data.???? and *.fstat.???? files
More...
|
| CFile (std::string name) |
| Constructor. More...
|
|
| ~CFile () |
| Destructor. More...
|
|
bool | copy () |
|
| CFile (std::string name) |
| Constructor. More...
|
|
| ~CFile () |
| Destructor. More...
|
|
void | copy (double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, double timeMin, double timeMax, unsigned int periodic) |
|
void | writeP4P (double timeMin, double timeMax) |
|
void | writeP4C (std::fstream &fstat, double timeData) |
|
void | writeP4W (std::fstream &fstat, double timeData) |
|
void | writeRestart (double timeData, double density) |
|
std::string | getName (std::string type, unsigned int counter) |
|
| CFile (std::string name) |
| Constructor. More...
|
|
| ~CFile () |
| Destructor. More...
|
|
bool | copy (unsigned int stepsize, unsigned int counter) |
|
bool | copy_data (unsigned int stepsize, unsigned int counter) |
|
bool | copy_fstat (unsigned int stepsize, unsigned int counter) |
|
takes data and fstat files and splits them into *.data.???? and *.fstat.???? files
103 double T,
R,
M, M1, M2, mass, info;
105 std::stringstream output_filename;
106 std::fstream output_file;
115 CX1 = CY1 = CZ1 = 0.0;
116 CX2 = CY2 = CZ2 = 0.0;
117 for (
unsigned int i=0;
i<N;
i++) {
118 data_file >>
X >>
Y >>
Z >> VX >> VY >> VZ >>
R >> AX >> AY >>
AZ >> WX >> WY >> WZ >> info;
123 CX +=
X*mass; CY +=
Y*mass; CZ +=
Z*mass;
M+=mass;
127 CX +=
X*mass; CY +=
Y*mass; CZ +=
Z*mass;
M+=mass;
132 CX1 +=
X*mass; CY1 +=
Y*mass; CZ1 +=
Z*mass; M1+=mass;
134 CX2 +=
X*mass; CY2 +=
Y*mass; CZ2 +=
Z*mass; M2+=mass;
141 CX1 +=
X*mass; CY1 +=
Y*mass; CZ1 +=
Z*mass; M1+=mass;
142 }
else if (info==
info1) {
143 CX2 +=
X*mass; CY2 +=
Y*mass; CZ2 +=
Z*mass; M2+=mass;
148 com_file << T <<
" " << CX/
M <<
" " << CY/
M <<
" " << CZ/
M;
149 com_file <<
" " << CX1/M1 <<
" " << CY1/M1 <<
" " << CZ1/M1;
150 com_file <<
" " << CX2/M2 <<
" " << CY2/M2 <<
" " << CZ2/M2 << std::endl;
152 com_file << T <<
" " << CX/
M <<
" " << CY/
M <<
" " << CZ/
M << std::endl;
@ AZ
Definition: StatisticsVector.h:42
@ R
Definition: StatisticsVector.h:42
@ Y
Definition: StatisticsVector.h:42
@ X
Definition: StatisticsVector.h:42
@ Z
Definition: StatisticsVector.h:42
int info0
Definition: centerofmass.cpp:173
int info1
Definition: centerofmass.cpp:173
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51
References AZ, com_file, data_file, constants::i, info0, info1, R, splittinginfo, splittingradius, X, Y, and Z.
Referenced by main().
void CFile::writeP4C |
( |
std::fstream & |
fstat, |
|
|
double |
timeData |
|
) |
| |
|
inline |
208 double P1, P2, delta, deltat, fn, ft;
213 p4c >> dummy >> dummy;
218 if (time < timeData * 0.999999)
220 logger(
INFO,
"reading p4c (t % N %): below timeMin; skipped", time, N);
221 for (
unsigned int i = 0;
i < N;
i++)
226 logger(
INFO,
"reading p4c (t % N %", time, N);
229 fstat <<
"# " << time <<
" " << N << std::endl;
230 fstat <<
"# " << std::endl;
231 fstat <<
"# " << std::endl;
235 for (
unsigned int i = 0;
i < N;
i++)
const unsigned n
Definition: CG3DPackingUnitTest.cpp:32
double Mdouble
Definition: GeneralDefine.h:34
std::vector< Vec3D > position_
Definition: ConvertP4Files.cpp:444
void writeP4W(std::fstream &fstat, double timeData)
Definition: ConvertP4Files.cpp:321
std::vector< unsigned int > id_
Definition: ConvertP4Files.cpp:445
Mdouble Y
Definition: Vector.h:66
Mdouble Z
Definition: Vector.h:66
Mdouble X
the vector components
Definition: Vector.h:66
void setZero()
Sets all elements to zero.
Definition: Vector.cc:43
double C1
"Mooney Rivlin" coefficient for generalised Mooney Rivlin law
Definition: TwenteMeshGluing.cpp:70
References Global_Physical_Variables::C1, constants::i, id_, INFO, logger, n, p4c, periodic_, position_, Vec3D::setZero(), writeP4W(), Vec3D::X, xmax_, xmin_, Vec3D::Y, and Vec3D::Z.
Referenced by writeP4P().
105 double ID, GROUP, VOLUME, MASS, VX, VY, VZ, Angular_Velocity_X, Angular_Velocity_Y, Angular_Velocity_Z;
107 unsigned int counter = 0;
112 p4p >> dummy >> dummy;
119 logger(
INFO,
"reading p4p (t % N %): timeMax reached; terminating", time, N);
122 else if (time < timeMin)
124 logger(
INFO,
"reading p4p (t % N %): below timeMin; skipped", time, N);
125 for (
unsigned int i = 0;
i < N;
i++)
130 logger(
INFO,
"reading p4p (t % N % timestep #%)", time, N, counter);
133 std::string dataName =
getName(
"data", counter);
134 data.open(dataName.c_str(), std::fstream::out);
135 std::string fstatName =
getName(
"fstat", counter);
136 fstat.open(fstatName.c_str(), std::fstream::out);
137 logger(
INFO,
"Files opened: % and %", dataName, fstatName);
147 <<
zmax_ << std::endl;
151 for (
unsigned int i=0;
i<N;
i++) {
169 >> Angular_Velocity_X
170 >> Angular_Velocity_Y
171 >> Angular_Velocity_Z;
182 << Angular_Velocity_X <<
" "
183 << Angular_Velocity_Y <<
" "
184 << Angular_Velocity_Z <<
" "
void writeP4C(std::fstream &fstat, double timeData)
Definition: ConvertP4Files.cpp:203
std::string getName(std::string type, unsigned int counter)
Definition: ConvertP4Files.cpp:417
void writeRestart(double timeData, double density)
Definition: ConvertP4Files.cpp:373
double P
Uniform pressure.
Definition: TwenteMeshGluing.cpp:73
const Mdouble pi
Definition: ExtendedMath.h:45
References getName(), constants::i, id_, INFO, logger, Global_Physical_Variables::P, p4p, constants::pi, position_, writeP4C(), writeRestart(), xmax_, xmin_, ymax_, ymin_, zmax_, and zmin_.
Referenced by copy().
void CFile::writeRestart |
( |
double |
timeData, |
|
|
double |
density |
|
) |
| |
|
inline |
380 "restart_version 1.0 name " <<
name_ <<
"\n"
381 "dataFile name " <<
name_ <<
".data fileType MULTIPLE_FILES_PADDED saveCount 1 counter 1 nextSavedTimeStep 0\n"
382 "fStatFile name " <<
name_ <<
".fstat fileType MULTIPLE_FILES_PADDED saveCount 1 counter 1 nextSavedTimeStep 0\n"
383 "eneFile name " <<
name_ <<
".ene fileType ONE_FILE saveCount 1 counter 302 nextSavedTimeStep 0\n"
384 "restartFile name " <<
name_ <<
".restart fileType ONE_FILE saveCount 1 counter 1 nextSavedTimeStep 0\n"
385 "statFile name " <<
name_ <<
".stat fileType ONE_FILE saveCount 1 counter 0 nextSavedTimeStep 0\n"
392 "timeStep 0 time " << timeData <<
" ntimeSteps 0 timeMax " << timeData <<
"\n"
393 "systemDimensions 3 particleDimensions 3 gravity 0 0 -9.8\n"
395 "LinearViscoelasticSpecies id 0 density " << density <<
" stiffness 0 dissipation 0\n"
403 restart <<
"PeriodicBoundary id 0 normal 1 0 0 scaleFactor 1 distanceLeft " <<
xmin_ <<
" distanceRight " <<
xmax_ <<
" shift " <<
xmax_-
xmin_ <<
" 0 0\n";
405 restart <<
"PeriodicBoundary id 0 normal 0 1 0 scaleFactor 1 distanceLeft " <<
ymin_ <<
" distanceRight " <<
ymax_ <<
" shift " <<
ymax_-
ymin_ <<
" 0 0\n";
407 restart <<
"PeriodicBoundary id 0 normal 0 0 1 scaleFactor 1 distanceLeft " <<
zmin_ <<
" distanceRight " <<
zmax_ <<
" shift " <<
zmax_-
zmin_ <<
" 0 0\n";
411 "BaseParticle id 0 indSpecies 0 position 0 0 0 orientation 0 0 0 0 velocity 0 0 0 angularVelocity 0 0 0 0 force 0 0 0 torque 0 0 0 radius 0.5 invMass 1 invInertia 10\n"
Definition: restart2.cpp:29
References INFO, logger, name_, periodic_, xmax_, xmin_, ymax_, ymin_, zmax_, and zmin_.
Referenced by writeP4P().