libMesh
memory_solution_history.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2017 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 
27 // C++ includes
28 #include <list>
29 
30 namespace libMesh
31 {
32 
42 {
43 public:
44 
50  { libmesh_experimental(); }
51 
56 
60  virtual void store() libmesh_override;
61 
65  virtual void retrieve() libmesh_override;
66 
71  typedef std::list<std::pair<Real, std::map<std::string, NumericVector<Number> *>>>::iterator stored_solutions_iterator;
72 
76  virtual UniquePtr<SolutionHistory > clone() const libmesh_override
77  {
79  }
80 
81 private:
82 
83  // This list of pairs will hold the current time and stored vectors
84  // from each timestep
85  std::list<std::pair<Real, std::map<std::string, NumericVector<Number> *>>> stored_solutions;
86 
87  // The stored solutions iterator
88  stored_solutions_iterator stored_sols;
89 
90  // A helper function to locate entries at a given time
91  void find_stored_entry();
92 
93  // A system reference
95 };
96 
97 } // end namespace libMesh
98 
99 #endif // LIBMESH_MEMORY_SOLUTION_HISTORY_H
std::list< std::pair< Real, std::map< std::string, NumericVector< Number > * > > >::iterator stored_solutions_iterator
Typedef for Stored Solutions iterator, a list of pairs of the current system time, map of strings and saved vectors.
std::list< std::pair< Real, std::map< std::string, NumericVector< Number > * > > > stored_solutions
virtual UniquePtr< SolutionHistory > clone() const libmesh_override
Definition of the clone function needed for the setter function.
Subclass of Solution History that stores the solutions and other important vectors in memory...
IterBase * end
Also have a polymorphic pointer to the end object, this prevents iterating past the end...
The libMesh namespace provides an interface to certain functionality in the library.
A SolutionHistory class that enables the storage and retrieval of timesteps and (in the future) adapt...
std::unique_ptr< T > UniquePtr
Definition: auto_ptr.h:46
virtual void store() libmesh_override
Virtual function store which we will be overriding to store timesteps.
This is the base class for classes which contain information related to any physical process that mig...
Definition: system.h:76
virtual void retrieve() libmesh_override
Virtual function retrieve which we will be overriding to retrieve timesteps.
stored_solutions_iterator stored_sols
MemorySolutionHistory(System &system_)
Constructor, reference to system to be passed by user, set the stored_sols iterator to some initial v...