LCOV - code coverage report
Current view: top level - include/solvers - history_data.h (source / functions) Hit Total Coverage
Test: libMesh/libmesh: #4229 (6a9aeb) with base 727f46 Lines: 11 11 100.0 %
Date: 2025-08-19 19:27:09 Functions: 6 7 85.7 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : 
      12             :     /** The History Data classes are companion classes to SolutionHistory and MeshHistory classes.
      13             :      * These provide data structures to store different types of history data (timestamps,
      14             :      * pointers, filenames) depending on the type of History being used.
      15             :      *
      16             :      * \author Vikram Garg
      17             :      * \date 2021
      18             :      * \brief Provides history data structures and I/O, memory operation functions.
      19             :      */
      20             : 
      21             :     class HistoryData
      22             :     {
      23             :         public:
      24             : 
      25             :         // Constructor
      26       12960 :         HistoryData() : time_stamp(std::numeric_limits<unsigned int>::signaling_NaN()),
      27       12600 :         deltat_at(std::numeric_limits<double>::signaling_NaN()), previously_stored(false) {};
      28             : 
      29             :         // Destructor
      30         360 :         virtual ~HistoryData() {};
      31             : 
      32             :         // Accessors for individual history members, common to all types of histories.
      33         336 :         unsigned int get_time_stamp()
      34       11424 :         { return time_stamp; }
      35             : 
      36         976 :         Real get_deltat_at()
      37       33184 :         { return deltat_at; }
      38             : 
      39         580 :         bool get_previously_stored()
      40       19720 :         { 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         336 :         void set_deltat_at(Real deltat_at_val)
      47       11760 :         { 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.
      76             :         Real deltat_at;
      77             : 
      78             :         // To help check if we are storing fresh or overwriting.
      79             :         bool previously_stored;
      80             : 
      81             :     };
      82             : } // end namespace libMesh
      83             : 
      84             : #endif // LIBMESH_HISTORY_DATA_H

Generated by: LCOV version 1.14