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::LiteralExpression< TDataType > Class Template Reference

Expression to hold a literal value. More...

#include <literal_expression.h>

Inheritance diagram for Kratos::LiteralExpression< TDataType >:
Collaboration diagram for Kratos::LiteralExpression< TDataType >:

Public Member Functions

 LiteralExpression (const int &Value, const IndexType NumberOfEntities)
 
 LiteralExpression (const double &Value, const IndexType NumberOfEntities)
 
double Evaluate (const IndexType EntityIndex, const IndexType EntityDataBeginIndex, const IndexType ComponentIndex) const
 Evalute the expression for the given entity data start index and component index and returns the value. More...
 
double Evaluate (const IndexType EntityIndex, const IndexType EntityDataBeginIndex, const IndexType ComponentIndex) const
 Evalute the expression for the given entity data start index and component index and returns the value. More...
 
 LiteralExpression (const Matrix &Value, const IndexType NumberOfEntities)
 
double Evaluate (const IndexType EntityIndex, const IndexType EntityDataBeginIndex, const IndexType ComponentIndex) const
 Evalute the expression for the given entity data start index and component index and returns the value. More...
 
Life cycle
 LiteralExpression (const TDataType &Value, const IndexType NumberOfEntities)
 
- Public Member Functions inherited from Kratos::Expression
 Expression (const IndexType NumberOfEntities)
 
virtual ~Expression ()=default
 
IndexType NumberOfEntities () const
 Get the maximum number of entities allowed for this expression. More...
 
IndexType GetItemComponentCount () const
 Get the Local Size of the expression. More...
 
IndexType size () const
 
const_iterator begin () const
 
const_iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 

Public operations

double Evaluate (const IndexType EntityIndex, const IndexType EntityDataBeginIndex, const IndexType ComponentIndex) const override
 Evalute the expression for the given entity data start index and component index and returns the value. More...
 
const std::vector< IndexTypeGetItemShape () const override
 Get the Shape of the expression. More...
 
IndexType GetMaxDepth () const override
 Get the Max Depth of the lazy expression tree. More...
 
std::string Info () const override
 
static Expression::Pointer Create (const TDataType &Value, const IndexType NumberOfEntities)
 

Additional Inherited Members

- Public Types inherited from Kratos::Expression
using Pointer = Kratos::intrusive_ptr< Expression >
 
using ConstPointer = Kratos::intrusive_ptr< const Expression >
 
using IndexType = std::size_t
 
using value_type = double
 
using size_type = IndexType
 
using const_iterator = ExpressionIterator
 

Detailed Description

template<class TDataType>
class Kratos::LiteralExpression< TDataType >

Expression to hold a literal value.

Constructor & Destructor Documentation

◆ LiteralExpression() [1/4]

template<class TDataType >
Kratos::LiteralExpression< TDataType >::LiteralExpression ( const TDataType &  Value,
const IndexType  NumberOfEntities 
)

◆ LiteralExpression() [2/4]

Kratos::LiteralExpression< int >::LiteralExpression ( const int Value,
const IndexType  NumberOfEntities 
)

◆ LiteralExpression() [3/4]

Kratos::LiteralExpression< double >::LiteralExpression ( const double Value,
const IndexType  NumberOfEntities 
)

◆ LiteralExpression() [4/4]

Kratos::LiteralExpression< Matrix >::LiteralExpression ( const Matrix Value,
const IndexType  NumberOfEntities 
)

Member Function Documentation

◆ Create()

template<class TDataType >
Expression::Pointer Kratos::LiteralExpression< TDataType >::Create ( const TDataType &  Value,
const IndexType  NumberOfEntities 
)
static

◆ Evaluate() [1/4]

double Kratos::LiteralExpression< int >::Evaluate ( const IndexType  EntityIndex,
const IndexType  EntityDataBeginIndex,
const IndexType  ComponentIndex 
) const
virtual

Evalute the expression for the given entity data start index and component index and returns the value.

Parameters
EntityIndexIndex of the entity.
EntityDataBeginIndexIndex at which entity data starts.
ComponentIndexComponent index.
Returns
double Evaluated expression.
Todo:
Move to private.

Implements Kratos::Expression.

◆ Evaluate() [2/4]

double Kratos::LiteralExpression< double >::Evaluate ( const IndexType  EntityIndex,
const IndexType  EntityDataBeginIndex,
const IndexType  ComponentIndex 
) const
virtual

Evalute the expression for the given entity data start index and component index and returns the value.

Parameters
EntityIndexIndex of the entity.
EntityDataBeginIndexIndex at which entity data starts.
ComponentIndexComponent index.
Returns
double Evaluated expression.
Todo:
Move to private.

Implements Kratos::Expression.

◆ Evaluate() [3/4]

double Kratos::LiteralExpression< Matrix >::Evaluate ( const IndexType  EntityIndex,
const IndexType  EntityDataBeginIndex,
const IndexType  ComponentIndex 
) const
virtual

Evalute the expression for the given entity data start index and component index and returns the value.

Parameters
EntityIndexIndex of the entity.
EntityDataBeginIndexIndex at which entity data starts.
ComponentIndexComponent index.
Returns
double Evaluated expression.
Todo:
Move to private.

Implements Kratos::Expression.

◆ Evaluate() [4/4]

template<class TDataType >
double Kratos::LiteralExpression< TDataType >::Evaluate ( const IndexType  EntityIndex,
const IndexType  EntityDataBeginIndex,
const IndexType  ComponentIndex 
) const
overridevirtual

Evalute the expression for the given entity data start index and component index and returns the value.

Parameters
EntityIndexIndex of the entity.
EntityDataBeginIndexIndex at which entity data starts.
ComponentIndexComponent index.
Returns
double Evaluated expression.
Todo:
Move to private.

Implements Kratos::Expression.

◆ GetItemShape()

template<class TDataType >
const std::vector< std::size_t > Kratos::LiteralExpression< TDataType >::GetItemShape ( ) const
overridevirtual

Get the Shape of the expression.

Returns
const std::vector<IndexType> Size of each dimension is in the vector elements.

Implements Kratos::Expression.

◆ GetMaxDepth()

template<class TDataType >
IndexType Kratos::LiteralExpression< TDataType >::GetMaxDepth ( ) const
inlineoverridevirtual

Get the Max Depth of the lazy expression tree.

Returns the maximum depth of the lazy expression tree.

Warning
This is a recursive computation, hence this should not be done repeatedly unless necessary.
Returns
IndexType Max depth of the lazy expression tree.

Implements Kratos::Expression.

◆ Info()

template<class TDataType >
std::string Kratos::LiteralExpression< TDataType >::Info
overridevirtual

Implements Kratos::Expression.


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