libMesh
history_data.h
Go to the documentation of this file.
1 #ifndef LIBMESH_HISTORY_DATA_H
2 #define LIBMESH_HISTORY_DATA_H
3 
4 #include <cmath>
5 #include "libmesh/system.h"
6 
7 // LOCAL INCLUDES
8 
9 namespace libMesh
10 {
11 
22  {
23  public:
24 
25  // Constructor
26  HistoryData() : time_stamp(std::numeric_limits<unsigned int>::signaling_NaN()),
27  deltat_at(std::numeric_limits<double>::signaling_NaN()), previously_stored(false) {};
28 
29  // Destructor
30  virtual ~HistoryData() {};
31 
32  // Accessors for individual history members, common to all types of histories.
33  unsigned int get_time_stamp()
34  { return time_stamp; }
35 
37  { return deltat_at; }
38 
40  { return previously_stored; }
41 
42  // Setters for common history members
43  void set_time_stamp(unsigned int time_stamp_val)
44  { time_stamp = time_stamp_val; }
45 
46  void set_deltat_at(Real deltat_at_val)
47  { deltat_at = deltat_at_val; }
48 
49  void set_previously_stored(bool previously_stored_val)
50  { previously_stored = previously_stored_val; }
51 
52  // Some history storing functions take an iterator to a map as an argument.
53  // This iterator is necessary for setting time stamps and delta_ts.
54  typedef std::map<Real, std::unique_ptr<HistoryData>> map_type;
55  typedef map_type::iterator stored_data_iterator;
56 
57  // Operations for SolutionHistory
58  virtual void store_initial_solution() = 0;
59  virtual void store_primal_solution(stored_data_iterator stored_datum) = 0;
60  virtual void store_adjoint_solution() = 0;
61  virtual void rewrite_stored_solution() = 0;
62 
63  virtual void retrieve_primal_solution() = 0;
64  virtual void retrieve_adjoint_solution() = 0;
65 
66  // Operations for MeshHistory
67 
68  protected:
69 
70  // Variable members common to all derived HistoryData types
71 
72  // The index of the current time step
73  unsigned int time_stamp;
74 
75  // The delta_t (timestep taken) at the current timestep.
77 
78  // To help check if we are storing fresh or overwriting.
80 
81  };
82 } // end namespace libMesh
83 
84 #endif // LIBMESH_HISTORY_DATA_H
virtual void store_primal_solution(stored_data_iterator stored_datum)=0
The History Data classes are companion classes to SolutionHistory and MeshHistory classes...
Definition: history_data.h:21
virtual void retrieve_primal_solution()=0
bool get_previously_stored()
Definition: history_data.h:39
unsigned int time_stamp
Definition: history_data.h:73
The libMesh namespace provides an interface to certain functionality in the library.
unsigned int get_time_stamp()
Definition: history_data.h:33
virtual ~HistoryData()
Definition: history_data.h:30
void set_time_stamp(unsigned int time_stamp_val)
Definition: history_data.h:43
virtual void store_adjoint_solution()=0
std::map< Real, std::unique_ptr< HistoryData > > map_type
Definition: history_data.h:54
virtual void retrieve_adjoint_solution()=0
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void set_deltat_at(Real deltat_at_val)
Definition: history_data.h:46
map_type::iterator stored_data_iterator
Definition: history_data.h:55
virtual void store_initial_solution()=0
virtual void rewrite_stored_solution()=0
void set_previously_stored(bool previously_stored_val)
Definition: history_data.h:49
void ErrorVector unsigned int
Definition: adjoints_ex3.C:360