KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
Public Member Functions | List of all members
Kratos::VariableExpressionDataIO< TDataType > Class Template Reference

Construct class to read into expressions from templated data values and write in to templated data values. More...

#include <variable_expression_data_io.h>

Collaboration diagram for Kratos::VariableExpressionDataIO< TDataType >:

Public Types

Type definitions
using Pointer = std::shared_ptr< VariableExpressionDataIO< TDataType > >
 
using IndexType = std::size_t
 
using RawType = std::conditional_t< std::disjunction_v< std::is_same< TDataType, int >, std::is_same< TDataType, std::vector< int > > >, int, double >
 
using RawLiteralFlatExpression = LiteralFlatExpression< RawType >
 

Public Member Functions

void Assign (int &rOutput, const Expression &rExpression, const IndexType EntityIndex) const
 
void Assign (std::vector< int > &rOutput, const Expression &rExpression, const IndexType EntityIndex) const
 
void Read (RawLiteralFlatExpression &rExpression, const IndexType EntityIndex, const int &Value) const
 
void Read (RawLiteralFlatExpression &rExpression, const IndexType EntityIndex, const std::vector< int > &Value) const
 
void Assign (double &rOutput, const Expression &rExpression, const IndexType EntityIndex) const
 
void Assign (std::vector< double > &rOutput, const Expression &rExpression, const IndexType EntityIndex) const
 
void Read (RawLiteralFlatExpression &rExpression, const IndexType EntityIndex, const double &Value) const
 
void Read (RawLiteralFlatExpression &rExpression, const IndexType EntityIndex, const std::vector< double > &Value) const
 
void Assign (Vector &rOutput, const Expression &rExpression, const IndexType EntityIndex) const
 
void Assign (std::vector< Vector > &rOutput, const Expression &rExpression, const IndexType EntityIndex) const
 
void Read (RawLiteralFlatExpression &rExpression, const IndexType EntityIndex, const Vector &Value) const
 
void Read (RawLiteralFlatExpression &rExpression, const IndexType EntityIndex, const std::vector< Vector > &Value) const
 
void Assign (Matrix &rOutput, const Expression &rExpression, const IndexType EntityIndex) const
 
void Assign (std::vector< Matrix > &rOutput, const Expression &rExpression, const IndexType EntityIndex) const
 
void Read (RawLiteralFlatExpression &rExpression, const IndexType EntityIndex, const Matrix &Value) const
 
void Read (RawLiteralFlatExpression &rExpression, const IndexType EntityIndex, const std::vector< Matrix > &Value) const
 
Life cycle
 VariableExpressionDataIO (const TDataType &SampleValue)
 Construct a new Variable Expression Data IO object from a given SampleValue. More...
 
 VariableExpressionDataIO (const std::vector< IndexType > &rShape)
 Construct a new Variable Expression Data IO object from a given shape. More...
 

Public operations

void Assign (TDataType &rOutput, const Expression &rExpression, const IndexType EntityIndex) const
 Evaluate the expression and assign the values to rOutput at the given index. More...
 
void Read (RawLiteralFlatExpression &rExpression, const IndexType EntityIndex, const TDataType &Value) const
 Read into expression the values from given value. More...
 
const std::vector< IndexTypeGetItemShape () const
 Get the shape of the data type. More...
 
static Pointer Create (const TDataType &SampleValue)
 Create a VariableExpressionDataIO from a given Sample value. More...
 
static Pointer Create (const std::vector< IndexType > &rShape)
 Create a VariableExpressionDataIO from a given shape. More...
 

Detailed Description

template<class TDataType>
class Kratos::VariableExpressionDataIO< TDataType >

Construct class to read into expressions from templated data values and write in to templated data values.

Template Parameters
TDataType

Member Typedef Documentation

◆ IndexType

template<class TDataType >
using Kratos::VariableExpressionDataIO< TDataType >::IndexType = std::size_t

◆ Pointer

template<class TDataType >
using Kratos::VariableExpressionDataIO< TDataType >::Pointer = std::shared_ptr<VariableExpressionDataIO<TDataType> >

◆ RawLiteralFlatExpression

◆ RawType

template<class TDataType >
using Kratos::VariableExpressionDataIO< TDataType >::RawType = std::conditional_t< std::disjunction_v< std::is_same<TDataType, int>, std::is_same<TDataType, std::vector<int> > >, int, double>

Constructor & Destructor Documentation

◆ VariableExpressionDataIO() [1/2]

template<class TDataType >
Kratos::VariableExpressionDataIO< TDataType >::VariableExpressionDataIO ( const TDataType &  SampleValue)

Construct a new Variable Expression Data IO object from a given SampleValue.

This will assign correct shape information for static data types. For dynamic data types, it is required to have the correct shape in the provided SampleValue.

Parameters
SampleValueSample value to provide the shape information.

◆ VariableExpressionDataIO() [2/2]

template<class TDataType >
Kratos::VariableExpressionDataIO< TDataType >::VariableExpressionDataIO ( const std::vector< IndexType > &  rShape)

Construct a new Variable Expression Data IO object from a given shape.

Parameters
rShapeShape of the data to be transferred.

Member Function Documentation

◆ Assign() [1/9]

void Kratos::VariableExpressionDataIO< double >::Assign ( double rOutput,
const Expression rExpression,
const IndexType  EntityIndex 
) const

◆ Assign() [2/9]

void Kratos::VariableExpressionDataIO< int >::Assign ( int rOutput,
const Expression rExpression,
const IndexType  EntityIndex 
) const

◆ Assign() [3/9]

void Kratos::VariableExpressionDataIO< Matrix >::Assign ( Matrix rOutput,
const Expression rExpression,
const IndexType  EntityIndex 
) const

◆ Assign() [4/9]

void Kratos::VariableExpressionDataIO< std::vector< double > >::Assign ( std::vector< double > &  rOutput,
const Expression rExpression,
const IndexType  EntityIndex 
) const

◆ Assign() [5/9]

void Kratos::VariableExpressionDataIO< std::vector< int > >::Assign ( std::vector< int > &  rOutput,
const Expression rExpression,
const IndexType  EntityIndex 
) const

◆ Assign() [6/9]

void Kratos::VariableExpressionDataIO< std::vector< Matrix > >::Assign ( std::vector< Matrix > &  rOutput,
const Expression rExpression,
const IndexType  EntityIndex 
) const

◆ Assign() [7/9]

void Kratos::VariableExpressionDataIO< std::vector< Vector > >::Assign ( std::vector< Vector > &  rOutput,
const Expression rExpression,
const IndexType  EntityIndex 
) const

◆ Assign() [8/9]

template<class TDataType >
void Kratos::VariableExpressionDataIO< TDataType >::Assign ( TDataType &  rOutput,
const Expression rExpression,
const IndexType  EntityIndex 
) const

Evaluate the expression and assign the values to rOutput at the given index.

This assigns the evaluated expression values to passed rOutput. The shape of the rExpression and rOutput should be checked before using this method.

Exceptions
Ifthe expression item shape and output shape mismatches in full debug.
Parameters
rOutputOutput containing evaluated rExpression values.
rExpressionExpression to be evaluated.
EntityIndexEntity index at which the expression will be evaluated.

◆ Assign() [9/9]

void Kratos::VariableExpressionDataIO< Vector >::Assign ( Vector rOutput,
const Expression rExpression,
const IndexType  EntityIndex 
) const

◆ Create() [1/2]

template<class TDataType >
std::shared_ptr< VariableExpressionDataIO< TDataType > > Kratos::VariableExpressionDataIO< TDataType >::Create ( const std::vector< IndexType > &  rShape)
static

Create a VariableExpressionDataIO from a given shape.

Parameters
rShapeShape of the data type.
Returns
Pointer Pointer to a VariableExpressionDataIO.

◆ Create() [2/2]

template<class TDataType >
std::shared_ptr< VariableExpressionDataIO< TDataType > > Kratos::VariableExpressionDataIO< TDataType >::Create ( const TDataType &  SampleValue)
static

Create a VariableExpressionDataIO from a given Sample value.

Parameters
SampleValueSample value.
Returns
Pointer Pointer to a VariableExpressionDataIO.

◆ GetItemShape()

template<class TDataType >
const std::vector<IndexType> Kratos::VariableExpressionDataIO< TDataType >::GetItemShape ( ) const
inline

Get the shape of the data type.

Returns
const std::vector<IndexType> Shape of the data type.

◆ Read() [1/9]

void Kratos::VariableExpressionDataIO< double >::Read ( RawLiteralFlatExpression rExpression,
const IndexType  EntityIndex,
const double Value 
) const

◆ Read() [2/9]

void Kratos::VariableExpressionDataIO< int >::Read ( RawLiteralFlatExpression rExpression,
const IndexType  EntityIndex,
const int Value 
) const

◆ Read() [3/9]

void Kratos::VariableExpressionDataIO< Matrix >::Read ( RawLiteralFlatExpression rExpression,
const IndexType  EntityIndex,
const Matrix Value 
) const

◆ Read() [4/9]

void Kratos::VariableExpressionDataIO< std::vector< double > >::Read ( RawLiteralFlatExpression rExpression,
const IndexType  EntityIndex,
const std::vector< double > &  Value 
) const

◆ Read() [5/9]

void Kratos::VariableExpressionDataIO< std::vector< int > >::Read ( RawLiteralFlatExpression rExpression,
const IndexType  EntityIndex,
const std::vector< int > &  Value 
) const

◆ Read() [6/9]

void Kratos::VariableExpressionDataIO< std::vector< Matrix > >::Read ( RawLiteralFlatExpression rExpression,
const IndexType  EntityIndex,
const std::vector< Matrix > &  Value 
) const

◆ Read() [7/9]

void Kratos::VariableExpressionDataIO< std::vector< Vector > >::Read ( RawLiteralFlatExpression rExpression,
const IndexType  EntityIndex,
const std::vector< Vector > &  Value 
) const

◆ Read() [8/9]

template<class TDataType >
void Kratos::VariableExpressionDataIO< TDataType >::Read ( RawLiteralFlatExpression rExpression,
const IndexType  EntityIndex,
const TDataType &  Value 
) const

Read into expression the values from given value.

This assigns values at the given EntityIndex with the values from Value. The shape of the rExpression and Value should be checked before using this method.

Exceptions
Ifthe expression item shape and output shape mismatches if full debug.
Parameters
rExpressionExpression to be assigned.
EntityIndexEntity of the expression to be assigned.
ValueValue to be assigned to expression.

◆ Read() [9/9]

void Kratos::VariableExpressionDataIO< Vector >::Read ( RawLiteralFlatExpression rExpression,
const IndexType  EntityIndex,
const Vector Value 
) const

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