66 std::cout <<
"In this function you can add code that is run on restart" <<std::endl;
77 species->setDensity(2000);
78 FreeFallProblem.
setName(
"FreeFallRestartUnitTest");
84 FreeFallProblem.
solve(argc,argv);
87 int main(
int argc,
char *argv[])
94 if (system(
"./FreeFallRestartUnitTest -tmax 0.4 -name FreeFallRestartUnitTest_NoRestart"))
100 if (system(
"./FreeFallRestartUnitTest -tmax 0.2 -name FreeFallRestartUnitTest_Restarted"))
103 if (system(
"./FreeFallRestartUnitTest -r FreeFallRestartUnitTest_Restarted -tmax 0.4"))
107 logger(
INFO,
"Case 3: restarted at t=0.2; using separate data files");
110 if (system(
"./FreeFallRestartUnitTest -tmax 0.2 -name FreeFallRestartUnitTest_SeparateFiles -fileTypeData 2"))
112 if (system(
"./FreeFallRestartUnitTest -r FreeFallRestartUnitTest_SeparateFiles -tmax 0.4 "))
125 logger(
INFO,
"Finished running, now comparing");
128 FreeFall FreeFallProblemReloadRestart;
129 FreeFall FreeFallProblemReloadSplitFiles;
131 FreeFallProblemReload.
readRestartFile(
"FreeFallRestartUnitTest_NoRestart.restart");
132 FreeFallProblemReloadRestart.
readRestartFile(
"FreeFallRestartUnitTest_Restarted.restart");
133 FreeFallProblemReloadSplitFiles.
readRestartFile(
"FreeFallRestartUnitTest_SeparateFiles.restart");
136 auto FreeFallProblemReloadSplitFilesIt = FreeFallProblemReloadSplitFiles.
particleHandler.
begin();
142 if (!(*FreeFallProblemReloadIt)->getPosition().isEqualTo((*FreeFallProblemReloadRestartIt)->getPosition(),1e-6))
144 logger(
FATAL,
"Particles is not in the same place after restart. Before it was % and now it is %.",(*FreeFallProblemReloadIt)->getPosition(),(*FreeFallProblemReloadRestartIt)->getPosition());
146 if (!(*FreeFallProblemReloadIt)->getPosition().isEqualTo((*FreeFallProblemReloadSplitFilesIt)->getPosition(), 1e-10))
148 logger(
FATAL,
"Particles velocities are not the same place. Before it was % and now it is %.",(*FreeFallProblemReloadIt)->getVelocity(),(*FreeFallProblemReloadRestartIt)->getVelocity());
150 ++FreeFallProblemReloadRestartIt;
151 ++FreeFallProblemReloadSplitFilesIt;
void setXMax(Mdouble newXMax)
If the length of the problem domain in x-direction is XMax - XMin, this method sets XMax...
void solve()
The work horse of the code.
The DPMBase header includes quite a few header files, defining all the handlers, which are essential...
void setVelocity(const Vec3D &velocity)
set the velocity of the BaseInteractable.
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Mdouble getXMin() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMin() returns XMin...
LL< Log::INFO > INFO
Info log level.
void setupInitialConditions()
This function allows to set the initial conditions for our problem to be solved, by default particle ...
Mdouble getYMin() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMin() returns YMin...
const std::vector< T * >::const_iterator end() const
Gets the end of the const_iterator over all BaseBoundary in this BaseHandler.
This code tests: 1) Restarting 2) Saving arcoss multiple files 3) and accepting command line argument...
void setRadius(const Mdouble radius)
Sets the particle's radius_ (and adjusts the mass_ accordingly, based on the particle's species) ...
const std::vector< T * >::const_iterator begin() const
Gets the begin of the const_iterator over all Object in this BaseHandler.
Mdouble getXMax() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMax() returns XMax...
void setYMax(Mdouble newYMax)
If the length of the problem domain in y-direction is YMax - YMin, this method sets YMax...
int main(int argc, char *argv[])
int readRestartFile()
Reads all the particle data corresponding to the current saved time step. Which is what the restart f...
std::fstream & getFstream()
Allows to access the member variable File::fstream_.
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
U * copyAndAddObject(const U &O)
Creates a copy of a Object and adds it to the BaseHandler.
void runFreeFall(int argc, char *argv[])
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
LL< Log::FATAL > FATAL
Fatal log level.
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
File dataFile
An instance of class File to handle in- and output into a .data file.
Species< LinearViscoelasticNormalSpecies > LinearViscoelasticSpecies
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. elastic, linear visco-elastic... et cetera...
Mdouble getYMax() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMax() returns XMax...
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
void setPosition(const Vec3D &position)
Sets the position of this BaseInteractable.
void set(Vec3D normal, Vec3D point)
Defines a standard wall, given an outward normal vector s.t. normal*x=normal*point for all x of the w...
void setTimeStep(Mdouble newDt)
Allows the time step dt to be changed.
This is a class defining walls.
Implementation of a 3D vector (by Vitaliy).
void actionsOnRestart()
A virtual function where the users can add extra code which is executed only when the code is restart...