GRINS-0.8.0
cached_values.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // GRINS - General Reacting Incompressible Navier-Stokes
5 //
6 // Copyright (C) 2014-2017 Paul T. Bauman, Roy H. Stogner
7 // Copyright (C) 2010-2013 The PECOS Development Team
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the Version 2.1 GNU Lesser General
11 // Public License as published by the Free Software Foundation.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
21 // Boston, MA 02110-1301 USA
22 //
23 //-----------------------------------------------------------------------el-
24 
25 
26 #ifndef GRINS_CACHED_VALUES_H
27 #define GRINS_CACHED_VALUES_H
28 
29 //C++
30 #include <set>
31 #include <vector>
32 #include <map>
33 
34 // libMesh
35 #include "libmesh/libmesh.h"
36 #include "libmesh/vector_value.h" //libMesh::Gradient
37 
38 // GRINS
40 
41 namespace GRINS
42 {
44  {
45  public:
46 
47  CachedValues();
48  ~CachedValues();
49 
50  void add_quantity( unsigned int quantity );
51 
52  void add_quantities( const std::set<unsigned int>& cache_list );
53 
54  void clear();
55 
56  bool is_active(unsigned int quantity);
57 
58  void set_values( unsigned int quantity, std::vector<libMesh::Number>& values );
59 
60  void set_gradient_values( unsigned int quantity,
61  std::vector<libMesh::Gradient>& values );
62 
63  void set_vector_values( unsigned int quantity,
64  std::vector<std::vector<libMesh::Number> >& values );
65 
66  void set_vector_gradient_values( unsigned int quantity,
67  std::vector<std::vector<libMesh::Gradient> >& values );
68 
69  const std::vector<libMesh::Number>& get_cached_values( unsigned int quantity ) const;
70 
71  const std::vector<libMesh::Gradient>& get_cached_gradient_values( unsigned int quantity ) const;
72 
73  const std::vector<std::vector<libMesh::Number> >& get_cached_vector_values( unsigned int quantity ) const;
74 
75  const std::vector<std::vector<libMesh::Gradient> >& get_cached_vector_gradient_values( unsigned int quantity ) const;
76 
77  unsigned int size() const;
78 
79  protected:
80 
81  std::set<unsigned int> _cache_list;
82 
83  std::map<unsigned int,std::vector<libMesh::Number> > _cached_values;
84  std::map<unsigned int,std::vector<libMesh::Gradient> > _cached_gradient_values;
85  std::map<unsigned int,std::vector<std::vector<libMesh::Number> > > _cached_vector_values;
86  std::map<unsigned int,std::vector<std::vector<libMesh::Gradient> > > _cached_vector_gradient_values;
87 
88  };
89 
90  inline
91  unsigned int CachedValues::size() const
92  {
93  return _cache_list.size();
94  }
95 
96 } // namespace GRINS
97 
98 #endif // GRINS_CACHED_VALUES_H
bool is_active(unsigned int quantity)
Definition: cached_values.C:62
void add_quantities(const std::set< unsigned int > &cache_list)
Definition: cached_values.C:46
std::map< unsigned int, std::vector< std::vector< libMesh::Number > > > _cached_vector_values
Definition: cached_values.h:85
void set_values(unsigned int quantity, std::vector< libMesh::Number > &values)
Definition: cached_values.C:72
std::set< unsigned int > _cache_list
Definition: cached_values.h:81
void set_vector_gradient_values(unsigned int quantity, std::vector< std::vector< libMesh::Gradient > > &values)
Definition: cached_values.C:86
std::map< unsigned int, std::vector< std::vector< libMesh::Gradient > > > _cached_vector_gradient_values
Definition: cached_values.h:86
unsigned int size() const
Definition: cached_values.h:91
GRINS namespace.
const std::vector< std::vector< libMesh::Number > > & get_cached_vector_values(unsigned int quantity) const
std::map< unsigned int, std::vector< libMesh::Number > > _cached_values
Definition: cached_values.h:83
const std::vector< std::vector< libMesh::Gradient > > & get_cached_vector_gradient_values(unsigned int quantity) const
const std::vector< libMesh::Gradient > & get_cached_gradient_values(unsigned int quantity) const
void add_quantity(unsigned int quantity)
Definition: cached_values.C:40
void set_vector_values(unsigned int quantity, std::vector< std::vector< libMesh::Number > > &values)
Definition: cached_values.C:93
void set_gradient_values(unsigned int quantity, std::vector< libMesh::Gradient > &values)
Definition: cached_values.C:78
const std::vector< libMesh::Number > & get_cached_values(unsigned int quantity) const
Definition: cached_values.C:99
std::map< unsigned int, std::vector< libMesh::Gradient > > _cached_gradient_values
Definition: cached_values.h:84

Generated on Tue Dec 19 2017 12:47:28 for GRINS-0.8.0 by  doxygen 1.8.9.1