libMesh
Loading...
Searching...
No Matches
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.

34 { return adjoint_filename; }

References adjoint_filename.

Referenced by libMesh::FileSolutionHistory::retrieve().

◆ get_deltat_at()

Real libMesh::HistoryData::get_deltat_at ( )
inlineinherited

Definition at line 36 of file history_data.h.

37 { return deltat_at; }

References libMesh::HistoryData::deltat_at.

◆ get_mesh_filename()

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

Definition at line 27 of file file_history_data.h.

28 { return mesh_filename; }

References mesh_filename.

◆ get_previously_stored()

bool libMesh::HistoryData::get_previously_stored ( )
inlineinherited

Definition at line 39 of file history_data.h.

40 { return previously_stored; }

References libMesh::HistoryData::previously_stored.

◆ get_primal_filename()

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

Definition at line 30 of file file_history_data.h.

31 { return primal_filename; }

References 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.

94 {
95 // Read in the adjoint solution stored at the current recovery time from the disk
97 }
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.
const EquationSystems & get_equation_systems() const
Definition system.h:767

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

◆ retrieve_primal_solution()

void libMesh::FileHistoryData::retrieve_primal_solution ( )
overridevirtual

◆ 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.

43 { adjoint_filename = adjoint_sol_name; }

References adjoint_filename.

◆ set_deltat_at()

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

Definition at line 46 of file history_data.h.

47 { deltat_at = deltat_at_val; }

References libMesh::HistoryData::deltat_at.

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

◆ set_mesh_filename()

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

Definition at line 36 of file file_history_data.h.

37 { mesh_filename = mesh_name; }

References mesh_filename.

◆ set_previously_stored()

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

Definition at line 49 of file history_data.h.

50 { previously_stored = previously_stored_val; }

References libMesh::HistoryData::previously_stored.

◆ 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.

40 { primal_filename = primal_sol_name; }

References primal_filename.

◆ set_time_stamp()

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

Definition at line 43 of file history_data.h.

44 { time_stamp = time_stamp_val; }

References libMesh::HistoryData::time_stamp.

◆ store_adjoint_solution()

void libMesh::FileHistoryData::store_adjoint_solution ( )
overridevirtual

◆ store_initial_solution()

void libMesh::FileHistoryData::store_initial_solution ( )
overridevirtual

Implements libMesh::HistoryData.

Definition at line 26 of file file_history_data.C.

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 }

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.

◆ 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.

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 }
std::unique_ptr< TimeSolver > time_solver
A pointer to the solver object we're going to use.
map_type::iterator stored_data_iterator
void set_deltat_at(Real deltat_at_val)
unsigned int get_time_stamp()

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.

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: