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.
|
Variable class contains all information needed to store and retrive data from a data container. More...
#include <variable.h>
Public Member Functions | |
Life Cycle | |
Variable (const std::string &NewName, const TDataType Zero=TDataType(), const VariableType *pTimeDerivativeVariable=nullptr) | |
Constructor with specific name and zero value. More... | |
Variable (const std::string &NewName, const VariableType *pTimeDerivativeVariable) | |
Constructor with specific name and zero value. More... | |
template<typename TSourceVariableType > | |
Variable (const std::string &rNewName, TSourceVariableType *pSourceVariable, char ComponentIndex, const TDataType Zero=TDataType()) | |
Constructor for creating a component of other variable. More... | |
template<typename TSourceVariableType > | |
Variable (const std::string &rNewName, TSourceVariableType *pSourceVariable, char ComponentIndex, const VariableType *pTimeDerivativeVariable, const TDataType Zero=TDataType()) | |
Constructor for creating a component of other variable. More... | |
Variable (const VariableType &rOtherVariable) | |
Copy constructor. More... | |
~Variable () override | |
Destructor. More... | |
Operators | |
VariableType & | operator= (const VariableType &rOtherVariable)=delete |
Assignment operator, deleted to avoid misuse which can lead to memory problems. More... | |
Access | |
const VariableType & | GetTimeDerivative () const |
This method returns the time derivative variable. More... | |
const TDataType & | Zero () const |
This method returns the zero value of the variable type. More... | |
const void * | pZero () const override |
Input and output | |
std::string | Info () const override |
void | PrintInfo (std::ostream &rOStream) const override |
void | PrintData (std::ostream &rOStream) const override |
Print object's data. More... | |
Public Member Functions inherited from Kratos::VariableData | |
VariableData (const VariableData &rOtherVariable) | |
Copy constructor. More... | |
virtual | ~VariableData () |
Destructor. More... | |
operator size_t () const | |
KeyType | HashKey () const |
KeyType | Key () const |
KeyType | SourceKey () const |
void | SetKey (KeyType NewKey) |
const std::string & | Name () const |
std::size_t | Size () const |
bool | IsComponent () const |
bool | IsNotComponent () const |
KeyType | GetComponentIndex () const |
Returns the component index. More... | |
const VariableData & | GetSourceVariable () const |
KRATOS_CLASS_POINTER_DEFINITION (VariableData) | |
Pointer definition of VariableData. More... | |
Type Definitions | |
typedef TDataType | Type |
type of this variable More... | |
typedef VariableData::KeyType | KeyType |
typedef Variable< TDataType > | VariableType |
KRATOS_CLASS_POINTER_DEFINITION (Variable) | |
Pointer definition of Variable. More... | |
Serialization | |
class | Serializer |
Operations | |
void * | Clone (const void *pSource) const override |
Clone creates a copy of the object using a copy constructor of the class. More... | |
void * | Copy (const void *pSource, void *pDestination) const override |
Copy is very similar to Clone except that it also the destination pointer also passed to it. More... | |
void | Assign (const void *pSource, void *pDestination) const override |
Assign is very similar to Copy. It just differs in using an assignment operator besides the copy constructor. Copy creates a new object while. More... | |
void | AssignZero (void *pDestination) const override |
AssignZero is a special case of Assign for which variable zero value used as source. More... | |
void | Delete (void *pSource) const override |
Delete removes an object of variable type from memory. More... | |
void | Destruct (void *pSource) const override |
Destruct eliminates an object maintaining the memory it is using. More... | |
void | Print (const void *pSource, std::ostream &rOStream) const override |
Print is an auxiliary method to produce output of given variable knowing its address. More... | |
void | PrintData (const void *pSource, std::ostream &rOStream) const override |
PrintData is an auxiliary method to produce output only the value of given variable knowing its address. More... | |
void | Save (Serializer &rSerializer, void *pData) const override |
The save operation which backups the data of the class. More... | |
void | Allocate (void **pData) const override |
This method allocates the data of the variable. More... | |
void | Load (Serializer &rSerializer, void *pData) const override |
The load operation which restores the data of the class. More... | |
TDataType & | GetValue (void *pSource) const |
const TDataType & | GetValue (const void *pSource) const |
static const VariableType & | StaticObject () |
This method returns the variable type. More... | |
Additional Inherited Members | |
Public Types inherited from Kratos::VariableData | |
typedef std::size_t | KeyType |
Static Public Member Functions inherited from Kratos::VariableData | |
static KeyType | GenerateKey (const std::string &Name, std::size_t Size, bool IsComponent, char ComponentIndex) |
This static method generates a uinque key for given name and flags. More... | |
Protected Member Functions inherited from Kratos::VariableData | |
VariableData & | operator= (const VariableData &rOtherVariable) |
VariableData (const std::string &NewName, std::size_t NewSize) | |
Constructor for variables. More... | |
VariableData (const std::string &NewName, std::size_t NewSize, const VariableData *pSourceVariable, char ComponentIndex) | |
Constructor for variables components. More... | |
VariableData () | |
Variable class contains all information needed to store and retrive data from a data container.
Variable class contains all information needed to store and retrive data from a data container. It contains key value which is needed for searching in data container. Also a zero value to use as a default value in the container. Finally it has the type of the Variable as its template parameter so the container can find it in its relative part.
TDataType | The data type hold by the variable |
typedef VariableData::KeyType Kratos::Variable< TDataType >::KeyType |
typedef TDataType Kratos::Variable< TDataType >::Type |
type of this variable
typedef Variable<TDataType> Kratos::Variable< TDataType >::VariableType |
|
inlineexplicit |
Constructor with specific name and zero value.
NewName | The name to be assigned to the new variable |
Zero | The value to be assigned to the variable as zero. In case of not definition will take the value given by the constructor of the time |
pTimeDerivativeVariable | Pointer to the time derivative variable |
|
inlineexplicit |
Constructor with specific name and zero value.
NewName | The name to be assigned to the new variable |
pTimeDerivativeVariable | Pointer to the time derivative variable |
|
inlineexplicit |
Constructor for creating a component of other variable.
rNewName | The name to be assigned to the compoenent |
Zero | The value to be assigned to the variable as zero. In case of not definition will take the value given by the constructor of the time |
|
inlineexplicit |
Constructor for creating a component of other variable.
rNewName | The name to be assigned to the compoenent |
pTimeDerivativeVariable | Pointer to the time derivative variable |
Zero | The value to be assigned to the variable as zero. In case of not definition will take the value given by the constructor of the time |
|
inlineexplicit |
Copy constructor.
Copy constructor.
rOtherVariable | The old variable to be copied |
|
inlineoverride |
Destructor.
|
inlineoverridevirtual |
This method allocates the data of the variable.
pData | A pointer to the data to be allocated |
Reimplemented from Kratos::VariableData.
|
inlineoverridevirtual |
Assign is very similar to Copy. It just differs in using an assignment operator besides the copy constructor. Copy creates a new object while.
Assign does the assignment for two existing objects.
pSource | The pointer of the value to be assigned |
pDestination | The pointer of the destination value |
Reimplemented from Kratos::VariableData.
|
inlineoverridevirtual |
AssignZero is a special case of Assign for which variable zero value used as source.
This method is useful for initializing arrays or resetting values in memory.
pDestination | The pointer of the destination variable |
Reimplemented from Kratos::VariableData.
|
inlineoverridevirtual |
Clone creates a copy of the object using a copy constructor of the class.
It is useful to avoid shallow copying of complex objects and also without actually having information about the variable type.
pSource | The pointer of the variable to be cloned |
Reimplemented from Kratos::VariableData.
|
inlineoverridevirtual |
Copy is very similar to Clone except that it also the destination pointer also passed to it.
It is a helpful method specially to create a copy of heterogeneous data arrays
pSource | The pointer of the variable to be copied |
pDestination | The pointer of the destination variable |
Reimplemented from Kratos::VariableData.
|
inlineoverridevirtual |
Delete removes an object of variable type from memory.
It calls a destructor of objects to prevent memory leak and frees the memory allocated for this object assuming that the object is allocated in heap.
pSource | The pointer of the variable to be deleted |
Reimplemented from Kratos::VariableData.
|
inlineoverridevirtual |
Destruct eliminates an object maintaining the memory it is using.
However, the unlike Delete it does nothing with the memory allocated to it. So it is very useful in case of reallocating a part of the memory.
pSource | The pointer of the variable to be destructed |
Reimplemented from Kratos::VariableData.
|
inline |
This method returns the time derivative variable.
|
inline |
|
inline |
|
inlineoverridevirtual |
Turn back information as a string.
Reimplemented from Kratos::VariableData.
Kratos::Variable< TDataType >::KRATOS_CLASS_POINTER_DEFINITION | ( | Variable< TDataType > | ) |
Pointer definition of Variable.
|
inlineoverridevirtual |
The load operation which restores the data of the class.
rSerializer | The serializer used to preserve the information |
pData | A pointer to the data to be loaded |
Reimplemented from Kratos::VariableData.
|
delete |
Assignment operator, deleted to avoid misuse which can lead to memory problems.
|
inlineoverridevirtual |
Print is an auxiliary method to produce output of given variable knowing its address.
For example writing an heterogenous container in an output stream can be done using this method. Point assumes that the streaming operator is defined for the variable type.
pSource | The pointer of the variable to be printed |
rOStream | The stream used to print the information |
Reimplemented from Kratos::VariableData.
|
inlineoverridevirtual |
PrintData is an auxiliary method to produce output only the value of given variable knowing its address.
For example writing an heterogenous container in an output stream can be done using this method. Point assumes that the streaming operator is defined for the variable type.
pSource | The pointer of the variable to be printed |
rOStream | The stream used to print the information |
Reimplemented from Kratos::VariableData.
|
inlineoverridevirtual |
Print object's data.
Reimplemented from Kratos::VariableData.
|
inlineoverridevirtual |
Print information about this object.
rOStream | The stream used to print the information |
Reimplemented from Kratos::VariableData.
|
inlineoverridevirtual |
Reimplemented from Kratos::VariableData.
|
inlineoverridevirtual |
The save operation which backups the data of the class.
rSerializer | The serializer used to preserve the information |
pData | A pointer to the data to be saved |
Reimplemented from Kratos::VariableData.
|
inlinestatic |
This method returns the variable type.
|
inline |
This method returns the zero value of the variable type.
|
friend |