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.
Classes | Public Member Functions | List of all members
Kratos::LiteralFlatExpression< TRawDataType > Class Template Reference

Expression to hold a literal with a flattened data structure. More...

#include <literal_flat_expression.h>

Inheritance diagram for Kratos::LiteralFlatExpression< TRawDataType >:
Collaboration diagram for Kratos::LiteralFlatExpression< TRawDataType >:

Classes

class  Data
 This class is used represent the flattened data array. More...
 

Public Types

Type definition
using Pointer = Kratos::intrusive_ptr< LiteralFlatExpression< TRawDataType > >
 
using value_type = TRawDataType
 
using size_type = std::size_t
 
using iterator = TRawDataType *
 
using const_iterator = TRawDataType const *
 
- 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
 

Public Member Functions

std::string Info () const
 
std::string Info () const
 
std::string Info () const
 
Life cycle
 LiteralFlatExpression (const IndexType NumberOfEntities, const std::vector< IndexType > &rShape)
 
 LiteralFlatExpression (TRawDataType *pDataBegin, const IndexType NumberOfEntities, const std::vector< IndexType > &rShape)
 
- Public Member Functions inherited from Kratos::Expression
 Expression (const IndexType NumberOfEntities)
 
virtual ~Expression ()=default
 
virtual double Evaluate (const IndexType EntityIndex, const IndexType EntityDataBeginIndex, const IndexType ComponentIndex) const =0
 Evalute the expression for the given entity data start index and component index and returns the value. More...
 
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
 

Protected Attributes

Protected member variables
const std::vector< IndexTypemShape
 
Data mData
 

Public operations

void SetData (const IndexType EntityDataBeginIndex, const IndexType ComponentIndex, const TRawDataType Value)
 
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...
 
IndexType size () const noexcept
 
iterator begin () noexcept
 
iterator end () noexcept
 
const_iterator begin () const noexcept
 
const_iterator end () const noexcept
 
const_iterator cbegin () const noexcept
 
const_iterator cend () const noexcept
 
std::string Info () const override
 
static LiteralFlatExpression< TRawDataType >::Pointer Create (const IndexType NumberOfEntities, const std::vector< IndexType > &rShape)
 A specific create method is used in here to return a pointer to the LiteralFlatExpression. More...
 
static LiteralFlatExpression< TRawDataType >::Pointer Create (TRawDataType *pDataBegin, const IndexType NumberOfEntities, const std::vector< IndexType > &rShape)
 

Detailed Description

template<class TRawDataType = double>
class Kratos::LiteralFlatExpression< TRawDataType >

Expression to hold a literal with a flattened data structure.

This expression holds data of a literal with rShape by flattening the data structure to a vector. This allocates a Vector with large sizes.

Template Parameters
TRawDataTypeRaw data type of the literal. Can be char, int or double

Member Typedef Documentation

◆ const_iterator

template<class TRawDataType = double>
using Kratos::LiteralFlatExpression< TRawDataType >::const_iterator = TRawDataType const*

◆ iterator

template<class TRawDataType = double>
using Kratos::LiteralFlatExpression< TRawDataType >::iterator = TRawDataType*

◆ Pointer

template<class TRawDataType = double>
using Kratos::LiteralFlatExpression< TRawDataType >::Pointer = Kratos::intrusive_ptr<LiteralFlatExpression<TRawDataType> >

◆ size_type

template<class TRawDataType = double>
using Kratos::LiteralFlatExpression< TRawDataType >::size_type = std::size_t

◆ value_type

template<class TRawDataType = double>
using Kratos::LiteralFlatExpression< TRawDataType >::value_type = TRawDataType

Constructor & Destructor Documentation

◆ LiteralFlatExpression() [1/2]

template<class TRawDataType >
Kratos::LiteralFlatExpression< TRawDataType >::LiteralFlatExpression ( const IndexType  NumberOfEntities,
const std::vector< IndexType > &  rShape 
)

◆ LiteralFlatExpression() [2/2]

template<class TRawDataType >
Kratos::LiteralFlatExpression< TRawDataType >::LiteralFlatExpression ( TRawDataType *  pDataBegin,
const IndexType  NumberOfEntities,
const std::vector< IndexType > &  rShape 
)

Member Function Documentation

◆ begin() [1/2]

template<class TRawDataType = double>
const_iterator Kratos::LiteralFlatExpression< TRawDataType >::begin ( ) const
inlinenoexcept

◆ begin() [2/2]

template<class TRawDataType = double>
iterator Kratos::LiteralFlatExpression< TRawDataType >::begin ( )
inlinenoexcept

◆ cbegin()

template<class TRawDataType = double>
const_iterator Kratos::LiteralFlatExpression< TRawDataType >::cbegin ( ) const
inlinenoexcept

◆ cend()

template<class TRawDataType = double>
const_iterator Kratos::LiteralFlatExpression< TRawDataType >::cend ( ) const
inlinenoexcept

◆ Create() [1/2]

template<class TRawDataType >
LiteralFlatExpression< TRawDataType >::Pointer Kratos::LiteralFlatExpression< TRawDataType >::Create ( const IndexType  NumberOfEntities,
const std::vector< IndexType > &  rShape 
)
static

A specific create method is used in here to return a pointer to the LiteralFlatExpression.

This method is used to return the derrived class LiteralFlatExpression pointer so that additional SetData method can be accessed to initialize the vector data.

Parameters
NumberOfEntitiesNumber of entities (eg. nodes, elements, etc.) in the container.
rShapeShape of the data in each entity.
Returns
LiteralFlatExpression::Pointer Returns an intrusive pointer to LiteralFlatExpression.

◆ Create() [2/2]

template<class TRawDataType >
LiteralFlatExpression< TRawDataType >::Pointer Kratos::LiteralFlatExpression< TRawDataType >::Create ( TRawDataType *  pDataBegin,
const IndexType  NumberOfEntities,
const std::vector< IndexType > &  rShape 
)
static

◆ end() [1/2]

template<class TRawDataType = double>
const_iterator Kratos::LiteralFlatExpression< TRawDataType >::end ( ) const
inlinenoexcept

◆ end() [2/2]

template<class TRawDataType = double>
iterator Kratos::LiteralFlatExpression< TRawDataType >::end ( )
inlinenoexcept

◆ GetItemShape()

template<class TRawDataType >
const std::vector< std::size_t > Kratos::LiteralFlatExpression< TRawDataType >::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 TRawDataType = double>
IndexType Kratos::LiteralFlatExpression< TRawDataType >::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() [1/4]

std::string Kratos::LiteralFlatExpression< char >::Info ( ) const
virtual

Implements Kratos::Expression.

◆ Info() [2/4]

std::string Kratos::LiteralFlatExpression< int >::Info ( ) const
virtual

Implements Kratos::Expression.

◆ Info() [3/4]

std::string Kratos::LiteralFlatExpression< double >::Info ( ) const
virtual

Implements Kratos::Expression.

◆ Info() [4/4]

template<class TRawDataType = double>
std::string Kratos::LiteralFlatExpression< TRawDataType >::Info ( ) const
overridevirtual

Implements Kratos::Expression.

◆ SetData()

template<class TRawDataType >
void Kratos::LiteralFlatExpression< TRawDataType >::SetData ( const IndexType  EntityDataBeginIndex,
const IndexType  ComponentIndex,
const TRawDataType  Value 
)

◆ size()

template<class TRawDataType = double>
IndexType Kratos::LiteralFlatExpression< TRawDataType >::size ( ) const
inlinenoexcept

Member Data Documentation

◆ mData

template<class TRawDataType = double>
Data Kratos::LiteralFlatExpression< TRawDataType >::mData
protected

◆ mShape

template<class TRawDataType = double>
const std::vector<IndexType> Kratos::LiteralFlatExpression< TRawDataType >::mShape
protected

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