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 | List of all members
Kratos::DataValueContainer Class Reference

Container for storing data values associated with variables. More...

#include <data_value_container.h>

Inheritance diagram for Kratos::DataValueContainer:
Collaboration diagram for Kratos::DataValueContainer:

Public Member Functions

Life Cycle
 DataValueContainer ()
 Default constructor. More...
 
 DataValueContainer (DataValueContainer const &rOther)
 Copy constructor. More...
 
virtual ~DataValueContainer ()
 Destructor. More...
 
Operators
template<class TDataType >
const TDataType & operator() (const VariableData &rThisVariable) const
 Accessor operator for retrieving a data value by a VariableData. More...
 
template<class TDataType >
TDataType & operator() (const Variable< TDataType > &rThisVariable)
 Accessor operator for retrieving a data value by a Variable. More...
 
template<class TDataType >
const TDataType & operator() (const Variable< TDataType > &rThisVariable) const
 Accessor operator for retrieving a data value by a Variable (const version). More...
 
template<class TDataType >
TDataType & operator[] (const VariableData &rThisVariable)
 Index operator for retrieving a data value by a VariableData. More...
 
template<class TDataType >
const TDataType & operator[] (const VariableData &rThisVariable) const
 Index operator for retrieving a data value by a VariableData (const version). More...
 
template<class TDataType >
TDataType & operator[] (const Variable< TDataType > &rThisVariable)
 Index operator for retrieving a data value by a Variable. More...
 
template<class TDataType >
const TDataType & operator[] (const Variable< TDataType > &rThisVariable) const
 Index operator for retrieving a data value by a Variable (const version). More...
 
iterator begin ()
 Iterator pointing to the beginning of the container. More...
 
const_iterator begin () const
 Const iterator pointing to the beginning of the container. More...
 
iterator end ()
 Iterator pointing to the end of the container. More...
 
const_iterator end () const
 Const iterator pointing to the end of the container. More...
 
DataValueContaineroperator= (const DataValueContainer &rOther)
 Assignment operator for copying data from another DataValueContainer. More...
 
Operations
template<class TDataType >
TDataType & GetValue (const Variable< TDataType > &rThisVariable)
 Gets the value associated with a given variable. More...
 
template<class TDataType >
const TDataType & GetValue (const Variable< TDataType > &rThisVariable) const
 Gets the value associated with a given variable (const version). More...
 
SizeType Size ()
 Gets the size of the data container. More...
 
template<class TDataType >
void SetValue (const Variable< TDataType > &rThisVariable, TDataType const &rValue)
 Sets the value for a given variable. More...
 
template<class TDataType >
void Erase (const Variable< TDataType > &rThisVariable)
 Erases the value associated with a given variable. More...
 
void Clear ()
 Clears the entire data container. More...
 
void Merge (const DataValueContainer &rOther, const Flags Options)
 Merges this data container with another data container. More...
 
Inquiry
template<class TDataType >
bool Has (const Variable< TDataType > &rThisVariable) const
 Checks if the data container has a value associated with a given variable. More...
 
bool IsEmpty () const
 Checks if the data container is empty. More...
 
Input and output
virtual std::string Info () const
 Retrieves a string representation of the data value container. More...
 
virtual void PrintInfo (std::ostream &rOStream) const
 Outputs a brief description of the data value container to a given stream. More...
 
virtual void PrintData (std::ostream &rOStream) const
 Outputs the detailed data contents of the data value container to a given stream. More...
 

Type Definitions

using ValueType = std::pair< const VariableData *, void * >
 Type of the container used for variables. More...
 
using ContainerType = std::vector< ValueType >
 Type of the container used for variables. More...
 
using iterator = ContainerType::iterator
 Type of the container used for variables. More...
 
using const_iterator = ContainerType::const_iterator
 Type of the container used for variables. More...
 
using SizeType = ContainerType::size_type
 Type of the container used for variables. More...
 
 KRATOS_DEFINE_LOCAL_FLAG (OVERWRITE_OLD_VALUES)
 Define local flag. More...
 
 KRATOS_CLASS_POINTER_DEFINITION (DataValueContainer)
 Pointer definition of DataValueContainer. More...
 

Serialization

class Serializer
 

Detailed Description

Container for storing data values associated with variables.

This class provides a container for storing data values associated with variables.

Author
Pooyan Dadvand

Member Typedef Documentation

◆ const_iterator

using Kratos::DataValueContainer::const_iterator = ContainerType::const_iterator

Type of the container used for variables.

◆ ContainerType

Type of the container used for variables.

◆ iterator

using Kratos::DataValueContainer::iterator = ContainerType::iterator

Type of the container used for variables.

◆ SizeType

using Kratos::DataValueContainer::SizeType = ContainerType::size_type

Type of the container used for variables.

◆ ValueType

using Kratos::DataValueContainer::ValueType = std::pair<const VariableData*, void*>

Type of the container used for variables.

Constructor & Destructor Documentation

◆ DataValueContainer() [1/2]

Kratos::DataValueContainer::DataValueContainer ( )
inline

Default constructor.

◆ DataValueContainer() [2/2]

Kratos::DataValueContainer::DataValueContainer ( DataValueContainer const &  rOther)
inline

Copy constructor.

◆ ~DataValueContainer()

virtual Kratos::DataValueContainer::~DataValueContainer ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ begin() [1/2]

iterator Kratos::DataValueContainer::begin ( )
inline

Iterator pointing to the beginning of the container.

Returns
An iterator pointing to the beginning of the container.

◆ begin() [2/2]

const_iterator Kratos::DataValueContainer::begin ( ) const
inline

Const iterator pointing to the beginning of the container.

Returns
A const iterator pointing to the beginning of the container.

◆ Clear()

void Kratos::DataValueContainer::Clear ( )
inline

Clears the entire data container.

◆ end() [1/2]

iterator Kratos::DataValueContainer::end ( )
inline

Iterator pointing to the end of the container.

Returns
An iterator pointing to the end of the container.

◆ end() [2/2]

const_iterator Kratos::DataValueContainer::end ( ) const
inline

Const iterator pointing to the end of the container.

Returns
A const iterator pointing to the end of the container.

◆ Erase()

template<class TDataType >
void Kratos::DataValueContainer::Erase ( const Variable< TDataType > &  rThisVariable)
inline

Erases the value associated with a given variable.

Template Parameters
TDataTypeThe data type of the variable.
Parameters
rThisVariableThe variable whose associated value is to be erased.

◆ GetValue() [1/2]

template<class TDataType >
TDataType& Kratos::DataValueContainer::GetValue ( const Variable< TDataType > &  rThisVariable)
inline

Gets the value associated with a given variable.

Template Parameters
TDataTypeThe data type of the variable.
Parameters
rThisVariableThe variable for which the value is to be retrieved.
Returns
Reference to the value of the provided variable.

◆ GetValue() [2/2]

template<class TDataType >
const TDataType& Kratos::DataValueContainer::GetValue ( const Variable< TDataType > &  rThisVariable) const
inline

Gets the value associated with a given variable (const version).

Template Parameters
TDataTypeThe data type of the variable.
Parameters
rThisVariableThe variable for which the value is to be retrieved.
Returns
Const reference to the value of the provided variable.
Todo:
Make the variable of the constant version consistent with the one of the "classical" one

◆ Has()

template<class TDataType >
bool Kratos::DataValueContainer::Has ( const Variable< TDataType > &  rThisVariable) const
inline

Checks if the data container has a value associated with a given variable.

Template Parameters
TDataTypeThe data type of the variable.
Parameters
rThisVariableThe variable for which the check is to be made.
Returns
True if the variable has an associated value in the container, otherwise false.

◆ Info()

virtual std::string Kratos::DataValueContainer::Info ( ) const
inlinevirtual

Retrieves a string representation of the data value container.

Returns
A string that describes the data value container.

Reimplemented in Kratos::ProcessInfo, Kratos::ModelPart, Kratos::Mesh< TNodeType, TPropertiesType, TElementType, TConditionType >, and Kratos::Mesh< NodeType, PropertiesType, ElementType, ConditionType >.

◆ IsEmpty()

bool Kratos::DataValueContainer::IsEmpty ( ) const
inline

Checks if the data container is empty.

Returns
True if the container is empty, otherwise false.

◆ KRATOS_CLASS_POINTER_DEFINITION()

Kratos::DataValueContainer::KRATOS_CLASS_POINTER_DEFINITION ( DataValueContainer  )

Pointer definition of DataValueContainer.

◆ KRATOS_DEFINE_LOCAL_FLAG()

Kratos::DataValueContainer::KRATOS_DEFINE_LOCAL_FLAG ( OVERWRITE_OLD_VALUES  )

Define local flag.

◆ Merge()

void Kratos::DataValueContainer::Merge ( const DataValueContainer rOther,
const Flags  Options 
)

Merges this data container with another data container.

Parameters
rOtherThe other data container to be merged.
OptionsFlags for the merging options.

◆ operator()() [1/3]

template<class TDataType >
TDataType& Kratos::DataValueContainer::operator() ( const Variable< TDataType > &  rThisVariable)
inline

Accessor operator for retrieving a data value by a Variable.

This operator allows you to retrieve a data value by providing a Variable object.

Template Parameters
TDataTypeThe data type of the value to retrieve.
Parameters
rThisVariableThe Variable object specifying the variable.
Returns
A reference to the data value.

◆ operator()() [2/3]

template<class TDataType >
const TDataType& Kratos::DataValueContainer::operator() ( const Variable< TDataType > &  rThisVariable) const
inline

Accessor operator for retrieving a data value by a Variable (const version).

This operator allows you to retrieve a data value by providing a Variable object.

Template Parameters
TDataTypeThe data type of the value to retrieve.
Parameters
rThisVariableThe Variable object specifying the variable.
Returns
A reference to the data value.

◆ operator()() [3/3]

template<class TDataType >
const TDataType& Kratos::DataValueContainer::operator() ( const VariableData rThisVariable) const
inline

Accessor operator for retrieving a data value by a VariableData.

This operator allows you to retrieve a data value by providing a VariableData object.

Template Parameters
TDataTypeThe data type of the value to retrieve.
Parameters
rThisVariableThe VariableData object specifying the variable.
Returns
A reference to the data value.

◆ operator=()

DataValueContainer& Kratos::DataValueContainer::operator= ( const DataValueContainer rOther)
inline

Assignment operator for copying data from another DataValueContainer.

This operator allows you to assign the contents of another DataValueContainer to this container.

Parameters
rOtherThe DataValueContainer to copy data from.
Returns
A reference to the modified DataValueContainer.

◆ operator[]() [1/4]

template<class TDataType >
TDataType& Kratos::DataValueContainer::operator[] ( const Variable< TDataType > &  rThisVariable)
inline

Index operator for retrieving a data value by a Variable.

This operator allows you to retrieve a data value by providing a Variable object.

Template Parameters
TDataTypeThe data type of the value to retrieve.
Parameters
rThisVariableThe Variable object specifying the variable.
Returns
A reference to the data value.

◆ operator[]() [2/4]

template<class TDataType >
const TDataType& Kratos::DataValueContainer::operator[] ( const Variable< TDataType > &  rThisVariable) const
inline

Index operator for retrieving a data value by a Variable (const version).

This operator allows you to retrieve a data value by providing a Variable object.

Template Parameters
TDataTypeThe data type of the value to retrieve.
Parameters
rThisVariableThe Variable object specifying the variable.
Returns
A reference to the data value.

◆ operator[]() [3/4]

template<class TDataType >
TDataType& Kratos::DataValueContainer::operator[] ( const VariableData rThisVariable)
inline

Index operator for retrieving a data value by a VariableData.

This operator allows you to retrieve a data value by providing a VariableData object.

Template Parameters
TDataTypeThe data type of the value to retrieve.
Parameters
rThisVariableThe VariableData object specifying the variable.
Returns
A reference to the data value.

◆ operator[]() [4/4]

template<class TDataType >
const TDataType& Kratos::DataValueContainer::operator[] ( const VariableData rThisVariable) const
inline

Index operator for retrieving a data value by a VariableData (const version).

This operator allows you to retrieve a data value by providing a VariableData object.

Template Parameters
TDataTypeThe data type of the value to retrieve.
Parameters
rThisVariableThe VariableData object specifying the variable.
Returns
A reference to the data value.

◆ PrintData()

virtual void Kratos::DataValueContainer::PrintData ( std::ostream &  rOStream) const
inlinevirtual

Outputs the detailed data contents of the data value container to a given stream.

For each data entry, it prints the variable type and its associated value.

Parameters
rOStreamThe output stream to which the data should be printed.

Reimplemented in Kratos::ProcessInfo, Kratos::ModelPart, Kratos::Mesh< TNodeType, TPropertiesType, TElementType, TConditionType >, and Kratos::Mesh< NodeType, PropertiesType, ElementType, ConditionType >.

◆ PrintInfo()

virtual void Kratos::DataValueContainer::PrintInfo ( std::ostream &  rOStream) const
inlinevirtual

Outputs a brief description of the data value container to a given stream.

Parameters
rOStreamThe output stream to which the information should be printed.

Reimplemented in Kratos::ProcessInfo, Kratos::ModelPart, Kratos::Mesh< TNodeType, TPropertiesType, TElementType, TConditionType >, and Kratos::Mesh< NodeType, PropertiesType, ElementType, ConditionType >.

◆ SetValue()

template<class TDataType >
void Kratos::DataValueContainer::SetValue ( const Variable< TDataType > &  rThisVariable,
TDataType const &  rValue 
)
inline

Sets the value for a given variable.

Template Parameters
TDataTypeThe data type of the variable.
Parameters
rThisVariableThe variable for which the value is to be set.
rValueThe value to be set for the variable.

◆ Size()

SizeType Kratos::DataValueContainer::Size ( )
inline

Gets the size of the data container.

Returns
Size of the data container.

Friends And Related Function Documentation

◆ Serializer

friend class Serializer
friend

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