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.
mark_outer_nodes_process.h
Go to the documentation of this file.
1 /*
2 ==============================================================================
3 KratosULFApplication
4 A library based on:
5 Kratos
6 A General Purpose Software for Multi-Physics Finite Element Analysis
7 Version 1.0 (Released on march 05, 2007).
8 
9 Copyright 2007
10 Pooyan Dadvand, Riccardo Rossi, Pawel Ryzhakov
11 pooyan@cimne.upc.edu
12 rrossi@cimne.upc.edu
13 - CIMNE (International Center for Numerical Methods in Engineering),
14 Gran Capita' s/n, 08034 Barcelona, Spain
15 
16 
17 Permission is hereby granted, free of charge, to any person obtaining
18 a copy of this software and associated documentation files (the
19 "Software"), to deal in the Software without restriction, including
20 without limitation the rights to use, copy, modify, merge, publish,
21 distribute, sublicense and/or sell copies of the Software, and to
22 permit persons to whom the Software is furnished to do so, subject to
23 the following condition:
24 
25 Distribution of this code for any commercial purpose is permissible
26 ONLY BY DIRECT ARRANGEMENT WITH THE COPYRIGHT OWNERS.
27 
28 The above copyright notice and this permission notice shall be
29 included in all copies or substantial portions of the Software.
30 
31 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
32 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
34 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
35 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
36 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
37 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
38 
39 ==============================================================================
40 */
41 
42 
43 //
44 // Project Name: Kratos
45 // Last Modified by: $Author: rrossi $
46 // Date: $Date: 2007-03-06 10:30:32 $
47 // Revision: $Revision: 1.2 $
48 //
49 //
50 
51 #if !defined(KRATOS_MARK_OUTER_NODES_PROCESS_INCLUDED )
52 #define KRATOS_MARK_OUTER_NODES_PROCESS_INCLUDED
53 
54 
55 
56 // System includes
57 #include <string>
58 #include <iostream>
59 #include <algorithm>
60 
61 // External includes
62 
63 
64 // Project includes
65 #include "includes/define.h"
66 #include "processes/process.h"
67 #include "includes/node.h"
68 #include "includes/element.h"
69 #include "includes/model_part.h"
70 #include "custom_utilities/geometry_utilities2D.h"
72 
73 
74 namespace Kratos
75 {
76 
79 
83 
84 
88 
92 
96 
98 
104 class MarkOuterNodesProcess
105  : public Process
106 {
107 public:
110 
113 
117 
120  : mr_model_part(model_part)
121  {
122  }
123 
126  {
127  }
128 
129 
133 
134 
135  void MarkOuterNodes(const array_1d<double,3>& corner1, const array_1d<double,3>& corner2)
136  {
137  KRATOS_TRY
138  //add a big number to the id of the nodes to be erased
139  int n_erased = 0;
140  double xmax, xmin, ymax,ymin, zmax, zmin;
141 
142  if(corner1[0] > corner2[0])
143  {
144  xmax = corner1[0];
145  xmin = corner2[0];
146  }
147  else
148  {
149  xmax = corner2[0];
150  xmin = corner1[0];
151  }
152  if(corner1[1] > corner2[1])
153  {
154  ymax = corner1[1];
155  ymin = corner2[1];
156  }
157  else
158  {
159  ymax = corner2[1];
160  ymin = corner1[1];
161  }
162  if(corner1[2] > corner2[2])
163  {
164  zmax = corner1[2];
165  zmin = corner2[2];
166  }
167  else
168  {
169  zmax = corner2[2];
170  zmin = corner1[2];
171  }
172  //for(ModelPart::NodesContainerType::iterator in = rNodes.begin(); in!=rNodes.end(); in++)
173  for(ModelPart::NodesContainerType::iterator in = mr_model_part.NodesBegin() ;
174  in != mr_model_part.NodesEnd() ; ++in)
175  {
176  bool erase = false;
177  double& x = in->X();
178  double& y = in->Y();
179  double& z = in->Z();
180 
181  if(x<xmin || x>xmax) erase = true;
182  else if(y<ymin || y>ymax) erase = true;
183  else if(z<zmin || z>zmax) erase = true;
184 
185  if(erase == true)
186  {
187  n_erased += 1;
188  in->Set(TO_ERASE, true);
189  KRATOS_WATCH("ERRASING OUTER NODE!!!!!!");
190  KRATOS_WATCH("ERRASING OUTER NODE!!!!!!");
191  KRATOS_WATCH("ERRASING OUTER NODE!!!!!!");
192  }
193  }
194 
195  KRATOS_CATCH("")
196  }
197 
198 
202 
203 
207 
208 
212 
214  std::string Info() const override
215  {
216  return "MarkOuterNodesProcess";
217  }
218 
220  void PrintInfo(std::ostream& rOStream) const override
221  {
222  rOStream << "MarkOuterNodesProcess";
223  }
224 
226  void PrintData(std::ostream& rOStream) const override
227  {
228  }
229 
230 
234 
235 
237 
238 protected:
241 
242 
246 
247 
251 
252 
256 
257 
261 
262 
266 
267 
271 
272 
274 
275 private:
278 
279 
283  ModelPart& mr_model_part;
284 
288 
289 
293 
294 
298 
299 
303 
304 
308 
310 // MarkOuterNodesProcess& operator=(MarkOuterNodesProcess const& rOther);
311 
313 // MarkOuterNodesProcess(MarkOuterNodesProcess const& rOther);
314 
315 
317 
318 }; // Class MarkOuterNodesProcess
319 
321 
324 
325 
329 
330 
332 inline std::istream& operator >> (std::istream& rIStream,
333  MarkOuterNodesProcess& rThis);
334 
336 inline std::ostream& operator << (std::ostream& rOStream,
337  const MarkOuterNodesProcess& rThis)
338 {
339  rThis.PrintInfo(rOStream);
340  rOStream << std::endl;
341  rThis.PrintData(rOStream);
342 
343  return rOStream;
344 }
346 
347 
348 } // namespace Kratos.
349 
350 #endif // KRATOS_MARK_OUTER_NODES_PROCESS_INCLUDED defined
351 
352 
Short class definition.
Definition: mark_outer_nodes_process.h:67
void MarkOuterNodes(const array_1d< double, 3 > &corner1, const array_1d< double, 3 > &corner2)
Definition: mark_outer_nodes_process.h:135
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: mark_outer_nodes_process.h:220
~MarkOuterNodesProcess() override
Destructor.
Definition: mark_outer_nodes_process.h:125
MarkOuterNodesProcess(ModelPart &model_part)
Default constructor.
Definition: mark_outer_nodes_process.h:119
std::string Info() const override
Turn back information as a string.
Definition: mark_outer_nodes_process.h:214
KRATOS_CLASS_POINTER_DEFINITION(MarkOuterNodesProcess)
Pointer definition of PushStructureProcess.
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: mark_outer_nodes_process.h:226
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
NodeIterator NodesEnd(IndexType ThisIndex=0)
Definition: model_part.h:497
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_WATCH(variable)
Definition: define.h:806
#define KRATOS_TRY
Definition: define.h:109
z
Definition: GenerateWind.py:163
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
float zmax
Definition: cube_mesher.py:747
float xmax
Definition: cube_mesher.py:743
float ymax
Definition: cube_mesher.py:745
float xmin
Definition: cube_mesher.py:742
float zmin
Definition: cube_mesher.py:746
float ymin
Definition: cube_mesher.py:744
model_part
Definition: face_heat.py:14
y
Other simbols definition.
Definition: generate_axisymmetric_navier_stokes_element.py:54
x
Definition: sensitivityMatrix.py:49