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.
model.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: Riccardo Rossi
11 // Pooyan Dadvand
12 //
13 
14 #if !defined(KRATOS_MODEL_H_INCLUDED )
15 #define KRATOS_MODEL_H_INCLUDED
16 
17 // System includes
18 #include <string>
19 #include <iostream>
20 #include <unordered_map>
21 
22 // External includes
23 
24 // Project includes
25 #include "includes/define.h"
26 #include "includes/model_part.h"
27 
28 namespace Kratos
29 {
32 
35 
39 
43 
47 
51 
59 class KRATOS_API(KRATOS_CORE) Model final
60 {
61 public:
64 
67 
70 
74 
76  Model(){};
77 
80  {
81  mRootModelPartMap.clear();
82  }
83 
84  Model(const Model&) = delete;
85 
89 
90  Model & operator=(const Model&) = delete;
91 
95 
100  void Reset();
101 
107  ModelPart& CreateModelPart( const std::string& ModelPartName, IndexType NewBufferSize=1 );
108 
114  void DeleteModelPart( const std::string& ModelPartName );
115 
122  void RenameModelPart( const std::string& OldName, const std::string& NewName );
123 
130  ModelPart& GetModelPart(const std::string& rFullModelPartName);
131 
138  const ModelPart& GetModelPart(const std::string& rFullModelPartName) const;
139 
146  bool HasModelPart(const std::string& rFullModelPartName) const;
147 
153  std::vector<std::string> GetModelPartNames() const;
154 
158 
159 
163 
164 
168 
170  std::string Info() const;
171 
173  void PrintInfo(std::ostream& rOStream) const;
174 
176  void PrintData(std::ostream& rOStream) const;
177 
178 
182 
183 
185 
186 protected:
189 
190 
194 
195 
199 
203 
204 
208 
209 
213 
214 
218 
219 
221 
222 private:
225 
226 
230 
231  std::map< std::string, std::unique_ptr<ModelPart> > mRootModelPartMap;
232 
236 
237 
241 
248  ModelPart* RecursiveSearchByName(const std::string& rModelPartName, ModelPart* pModelPart) const;
249 
255  std::vector<std::string> SplitSubModelPartHierarchy(const std::string& rFullModelPartName) const;
256 
262  void CreateRootModelPart(const std::string& ModelPartName, ModelPart::IndexType NewBufferSize);
263 
267 
268 
272 
273 
277 
279 // Model& operator=(Model const& rOther);
280 
282 // Model(Model const& rOther);
283 
284 
288 
289  friend class Serializer;
290 
291  void save(Serializer& rSerializer) const;
292  void load(Serializer& rSerializer);
293 
295 
296 }; // Class Model
297 
299 
302 
303 
307 
308 
310 inline std::istream& operator >> (std::istream& rIStream,
311  Model& rThis);
312 
314 inline std::ostream& operator << (std::ostream& rOStream,
315  const Model& rThis)
316 {
317  rThis.PrintInfo(rOStream);
318  rOStream << std::endl;
319  rThis.PrintData(rOStream);
320 
321  return rOStream;
322 }
324 
326 
327 } // namespace Kratos.
328 
329 #endif // KRATOS_MODEL_H_INCLUDED defined
std::string Info() const override
Turn back information as a string.
Definition: periodic_interface_process.hpp:93
This class aims to manage different model parts across multi-physics simulations.
Definition: model.h:60
Model(const Model &)=delete
ModelPart::IndexType IndexType
Definition of the index type.
Definition: model.h:66
Model()
Default constructor.
Definition: model.h:76
~Model()
Destructor.
Definition: model.h:79
void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: model.cpp:249
Model & operator=(const Model &)=delete
void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: model.cpp:256
KRATOS_CLASS_POINTER_DEFINITION(Model)
Pointer definition of Model.
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
std::size_t IndexType
Pointer definition of ModelPart.
Definition: model_part.h:105
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
def load(f)
Definition: ode_solve.py:307
def CreateModelPart(model_part)
Definition: test_utilities.py:61