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

          Line data    Source code
       1             : // The libMesh Finite Element Library.
       2             : // Copyright (C) 2002-2025 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             : 
      19             : 
      20             : #ifndef LIBMESH_FILE_SOLUTION_HISTORY_H
      21             : #define LIBMESH_FILE_SOLUTION_HISTORY_H
      22             : 
      23             : // Local includes
      24             : #include "libmesh/solution_history.h"
      25             : #include "libmesh/libmesh.h"
      26             : 
      27             : // C++ includes
      28             : #include <vector>
      29             : #include <memory>
      30             : 
      31             : namespace libMesh
      32             : {
      33             : 
      34             : // Forward declarations
      35             : template <typename T> class NumericVector;
      36             : class DifferentiableSystem;
      37             : 
      38             : /**
      39             :  * Subclass of Solution History that stores the solutions
      40             :  * and other important vectors onto disk.
      41             :  *
      42             :  * \author Vikram Garg
      43             :  * \date 2020
      44             :  * \brief Stores past solutions onto disk.
      45             :  */
      46          64 : class FileSolutionHistory : public SolutionHistory
      47             : {
      48             : public:
      49             : 
      50             :   /**
      51             :    * Constructor, reference to system to be passed by user, set the
      52             :    * stored_sols iterator to some initial value
      53             :    */
      54             :   FileSolutionHistory(DifferentiableSystem & system);
      55             : 
      56             :   /**
      57             :    * Destructor, defaulted out-of-line.
      58             :    */
      59             :   ~FileSolutionHistory();
      60             : 
      61             :   /**
      62             :    * Virtual function store which we will be overriding to store timesteps
      63             :    */
      64             :   virtual void store(bool is_adjoint_solve, Real time) override;
      65             : 
      66             :   /**
      67             :    * Virtual function retrieve which we will be overriding to retrieve timesteps
      68             :    */
      69             :   virtual void retrieve(bool is_adjoint_solve, Real time) override;
      70             : 
      71             :   /**
      72             :    * Definition of the clone function needed for the setter function
      73             :    */
      74             :   virtual std::unique_ptr<SolutionHistory> clone() const override;
      75             : 
      76             : private:
      77             : 
      78             :   // A system reference
      79             :   DifferentiableSystem & _system;
      80             : 
      81             :   /**
      82             :    * A vector of pointers to adjoint and old adjoint solutions at the last time step.
      83             :    * These are used to prevent the zeroing of the adjoint and old adjoint by es::read.
      84             :    */
      85             :   std::vector< std::unique_ptr<NumericVector<Number>> > dual_solution_copies;
      86             :   std::vector< std::unique_ptr<NumericVector<Number>> > old_dual_solution_copies;
      87             : };
      88             : 
      89             : } // end namespace libMesh
      90             : 
      91             : #endif // LIBMESH_FILE_SOLUTION_HISTORY_H

Generated by: LCOV version 1.14