Wonton::StateVectorMulti< T > Class Template Reference

#include <state_vector_multi.h>

Inheritance diagram for Wonton::StateVectorMulti< T >:
Wonton::StateVectorBase

Public Member Functions

 StateVectorMulti (std::string name, std::unordered_map< int, std::vector< T >> data=std::unordered_map< int, std::vector< T >>())
 Constructor for StateVectorMulti. More...
 
 ~StateVectorMulti ()
 Destructor. More...
 
std::ostream & print (std::ostream &os) const
 Virtual methods. More...
 
const std::type_info & data_type () const
 
std::unordered_map< int, std::vector< T > > & get_data ()
 Return a reference to the data in the state vector. More...
 
std::unordered_map< int, std::vector< T > > const & get_data () const
 Return a const reference to the data in the state vector. More...
 
std::vector< T > & get_data (int m)
 Return a reference to the data in the state vector. More...
 
std::vector< T > const & get_data (int m) const
 Return a const reference to the data in the state vector. More...
 
- Public Member Functions inherited from Wonton::StateVectorBase
 StateVectorBase (std::string name, Field_type type, Entity_kind kind=Entity_kind::CELL)
 Constructor with a name. More...
 
virtual ~StateVectorBase ()=default
 Destructor. More...
 
std::string get_name () const
 Query Metadata. More...
 
Field_type get_type () const
 Return the field type [MESH_FIELD, MULTIMATERIAL_FIELD] of the state vector. More...
 
Entity_kind get_kind () const
 Return the entity kind [CELL, NODE] of the state vector. More...
 

Additional Inherited Members

- Protected Attributes inherited from Wonton::StateVectorBase
std::string name_
 
Field_type type_
 
Entity_kind kind_
 

Detailed Description

template<class T = double>
class Wonton::StateVectorMulti< T >

This class implements a state vector for a multi material field, meaning there are as many numbers per cell as materials in the cell. The current implementation is material dominant, meaning there is a list of cells for each material. The shape of the data needs to be the same shape as the cell indices of materials. Multi material fields can only be defined on cells.

Constructor & Destructor Documentation

◆ StateVectorMulti()

template<class T = double>
Wonton::StateVectorMulti< T >::StateVectorMulti ( std::string  name,
std::unordered_map< int, std::vector< T >>  data = std::unordered_map<int, std::vector<T>>() 
)
inline

Constructor for StateVectorMulti.

Parameters
[in]dataThe map of data. The key of the map is the material id. The value is the data defined on the material cells

◆ ~StateVectorMulti()

template<class T = double>
Wonton::StateVectorMulti< T >::~StateVectorMulti ( )
inline

Destructor.

Member Function Documentation

◆ data_type()

template<class T = double>
const std::type_info& Wonton::StateVectorMulti< T >::data_type ( ) const
inlinevirtual

◆ get_data() [1/4]

template<class T = double>
std::unordered_map<int, std::vector<T> >& Wonton::StateVectorMulti< T >::get_data ( )
inline

Return a reference to the data in the state vector.

Returns
a reference to the vector of data in the state vector

Return a reference to the data in the state vector.

◆ get_data() [2/4]

template<class T = double>
std::unordered_map<int, std::vector<T> > const& Wonton::StateVectorMulti< T >::get_data ( ) const
inline

Return a const reference to the data in the state vector.

Returns
a const reference to the vector of data in the state vector

Return a const reference to the data in the state vector.

◆ get_data() [3/4]

template<class T = double>
std::vector<T>& Wonton::StateVectorMulti< T >::get_data ( int  m)
inline

Return a reference to the data in the state vector.

Parameters
[in]mmaterial id
Returns
a reference to the vector of data in the state vector

Return a reference to the data in the state vector. Note: this function has a potential side effect (which is a good thing, but users need to be aware). If the vector for key m does not exist, it will be created automatically. If you want to throw an error, use get_data().at(m) instead.

◆ get_data() [4/4]

template<class T = double>
std::vector<T> const& Wonton::StateVectorMulti< T >::get_data ( int  m) const
inline

Return a const reference to the data in the state vector.

Parameters
[in]mmaterial id
Returns
a const reference to the vector of data in the state vector

Return a const reference to the data in the state vector. If you want to throw an error, use get_data().at(m) instead.

◆ print()

template<class T = double>
std::ostream& Wonton::StateVectorMulti< T >::print ( std::ostream &  os) const
inlinevirtual

Virtual methods.

Reimplemented from Wonton::StateVectorBase.


The documentation for this class was generated from the following file: