Flow123d  DF_patch_fe_data_tables-c52f2c3
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
ElementDataCache< T > Class Template Reference

#include <element_data_cache.hh>

Inheritance diagram for ElementDataCache< T >:
Inheritance graph
[legend]
Collaboration diagram for ElementDataCache< T >:
Collaboration graph
[legend]

Public Types

typedef std::shared_ptr< std::vector< T > > CacheData
 
- Public Types inherited from ElementDataCacheBase
enum  NumCompValueType { N_SCALAR = 1 , N_VECTOR = 3 , N_TENSOR = 9 }
 
enum  VTKValueType {
  VTK_INT8 , VTK_UINT8 , VTK_INT16 , VTK_UINT16 ,
  VTK_INT32 , VTK_UINT32 , VTK_FLOAT32 , VTK_FLOAT64
}
 Types of VTK value. More...
 

Public Member Functions

 ElementDataCache ()
 Default constructor. More...
 
 ElementDataCache (std::string field_name, double time, unsigned int row_vec_size, unsigned int boundary_begin)
 Constructor of input ElementDataCache (allow read data from GMSH or VTK file) More...
 
 ElementDataCache (std::string field_name, unsigned int n_comp, unsigned int size, std::string fe_type="", unsigned int n_dofs_per_element=1)
 Constructor of output ElementDataCache (allow write data) More...
 
virtual ~ElementDataCache () override
 Destructor of ElementDataCache. More...
 
CacheData get_data ()
 Return underlying vector of element data. More...
 
void read_ascii_data (Tokenizer &tok, unsigned int n_components, unsigned int i_row) override
 Implements ElementDataCacheBase::read_ascii_data. More...
 
void read_binary_data (std::istream &data_stream, unsigned int n_components, unsigned int i_row) override
 Implements ElementDataCacheBase::read_binary_data. More...
 
void print_ascii (ostream &out_stream, unsigned int idx) override
 
void print_ascii_all (ostream &out_stream, unsigned int start=0) override
 Print all data stored in output data ro ascii format. More...
 
void print_binary_all (ostream &out_stream, bool print_data_size=true, unsigned int start=0) override
 Print all data stored in output data to appended binary format. More...
 
void print_yaml_subarray (ostream &out_stream, unsigned int precision, unsigned int begin, unsigned int end) override
 
void store_value (unsigned int idx, const T *value)
 
void add (unsigned int idx, const T *value)
 
void zero (unsigned int idx)
 
void normalize (unsigned int idx, unsigned int divisor)
 
void get_min_max_range (double &min, double &max) override
 
std::shared_ptr< ElementDataCacheBasegather (Distribution *distr, LongIdx *local_to_global) override
 Implements ElementDataCacheBase::gather. More...
 
std::shared_ptr< ElementDataCacheBaseelement_node_cache_fixed_size (std::vector< unsigned int > &offset_vec) override
 Implements ElementDataCacheBase::element_node_cache_fixed_size. More...
 
std::shared_ptr< ElementDataCacheBaseelement_node_cache_optimize_size (std::vector< unsigned int > &offset_vec) override
 Implements ElementDataCacheBase::element_node_cache_optimize_size. More...
 
std::shared_ptr< ElementDataCacheBasecompute_node_data (std::vector< unsigned int > &conn_vec, unsigned int data_size) override
 Implements ElementDataCacheBase::compute_node_data. More...
 
T & operator[] (unsigned int i)
 Access i-th element in the data vector of 0th component. More...
 
- Public Member Functions inherited from ElementDataCacheBase
 ElementDataCacheBase ()
 Constructor. More...
 
virtual ~ElementDataCacheBase ()
 Destructor. More...
 
double get_time ()
 Getter for time of cache. More...
 
std::string field_input_name ()
 Getter for quantity name of cache. More...
 
bool is_actual (double time, std::string field_name)
 Check if cache stored actual data. More...
 
void set_field_units (std::string unit_string)
 
void set_n_values (unsigned int n_values)
 
std::string field_units () const
 
unsigned int n_values () const
 
bool is_dummy () const
 
unsigned int n_comp () const
 
unsigned int n_dofs_per_element () const
 
VTKValueType vtk_type () const
 Get type of stored data. More...
 
std::size_t dof_handler_hash () const
 
void set_dof_handler_hash (std::size_t hash)
 
std::string fe_type () const
 
unsigned int get_boundary_begin () const
 Returns start position of boundary data in cache. More...
 

Static Public Member Functions

static CacheData create_data_cache (unsigned int row_vec_size)
 

Protected Types

enum  CheckScaleData { none , check , scale }
 Allow to hold sign, if data in cache is checked and scale (both can be executed only once) More...
 

Protected Member Functions

MPI_Datatype mpi_data_type ()
 Return MPI data type corresponding with template parameter of cache. Needs template specialization. More...
 
MPI_Datatype mpi_data_type ()
 
MPI_Datatype mpi_data_type ()
 
- Protected Member Functions inherited from ElementDataCacheBase
template<class T >
void set_vtk_type ()
 

Protected Attributes

CheckScaleData check_scale_data_
 Sign, if data in cache is checked and scale. More...
 
CacheData data_
 
- Protected Attributes inherited from ElementDataCacheBase
double time_
 time step stored in cache More...
 
std::string field_input_name_
 name of field stored in cache More...
 
std::string field_name_
 
std::string field_units_
 
unsigned int n_values_
 
unsigned int n_comp_
 
VTKValueType vtk_type_
 Type of stored data. More...
 
std::size_t dof_handler_hash_
 Hash of DOF handler (attribute of native VTK data) More...
 
std::string fe_type_
 
unsigned int n_dofs_per_element_
 
bool is_dummy_
 Is true for DummyElementDataCache. More...
 
unsigned int boundary_begin_
 Start position of boundary data in cache. More...
 

Detailed Description

template<typename T>
class ElementDataCache< T >

Definition at line 44 of file element_data_cache.hh.

Member Typedef Documentation

◆ CacheData

template<typename T >
typedef std::shared_ptr< std::vector<T> > ElementDataCache< T >::CacheData

Container of the field data on elements used as a common data storage for output of various fields using various output formats and to cache data of several fields when reading the input file. This container also perform serialization for the serial output. Read of values from tokenizer and output of values to stream is implemented as it depends on the value type T.

Definition at line 52 of file element_data_cache.hh.

Member Enumeration Documentation

◆ CheckScaleData

template<typename T >
enum ElementDataCache::CheckScaleData
protected

Allow to hold sign, if data in cache is checked and scale (both can be executed only once)

Enumerator
none 

Data is neither checked nor scaled.

check 

Data is only checked.

scale 

Data is scaled.

Definition at line 167 of file element_data_cache.hh.

Constructor & Destructor Documentation

◆ ElementDataCache() [1/3]

template<typename T >
ElementDataCache< T >::ElementDataCache

Default constructor.

Definition at line 32 of file element_data_cache.cc.

◆ ElementDataCache() [2/3]

template<typename T >
ElementDataCache< T >::ElementDataCache ( std::string  field_name,
double  time,
unsigned int  row_vec_size,
unsigned int  boundary_begin 
)

Constructor of input ElementDataCache (allow read data from GMSH or VTK file)

Allows set variable size of cache.

Parameters
field_nameField name thas is read
timeActual time of data
row_vec_sizeCount of rows of data cache

Definition at line 38 of file element_data_cache.cc.

◆ ElementDataCache() [3/3]

template<typename T >
ElementDataCache< T >::ElementDataCache ( std::string  field_name,
unsigned int  n_comp,
unsigned int  size,
std::string  fe_type = "",
unsigned int  n_dofs_per_element = 1 
)

Constructor of output ElementDataCache (allow write data)

Has fix size of cache.

Parameters
field_nameField name is written as parameter to output stream
n_compGiven from shape of field
sizeCount of rows of data cache
fe_typeFiniteElement type (used only for native data)
n_dofs_per_elementNumber of DOFs per element (used only for native data)

Definition at line 50 of file element_data_cache.cc.

◆ ~ElementDataCache()

template<typename T >
ElementDataCache< T >::~ElementDataCache
overridevirtual

Destructor of ElementDataCache.

Definition at line 69 of file element_data_cache.cc.

Member Function Documentation

◆ add()

template<typename T >
void ElementDataCache< T >::add ( unsigned int  idx,
const T *  value 
)

Add value to given index

Definition at line 225 of file element_data_cache.cc.

◆ compute_node_data()

template<typename T >
std::shared_ptr< ElementDataCacheBase > ElementDataCache< T >::compute_node_data ( std::vector< unsigned int > &  conn_vec,
unsigned int  data_size 
)
overridevirtual

Implements ElementDataCacheBase::compute_node_data.

Implements ElementDataCacheBase.

Definition at line 362 of file element_data_cache.cc.

◆ create_data_cache()

template<typename T >
ElementDataCache< T >::CacheData ElementDataCache< T >::create_data_cache ( unsigned int  row_vec_size)
static

Create data cache with given count rows (row_vec_size).

Definition at line 79 of file element_data_cache.cc.

Here is the caller graph for this function:

◆ element_node_cache_fixed_size()

template<typename T >
std::shared_ptr< ElementDataCacheBase > ElementDataCache< T >::element_node_cache_fixed_size ( std::vector< unsigned int > &  offset_vec)
overridevirtual

Implements ElementDataCacheBase::element_node_cache_fixed_size.

Implements ElementDataCacheBase.

Definition at line 314 of file element_data_cache.cc.

Here is the caller graph for this function:

◆ element_node_cache_optimize_size()

template<typename T >
std::shared_ptr< ElementDataCacheBase > ElementDataCache< T >::element_node_cache_optimize_size ( std::vector< unsigned int > &  offset_vec)
overridevirtual

◆ gather()

template<typename T >
std::shared_ptr< ElementDataCacheBase > ElementDataCache< T >::gather ( Distribution distr,
LongIdx local_to_global 
)
overridevirtual

Implements ElementDataCacheBase::gather.

Implements ElementDataCacheBase.

Definition at line 261 of file element_data_cache.cc.

Here is the caller graph for this function:

◆ get_data()

template<typename T >
ElementDataCache< T >::CacheData ElementDataCache< T >::get_data

Return underlying vector of element data.

Definition at line 73 of file element_data_cache.cc.

Here is the caller graph for this function:

◆ get_min_max_range()

template<typename T >
void ElementDataCache< T >::get_min_max_range ( double &  min,
double &  max 
)
overridevirtual

Find minimal and maximal range of stored data

Implements ElementDataCacheBase.

Definition at line 194 of file element_data_cache.cc.

◆ mpi_data_type() [1/3]

MPI_Datatype ElementDataCache< int >::mpi_data_type ( )
protected

Definition at line 394 of file element_data_cache.cc.

◆ mpi_data_type() [2/3]

MPI_Datatype ElementDataCache< unsigned int >::mpi_data_type ( )
protected

Definition at line 399 of file element_data_cache.cc.

◆ mpi_data_type() [3/3]

template<typename T >
MPI_Datatype ElementDataCache< T >::mpi_data_type ( )
protected

Return MPI data type corresponding with template parameter of cache. Needs template specialization.

◆ normalize()

template<typename T >
void ElementDataCache< T >::normalize ( unsigned int  idx,
unsigned int  divisor 
)

Normalize values at given index

Definition at line 251 of file element_data_cache.cc.

◆ operator[]()

template<class T >
T & ElementDataCache< T >::operator[] ( unsigned int  i)

Access i-th element in the data vector of 0th component.

Access i-th element in the data vector.

Definition at line 406 of file element_data_cache.cc.

◆ print_ascii()

template<typename T >
void ElementDataCache< T >::print_ascii ( ostream &  out_stream,
unsigned int  idx 
)
overridevirtual

Output data element on given index idx. Method for writing data to output stream.

Note
This method is used only by MSH file format.

Implements ElementDataCacheBase.

Definition at line 115 of file element_data_cache.cc.

◆ print_ascii_all()

template<typename T >
void ElementDataCache< T >::print_ascii_all ( ostream &  out_stream,
unsigned int  start = 0 
)
overridevirtual

Print all data stored in output data ro ascii format.

Print all data stored in output data.

TODO: indicate if the tensor data are output in column-first or raw-first order and possibly implement transposition. Set such property for individual file formats. Class OutputData stores always in raw-first order.

Implements ElementDataCacheBase.

Definition at line 131 of file element_data_cache.cc.

◆ print_binary_all()

template<typename T >
void ElementDataCache< T >::print_binary_all ( ostream &  out_stream,
bool  print_data_size = true,
unsigned int  start = 0 
)
overridevirtual

Print all data stored in output data to appended binary format.

Prints the whole data vector into stream.

Implements ElementDataCacheBase.

Definition at line 143 of file element_data_cache.cc.

◆ print_yaml_subarray()

template<typename T >
void ElementDataCache< T >::print_yaml_subarray ( ostream &  out_stream,
unsigned int  precision,
unsigned int  begin,
unsigned int  end 
)
overridevirtual

Print stored values in the YAML format (using JSON like arrays). Used for output of observe values.

Implements ElementDataCacheBase.

Definition at line 160 of file element_data_cache.cc.

◆ read_ascii_data()

template<typename T >
void ElementDataCache< T >::read_ascii_data ( Tokenizer &  tok,
unsigned int  n_components,
unsigned int  i_row 
)
overridevirtual

Implements ElementDataCacheBase::read_ascii_data.

Implements ElementDataCacheBase.

Definition at line 87 of file element_data_cache.cc.

◆ read_binary_data()

template<typename T >
void ElementDataCache< T >::read_binary_data ( std::istream &  data_stream,
unsigned int  n_components,
unsigned int  i_row 
)
overridevirtual

Implements ElementDataCacheBase::read_binary_data.

Implements ElementDataCacheBase.

Definition at line 99 of file element_data_cache.cc.

◆ store_value()

template<typename T >
void ElementDataCache< T >::store_value ( unsigned int  idx,
const T *  value 
)

Store data element of given data value under given index.

Definition at line 212 of file element_data_cache.cc.

Here is the caller graph for this function:

◆ zero()

template<typename T >
void ElementDataCache< T >::zero ( unsigned int  idx)

Reset values at given index

Definition at line 238 of file element_data_cache.cc.

Member Data Documentation

◆ check_scale_data_

template<typename T >
CheckScaleData ElementDataCache< T >::check_scale_data_
protected

Sign, if data in cache is checked and scale.

Definition at line 178 of file element_data_cache.hh.

◆ data_

template<typename T >
CacheData ElementDataCache< T >::data_
protected

Table of element data.

For every components contains vector of element data.

Definition at line 185 of file element_data_cache.hh.


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