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.
combine_model_part_modeler.h
Go to the documentation of this file.
1 #pragma once
2 
3 // System includes
4 
5 // External includes
6 
7 // Project includes
8 #include "modeler/modeler.h"
9 #include "containers/model.h"
11 
12 namespace Kratos
13 {
16 
20 
24 
28 
32 
41 class KRATOS_API(KRATOS_CORE) CombineModelPartModeler
42  : public Modeler {
43 public:
46 
49 
53 
54  // Default constructor.
56  {
57  }
58 
65  Model& rModel,
66  Parameters ModelerParameters
67  );
68 
70  virtual ~CombineModelPartModeler() = default;
71 
75 
79 
80  const Parameters GetDefaultParameters() const override;
81 
89  Modeler::Pointer Create(
90  Model& rModel,
91  const Parameters ModelParameters
92  ) const override;
93 
97  void SetupModelPart() override;
98 
102 
104  std::string Info() const override
105  {
106  return "CombineModelPartModeler";
107  }
108 
110  void PrintInfo(std::ostream& rOStream) const override
111  {
112  rOStream << Info();
113  }
114 
116  void PrintData(std::ostream& rOStream) const override
117  {
118  }
119 
121 protected:
122 
125 
129 
133 
137 
138 
139  void DuplicateElements(
140  ModelPart& rOriginModelPart,
141  ModelPart& rDestinationModelPart,
142  const Element& rReferenceElement) const;
143 
144  void DuplicateConditions(
145  ModelPart& rOriginModelPart,
146  ModelPart& rDestinationModelPart,
147  const Condition& rReferenceBoundaryCondition) const;
148 
149  void DuplicateCommunicatorData(
150  ModelPart& rOriginModelPart,
151  ModelPart& rDestinationModelPart) const;
152 
153  void DuplicateSubModelParts(
154  ModelPart& rOriginModelPart,
155  ModelPart& rDestinationModelPart) const;
156 
157  void CopyCommonData(
158  ModelPart& rCombinedModelPart) const;
159 
160  void DuplicateMesh() const;
161 
162  void CreateSubModelParts();
163 
164  void CreateCommunicators();
165 
166  void PopulateCommunicators();
167 
168  void PopulateLocalMesh(
169  Communicator& rReferenceComm,
170  Communicator& rDestinationComm,
171  ModelPart& rDestinationModelPart
172  ) const;
173 
174  void ResetModelPart(ModelPart& rCombinedModelPart) const;
175 
176  void CheckOriginModelPartsAndAssignRoot();
177 
181 
185 
190 
191 private:
197 
198  Model* mpModel = nullptr;
199 
200  Parameters mParameters;
201 
202  ModelPart* mpOriginRootModelPart = nullptr;
203 
207 
211 
216 
220 
221  friend class Serializer;
222 
223  void save(Serializer& rSerializer) const
224  {
225  }
226 
227  void load(Serializer& rSerializer)
228  {
229  }
230 
234 
238 
239 }; // Class CombineModelPartModeler
240 
244 
246 inline std::istream& operator>>(std::istream& rIStream,
248 {
249  return rIStream;
250 }
251 
253 inline std::ostream& operator<<(std::ostream& rOStream, const CombineModelPartModeler& rThis)
254 {
255  rThis.PrintInfo(rOStream);
256  rOStream << std::endl;
257  rThis.PrintData(rOStream);
258 
259  return rOStream;
260 }
261 
263 
264 } // namespace Kratos.
265 
std::string Info() const override
Turn back information as a string.
Definition: periodic_interface_process.hpp:93
This modeler combines several model parts into a new one. All input model parts should share the same...
Definition: combine_model_part_modeler.h:42
virtual ~CombineModelPartModeler()=default
Destructor.
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: combine_model_part_modeler.h:116
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: combine_model_part_modeler.h:110
KRATOS_CLASS_POINTER_DEFINITION(CombineModelPartModeler)
Pointer definition of CombineModelPartModeler.
CombineModelPartModeler()
Definition: combine_model_part_modeler.h:55
std::string Info() const override
Turn back information as a string.
Definition: combine_model_part_modeler.h:104
The Commmunicator class manages communication for distributed ModelPart instances.
Definition: communicator.h:67
Base class for all Conditions.
Definition: condition.h:59
Base class for all Elements.
Definition: element.h:60
This class aims to manage different model parts across multi-physics simulations.
Definition: model.h:60
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
Modeler to interact with ModelParts.
Definition: modeler.h:39
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
Modeler::Pointer Create(const std::string &ModelerName, Model &rModel, const Parameters ModelParameters)
Checks if the modeler is registered.
Definition: modeler_factory.cpp:30
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