Line data Source code
1 : #ifndef LIBMESH_FILE_HISTORY_DATA_H 2 : #define LIBMESH_FILE_HISTORY_DATA_H 3 : 4 : #include "libmesh/history_data.h" 5 : #include "libmesh/diff_system.h" 6 : 7 : namespace libMesh 8 : { 9 : 10 : /** HistoryData subclass that provides a struct to store history data 11 : * such as timestamps, mesh, primal and adjoint filenames and timestep sizes. 12 : * 13 : * \author Vikram Garg 14 : * \date 2021 15 : * \brief 16 : */ 17 : 18 : class FileHistoryData : public HistoryData 19 : { 20 : public: 21 : 22 4176 : FileHistoryData(DifferentiableSystem & system) : HistoryData(), _system(system),mesh_filename(""), primal_filename(""), adjoint_filename("") {}; 23 : 24 8120 : ~FileHistoryData() {}; 25 : 26 : // Accessors for FileHistory specific variables 27 : std::string & get_mesh_filename() 28 : { return mesh_filename; } 29 : 30 : std::string & get_primal_filename() 31 : { return primal_filename; } 32 : 33 180 : std::string & get_adjoint_filename() 34 180 : { return adjoint_filename; } 35 : 36 : void set_mesh_filename(std::string & mesh_name) 37 : { mesh_filename = mesh_name; } 38 : 39 : void set_primal_filename(std::string & primal_sol_name) 40 : { primal_filename = primal_sol_name; } 41 : 42 : void set_adjoint_filename(std::string & adjoint_sol_name) 43 : { adjoint_filename = adjoint_sol_name; } 44 : 45 : virtual void store_initial_solution() override; 46 : virtual void store_primal_solution(stored_data_iterator stored_datum) override; 47 : virtual void store_adjoint_solution() override; 48 : virtual void rewrite_stored_solution() override; 49 : 50 : virtual void retrieve_primal_solution() override; 51 : virtual void retrieve_adjoint_solution() override; 52 : 53 : private: 54 : 55 : // Reference to underlying system 56 : DifferentiableSystem & _system; 57 : 58 : // File History specific variables 59 : std::string mesh_filename; 60 : std::string primal_filename; 61 : std::string adjoint_filename; 62 : 63 : }; 64 : } 65 : #endif