state_vector_multi.h
Go to the documentation of this file.
1 /*
2 This file is part of the Ristra Wonton project.
3 Please see the license file at the root of this repository, or at:
4  https://github.com/laristra/wonton/blob/master/LICENSE
5 */
6 
7 #ifndef WONTON_STATE_VECTOR_MULTI_H_
8 #define WONTON_STATE_VECTOR_MULTI_H_
9 
10 #include <string>
11 #include <typeinfo>
12 #include <vector>
13 #include <unordered_map>
14 
15 #include "wonton/support/wonton.h"
17 
18 namespace Wonton {
19 
27 template <class T=double>
29 
30  public:
31 
38  std::string name,
39  std::unordered_map<int, std::vector<T>> data = std::unordered_map<int, std::vector<T>>()
41  data_(data) {}
42 
43 
46 
47  // print
48  std::ostream & print(std::ostream & os) const {
49  os << "StateVectorMulti\n";
50  return os;
51  }
52 
53  // get the data type
54  const std::type_info& data_type() const {
55  const std::type_info& ti = typeid(T);
56  return ti;
57  }
58 
59 
66  std::unordered_map<int, std::vector<T>>& get_data() { return data_; }
67 
68 
75  std::unordered_map<int, std::vector<T>> const & get_data() const { return data_; }
76 
77 
88  std::vector<T>& get_data(int m) { return data_[m]; }
89 
98  std::vector<T> const & get_data(int m) const { return data_.at(m); }
99 
100  private:
101 
102  std::unordered_map<int, std::vector<T>> data_;
103 
104 };
105 
106 }
107 
108 #endif //WONTON_STATE_VECTOR_MULTI_H_
109 
std::vector< T > & get_data(int m)
Return a reference to the data in the state vector.
Definition: state_vector_multi.h:88
Definition: state_vector_base.h:30
const std::type_info & data_type() const
Definition: state_vector_multi.h:54
Factorize a number N into D equal (or nearly equal) factors.
Definition: adaptive_refinement_mesh.h:31
Definition: state_vector_multi.h:28
std::unordered_map< int, std::vector< T > > & get_data()
Return a reference to the data in the state vector.
Definition: state_vector_multi.h:66
std::unordered_map< int, std::vector< T > > const & get_data() const
Return a const reference to the data in the state vector.
Definition: state_vector_multi.h:75
StateVectorMulti(std::string name, std::unordered_map< int, std::vector< T >> data=std::unordered_map< int, std::vector< T >>())
Constructor for StateVectorMulti.
Definition: state_vector_multi.h:37
Definition: wonton.h:88
Field_type
Field type - whether it is mesh field or multi-material field.
Definition: wonton.h:187
std::vector< T > const & get_data(int m) const
Return a const reference to the data in the state vector.
Definition: state_vector_multi.h:98
~StateVectorMulti()
Destructor.
Definition: state_vector_multi.h:45
Entity_kind
The type of mesh entity.
Definition: wonton.h:81
std::ostream & print(std::ostream &os) const
Virtual methods.
Definition: state_vector_multi.h:48