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.
save_fluid_only_process.h
Go to the documentation of this file.
1 //
2 // Project Name: Kratos
3 // Last Modified by: $Author: anonymous $
4 // Date: $Date: 2007-11-06 12:34:26 $
5 // Revision: $Revision: 1.4 $
6 //
7 // this process save structural elements in a separate list
8 
9 #if !defined(KRATOS_SAVE_FLUID_ONLY_PROCESS_INCLUDED )
10 #define KRATOS_SAVE_FLUID_ONLY_PROCESS_INCLUDED
11 
12 
13 
14 // System includes
15 #include <string>
16 #include <iostream>
17 #include <algorithm>
18 
19 // External includes
20 
21 
22 // Project includes
23 #include "includes/define.h"
24 #include "processes/process.h"
25 #include "includes/node.h"
26 #include "includes/element.h"
27 #include "includes/model_part.h"
32 
33 
34 namespace Kratos
35 {
36 
39 
43 
44 
48 
52 
56 
58 
65  : public Process
66 {
67 public:
70 
73 
77 
80  //ModelPart& fluid_model_part, ModelPart& structure_model_part, ModelPart& combined_model_part)
81  //: mr_fluid_model_part(fluid_model_part), mr_structure_model_part(structure_model_part), mr_combined_model_part(combined_model_part)
82  {
83  }
84 
87  {
88  }
89 
90 
94 
95  // void operator()()
96  // {
97  // MergeParts();
98  // }
99 
100 
104 
106  {
107  KRATOS_TRY
108  fluid_only_model_part.Elements().clear();
109  fluid_only_model_part.Nodes();
110  fluid_only_model_part.Nodes().clear();
111 
112  //combined_model_part.Nodes()=fluid_model_part.Nodes();
113  fluid_only_model_part.Elements()=fluid_model_part.Elements();
114  fluid_only_model_part.Conditions()=fluid_model_part.Conditions();
115 
116 
117 
118  for(ModelPart::NodesContainerType::iterator in = fluid_model_part.NodesBegin() ;
119  in != fluid_model_part.NodesEnd() ; ++in)
120  {
121  if (in->FastGetSolutionStepValue(IS_FLUID)!=0)
122  fluid_only_model_part.Nodes().push_back(*(in.base()));
123  }
124 
125 
126  //sorting and renumbering the fluid elements
127  unsigned int id=1;
128  for(ModelPart::NodesContainerType::iterator in = fluid_model_part.NodesBegin() ;
129  in != fluid_model_part.NodesEnd() ; ++in)
130  {
131  in->SetId(id);
132 // im->Id() = id;
133  id++;
134  }
135 
136  //fluid_only_model_part.Nodes().Sort();
137  //fluid_only_model_part.Elements().Sort();
138  //fluid_only_model_part.Conditions().Sort();
139 
140  //WE HAVE TO COPY THE ProcessInfo pointer to the new part, otherwise it is empty
141  fluid_only_model_part.SetProcessInfo(fluid_model_part.pGetProcessInfo());
142 
143 
144  KRATOS_CATCH("")
145  }
146 
147 
151 
152 
156 
157 
161 
163  std::string Info() const override
164  {
165  return "SaveFluidOnlyProcess";
166  }
167 
169  void PrintInfo(std::ostream& rOStream) const override
170  {
171  rOStream << "SaveFluidOnlyProcess";
172  }
173 
175  void PrintData(std::ostream& rOStream) const override
176  {
177  }
178 
179 
183 
184 
186 
187 protected:
190 
191 
195 
196 
200 
201 
205 
206 
210 
211 
215 
216 
220 
221 
223 
224 private:
227 
228 
232  //ModelPart& mr_fluid_model_part;
233  //ModelPart& mr_structure_model_part;
234  //ModelPart& mr_combined_model_part;
235 
239 
240 
244 
245 
249 
250 
254 
255 
259 
261 // SaveFluidOnlyProcess& operator=(SaveFluidOnlyProcess const& rOther);
262 
264 // SaveFluidOnlyProcess(SaveFluidOnlyProcess const& rOther);
265 
266 
268 
269 }; // Class SaveFluidOnlyProcess
270 
272 
275 
276 
280 
281 
283 inline std::istream& operator >> (std::istream& rIStream,
284  SaveFluidOnlyProcess& rThis);
285 
287 inline std::ostream& operator << (std::ostream& rOStream,
288  const SaveFluidOnlyProcess& rThis)
289 {
290  rThis.PrintInfo(rOStream);
291  rOStream << std::endl;
292  rThis.PrintData(rOStream);
293 
294  return rOStream;
295 }
297 
298 
299 } // namespace Kratos.
300 
301 #endif // KRATOS_SAVE_FLUID_ONLY_PROCESS_INCLUDED defined
302 
303 
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
The base class for all processes in Kratos.
Definition: process.h:49
Short class definition.
Definition: save_fluid_only_process.h:66
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: save_fluid_only_process.h:175
~SaveFluidOnlyProcess() override
Destructor.
Definition: save_fluid_only_process.h:86
std::string Info() const override
Turn back information as a string.
Definition: save_fluid_only_process.h:163
KRATOS_CLASS_POINTER_DEFINITION(SaveFluidOnlyProcess)
Pointer definition of PushStructureProcess.
SaveFluidOnlyProcess()
Default constructor.
Definition: save_fluid_only_process.h:79
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: save_fluid_only_process.h:169
void SaveFluidOnly(ModelPart &fluid_model_part, ModelPart &fluid_only_model_part)
Definition: save_fluid_only_process.h:105
#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
fluid_model_part
Definition: edgebased_PureConvection.py:18
fluid_only_model_part
Definition: script.py:28