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.
tetrahedral_mesh_orientation_check.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: Pooyan Dadvand
11 // Riccardo Rossi
12 //
13 //
14 
15 #ifndef KRATOS_TETRAHEDRAL_MESH_ORIENTATION_CHECK_H
16 #define KRATOS_TETRAHEDRAL_MESH_ORIENTATION_CHECK_H
17 
18 // System includes
19 
20 // External includes
21 
22 // Project includes
23 #include "includes/define.h"
24 #include "includes/model_part.h"
25 #include "processes/process.h"
26 #include "geometries/geometry.h"
27 
28 namespace Kratos
29 {
32 
34 typedef Node NodeType;
35 
38 
42 
52 class KRATOS_API(KRATOS_CORE) TetrahedralMeshOrientationCheck
53  : public Process
54 {
55 public:
58 
59  //DEFINITION OF FLAGS TO CONTROL THE BEHAVIOUR
60  KRATOS_DEFINE_LOCAL_FLAG(ASSIGN_NEIGHBOUR_ELEMENTS_TO_CONDITIONS);
61  KRATOS_DEFINE_LOCAL_FLAG(COMPUTE_NODAL_NORMALS);
62  KRATOS_DEFINE_LOCAL_FLAG(COMPUTE_CONDITION_NORMALS);
63  KRATOS_DEFINE_LOCAL_FLAG(MAKE_VOLUMES_POSITIVE);
64  KRATOS_DEFINE_LOCAL_FLAG(ALLOW_REPEATED_CONDITIONS);
65 
68 
70  typedef std::size_t IndexType;
71 
73  typedef std::size_t SizeType;
74 
76  typedef Node NodeType;
77 
78  // Definition of the geometry
80 
84 
86 
91  ModelPart& rModelPart,
92  bool ThrowErrors,
93  const Flags options = COMPUTE_NODAL_NORMALS.AsFalse() | COMPUTE_CONDITION_NORMALS.AsFalse() | ASSIGN_NEIGHBOUR_ELEMENTS_TO_CONDITIONS.AsFalse() | ALLOW_REPEATED_CONDITIONS.AsFalse()
94  ): Process(),
95  mrModelPart(rModelPart),
96  mThrowErrors(ThrowErrors), //to be changed to a flag
97  mrOptions(options)
98 
99  {
100  }
101 
103  ModelPart& rModelPart,
104  const Flags options = COMPUTE_NODAL_NORMALS.AsFalse() | COMPUTE_CONDITION_NORMALS.AsFalse() | ASSIGN_NEIGHBOUR_ELEMENTS_TO_CONDITIONS.AsFalse() | ALLOW_REPEATED_CONDITIONS.AsFalse()
105  ): Process(),
106  mrModelPart(rModelPart),
107  mThrowErrors(false),
108  mrOptions(options)
109  {
110  }
111 
114 
118 
120  void operator()()
121  {
122  Execute();
123  }
124 
128 
129 
131  void Execute() override;
132 
133  void SwapAll();
134 
135  void SwapNegativeElements();
136 
140 
141 
145 
146 
150 
152  std::string Info() const override
153  {
154  return "TetrahedralMeshOrientationCheck";
155  }
156 
158  void PrintInfo(std::ostream& rOStream) const override
159  {
160  rOStream << "TetrahedralMeshOrientationCheck";
161  }
162 
164  void PrintData(std::ostream& rOStream) const override
165  {
166  this->PrintInfo(rOStream);
167  }
168 
169 
173 
174 
176 
177 
178 private:
181 
182 
186 
187  ModelPart& mrModelPart;
188  const bool mThrowErrors;
189  Flags mrOptions;
190 
194 
195  bool Orient(GeometryType& rGeom);
196 
200 
203 
206 
208 
209 }; // Class Process
210 
212 
215 
219 
220 
222 inline std::istream& operator >> (std::istream& rIStream,
224 
226 inline std::ostream& operator << (std::ostream& rOStream,
227  const TetrahedralMeshOrientationCheck& rThis)
228 {
229  rThis.PrintInfo(rOStream);
230  rOStream << std::endl;
231  rThis.PrintData(rOStream);
232 
233  return rOStream;
234 }
236 
237 
238 
239 } // namespace Kratos
240 
241 
242 #endif // KRATOS_TETRAHEDRAL_MESH_ORIENTATION_PROCESS_H
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
Definition: flags.h:58
Flags AsFalse() const
Definition: flags.h:241
Geometry base class.
Definition: geometry.h:71
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
This class defines the node.
Definition: node.h:65
The base class for all processes in Kratos.
Definition: process.h:49
Check a triangular or tetrahedral mesh to ensure that local connectivities follow the expected conven...
Definition: tetrahedral_mesh_orientation_check.h:54
std::size_t IndexType
The definition of the index type.
Definition: tetrahedral_mesh_orientation_check.h:70
std::string Info() const override
Turn back information as a string.
Definition: tetrahedral_mesh_orientation_check.h:152
KRATOS_DEFINE_LOCAL_FLAG(ASSIGN_NEIGHBOUR_ELEMENTS_TO_CONDITIONS)
TetrahedralMeshOrientationCheck(ModelPart &rModelPart, bool ThrowErrors, const Flags options=COMPUTE_NODAL_NORMALS.AsFalse()|COMPUTE_CONDITION_NORMALS.AsFalse()|ASSIGN_NEIGHBOUR_ELEMENTS_TO_CONDITIONS.AsFalse()|ALLOW_REPEATED_CONDITIONS.AsFalse())
Constructor for TetrahedralMeshOrientationCheck Process.
Definition: tetrahedral_mesh_orientation_check.h:90
void operator()()
This operator is provided to call the process as a function and simply calls the Execute method.
Definition: tetrahedral_mesh_orientation_check.h:120
KRATOS_DEFINE_LOCAL_FLAG(ALLOW_REPEATED_CONDITIONS)
TetrahedralMeshOrientationCheck(ModelPart &rModelPart, const Flags options=COMPUTE_NODAL_NORMALS.AsFalse()|COMPUTE_CONDITION_NORMALS.AsFalse()|ASSIGN_NEIGHBOUR_ELEMENTS_TO_CONDITIONS.AsFalse()|ALLOW_REPEATED_CONDITIONS.AsFalse())
Definition: tetrahedral_mesh_orientation_check.h:102
KRATOS_DEFINE_LOCAL_FLAG(COMPUTE_NODAL_NORMALS)
~TetrahedralMeshOrientationCheck() override
Destructor.
Definition: tetrahedral_mesh_orientation_check.h:113
KRATOS_DEFINE_LOCAL_FLAG(MAKE_VOLUMES_POSITIVE)
Geometry< NodeType > GeometryType
Definition: tetrahedral_mesh_orientation_check.h:79
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: tetrahedral_mesh_orientation_check.h:164
KRATOS_CLASS_POINTER_DEFINITION(TetrahedralMeshOrientationCheck)
Pointer definition of Process.
std::size_t SizeType
The definition of the size type.
Definition: tetrahedral_mesh_orientation_check.h:73
Node NodeType
Definition of the node type.
Definition: tetrahedral_mesh_orientation_check.h:76
KRATOS_DEFINE_LOCAL_FLAG(COMPUTE_CONDITION_NORMALS)
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: tetrahedral_mesh_orientation_check.h:158
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
Node NodeType
The definition of the node.
Definition: tetrahedral_mesh_orientation_check.h:34
Geometry< Node > GeometryType
The definition of the geometry.
Definition: mortar_classes.h:37
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