Wonton::flecsi_state_t< M > Class Template Reference

Provides access to data stored in Flecsi_State. More...

#include <flecsi_state_wrapper.h>

Public Member Functions

 flecsi_state_t (mesh_t &mesh)
 Default constructor. More...
 
 flecsi_state_t ()=default
 Default constructor deleted. More...
 
 flecsi_state_t (const flecsi_state_t &)=default
 Default copy constructor. More...
 
flecsi_state_toperator= (const flecsi_state_t &)=default
 Default assignment operator. More...
 
int num_materials () const
 Number of materials in problem. More...
 
std::string material_name (int matid) const
 Name of material. More...
 
int mat_get_num_cells (int matid) const
 Get number of cells containing a particular material. More...
 
void mat_get_cells (int matid, std::vector< int > *matcells) const
 Get cell indices containing a particular material. More...
 
int cell_get_num_mats (int cellid) const
 Get number of materials contained in a cell. More...
 
void cell_get_mats (int cellid, std::vector< int > *cellmats) const
 Get the IDs of materials in a cell. More...
 
int cell_index_in_material (int meshcell, int matid) const
 Get the local index of mesh cell in material cell list. More...
 
Field_type field_type (Entity_kind on_what, std::string const &var_name) const
 Type of field (MESH_FIELD or MULTIMATERIAL_FIELD) More...
 
entity_kind_t get_entity (std::string const &var_name) const
 Get the entity type on which the given field is defined. More...
 
template<class T >
void mesh_get_data (entity_kind_t on_what, std::string const &var_name, T **data) const
 Get pointer to scalar data. More...
 
template<typename T >
void mat_get_celldata (std::string const &var_name, int matid, T const **data) const
 Get pointer to read-only scalar cell data for a particular material. More...
 
template<typename T >
void mat_get_celldata (std::string const &var_name, int matid, T **data)
 Get pointer to read-write scalar data for a particular material. More...
 
void mesh_add_data (Entity_kind on_what, std::string const &name, double const **data) const
 Get a pointer to data from the state manager with a given variable name and on on_what mesh entities. More...
 
void mat_add_celldata (std::string const &var_name, double value)
 Add a scalar multi-valued data field on cells and initialize its material data to a single value. More...
 
void mat_add_celldata (std::string const &var_name, double const *const *values=nullptr, Data_layout layout=Data_layout::MATERIAL_CENTRIC)
 Add a scalar multi-valued data field on cells and initialize its material data according to a 2D array. More...
 
void mat_add_celldata (std::string const &var_name, int matid, double const *values)
 Add a scalar multi-valued data field on cells and add data to one of its materials. More...
 
void mat_add_celldata (std::string const &var_name, int matid, Point< 2 > const *values)
 
void mat_add_celldata (std::string const &var_name, int matid, Point< 3 > const *values)
 
void mat_add_celldata (std::string const &var_name, int matid, double value)
 Add a scalar multi-valued data field on cells and initialize one of its material data to a uniform value. More...
 
void mat_add_cells (int matid, std::vector< int > const &newcells)
 Add cells to material (or add material to cells) More...
 
void mat_rem_cells (int matid, std::vector< int > const &delcells)
 Remove cells from material (or remove material from cells) More...
 
void add_material (std::string const &matname, std::vector< int > const &matcells)
 Add a material to state. More...
 
int get_data_size (entity_kind_t on_what, std::string const &var_name) const
 
const std::type_info & get_data_type (std::string const &var_name) const
 Get the data type of the given field. More...
 
std::vector< std::string > names () const
 Vector of names. More...
 

Detailed Description

template<typename M>
class Wonton::flecsi_state_t< M >

Provides access to data stored in Flecsi_State.

Constructor & Destructor Documentation

◆ flecsi_state_t() [1/3]

template<typename M >
Wonton::flecsi_state_t< M >::flecsi_state_t ( mesh_t &  mesh)
inlineexplicit

Default constructor.

Parameters
[in]meshThe minimum coordinates of the domain.

◆ flecsi_state_t() [2/3]

template<typename M >
Wonton::flecsi_state_t< M >::flecsi_state_t ( )
default

Default constructor deleted.

◆ flecsi_state_t() [3/3]

template<typename M >
Wonton::flecsi_state_t< M >::flecsi_state_t ( const flecsi_state_t< M > &  )
default

Default copy constructor.

Member Function Documentation

◆ add_material()

template<typename M >
void Wonton::flecsi_state_t< M >::add_material ( std::string const &  matname,
std::vector< int > const &  matcells 
)
inline

Add a material to state.

Parameters
[in]matnameName of material
[in]matcellsCells containing the material

◆ cell_get_mats()

template<typename M >
void Wonton::flecsi_state_t< M >::cell_get_mats ( int  cellid,
std::vector< int > *  cellmats 
) const
inline

Get the IDs of materials in a cell.

Parameters
cellidIndex of cell in mesh
cellmatsIndices of materials in cell

◆ cell_get_num_mats()

template<typename M >
int Wonton::flecsi_state_t< M >::cell_get_num_mats ( int  cellid) const
inline

Get number of materials contained in a cell.

Parameters
cellidIndex of cell in mesh
Returns
Number of materials in cell

◆ cell_index_in_material()

template<typename M >
int Wonton::flecsi_state_t< M >::cell_index_in_material ( int  meshcell,
int  matid 
) const
inline

Get the local index of mesh cell in material cell list.

Parameters
meshcellMesh cell ID
matidMaterial ID
Returns
Local cell index in material cell list

◆ field_type()

template<typename M >
Field_type Wonton::flecsi_state_t< M >::field_type ( Entity_kind  on_what,
std::string const &  var_name 
) const
inline

Type of field (MESH_FIELD or MULTIMATERIAL_FIELD)

Parameters
[in]onwhatEntity_kind that field is defined on
[in]varnameName of field
Returns
Field_type

◆ get_data_size()

template<typename M >
int Wonton::flecsi_state_t< M >::get_data_size ( entity_kind_t  on_what,
std::string const &  var_name 
) const
inline

◆ get_data_type()

template<typename M >
const std::type_info& Wonton::flecsi_state_t< M >::get_data_type ( std::string const &  var_name) const
inline

Get the data type of the given field.

Parameters
[in]var_nameThe string name of the data field
Returns
A reference to the type_info struct for the field's data type

◆ get_entity()

template<typename M >
entity_kind_t Wonton::flecsi_state_t< M >::get_entity ( std::string const &  var_name) const
inline

Get the entity type on which the given field is defined.

Parameters
[in]var_nameThe string name of the data field
Returns
The Entity_kind enum for the entity type on which the field is defined
Todo:

THIS ASSUMES ONLY DOUBLE VECTORS - WE HAVE TO ACCOUNT FOR OTHER TYPES OR WE HAVE TO GENERALIZE THE FIND FUNCTION!!!

THIS ALSO DOES NOT CHECK FOR OTHER ENTITY TYPES LIKE EDGE, FACE, SIDE, WEDGE AND CORNER

◆ mat_add_celldata() [1/6]

template<typename M >
void Wonton::flecsi_state_t< M >::mat_add_celldata ( std::string const &  var_name,
double  value 
)
inline

Add a scalar multi-valued data field on cells and initialize its material data to a single value.

Parameters
[in]var_nameThe name of the data field
[in]valueInitialize with this value The 2D array will be read and values copied according to which materials are contained in which cells. If a material+cell combination is not active providing a value for the array will have no effect.

◆ mat_add_celldata() [2/6]

template<typename M >
void Wonton::flecsi_state_t< M >::mat_add_celldata ( std::string const &  var_name,
double const *const *  values = nullptr,
Data_layout  layout = Data_layout::MATERIAL_CENTRIC 
)
inline

Add a scalar multi-valued data field on cells and initialize its material data according to a 2D array.

Parameters
[in]var_nameThe name of the data field
[in]layoutWhether 2D array is laid out with first index being the cell (CELL_CENRIC) or material (MATERIAL CENTRIC)
[in]valueInitialize with this value

The 2D array will be read and values copied according to which materials are contained in which cells. If a material+cell combination is not active providing a value for the array will have no effect.

◆ mat_add_celldata() [3/6]

template<typename M >
void Wonton::flecsi_state_t< M >::mat_add_celldata ( std::string const &  var_name,
int  matid,
double const *  values 
)
inline

Add a scalar multi-valued data field on cells and add data to one of its materials.

Parameters
[in]var_nameThe name of the data field
[in]matidIndex of material in the problem
[in]layoutData layout -
[in]valuesInitialize with this array of values

Subsequent calls to this function with the same name will find the added field and just add the data.

◆ mat_add_celldata() [4/6]

template<typename M >
void Wonton::flecsi_state_t< M >::mat_add_celldata ( std::string const &  var_name,
int  matid,
Point< 2 > const *  values 
)
inline

◆ mat_add_celldata() [5/6]

template<typename M >
void Wonton::flecsi_state_t< M >::mat_add_celldata ( std::string const &  var_name,
int  matid,
Point< 3 > const *  values 
)
inline

◆ mat_add_celldata() [6/6]

template<typename M >
void Wonton::flecsi_state_t< M >::mat_add_celldata ( std::string const &  var_name,
int  matid,
double  value 
)
inline

Add a scalar multi-valued data field on cells and initialize one of its material data to a uniform value.

Parameters
[in]var_nameThe name of the data field
[in]matidIndex of material in the problem
[in]valueInitialize with this value Subsequent calls to this function with the same name will find the added field and just add the data.

◆ mat_add_cells()

template<typename M >
void Wonton::flecsi_state_t< M >::mat_add_cells ( int  matid,
std::vector< int > const &  newcells 
)
inline

Add cells to material (or add material to cells)

Parameters
[in]matidMaterial ID
[in]newcellsVector of new cells in material

◆ mat_get_celldata() [1/2]

template<typename M >
template<typename T >
void Wonton::flecsi_state_t< M >::mat_get_celldata ( std::string const &  var_name,
int  matid,
T const **  data 
) const
inline

Get pointer to read-only scalar cell data for a particular material.

Parameters
[in]var_nameThe string name of the data field
[in]matidIndex (not unique identifier) of the material
[out]datavector containing the values corresponding to cells in the material

◆ mat_get_celldata() [2/2]

template<typename M >
template<typename T >
void Wonton::flecsi_state_t< M >::mat_get_celldata ( std::string const &  var_name,
int  matid,
T **  data 
)
inline

Get pointer to read-write scalar data for a particular material.

Parameters
[in]on_whatThe entity type on which to get the data
[in]var_nameThe string name of the data field
[in]matidIndex (not unique identifier) of the material
[out]datavector containing the values corresponding to cells in the material

◆ mat_get_cells()

template<typename M >
void Wonton::flecsi_state_t< M >::mat_get_cells ( int  matid,
std::vector< int > *  matcells 
) const
inline

Get cell indices containing a particular material.

Parameters
matidIndex of material (0, num_materials()-1)
matcellsCells containing material 'matid'

◆ mat_get_num_cells()

template<typename M >
int Wonton::flecsi_state_t< M >::mat_get_num_cells ( int  matid) const
inline

Get number of cells containing a particular material.

Parameters
matidIndex of material (0, num_materials()-1)
Returns
Number of cells containing material 'matid'

◆ mat_rem_cells()

template<typename M >
void Wonton::flecsi_state_t< M >::mat_rem_cells ( int  matid,
std::vector< int > const &  delcells 
)
inline

Remove cells from material (or remove material from cells)

Parameters
[in]matidMaterial ID
[in]matcellsVector of to be removed cells

◆ material_name()

template<typename M >
std::string Wonton::flecsi_state_t< M >::material_name ( int  matid) const
inline

Name of material.

◆ mesh_add_data()

template<typename M >
void Wonton::flecsi_state_t< M >::mesh_add_data ( Entity_kind  on_what,
std::string const &  name,
double const **  data 
) const
inline

Get a pointer to data from the state manager with a given variable name and on on_what mesh entities.

Parameters
[in]on_whatThe Entity_kind (e.g. CELL) on which the data lives.
[in]nameThe name of the variable.
dataA pointer to the const data array. If the requested data is not found in the state manager, a nullptr is returned.

◆ mesh_get_data()

template<typename M >
template<class T >
void Wonton::flecsi_state_t< M >::mesh_get_data ( entity_kind_t  on_what,
std::string const &  var_name,
T **  data 
) const
inline

Get pointer to scalar data.

Parameters
[in]on_whatThe entity type on which to get the data
[in]var_nameThe string name of the data field
[in,out]dataA pointer to an array of data

◆ names()

template<typename M >
std::vector<std::string> Wonton::flecsi_state_t< M >::names ( ) const
inline

Vector of names.

Returns
vector of strings

◆ num_materials()

template<typename M >
int Wonton::flecsi_state_t< M >::num_materials ( ) const
inline

Number of materials in problem.

◆ operator=()

template<typename M >
flecsi_state_t& Wonton::flecsi_state_t< M >::operator= ( const flecsi_state_t< M > &  )
default

Default assignment operator.


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