memory_solution_history.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2018 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_MEMORY_SOLUTION_HISTORY_H
21 #define LIBMESH_MEMORY_SOLUTION_HISTORY_H
22 
23 // Local includes
24 #include "libmesh/numeric_vector.h"
26 #include "libmesh/auto_ptr.h" // libmesh_make_unique
27 
28 // C++ includes
29 #include <list>
30 
31 namespace libMesh
32 {
33 
43 {
44 public:
45 
51  { libmesh_experimental(); }
52 
57 
61  virtual void store() override;
62 
66  virtual void retrieve() override;
67 
72  typedef std::map<std::string, std::unique_ptr<NumericVector<Number>>> map_type;
73  typedef std::list<std::pair<Real, map_type>> list_type;
74  typedef list_type::iterator stored_solutions_iterator;
75 
79  virtual std::unique_ptr<SolutionHistory > clone() const override
80  {
81  return libmesh_make_unique<MemorySolutionHistory>(_system);
82  }
83 
84 private:
85 
86  // This list of pairs will hold the current time and stored vectors
87  // from each timestep
89 
90  // The stored solutions iterator
92 
93  // A helper function to locate entries at a given time
94  void find_stored_entry();
95 
96  // A system reference
98 };
99 
100 } // end namespace libMesh
101 
102 #endif // LIBMESH_MEMORY_SOLUTION_HISTORY_H
std::list< std::pair< Real, map_type > > list_type
Stores past solutions in memory.
IterBase * end
For storing and retrieving timestep data.
Manages consistently variables, degrees of freedom, and coefficient vectors.
Definition: system.h:92
stored_solutions_iterator stored_sols
std::map< std::string, std::unique_ptr< NumericVector< Number > > > map_type
list_type::iterator stored_solutions_iterator
virtual std::unique_ptr< SolutionHistory > clone() const override