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-05-16 13:59:01 $
47 // Revision: $Revision: 1.3 $
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  std::cout << "erasing outer node at " << in->X() << " " << in->Y() << " " << in->Z() << std::endl;
190  }
191  }
192 
193  KRATOS_CATCH("")
194  }
195 
196 
200 
201 
205 
206 
210 
212  std::string Info() const override
213  {
214  return "MarkOuterNodesProcess";
215  }
216 
218  void PrintInfo(std::ostream& rOStream) const override
219  {
220  rOStream << "MarkOuterNodesProcess";
221  }
222 
224  void PrintData(std::ostream& rOStream) const override
225  {
226  }
227 
228 
232 
233 
235 
236 protected:
239 
240 
244 
245 
249 
250 
254 
255 
259 
260 
264 
265 
269 
270 
272 
273 private:
276 
277 
281  ModelPart& mr_model_part;
282 
286 
287 
291 
292 
296 
297 
301 
302 
306 
308 // MarkOuterNodesProcess& operator=(MarkOuterNodesProcess const& rOther);
309 
311 // MarkOuterNodesProcess(MarkOuterNodesProcess const& rOther);
312 
313 
315 
316 }; // Class MarkOuterNodesProcess
317 
319 
322 
323 
327 
328 
330 inline std::istream& operator >> (std::istream& rIStream,
331  MarkOuterNodesProcess& rThis);
332 
334 inline std::ostream& operator << (std::ostream& rOStream,
335  const MarkOuterNodesProcess& rThis)
336 {
337  rThis.PrintInfo(rOStream);
338  rOStream << std::endl;
339  rThis.PrintData(rOStream);
340 
341  return rOStream;
342 }
344 
345 
346 } // namespace Kratos.
347 
348 #endif // KRATOS_MARK_OUTER_NODES_PROCESS_INCLUDED defined
349 
350 
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:218
~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:212
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:224
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_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