libMesh
Public Types | Public Member Functions | Protected Attributes | Private Attributes | List of all members
libMesh::FileHistoryData Class Reference

HistoryData subclass that provides a struct to store history data such as timestamps, mesh, primal and adjoint filenames and timestep sizes. More...

#include <file_history_data.h>

Inheritance diagram for libMesh::FileHistoryData:
[legend]

Public Types

typedef std::map< Real, std::unique_ptr< HistoryData > > map_type
 
typedef map_type::iterator stored_data_iterator
 

Public Member Functions

 FileHistoryData (DifferentiableSystem &system)
 
 ~FileHistoryData ()
 
std::string & get_mesh_filename ()
 
std::string & get_primal_filename ()
 
std::string & get_adjoint_filename ()
 
void set_mesh_filename (std::string &mesh_name)
 
void set_primal_filename (std::string &primal_sol_name)
 
void set_adjoint_filename (std::string &adjoint_sol_name)
 
virtual void store_initial_solution () override
 
virtual void store_primal_solution (stored_data_iterator stored_datum) override
 
virtual void store_adjoint_solution () override
 
virtual void rewrite_stored_solution () override
 
virtual void retrieve_primal_solution () override
 
virtual void retrieve_adjoint_solution () override
 
unsigned int get_time_stamp ()
 
Real get_deltat_at ()
 
bool get_previously_stored ()
 
void set_time_stamp (unsigned int time_stamp_val)
 
void set_deltat_at (Real deltat_at_val)
 
void set_previously_stored (bool previously_stored_val)
 

Protected Attributes

unsigned int time_stamp
 
Real deltat_at
 
bool previously_stored
 

Private Attributes

DifferentiableSystem_system
 
std::string mesh_filename
 
std::string primal_filename
 
std::string adjoint_filename
 

Detailed Description

HistoryData subclass that provides a struct to store history data such as timestamps, mesh, primal and adjoint filenames and timestep sizes.

Author
Vikram Garg
Date
2021

Definition at line 18 of file file_history_data.h.

Member Typedef Documentation

◆ map_type

typedef std::map<Real, std::unique_ptr<HistoryData> > libMesh::HistoryData::map_type
inherited

Definition at line 54 of file history_data.h.

◆ stored_data_iterator

typedef map_type::iterator libMesh::HistoryData::stored_data_iterator
inherited

Definition at line 55 of file history_data.h.

Constructor & Destructor Documentation

◆ FileHistoryData()

libMesh::FileHistoryData::FileHistoryData ( DifferentiableSystem system)
inline

Definition at line 22 of file file_history_data.h.

◆ ~FileHistoryData()

libMesh::FileHistoryData::~FileHistoryData ( )
inline

Definition at line 24 of file file_history_data.h.

24 {};

Member Function Documentation

◆ get_adjoint_filename()

std::string& libMesh::FileHistoryData::get_adjoint_filename ( )
inline

Definition at line 33 of file file_history_data.h.

References adjoint_filename.

34  { return adjoint_filename; }

◆ get_deltat_at()

Real libMesh::HistoryData::get_deltat_at ( )
inlineinherited

Definition at line 36 of file history_data.h.

References libMesh::HistoryData::deltat_at.

37  { return deltat_at; }

◆ get_mesh_filename()

std::string& libMesh::FileHistoryData::get_mesh_filename ( )
inline

Definition at line 27 of file file_history_data.h.

References mesh_filename.

28  { return mesh_filename; }

◆ get_previously_stored()

bool libMesh::HistoryData::get_previously_stored ( )
inlineinherited

Definition at line 39 of file history_data.h.

References libMesh::HistoryData::previously_stored.

40  { return previously_stored; }

◆ get_primal_filename()

std::string& libMesh::FileHistoryData::get_primal_filename ( )
inline

Definition at line 30 of file file_history_data.h.

References primal_filename.

31  { return primal_filename; }

◆ get_time_stamp()

unsigned int libMesh::HistoryData::get_time_stamp ( )
inlineinherited

◆ retrieve_adjoint_solution()

void libMesh::FileHistoryData::retrieve_adjoint_solution ( )
overridevirtual

Implements libMesh::HistoryData.

Definition at line 93 of file file_history_data.C.

References _system, adjoint_filename, libMesh::System::get_equation_systems(), libMesh::READ, libMesh::EquationSystems::read(), libMesh::EquationSystems::READ_ADDITIONAL_DATA, and libMesh::EquationSystems::READ_DATA.

94  {
95  // Read in the adjoint solution stored at the current recovery time from the disk
97  }
const EquationSystems & get_equation_systems() const
Definition: system.h:721
DifferentiableSystem & _system
void read(std::string_view name, const XdrMODE, const unsigned int read_flags=(READ_HEADER|READ_DATA), bool partition_agnostic=true)
Read & initialize the systems from disk using the XDR data format.

◆ retrieve_primal_solution()

void libMesh::FileHistoryData::retrieve_primal_solution ( )
overridevirtual

Implements libMesh::HistoryData.

Definition at line 87 of file file_history_data.C.

References _system, libMesh::System::get_equation_systems(), primal_filename, libMesh::READ, libMesh::EquationSystems::read(), libMesh::EquationSystems::READ_ADDITIONAL_DATA, and libMesh::EquationSystems::READ_DATA.

88  {
89  // Read in the primal solution stored at the current recovery time from the disk
91  }
const EquationSystems & get_equation_systems() const
Definition: system.h:721
DifferentiableSystem & _system
void read(std::string_view name, const XdrMODE, const unsigned int read_flags=(READ_HEADER|READ_DATA), bool partition_agnostic=true)
Read & initialize the systems from disk using the XDR data format.

◆ rewrite_stored_solution()

void libMesh::FileHistoryData::rewrite_stored_solution ( )
overridevirtual

◆ set_adjoint_filename()

void libMesh::FileHistoryData::set_adjoint_filename ( std::string &  adjoint_sol_name)
inline

Definition at line 42 of file file_history_data.h.

References adjoint_filename.

43  { adjoint_filename = adjoint_sol_name; }

◆ set_deltat_at()

void libMesh::HistoryData::set_deltat_at ( Real  deltat_at_val)
inlineinherited

Definition at line 46 of file history_data.h.

References libMesh::HistoryData::deltat_at.

Referenced by libMesh::MemoryHistoryData::store_primal_solution(), and store_primal_solution().

47  { deltat_at = deltat_at_val; }

◆ set_mesh_filename()

void libMesh::FileHistoryData::set_mesh_filename ( std::string &  mesh_name)
inline

Definition at line 36 of file file_history_data.h.

References mesh_filename.

37  { mesh_filename = mesh_name; }

◆ set_previously_stored()

void libMesh::HistoryData::set_previously_stored ( bool  previously_stored_val)
inlineinherited

Definition at line 49 of file history_data.h.

References libMesh::HistoryData::previously_stored.

50  { previously_stored = previously_stored_val; }

◆ set_primal_filename()

void libMesh::FileHistoryData::set_primal_filename ( std::string &  primal_sol_name)
inline

Definition at line 39 of file file_history_data.h.

References primal_filename.

40  { primal_filename = primal_sol_name; }

◆ set_time_stamp()

void libMesh::HistoryData::set_time_stamp ( unsigned int  time_stamp_val)
inlineinherited

Definition at line 43 of file history_data.h.

References libMesh::HistoryData::time_stamp.

44  { time_stamp = time_stamp_val; }
unsigned int time_stamp
Definition: history_data.h:73

◆ store_adjoint_solution()

void libMesh::FileHistoryData::store_adjoint_solution ( )
overridevirtual

Implements libMesh::HistoryData.

Definition at line 70 of file file_history_data.C.

References _system, adjoint_filename, libMesh::System::get_equation_systems(), libMesh::HistoryData::time_stamp, libMesh::WRITE, libMesh::EquationSystems::write(), libMesh::EquationSystems::WRITE_ADDITIONAL_DATA, and libMesh::EquationSystems::WRITE_DATA.

71  {
72  adjoint_filename = "adjoint.out.xda.";
73 
74  adjoint_filename += std::to_string(time_stamp);
75 
77  }
void write(std::string_view name, const XdrMODE, const unsigned int write_flags=(WRITE_DATA), bool partition_agnostic=true) const
Write the systems to disk using the XDR data format.
unsigned int time_stamp
Definition: history_data.h:73
const EquationSystems & get_equation_systems() const
Definition: system.h:721
DifferentiableSystem & _system

◆ store_initial_solution()

void libMesh::FileHistoryData::store_initial_solution ( )
overridevirtual

Implements libMesh::HistoryData.

Definition at line 26 of file file_history_data.C.

References _system, libMesh::HistoryData::deltat_at, libMesh::System::get_equation_systems(), libMesh::libmesh_assert(), libMesh::HistoryData::previously_stored, primal_filename, libMesh::HistoryData::time_stamp, libMesh::WRITE, libMesh::EquationSystems::write(), libMesh::EquationSystems::WRITE_ADDITIONAL_DATA, and libMesh::EquationSystems::WRITE_DATA.

27  {
28  // The initial data should only be stored once.
30 
31  time_stamp = 0;
32 
33  primal_filename = "primal.out.xda.";
34 
35  primal_filename += std::to_string(time_stamp);
36 
38 
39  // We wont know the deltat taken at this timestep until the solve is completed, which is done after the store operation.
40  deltat_at = std::numeric_limits<double>::signaling_NaN();
41 
42  previously_stored = true;
43  }
void write(std::string_view name, const XdrMODE, const unsigned int write_flags=(WRITE_DATA), bool partition_agnostic=true) const
Write the systems to disk using the XDR data format.
unsigned int time_stamp
Definition: history_data.h:73
const EquationSystems & get_equation_systems() const
Definition: system.h:721
DifferentiableSystem & _system
libmesh_assert(ctx)

◆ store_primal_solution()

void libMesh::FileHistoryData::store_primal_solution ( stored_data_iterator  stored_datum)
overridevirtual

Implements libMesh::HistoryData.

Definition at line 45 of file file_history_data.C.

References _system, libMesh::HistoryData::deltat_at, libMesh::System::get_equation_systems(), libMesh::HistoryData::get_time_stamp(), libMesh::HistoryData::previously_stored, primal_filename, libMesh::HistoryData::set_deltat_at(), libMesh::DifferentiableSystem::time_solver, libMesh::HistoryData::time_stamp, libMesh::WRITE, libMesh::EquationSystems::write(), libMesh::EquationSystems::WRITE_ADDITIONAL_DATA, and libMesh::EquationSystems::WRITE_DATA.

46  {
47  // An iterator to the datum being stored has been passed. This is taken to imply
48  // that we are in a sequential time stepping sequence.
49 
50  stored_data_iterator stored_datum_last = stored_datum;
51  stored_datum_last--;
52 
53  time_stamp = (stored_datum_last->second)->get_time_stamp() + 1;
54 
55  primal_filename = "primal.out.xda.";
56 
57  primal_filename += std::to_string(time_stamp);
58 
60 
61  // We dont know the deltat that will be taken at the current timestep.
62  deltat_at = std::numeric_limits<double>::signaling_NaN();
63 
64  // But we know what deltat got us to the current time.
65  (stored_datum_last->second)->set_deltat_at(_system.time_solver->TimeSolver::last_completed_timestep_size());
66 
67  previously_stored = true;
68  }
void write(std::string_view name, const XdrMODE, const unsigned int write_flags=(WRITE_DATA), bool partition_agnostic=true) const
Write the systems to disk using the XDR data format.
unsigned int time_stamp
Definition: history_data.h:73
const EquationSystems & get_equation_systems() const
Definition: system.h:721
std::unique_ptr< TimeSolver > time_solver
A pointer to the solver object we&#39;re going to use.
Definition: diff_system.h:253
unsigned int get_time_stamp()
Definition: history_data.h:33
DifferentiableSystem & _system
void set_deltat_at(Real deltat_at_val)
Definition: history_data.h:46
map_type::iterator stored_data_iterator
Definition: history_data.h:55

Member Data Documentation

◆ _system

DifferentiableSystem& libMesh::FileHistoryData::_system
private

◆ adjoint_filename

std::string libMesh::FileHistoryData::adjoint_filename
private

◆ deltat_at

Real libMesh::HistoryData::deltat_at
protectedinherited

◆ mesh_filename

std::string libMesh::FileHistoryData::mesh_filename
private

Definition at line 59 of file file_history_data.h.

Referenced by get_mesh_filename(), and set_mesh_filename().

◆ previously_stored

bool libMesh::HistoryData::previously_stored
protectedinherited

◆ primal_filename

std::string libMesh::FileHistoryData::primal_filename
private

◆ time_stamp

unsigned int libMesh::HistoryData::time_stamp
protectedinherited

The documentation for this class was generated from the following files: