13 #if !defined(KRATOS_FACTORY_H_INCLUDED )
14 #define KRATOS_FACTORY_H_INCLUDED
71 virtual bool Has(
const std::string& rClassName)
const
73 KRATOS_ERROR <<
"Methods must be implemented in the derived class" << std::endl;
82 virtual std::string
Info()
const
88 virtual void PrintInfo(std::ostream& rOStream)
const
90 rOStream << this->
Info() << std::endl;
94 virtual void PrintData(std::ostream& rOStream)
const
107 template<
typename TClass>
146 bool Has(
const std::string& rClassName)
const override
157 template<
typename... TArgumentsType >
158 typename ClassType::Pointer
Create(TArgumentsType&&... Arguments)
const
160 std::tuple<TArgumentsType...>
args(Arguments...);
161 constexpr std::size_t args_size = std::tuple_size<std::tuple<TArgumentsType...>>::value;
163 const std::string& r_name = Settings[
"name"].
GetString();
165 "Which does not exist. The list of available options (for currently loaded applications) are: \n" <<
168 return aux.Create(std::forward<TArgumentsType>(Arguments)...);
184 std::string
Info()
const override
192 rOStream << this->
Info() << std::endl;
194 for (
const auto& r_comp : factory_components) {
195 rOStream <<
"\t" << r_comp.first << std::endl;
200 virtual void PrintData(std::ostream& rOStream)
const override
209 template <
typename TBaseCategoryType>
215 template <
typename TClassType,
typename TBaseCategoryType>
235 template<
class TClass>
240 rOStream << std::endl;
Here we define some common methods.
Definition: factory.h:42
KRATOS_CLASS_POINTER_DEFINITION(FactoryBase)
Pointer definition of FactoryBase.
virtual bool Has(const std::string &rClassName) const
This method checks if the linear class is registered.
Definition: factory.h:71
virtual ~FactoryBase()
Definition: factory.h:60
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: factory.h:94
virtual std::string Info() const
Turn back information as a string.
Definition: factory.h:82
FactoryBase()
Definition: factory.h:56
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: factory.h:88
Here we add the functions needed for the registration of class.
Definition: factory.h:110
bool Has(const std::string &rClassName) const override
This method checks if the linear class is registered.
Definition: factory.h:146
std::string Info() const override
Turn back information as a string.
Definition: factory.h:184
ClassType::Pointer Create(TArgumentsType &&... Arguments) const
This method creates a new class.
Definition: factory.h:158
virtual ~Factory()=default
Factory()
Definition: factory.h:127
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: factory.h:190
virtual void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: factory.h:200
TClass ClassType
The definition of the class.
Definition: factory.h:116
KRATOS_CLASS_POINTER_DEFINITION(Factory)
Pointer definition of Factory.
Definition: factory.h:210
RegisteredPrototypeBase()=default
Definition: factory.h:216
RegisteredPrototype(const std::string &rName, const TClassType &rPrototype)
Definition: factory.h:218
KratosComponents class encapsulates a lookup table for a family of classes in a generic way.
Definition: kratos_components.h:49
static void Add(const std::string &rName, const TComponentType &rComponent)
Adds a component to the collection.
Definition: kratos_components.h:88
static ComponentsContainerType & GetComponents()
Retrieves the ComponentsContainer.
Definition: kratos_components.h:138
static bool Has(const std::string &rName)
Check if the given name exists in the set of components.
Definition: kratos_components.h:161
static const TComponentType & Get(const std::string &rName)
Retrieves a component with the specified name.
Definition: kratos_components.h:114
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
std::string GetString() const
This method returns the string contained in the current Parameter.
Definition: kratos_parameters.cpp:684
#define KRATOS_ERROR
Definition: exception.h:161
#define KRATOS_ERROR_IF_NOT(conditional)
Definition: exception.h:163
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
args
Definition: generate_gid_list_file.py:37