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.
divide_geometry.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: Ruben Zorrilla
11 //
12 
13 #if !defined(KRATOS_DIVIDE_GEOMETRY)
14 #define KRATOS_DIVIDE_GEOMETRY
15 
16 // System includes
17 
18 // External includes
19 
20 // Project includes
21 #include "includes/node.h"
22 #include "geometries/point.h"
23 #include "geometries/geometry.h"
27 
28 namespace Kratos
29 {
32 
36 
40 
44 
45 class KRATOS_API(KRATOS_CORE) IndexedPoint : public Point, public IndexedObject
46 {
47 public:
48 
51 
54 
58 
60  IndexedPoint();
61 
63  explicit IndexedPoint(const unsigned int Id);
64 
66  IndexedPoint(const array_1d<double,3>& rCoords, const unsigned int Id);
67 
69  ~IndexedPoint();
70 
74 
78 
82 
84  std::string Info() const override;
85 
87  void PrintInfo(std::ostream& rOStream) const override;
88 
90  void PrintData(std::ostream& rOStream) const override;
91 
95 
99 
103 
105 
106 private:
109 
113 
117 
118  friend class Serializer;
119 
120  void save(Serializer& rSerializer) const override {
123  };
124 
125  void load(Serializer& rSerializer) override {
128  };
129 
133 
137 
141 
145 
147 };
148 
150 inline std::istream& operator >> (std::istream& rIStream,
151  IndexedPoint& rThis) {
152  return rIStream;
153 };
154 
156 inline std::ostream& operator << (std::ostream& rOStream,
157  const IndexedPoint& rThis) {
158  rThis.PrintInfo(rOStream);
159  rOStream << std::endl;
160  rThis.PrintData(rOStream);
161 
162  return rOStream;
163 };
164 
165 template<class TPointType>
166 class KRATOS_API(KRATOS_CORE) DivideGeometry
167 {
168 public:
169 
172 
175 
176  // General type definitions
179  typedef IndexedPoint::Pointer IndexedPointPointerType;
183 
184  bool mIsSplit; // True if the element is split.
185 
186  int mSplitEdgesNumber; // Number of split edges.
187  int mDivisionsNumber; // Number of generated subdivisions.
188 
189  IndexedPointsContainerType mAuxPointsContainer; // Indexed points container to store the original plus the intersection points.
190 
194 
196  DivideGeometry(const GeometryType& rInputGeometry, const Vector& rNodalDistances);
197 
199  virtual ~DivideGeometry();
200 
204 
210  std::vector<IndexedPointGeometryPointerType> GetPositiveSubdivisions() const;
211 
217  std::vector<IndexedPointGeometryPointerType> GetNegativeSubdivisions() const;
218 
224  std::vector<IndexedPointGeometryPointerType> GetPositiveInterfaces() const;
225 
231  std::vector<IndexedPointGeometryPointerType> GetNegativeInterfaces() const;
232 
238  std::vector<unsigned int> GetPositiveInterfacesParentIds() const;
239 
245  std::vector<unsigned int> GetNegativeInterfacesParentIds() const;
246 
250 
254 
256  virtual std::string Info() const;
257 
259  virtual void PrintInfo(std::ostream& rOStream) const;
260 
262  virtual void PrintData(std::ostream& rOStream) const;
263 
267 
271 
275  virtual const std::vector<int>& GetEdgeIdsI() const = 0;
276 
280  virtual const std::vector<int>& GetEdgeIdsJ() const = 0;
281 
285  virtual std::vector<int>& GetSplitEdges() = 0;
286 
290  Vector GetNodalDistances() const;
291 
295  GeometryType GetInputGeometry() const;
296 
300  virtual void GenerateDivision() = 0;
301 
305  virtual void GenerateIntersectionsSkin() = 0;
306 
313  virtual void GenerateExteriorFaces(
314  std::vector < IndexedPointGeometryPointerType > &rExteriorFacesVector,
315  std::vector < unsigned int > &rExteriorFacesParentSubdivisionsIdsVector,
316  const std::vector < IndexedPointGeometryPointerType > &rSubdivisionsContainer)
317  {
318  KRATOS_ERROR << "Accessing base class \'GenerateExteriorFaces\' method."<< std::endl;
319  };
320 
329  virtual void GenerateExteriorFaces(
330  std::vector < IndexedPointGeometryPointerType > &rExteriorFacesVector,
331  std::vector < unsigned int > &rExteriorFacesParentSubdivisionsIdsVector,
332  const std::vector < IndexedPointGeometryPointerType > &rSubdivisionsContainer,
333  const unsigned int FatherFaceId)
334  {
335  KRATOS_ERROR << "Accessing base class \'GenerateExteriorFaces\' method."<< std::endl;
336  };
337 
339 
340 protected:
343 
347 
348  std::vector<IndexedPointGeometryPointerType> mPositiveSubdivisions; // Array to store the generated positive subdivisions geometries.
349  std::vector<IndexedPointGeometryPointerType> mNegativeSubdivisions; // Array to store the generated negative subdivisions geometries.
350  std::vector<IndexedPointGeometryPointerType> mPositiveInterfaces; // Array to store the generated positive interfaces geometries.
351  std::vector<IndexedPointGeometryPointerType> mNegativeInterfaces; // Array to store the generated negative interfaces geometries.
352  std::vector<unsigned int> mPositiveInterfacesParentIds; // Array to store the parent subgeometries ids of the generated positive interfaces.
353  std::vector<unsigned int> mNegativeInterfacesParentIds; // Array to store the parent subgeometries ids of the generated negative interfaces.
354 
358 
362 
366  void IsSplit();
367 
371 
375 
379 
381 
382 private:
385 
389 
390  const GeometryType& mrInputGeometry;
391  const Vector& mrNodalDistances;
392 
396 
400 
404 
408 
412 
416 
418  DivideGeometry& operator=(DivideGeometry const& rOther);
419 
421  DivideGeometry(DivideGeometry const& rOther)
422  : mrInputGeometry(rOther.mrInputGeometry) , mrNodalDistances(rOther.mrNodalDistances) {};
423 
425 
426 };// class DivideGeometry
427 
428 }//namespace Kratos
429 #endif /* KRATOS_DIVIDE_GEOMETRY defined */
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
std::string Info() const override
Turn back information as a string.
Definition: periodic_interface_process.hpp:93
Definition: divide_geometry.h:167
virtual const std::vector< int > & GetEdgeIdsJ() const =0
int mDivisionsNumber
Definition: divide_geometry.h:187
virtual void GenerateExteriorFaces(std::vector< IndexedPointGeometryPointerType > &rExteriorFacesVector, std::vector< unsigned int > &rExteriorFacesParentSubdivisionsIdsVector, const std::vector< IndexedPointGeometryPointerType > &rSubdivisionsContainer)
Definition: divide_geometry.h:313
virtual void GenerateExteriorFaces(std::vector< IndexedPointGeometryPointerType > &rExteriorFacesVector, std::vector< unsigned int > &rExteriorFacesParentSubdivisionsIdsVector, const std::vector< IndexedPointGeometryPointerType > &rSubdivisionsContainer, const unsigned int FatherFaceId)
Definition: divide_geometry.h:329
std::vector< IndexedPointGeometryPointerType > mPositiveInterfaces
Definition: divide_geometry.h:350
PointerVectorSet< IndexedPointType, IndexedObject > IndexedPointsContainerType
Definition: divide_geometry.h:182
std::vector< IndexedPointGeometryPointerType > mNegativeSubdivisions
Definition: divide_geometry.h:349
std::vector< IndexedPointGeometryPointerType > mPositiveSubdivisions
Definition: divide_geometry.h:348
Geometry< TPointType > GeometryType
Definition: divide_geometry.h:177
virtual void GenerateIntersectionsSkin()=0
IndexedPointsContainerType mAuxPointsContainer
Definition: divide_geometry.h:189
std::vector< unsigned int > mNegativeInterfacesParentIds
Definition: divide_geometry.h:353
IndexedPoint IndexedPointType
Definition: divide_geometry.h:178
int mSplitEdgesNumber
Definition: divide_geometry.h:186
bool mIsSplit
Definition: divide_geometry.h:184
std::vector< unsigned int > mPositiveInterfacesParentIds
Definition: divide_geometry.h:352
std::vector< IndexedPointGeometryPointerType > mNegativeInterfaces
Definition: divide_geometry.h:351
virtual void GenerateDivision()=0
virtual std::vector< int > & GetSplitEdges()=0
virtual const std::vector< int > & GetEdgeIdsI() const =0
IndexedPoint::Pointer IndexedPointPointerType
Definition: divide_geometry.h:179
KRATOS_CLASS_POINTER_DEFINITION(DivideGeometry)
Pointer definition of DivideGeometry.
Geometry< IndexedPoint >::Pointer IndexedPointGeometryPointerType
Definition: divide_geometry.h:181
Geometry< IndexedPoint > IndexedPointGeometryType
Definition: divide_geometry.h:180
Geometry base class.
Definition: geometry.h:71
This object defines an indexed object.
Definition: indexed_object.h:54
Definition: divide_geometry.h:46
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: divide_geometry.cpp:45
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: divide_geometry.cpp:51
KRATOS_CLASS_POINTER_DEFINITION(IndexedPoint)
Pointer definition of IndexedPoint.
Point class.
Definition: point.h:59
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
#define KRATOS_SERIALIZE_SAVE_BASE_CLASS(Serializer, BaseType)
Definition: define.h:812
#define KRATOS_SERIALIZE_LOAD_BASE_CLASS(Serializer, BaseType)
Definition: define.h:815
#define KRATOS_ERROR
Definition: exception.h:161
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
def load(f)
Definition: ode_solve.py:307