state_vector_uni.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_STATE_VECTOR_UNI_H_
8 #define WONTON_STATE_STATE_VECTOR_UNI_H_
9 
10 #include <string>
11 #include <typeinfo>
12 #include <vector>
13 
14 #include "wonton/support/wonton.h"
16 
17 namespace Wonton {
18 
26 template <class T = double>
28  public:
36  std::string name,
38  std::vector<T> data = std::vector<T>())
39  : StateVectorBase(name, Field_type::MESH_FIELD, kind), data_(data) {}
40 
53  std::string name,
54  T const* begin,
55  T const* end,
57  : StateVectorBase(name, Field_type::MESH_FIELD, kind), data_(begin, end) {}
58 
59 
62 
63  // print
64  std::ostream & print(std::ostream & os) const {
65  os << "UniStateVector\n";
66  return os;
67  }
68 
69  // get the data type
70  const std::type_info& data_type() const {
71  const std::type_info& ti = typeid(T);
72  return ti;
73  }
74 
81  std::vector<T>& get_data() { return data_; }
82 
89  std::vector<T> const & get_data() const { return data_; }
90 
91  private:
92  std::vector<T> data_;
93 }; // class StateVectorUni
94 
95 } // namespace Wonton
96 
97 #endif // WONTON_STATE_STATE_VECTOR_UNI_H_
StateVectorUni(std::string name, Entity_kind kind=Entity_kind::CELL, std::vector< T > data=std::vector< T >())
Constructor for StateVectorUni.
Definition: state_vector_uni.h:35
Definition: state_vector_base.h:30
std::ostream & print(std::ostream &os) const
Virtual methods.
Definition: state_vector_uni.h:64
StateVectorUni(std::string name, T const *begin, T const *end, Entity_kind kind=Entity_kind::CELL)
Constructor for StateVectorUni.
Definition: state_vector_uni.h:52
Factorize a number N into D equal (or nearly equal) factors.
Definition: adaptive_refinement_mesh.h:31
std::vector< T > const & get_data() const
Return a const reference to the data in the state vector.
Definition: state_vector_uni.h:89
const std::type_info & data_type() const
Definition: state_vector_uni.h:70
Definition: wonton.h:88
Field_type
Field type - whether it is mesh field or multi-material field.
Definition: wonton.h:187
std::vector< T > & get_data()
Return a reference to the data in the state vector.
Definition: state_vector_uni.h:81
Entity_kind
The type of mesh entity.
Definition: wonton.h:81
~StateVectorUni()
Destructor.
Definition: state_vector_uni.h:61
Definition: state_vector_uni.h:27