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.
|
KratosComponents class encapsulates a lookup table for a family of classes in a generic way. More...
#include <kratos_components.h>
Public Member Functions | |
Life Cycle | |
KratosComponents ()=default | |
Default constructor. More... | |
virtual | ~KratosComponents ()=default |
Destructor. More... | |
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 | |
Operations | |
static void | Add (const std::string &rName, const TComponentType &rComponent) |
Adds a component to the collection. More... | |
static void | Remove (const std::string &rName) |
Removes a component with the specified name. More... | |
static const TComponentType & | Get (const std::string &rName) |
Retrieves a component with the specified name. More... | |
static void | Register () |
Registers the function. More... | |
Access | |
static ComponentsContainerType & | GetComponents () |
Retrieves the ComponentsContainer. More... | |
static ComponentsContainerType * | pGetComponents () |
Retrieves the pointer to the ComponentsContainerType object. More... | |
Inquiry | |
static bool | Has (const std::string &rName) |
Check if the given name exists in the set of components. More... | |
Type Definitions | |
using | ComponentsContainerType = std::map< std::string, const TComponentType * > |
The map type used to store the components // TODO: Replace std::map with faster alternative. More... | |
using | ValueType = typename ComponentsContainerType::value_type |
Component type. More... | |
KRATOS_CLASS_POINTER_DEFINITION (KratosComponents) | |
Pointer definition of KratosComponents. More... | |
KratosComponents class encapsulates a lookup table for a family of classes in a generic way.
Prototypes must be added to this table by unique names to be accessible by IO. These names can be created automatically using C++ RTTI or given manually for each component. In this design the manual approach is chosen, so shorter and more clear names can be given to each component and also there is a flexibility to give different names to different states of an object and create them via different prototypes. For example having TriangularThermal and both
TComponentType | The type of components to be stored in this table. |
using Kratos::KratosComponents< TComponentType >::ComponentsContainerType = std::map<std::string, const TComponentType*> |
The map type used to store the components // TODO: Replace std::map with faster alternative.
using Kratos::KratosComponents< TComponentType >::ValueType = typename ComponentsContainerType::value_type |
Component type.
|
default |
Default constructor.
|
virtualdefault |
Destructor.
|
inlinestatic |
Adds a component to the collection.
rName | the name of the component |
rComponent | the component to add |
std::runtime_error | if a different object was already registered with the same name |
|
inlinestatic |
Retrieves a component with the specified name.
This function retrieves a component from the ComponentsContainer using the provided name.
rName | The name of the component to retrieve. |
|
inlinestatic |
Retrieves the ComponentsContainer.
This function returns a reference to the ComponentsContainer, which stores all the components.
|
inlinestatic |
Check if the given name exists in the set of components.
rName | the name to check |
|
inlinevirtual |
Turn back information as a string.
Kratos::KratosComponents< TComponentType >::KRATOS_CLASS_POINTER_DEFINITION | ( | KratosComponents< TComponentType > | ) |
Pointer definition of KratosComponents.
|
inlinestatic |
Retrieves the pointer to the ComponentsContainerType object.
|
inlinevirtual |
Print object's data.
|
inlinevirtual |
Print information about this object.
|
inlinestatic |
Registers the function.
|
inlinestatic |
Removes a component with the specified name.
rName | The name of the component to remove. |
ErrorType | If the component with the specified name does not exist. |