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.
|
This class is the base of variables and variable's components which contains their common data. More...
#include <variable_data.h>
Public Member Functions | |
Life Cycle | |
VariableData (const VariableData &rOtherVariable) | |
Copy constructor. More... | |
virtual | ~VariableData () |
Destructor. More... | |
Operators | |
operator size_t () const | |
Operations | |
virtual void * | Clone (const void *pSource) const |
virtual void * | Copy (const void *pSource, void *pDestination) const |
virtual void | Assign (const void *pSource, void *pDestination) const |
virtual void | AssignZero (void *pDestination) const |
virtual void | Delete (void *pSource) const |
virtual void | Destruct (void *pSource) const |
virtual void | Print (const void *pSource, std::ostream &rOStream) const |
virtual void | PrintData (const void *pSource, std::ostream &rOStream) const |
virtual void | Allocate (void **pData) const |
virtual void | Save (Serializer &rSerializer, void *pData) const |
virtual void | Load (Serializer &rSerializer, void *pData) const |
Access | |
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 |
virtual const void * | pZero () const |
Input and output | |
virtual std::string | Info () const |
Turn back information as a string. More... | |
virtual void | PrintInfo (std::ostream &rOStream) const |
Print information about this object. More... | |
virtual void | PrintData (std::ostream &rOStream) const |
Print object's data. More... | |
Static Public Member Functions | |
Statics | |
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 | |
Protected Operators | |
VariableData & | operator= (const VariableData &rOtherVariable) |
Protected LifeCycle | |
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 () | |
Friends | |
Friends | |
bool | operator== (const VariableData &rFirstVariable, const VariableData &rSecondVariable) |
Type Definitions | |
typedef std::size_t | KeyType |
KRATOS_CLASS_POINTER_DEFINITION (VariableData) | |
Pointer definition of VariableData. More... | |
Private Operations | |
class | Serializer |
This class is the base of variables and variable's components which contains their common data.
This class hold variables name and key and also adaptor type for variables components. It also has static method for generating a key based on the name of the variable
typedef std::size_t Kratos::VariableData::KeyType |
Kratos::VariableData::VariableData | ( | const VariableData & | rOtherVariable | ) |
Copy constructor.
|
inlinevirtual |
Destructor.
|
protected |
Constructor for variables.
|
protected |
Constructor for variables components.
Constructor.
|
inlineprotected |
default constructor is to be used only with serialization due to the fact that each variable must have a name defined.
|
virtual |
This method allocates the data of the variable
pData | A pointer to the data to be allocated |
Reimplemented in Kratos::Variable< TDataType >, Kratos::Variable< TVarType >, Kratos::Variable< Kratos::Internals::Matrix >, Kratos::Variable< double >, Kratos::Variable< Kratos::GlobalPointersVector >, Kratos::Variable< GradientDataType >, Kratos::Variable< TValue >, Kratos::Variable< int >, Kratos::Variable< T >, Kratos::Variable< Kratos::GlobalPointersVector< Kratos::Node > >, and Kratos::Variable< Kratos::array_1d< double, 3 > >.
|
virtual |
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 in Kratos::Variable< TDataType >, Kratos::Variable< TVarType >, Kratos::Variable< Kratos::Internals::Matrix >, Kratos::Variable< double >, Kratos::Variable< Kratos::GlobalPointersVector >, Kratos::Variable< GradientDataType >, Kratos::Variable< TValue >, Kratos::Variable< int >, Kratos::Variable< T >, Kratos::Variable< Kratos::GlobalPointersVector< Kratos::Node > >, and Kratos::Variable< Kratos::array_1d< double, 3 > >.
|
virtual |
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 in Kratos::Variable< TDataType >, Kratos::Variable< TVarType >, Kratos::Variable< Kratos::Internals::Matrix >, Kratos::Variable< double >, Kratos::Variable< Kratos::GlobalPointersVector >, Kratos::Variable< GradientDataType >, Kratos::Variable< TValue >, Kratos::Variable< int >, Kratos::Variable< T >, Kratos::Variable< Kratos::GlobalPointersVector< Kratos::Node > >, and Kratos::Variable< Kratos::array_1d< double, 3 > >.
|
virtual |
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 in Kratos::Variable< TDataType >, Kratos::Variable< TVarType >, Kratos::Variable< Kratos::Internals::Matrix >, Kratos::Variable< double >, Kratos::Variable< Kratos::GlobalPointersVector >, Kratos::Variable< GradientDataType >, Kratos::Variable< TValue >, Kratos::Variable< int >, Kratos::Variable< T >, Kratos::Variable< Kratos::GlobalPointersVector< Kratos::Node > >, and Kratos::Variable< Kratos::array_1d< double, 3 > >.
|
virtual |
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 in Kratos::Variable< TDataType >, Kratos::Variable< TVarType >, Kratos::Variable< Kratos::Internals::Matrix >, Kratos::Variable< double >, Kratos::Variable< Kratos::GlobalPointersVector >, Kratos::Variable< GradientDataType >, Kratos::Variable< TValue >, Kratos::Variable< int >, Kratos::Variable< T >, Kratos::Variable< Kratos::GlobalPointersVector< Kratos::Node > >, and Kratos::Variable< Kratos::array_1d< double, 3 > >.
|
virtual |
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 in Kratos::Variable< TDataType >, Kratos::Variable< TVarType >, Kratos::Variable< Kratos::Internals::Matrix >, Kratos::Variable< double >, Kratos::Variable< Kratos::GlobalPointersVector >, Kratos::Variable< GradientDataType >, Kratos::Variable< TValue >, Kratos::Variable< int >, Kratos::Variable< T >, Kratos::Variable< Kratos::GlobalPointersVector< Kratos::Node > >, and Kratos::Variable< Kratos::array_1d< double, 3 > >.
|
virtual |
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 in Kratos::Variable< TDataType >, Kratos::Variable< TVarType >, Kratos::Variable< Kratos::Internals::Matrix >, Kratos::Variable< double >, Kratos::Variable< Kratos::GlobalPointersVector >, Kratos::Variable< GradientDataType >, Kratos::Variable< TValue >, Kratos::Variable< int >, Kratos::Variable< T >, Kratos::Variable< Kratos::GlobalPointersVector< Kratos::Node > >, and Kratos::Variable< Kratos::array_1d< double, 3 > >.
|
static |
This static method generates a uinque key for given name and flags.
The generated key contains a 32-bit uique hash and following information:
64 size 32-bit hash comp. index 0 |--------—|-—|------------------------------------------—|-|
|
inline |
Returns the component index.
Please note that this method don't check if it is a component or not. It uses the key to reterive the compenent index from its first 7 bits. Component index can be from 0 to 127 at most, because 7 bits are used to store it. So in case of normal variables it returns 0 (like being the first componet)
|
inline |
|
inline |
|
virtual |
Turn back information as a string.
Reimplemented in Kratos::Variable< TDataType >, Kratos::Variable< TVarType >, Kratos::Variable< Kratos::Internals::Matrix >, Kratos::Variable< double >, Kratos::Variable< Kratos::GlobalPointersVector >, Kratos::Variable< GradientDataType >, Kratos::Variable< TValue >, Kratos::Variable< int >, Kratos::Variable< T >, Kratos::Variable< Kratos::GlobalPointersVector< Kratos::Node > >, and Kratos::Variable< Kratos::array_1d< double, 3 > >.
|
inline |
|
inline |
|
inline |
Kratos::VariableData::KRATOS_CLASS_POINTER_DEFINITION | ( | VariableData | ) |
Pointer definition of VariableData.
|
virtual |
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 in Kratos::Variable< TDataType >, Kratos::Variable< TVarType >, Kratos::Variable< Kratos::Internals::Matrix >, Kratos::Variable< double >, Kratos::Variable< Kratos::GlobalPointersVector >, Kratos::Variable< GradientDataType >, Kratos::Variable< TValue >, Kratos::Variable< int >, Kratos::Variable< T >, Kratos::Variable< Kratos::GlobalPointersVector< Kratos::Node > >, and Kratos::Variable< Kratos::array_1d< double, 3 > >.
|
inline |
|
inline |
This operator return the key. by this method user can use Variable as argument for the places which variable key is needed.
|
inlineprotected |
|
virtual |
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 in Kratos::Variable< TDataType >, Kratos::Variable< TVarType >, Kratos::Variable< Kratos::Internals::Matrix >, Kratos::Variable< double >, Kratos::Variable< Kratos::GlobalPointersVector >, Kratos::Variable< GradientDataType >, Kratos::Variable< TValue >, Kratos::Variable< int >, Kratos::Variable< T >, Kratos::Variable< Kratos::GlobalPointersVector< Kratos::Node > >, and Kratos::Variable< Kratos::array_1d< double, 3 > >.
|
virtual |
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 in Kratos::Variable< TDataType >, Kratos::Variable< TVarType >, Kratos::Variable< Kratos::Internals::Matrix >, Kratos::Variable< double >, Kratos::Variable< Kratos::GlobalPointersVector >, Kratos::Variable< GradientDataType >, Kratos::Variable< TValue >, Kratos::Variable< int >, Kratos::Variable< T >, Kratos::Variable< Kratos::GlobalPointersVector< Kratos::Node > >, and Kratos::Variable< Kratos::array_1d< double, 3 > >.
|
virtual |
Print object's data.
Reimplemented in Kratos::Variable< TDataType >, Kratos::Variable< TVarType >, Kratos::Variable< Kratos::Internals::Matrix >, Kratos::Variable< double >, Kratos::Variable< Kratos::GlobalPointersVector >, Kratos::Variable< GradientDataType >, Kratos::Variable< TValue >, Kratos::Variable< int >, Kratos::Variable< T >, Kratos::Variable< Kratos::GlobalPointersVector< Kratos::Node > >, and Kratos::Variable< Kratos::array_1d< double, 3 > >.
|
virtual |
Print information about this object.
Reimplemented in Kratos::Variable< TDataType >, Kratos::Variable< TVarType >, Kratos::Variable< Kratos::Internals::Matrix >, Kratos::Variable< double >, Kratos::Variable< Kratos::GlobalPointersVector >, Kratos::Variable< GradientDataType >, Kratos::Variable< TValue >, Kratos::Variable< int >, Kratos::Variable< T >, Kratos::Variable< Kratos::GlobalPointersVector< Kratos::Node > >, and Kratos::Variable< Kratos::array_1d< double, 3 > >.
|
inlinevirtual |
Reimplemented in Kratos::Variable< TDataType >, Kratos::Variable< TVarType >, Kratos::Variable< Kratos::Internals::Matrix >, Kratos::Variable< double >, Kratos::Variable< Kratos::GlobalPointersVector >, Kratos::Variable< GradientDataType >, Kratos::Variable< TValue >, Kratos::Variable< int >, Kratos::Variable< T >, Kratos::Variable< Kratos::GlobalPointersVector< Kratos::Node > >, and Kratos::Variable< Kratos::array_1d< double, 3 > >.
|
virtual |
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 in Kratos::Variable< TDataType >, Kratos::Variable< TVarType >, Kratos::Variable< Kratos::Internals::Matrix >, Kratos::Variable< double >, Kratos::Variable< Kratos::GlobalPointersVector >, Kratos::Variable< GradientDataType >, Kratos::Variable< TValue >, Kratos::Variable< int >, Kratos::Variable< T >, Kratos::Variable< Kratos::GlobalPointersVector< Kratos::Node > >, and Kratos::Variable< Kratos::array_1d< double, 3 > >.
void Kratos::VariableData::SetKey | ( | KeyType | NewKey | ) |
NOTE: This function is for internal use and not to change arbitrary any variable's key
|
inline |
|
inline |
|
friend |
|
friend |