libMesh
memory_solution_history.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2019 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"
25 #include "libmesh/solution_history.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
libMesh::System
Manages consistently variables, degrees of freedom, and coefficient vectors.
Definition: system.h:100
libMesh::MemorySolutionHistory
Subclass of Solution History that stores the solutions and other important vectors in memory.
Definition: memory_solution_history.h:42
libMesh::MemorySolutionHistory::retrieve
virtual void retrieve() override
Virtual function retrieve which we will be overriding to retrieve timesteps.
Definition: memory_solution_history.C:131
libMesh::MemorySolutionHistory::_system
System & _system
Definition: memory_solution_history.h:97
libMesh::MemorySolutionHistory::store
virtual void store() override
Virtual function store which we will be overriding to store timesteps.
Definition: memory_solution_history.C:67
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition: factoryfunction.C:55
end
IterBase * end
Also have a polymorphic pointer to the end object, this prevents iterating past the end.
Definition: variant_filter_iterator.h:343
libMesh::MemorySolutionHistory::clone
virtual std::unique_ptr< SolutionHistory > clone() const override
Definition of the clone function needed for the setter function.
Definition: memory_solution_history.h:79
libMesh::MemorySolutionHistory::stored_solutions_iterator
list_type::iterator stored_solutions_iterator
Definition: memory_solution_history.h:74
libMesh::MemorySolutionHistory::stored_solutions
list_type stored_solutions
Definition: memory_solution_history.h:88
libMesh::MemorySolutionHistory::find_stored_entry
void find_stored_entry()
Definition: memory_solution_history.C:32
libMesh::MemorySolutionHistory::stored_sols
stored_solutions_iterator stored_sols
Definition: memory_solution_history.h:91
libMesh::MemorySolutionHistory::~MemorySolutionHistory
~MemorySolutionHistory()
Destructor.
Definition: memory_solution_history.C:26
libMesh::MemorySolutionHistory::map_type
std::map< std::string, std::unique_ptr< NumericVector< Number > > > map_type
Typedef for Stored Solutions iterator, a list of pairs of the current system time,...
Definition: memory_solution_history.h:72
libMesh::MemorySolutionHistory::MemorySolutionHistory
MemorySolutionHistory(System &system_)
Constructor, reference to system to be passed by user, set the stored_sols iterator to some initial v...
Definition: memory_solution_history.h:50
libMesh::SolutionHistory
A SolutionHistory class that enables the storage and retrieval of timesteps and (in the future) adapt...
Definition: solution_history.h:35
libMesh::MemorySolutionHistory::list_type
std::list< std::pair< Real, map_type > > list_type
Definition: memory_solution_history.h:73