27 #ifndef MERCURY3DRESTART_H
28 #define MERCURY3DRESTART_H
73 if (!strcmp(argv[i],
"-restart") || !strcmp(argv[i],
"-r"))
78 std::cout <<
"tmax= " <<
getTimeMax() << std::endl;
95 if (gettimeofday(&time, NULL))
97 std::cerr <<
"Error in getWallTime: Wall time could not be read" << std::endl;
100 return (
double) time.tv_sec + (double) time.tv_usec * .000001;
118 std::cout <<
"Exiting for restarting after "
122 std::stringstream com(
"");
125 std::size_t found =
getName().find(
'.');
126 if (found==std::string::npos) {
132 std::cout <<
"system output:" << system(com.str().c_str()) << std::endl;
std::string clusterCommand_
Command required to execute code on a cluster; for einder, the command is ~/bin/sclusterscriptexecute...
File restartFile
An instance of class File to handle in- and output into a .restart file.
void closeFiles()
Closes all files (ene, data, fstat, restart, stat) that were opened to read or write.
void setClusterCommand(std::string clusterCommand)
void setAppend(bool newAppendFlag)
Allows to set the append option.
virtual void writeOutputFiles()
Writes the simulation data onto all the files i.e. .data, .ene, .fstat ...
double getWallTime() const
Returns wall time (uses sys command, thus might not work on Windows)
double initialWallTime_
Internal variable (i.e.
void setMaxWallTime(Mdouble maxWallTime)
std::fstream & getFstream()
Allows to access the member variable File::fstream_.
int readRestartFile()
Reads all the particle data corresponding to the current saved time step. Which is what the restart f...
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
This adds on the hierarchical grid code for 3D problems.
bool readNextArgument(int &i, int argc, char *argv[]) override
Reads the next command line argument.
Mdouble getInitialWallTime() const
virtual void actionsAfterSolve()
A virtual function which allows to define operations to be executed after the solve().
virtual void printTime() const
Displays the current simulation time onto your screen for example.
void writeOutputFiles()
Writes the simulation data onto all the files i.e. .data, .ene, .fstat ...
This class adds to Mercury3D the ability to restart after a certain wall time.
int readNextArgument(int &i, int argc, char *argv[])
the -r option is used to restart the code; this should probably be moved to DPMBase ...
double maxWallTime_
Time in seconds after which the code is automatically restarted for einder, this should be set to ~10...
virtual void finishStatistics()
no implementation but can be overidden in its derived classes.
const std::string & getName() const
Returns the name of the file. Does not allow to change it though.
Mdouble getMaxWallTime() const
Mdouble getTimeMax() const
Allows the user to access the total simulation time during the simulation. Cannot change it though...
const std::string & getName() const
Allows to access the file name, e.g., "problem.data".