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.
pqmpm_partition_utilities.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: Peter Wilson
11 //
12 
13 #ifndef KRATOS_PQMPM_PARTITION_UTILITIES
14 #define KRATOS_PQMPM_PARTITION_UTILITIES
15 
16 // Project includes
20 
21 #include "geometries/geometry.h"
22 #include "includes/model_part.h"
23 
24 #include "boost/geometry/geometry.hpp"
25 
26 namespace Kratos
27 {
30 
36  class KRATOS_API(PARTICLE_MECHANICS_APPLICATION) PQMPMPartitionUtilities
37  {
38  public:
39  // Standard types
40  typedef std::size_t IndexType;
41  typedef std::size_t SizeType;
42  typedef Node NodeType;
45 
46  // Boost Polygon
47  typedef boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> Boost2DPointType;
48  typedef boost::geometry::model::polygon<Boost2DPointType> Boost2DPolygonType;
49 
50  // Container types
55 
58 
60  virtual ~PQMPMPartitionUtilities() = default;
61 
62  static void PartitionMasterMaterialPointsIntoSubPoints(const ModelPart& rBackgroundGridModelPart,
63  const array_1d<double, 3>& rCoordinates,
64  const array_1d<double, 3>& rLocalCoords,
65  Element& rMasterMaterialPoint,
66  typename GeometryType::Pointer pQuadraturePointGeometry,
67  const double Tolerance);
68 
69  private:
70  static void CreateBoundingBoxPoints(std::vector<array_1d<double, 3>>& rPointVector,
71  const array_1d<double, 3>& rCenter, const double SideHalfLength, const SizeType WorkingDim);
72 
73  static bool CheckAllPointsAreInGeom(
74  const std::vector<array_1d<double, 3>>& rPoints,
75  const GeometryType& rReferenceGeom,
76  const double Tolerance);
77 
78  static void Check3DBackGroundMeshIsCubicAxisAligned(const std::vector<GeometryType*>& rIntersectedGeometries);
79 
80  static Boost2DPolygonType Create2DPolygonBoundingSquareFromPointsFast(const std::vector<array_1d<double, 3>>& rPoints,
81  const bool XActive = true, const bool YActive = true, const bool ZActive = false);
82 
83  static Boost2DPolygonType Create2DPolygonFromGeometryFast(const GeometryType& rGeom,
84  const bool XActive = true, const bool YActive = true, const bool ZActive = false);
85 
86  static IntegrationPoint<3> CreateSubPoint(const array_1d<double, 3>& rGlobalCoords, const double rVolumeFraction,
87  const GeometryType& rBackgroundGridElementGeom, Vector& rN, Matrix& rDN_De);
88 
89  static void Determine2DSubPoint(const GeometryType& rGridElement, const std::vector<array_1d<double, 3>>& rMasterDomainPoints,
90  array_1d<double, 3>& rSubPointCoord, double& rSubPointVolume);
91 
92  static void Determine3DSubPoint(const GeometryType& rGridElement, const std::vector<array_1d<double, 3>>& rMasterDomainPoints,
93  array_1d<double, 3>& rSubPointCoord, double& rSubPointVolume);
94 
95  static void CheckPQMPM(IntegrationPointsArrayType& rIntergrationSubPoints,
96  const double Tolerance, Matrix& rN, const DenseVector<Matrix>& rDN_De);
97 
98  static bool DetermineIfDomainOverlapsBoundaryConditions(std::vector<GeometryType*>& IntersectedGeometries,
99  const array_1d<double, 3>& rCoordinates, const double SideHalfLength);
100 
101  static bool IntersectionCheckWithBoundingBox(const GeometryType& rGeom,
102  const array_1d<double, 3>& rCoord, const double SideHalfLength);
103 
104  static void RecursivePQMPMNeighbourSearch(const ModelPart& rBackgroundGridModelPart,
105  std::vector<GeometryType*>& rIntersectedGeometries,
106  const Point& rPointLow,
107  const Point& rPointHigh,
108  IndexType& RecursionCount,
109  const array_1d<double, 3>& rCoordinates,
110  const double SideHalfLength,
111  const SizeType MaxRecursions = 100);
112 
113  static bool CheckFixedNodesWithinBoundingBox(const PointerVector<Node>& rNodesList,
114  const Point& rPointHigh, const Point& rPointLow, const SizeType WorkingDim);
115 
116  static GeometryNodePointerType CreateCustomQuadraturePoint(
117  SizeType WorkingSpaceDimension,
118  SizeType LocalSpaceDimension,
120  typename Geometry<Node>::PointsArrayType rPoints,
121  GeometryType* pGeometryParent);
122  }; // class PQMPMPartitionUtilities
123 } // namespace Kratos
124 #endif /* KRATOS_PQMPM_PARTITION_UTILITIES defined */
Base class for all Elements.
Definition: element.h:60
Geometry base class.
Definition: geometry.h:71
Definition: geometry_shape_function_container.h:60
std::vector< IntegrationPointType > IntegrationPointsArrayType
Definition: geometry_shape_function_container.h:78
std::array< Matrix, static_cast< int >IntegrationMethod::NumberOfIntegrationMethods)> ShapeFunctionsValuesContainerType
Shape functions.
Definition: geometry_shape_function_container.h:82
std::array< IntegrationPointsArrayType, static_cast< int >IntegrationMethod::NumberOfIntegrationMethods)> IntegrationPointsContainerType
Definition: geometry_shape_function_container.h:79
std::array< DenseVector< Matrix >, static_cast< int >IntegrationMethod::NumberOfIntegrationMethods)> ShapeFunctionsLocalGradientsContainerType
Definition: geometry_shape_function_container.h:86
Short class definition.
Definition: integration_point.h:52
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
This class defines the node.
Definition: node.h:65
This class includes several utilities necessaries for the PQMPM.
Definition: pqmpm_partition_utilities.h:37
GeometryShapeFunctionContainer< GeometryData::IntegrationMethod >::IntegrationPointsContainerType IntegrationPointsContainerType
Definition: pqmpm_partition_utilities.h:52
std::size_t SizeType
Definition: pqmpm_partition_utilities.h:41
Geometry< Node >::Pointer GeometryNodePointerType
Definition: pqmpm_partition_utilities.h:44
PQMPMPartitionUtilities()=default
Constructor.
ModelPart::GeometryType GeometryType
Definition: pqmpm_partition_utilities.h:43
GeometryShapeFunctionContainer< GeometryData::IntegrationMethod >::ShapeFunctionsValuesContainerType ShapeFunctionsValuesContainerType
Definition: pqmpm_partition_utilities.h:53
boost::geometry::model::polygon< Boost2DPointType > Boost2DPolygonType
Definition: pqmpm_partition_utilities.h:48
std::size_t IndexType
Definition: pqmpm_partition_utilities.h:40
Node NodeType
Definition: pqmpm_partition_utilities.h:42
boost::geometry::model::point< double, 2, boost::geometry::cs::cartesian > Boost2DPointType
Definition: pqmpm_partition_utilities.h:47
GeometryShapeFunctionContainer< GeometryData::IntegrationMethod >::ShapeFunctionsLocalGradientsContainerType ShapeFunctionsLocalGradientsContainerType
Definition: pqmpm_partition_utilities.h:54
virtual ~PQMPMPartitionUtilities()=default
Destructor.
GeometryShapeFunctionContainer< GeometryData::IntegrationMethod >::IntegrationPointsArrayType IntegrationPointsArrayType
Definition: pqmpm_partition_utilities.h:51
Point class.
Definition: point.h:59
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.h:72
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21