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.
merge_variable_lists_utility.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 //
12 
13 #if !defined(KRATOS_MERGE_VARIABLE_LISTS_H_INCLUDED )
14 #define KRATOS_MERGE_VARIABLE_LISTS_H_INCLUDED
15 
16 
17 
18 // System includes
19 #include <string>
20 #include <iostream>
21 
22 
23 // External includes
24 
25 
26 // Project includes
27 #include "includes/define.h"
28 #include "includes/model_part.h"
29 
30 namespace Kratos
31 {
34 
37 
41 
45 
49 
53 
55 
60  {
61  public:
64 
67 
71 
74 
77 
78 
82 
83 
87  void Merge(ModelPart& model_part1, ModelPart& model_part2)
88  {
90 
91  auto& list1 = model_part1.GetNodalSolutionStepVariablesList();
92  auto& list2 = model_part2.GetNodalSolutionStepVariablesList();
93 
94  for(const auto& var : list1)
95  {
96  model_part2.AddNodalSolutionStepVariable(var);
97  }
98 
99  for(const auto& var : list2)
100  {
101  model_part1.AddNodalSolutionStepVariable(var);
102  }
103 
104  KRATOS_CATCH("")
105  }
106 
110 
111 
115 
116 
120 
122  virtual std::string Info() const
123  {
124  std::stringstream buffer;
125  buffer << "MergeVariableListsUtility" ;
126  return buffer.str();
127  }
128 
130  virtual void PrintInfo(std::ostream& rOStream) const {rOStream << "MergeVariableListsUtility";}
131 
133  virtual void PrintData(std::ostream& rOStream) const {}
134 
135 
139 
140 
142 
143  protected:
146 
147 
151 
152 
156 
157 
161 
162 
166 
167 
171 
172 
176 
177 
179 
180  private:
183 
184 
188 
189 
193 
194 
198 
199 
203 
204 
208 
209 
213 
215  MergeVariableListsUtility& operator=(MergeVariableListsUtility const& rOther) = delete;
216 
219 
220 
222 
223  }; // Class MergeVariableListsUtility
224 
226 
229 
230 
234 
235 
237  inline std::istream& operator >> (std::istream& rIStream,
239  {
240  return rIStream;
241  }
242 
244  inline std::ostream& operator << (std::ostream& rOStream,
245  const MergeVariableListsUtility& rThis)
246  {
247  rThis.PrintInfo(rOStream);
248  rOStream << std::endl;
249  rThis.PrintData(rOStream);
250 
251  return rOStream;
252  }
254 
256 
257 } // namespace Kratos.
258 
259 #endif // KRATOS_MERGE_VARIABLE_LISTS_H_INCLUDED defined
Merges the variable lists of the input modelparts.
Definition: merge_variable_lists_utility.h:60
void Merge(ModelPart &model_part1, ModelPart &model_part2)
Definition: merge_variable_lists_utility.h:87
virtual std::string Info() const
Turn back information as a string.
Definition: merge_variable_lists_utility.h:122
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: merge_variable_lists_utility.h:133
KRATOS_CLASS_POINTER_DEFINITION(MergeVariableListsUtility)
Pointer definition of MergeVariableListsUtility.
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: merge_variable_lists_utility.h:130
virtual ~MergeVariableListsUtility()
Destructor.
Definition: merge_variable_lists_utility.h:76
MergeVariableListsUtility()
Default constructor.
Definition: merge_variable_lists_utility.h:73
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
void AddNodalSolutionStepVariable(VariableData const &ThisVariable)
Definition: model_part.h:532
VariablesList & GetNodalSolutionStepVariablesList()
Definition: model_part.h:549
#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