main_loop_1d.hpp
Go to the documentation of this file.
1 
6 #ifndef MAIN_LOOP_HPP
7 #define MAIN_LOOP_HPP 1
8 
9 #include <string>
10 #include "../one_dimensional/hdsim.hpp"
11 
12 using std::string;
13 
15 namespace simulation1d{
16 
19  {
20  public:
21 
26  virtual bool operator()(hdsim1D const& sim) = 0;
27 
28  virtual ~TerminationCondition(void);
29 
30  private:
31  };
32 
35  {
36  public:
37 
42  SafeTimeTermination(double termination_time,
43  int max_cycles);
44 
45  bool operator()(hdsim1D const& sim);
46 
47  private:
48 
49  const double termination_time_;
50  const int max_cycles_;
51  };
52 
55  {
56  public:
57 
61  virtual void operator()(hdsim1D const& sim) = 0;
62 
63  virtual ~DiagnosticsFunction(void);
64  };
65 
68  {
69  public:
70 
74  explicit WriteTime(string const& fname);
75 
79  void operator()(hdsim1D const& sim);
80 
81  private:
82  const string fname_;
83  };
84 
91  void main_loop(hdsim1D& sim,
92  TerminationCondition& term_cond,
93  int time_order,
94  DiagnosticsFunction* diag = 0);
95 
103  void main_loop(hdsim1D& sim,
104  double final_time,
105  int max_iter=1e6,
106  int time_order=1,
107  string const& time_log="");
108 }
109 
110 #endif // MAIN_LOOP_HPP
Newtonian hydrodynamic simulation.
Definition: hdsim.hpp:25
virtual bool operator()(hdsim1D const &sim)=0
Determines if a simulation should continue running.
Terminates the simulation after a certain time is reached.
Abstract class for diagnostics function.
Abstract type for termination condition.
void main_loop(hdsim1D &sim, TerminationCondition &term_cond, int time_order, DiagnosticsFunction *diag=0)
Main simulation time advance loop.
Writes the time to a file after each time advance cycle.
Functions and classes for managing simulation time advance loops.