libMesh
Loading...
Searching...
No Matches
file_history_data.C
Go to the documentation of this file.
1// The libMesh Finite Element Library.
2// Copyright (C) 2002-2026 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3
4// This library is free software; you can redistribute it and/or
5// modify it under the terms of the GNU Lesser General Public
6// License as published by the Free Software Foundation; either
7// version 2.1 of the License, or (at your option) any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// Lesser General Public License for more details.
13
14// You should have received a copy of the GNU Lesser General Public
15// License along with this library; if not, write to the Free Software
16// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18// Local includes
19#include "libmesh/file_history_data.h"
20
21#include "libmesh/enum_xdr_mode.h"
22#include "libmesh/equation_systems.h"
23
24namespace libMesh
25{
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 }
44
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 }
69
78
86
88 {
89 // Read in the primal solution stored at the current recovery time from the disk
91 }
92
94 {
95 // Read in the adjoint solution stored at the current recovery time from the disk
97 }
98}
std::unique_ptr< TimeSolver > time_solver
A pointer to the solver object we're going to use.
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.
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.
virtual void retrieve_adjoint_solution() override
virtual void store_initial_solution() override
virtual void store_adjoint_solution() override
virtual void retrieve_primal_solution() override
DifferentiableSystem & _system
virtual void rewrite_stored_solution() override
virtual void store_primal_solution(stored_data_iterator stored_datum) override
map_type::iterator stored_data_iterator
void set_deltat_at(Real deltat_at_val)
unsigned int time_stamp
unsigned int get_time_stamp()
const EquationSystems & get_equation_systems() const
Definition system.h:767
The libMesh namespace provides an interface to certain functionality in the library.
libmesh_assert(ctx)