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.
registry_auxiliaries.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ `
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // Kratos default license: kratos/license.txt
9 //
10 // Main authors: Ruben Zorrilla
11 // Pooyan Dadvand
12 //
13 
14 #pragma once
15 
16 // System includes
17 #include <string>
18 #include <iostream>
19 
20 // External includes
21 
22 
23 // Project includes
24 #include "includes/registry.h"
25 
26 namespace Kratos
27 {
28 
31 
34 
38 
42 
46 
50 
56 {
57 public:
60 
63 
67 
69  RegistryAuxiliaries() = delete;
70 
72  RegistryAuxiliaries(RegistryAuxiliaries const& rOther) = delete;
73 
76 
80 
81 
85 
86  template<typename TPrototypeType>
88  const std::string ModuleName,
89  const std::string ProcessName,
90  TPrototypeType rProcessPrototype)
91  {
92  const std::string all_path = std::string("Processes.All.") + ProcessName;
93  RegisterPrototype(all_path, rProcessPrototype);
94  const std::string module_path = std::string("Processes.") + ModuleName + std::string(".") + ProcessName;
95  RegisterPrototype(module_path, rProcessPrototype);
96  }
97 
98  template<typename TPrototypeType>
100  const std::string ModuleName,
101  const std::string OperationName,
102  TPrototypeType rOperationPrototype)
103  {
104  const std::string all_path = std::string("Operations.All.") + OperationName;
105  RegisterPrototype(all_path, rOperationPrototype);
106  const std::string module_path = std::string("Operations.") + ModuleName + std::string(".") + OperationName;
107  RegisterPrototype(module_path, rOperationPrototype);
108  }
109 
110  template<typename TPrototypeType>
112  const std::string ModuleName,
113  const std::string ControllerName,
114  TPrototypeType rControllerPrototype)
115  {
116  const std::string all_path = std::string("Controllers.All.") + ControllerName;
117  RegisterPrototype(all_path, rControllerPrototype);
118  const std::string module_path = std::string("Controllers.") + ModuleName + std::string(".") + ControllerName;
119  RegisterPrototype(module_path, rControllerPrototype);
120  }
121 
125 
126 
130 
131 
135 
136 
140 
141 
143 private:
146 
147 
151 
152 
156 
157 
161 
162  template<typename TPrototypeType>
163  static void RegisterPrototype(
164  const std::string RegistryEntryName,
165  TPrototypeType rPrototype)
166  {
167  if (!Registry::HasItem(RegistryEntryName)) {
168  auto& r_item = Registry::AddItem<RegistryItem>(RegistryEntryName);
169  r_item.AddItem<TPrototypeType>("Prototype", rPrototype);
170  } else {
171  KRATOS_ERROR << "'" << RegistryEntryName << "' is already registered." << std::endl;
172  }
173  }
174 
178 
179 
183 
184 
188 
189 
191 }; // Class RegistryAuxiliaries
192 
194 
197 
198 
202 
203 
206 
207 } // namespace Kratos.
Kratos registry auxiliaries This static class collect all the auxiliary functions to be used to regis...
Definition: registry_auxiliaries.h:56
static void RegisterOperationWithPrototype(const std::string ModuleName, const std::string OperationName, TPrototypeType rOperationPrototype)
Definition: registry_auxiliaries.h:99
static void RegisterControllerWithPrototype(const std::string ModuleName, const std::string ControllerName, TPrototypeType rControllerPrototype)
Definition: registry_auxiliaries.h:111
RegistryAuxiliaries()=delete
Default constructor.
RegistryAuxiliaries(RegistryAuxiliaries const &rOther)=delete
Copy constructor.
~RegistryAuxiliaries()=delete
Destructor.
KRATOS_CLASS_POINTER_DEFINITION(RegistryAuxiliaries)
Pointer definition of Registry.
static void RegisterProcessWithPrototype(const std::string ModuleName, const std::string ProcessName, TPrototypeType rProcessPrototype)
Definition: registry_auxiliaries.h:87
static bool HasItem(std::string const &rItemFullName)
Definition: registry.cpp:88
#define KRATOS_ERROR
Definition: exception.h:161
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21