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.
replace_elements_and_condition_process.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 // Vicente Mataix Ferrandiz
12 // Philipp Bucher
13 //
14 
15 #pragma once
16 
17 // System includes
18 
19 // External includes
20 
21 // Project includes
22 #include "containers/model.h"
24 #include "processes/process.h"
27 
28 namespace Kratos
29 {
30 
33 
41 class KRATOS_API(KRATOS_CORE) ReplaceElementsAndConditionsProcess
42  : public Process
43 {
44 public:
47 
50 
54 
61  Model& rModel,
62  Parameters Settings
63  ) : Process(Flags()) ,
64  mrModelPart(rModel.GetModelPart(Settings["model_part_name"].GetString())),
65  mSettings( Settings.WriteJsonString())
66  {
68 
69  // Initialize member variables
70  InitializeMemberVariables();
71 
72  KRATOS_CATCH("")
73  }
74 
81  ModelPart& rModelPart,
82  Parameters Settings
83  ) : Process(Flags()) ,
84  mrModelPart(rModelPart),
85  mSettings( Settings.WriteJsonString())
86  {
88 
89  // Initialize member variables
90  InitializeMemberVariables();
91 
92  KRATOS_CATCH("")
93  }
94 
97 
100 
104 
107 
111 
119  Process::Pointer Create(
120  Model& rModel,
121  Parameters ThisParameters
122  ) override
123  {
124  return Kratos::make_shared<ReplaceElementsAndConditionsProcess>(rModel, ThisParameters);
125  }
126 
130  void Execute() override;
131 
135  const Parameters GetDefaultParameters() const override
136  {
137  const Parameters default_parameters( R"({
138  "model_part_name" : "PLEASE_CHOOSE_MODEL_PART_NAME",
139  "element_name" : "PLEASE_CHOOSE_ELEMENT_NAME",
140  "condition_name" : "PLEASE_CHOOSE_CONDITION_NAME"
141  } )" );
142  return default_parameters;
143  }
144 
148 
150  std::string Info() const override
151  {
152  return "ReplaceElementsAndConditionsProcess";
153  }
154 
156  void PrintInfo(std::ostream& rOStream) const override
157  {
158  rOStream << "ReplaceElementsAndConditionsProcess";
159  }
160 
162  void PrintData(std::ostream& rOStream) const override
163  {
164  }
165 
167 protected:
170 
175 
177 private:
180 
184 
188  void InitializeMemberVariables();
189 
191 
192 }; // Class ReplaceElementsAndConditionsProcess
193 
197 
199 inline std::istream& operator >> (std::istream& rIStream,
201 
203 inline std::ostream& operator << (std::ostream& rOStream,
205 {
206  rThis.PrintInfo(rOStream);
207  rOStream << std::endl;
208  rThis.PrintData(rOStream);
209 
210  return rOStream;
211 }
213 
214 } // namespace Kratos.
Template struct for entity identifier.
Definition: entities_utilities.h:43
Definition: flags.h:58
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
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
The base class for all processes in Kratos.
Definition: process.h:49
This methods replaces elements and conditions in a model part by a given name.
Definition: replace_elements_and_condition_process.h:43
ReplaceElementsAndConditionsProcess(Model &rModel, Parameters Settings)
Default constructor.
Definition: replace_elements_and_condition_process.h:60
~ReplaceElementsAndConditionsProcess() override=default
Destructor.
Parameters mSettings
The main model part where the elements and conditions will be replaced.
Definition: replace_elements_and_condition_process.h:172
ReplaceElementsAndConditionsProcess & operator=(ReplaceElementsAndConditionsProcess const &rOther)=delete
Assignment operator.
KRATOS_CLASS_POINTER_DEFINITION(ReplaceElementsAndConditionsProcess)
Pointer definition of ReplaceElementsAndConditionsProcess.
ReplaceElementsAndConditionsProcess(ReplaceElementsAndConditionsProcess const &rOther)=delete
Copy constructor.
EntitiesUtilities::EntitityIdentifier< Element > mElementIdentifier
The settings of the problem (names of the conditions and elements)
Definition: replace_elements_and_condition_process.h:173
Process::Pointer Create(Model &rModel, Parameters ThisParameters) override
This method creates an pointer of the process.
Definition: replace_elements_and_condition_process.h:119
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: replace_elements_and_condition_process.h:162
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: replace_elements_and_condition_process.h:156
ModelPart & mrModelPart
Definition: replace_elements_and_condition_process.h:171
ReplaceElementsAndConditionsProcess(ModelPart &rModelPart, Parameters Settings)
Default constructor.
Definition: replace_elements_and_condition_process.h:80
const Parameters GetDefaultParameters() const override
This method provides the defaults parameters to avoid conflicts between the different constructors.
Definition: replace_elements_and_condition_process.h:135
std::string Info() const override
Turn back information as a string.
Definition: replace_elements_and_condition_process.h:150
EntitiesUtilities::EntitityIdentifier< Condition > mConditionIdentifier
This variable stores the identifier of the elements.
Definition: replace_elements_and_condition_process.h:174
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
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