13 #if !defined(KRATOS_EXACT_MORTAR_INTEGRATION_UTILITY_H_INCLUDED)
14 #define KRATOS_EXACT_MORTAR_INTEGRATION_UTILITY_H_INCLUDED
87 template <SizeType TDim, SizeType TNumNodes,
bool TBe
long = false, SizeType TNumNodesMaster = TNumNodes>
140 static constexpr
double ZeroTolerance = std::numeric_limits<double>::epsilon();
155 const SizeType IntegrationOrder = 0,
158 const double ZeroToleranceFactor = 1.0,
159 const bool ConsiderDelaunator =
false
160 ) :mIntegrationOrder(IntegrationOrder),
161 mDistanceThreshold(DistanceThreshold),
163 mZeroToleranceFactor(ZeroToleranceFactor),
164 mConsiderDelaunator(ConsiderDelaunator)
166 GetIntegrationMethod();
206 bool GetExactIntegration(
223 bool GetExactAreaIntegration(
250 bool TestGetExactIntegration(
251 Condition::Pointer pSlaveCond,
252 Condition::Pointer pMasterCond,
263 double TestGetExactAreaIntegration(
264 Condition::Pointer pSlaveCond,
265 Condition::Pointer pMasterCond
275 double TestGetExactAreaIntegration(
277 Condition::Pointer pSlaveCond
287 const std::string IOConsidered =
"GiD"
300 return mIntegrationOrder;
309 mIntegrationOrder = IntegrationOrder;
310 GetIntegrationMethod();
319 return mDistanceThreshold;
328 mDistanceThreshold = DistanceThreshold;
355 return mZeroToleranceFactor;
364 mZeroToleranceFactor = ZeroToleranceFactor;
373 return mConsiderDelaunator;
382 mConsiderDelaunator = ConsiderDelaunator;
405 void GetIntegrationMethod();
417 template<SizeType TSizeCheck = TNumNodes>
420 for (
IndexType i_node = 0; i_node < TSizeCheck; ++i_node)
421 if (!rAllInside[i_node])
449 const double s_orig1_orig2_x = r_coord_point_orig2[0] - r_coord_point_orig1[0];
450 const double s_orig1_orig2_y = r_coord_point_orig2[1] - r_coord_point_orig1[1];
451 const double s_dest1_dest2_x = r_coord_point_dest2[0] - r_coord_point_dest1[0];
452 const double s_dest1_dest2_y = r_coord_point_dest2[1] - r_coord_point_dest1[1];
454 const double denom = s_orig1_orig2_x * s_dest1_dest2_y -
455 s_dest1_dest2_x * s_orig1_orig2_y;
457 const double tolerance = 1.0e-15;
460 if (std::abs(denom) < tolerance)
463 const double s_orig1_dest1_x = r_coord_point_orig1[0] - r_coord_point_dest1[0];
464 const double s_orig1_dest1_y = r_coord_point_orig1[1] - r_coord_point_dest1[1];
466 const double s = (s_orig1_orig2_x * s_orig1_dest1_y - s_orig1_orig2_y * s_orig1_dest1_x)/denom;
468 const double t = (s_dest1_dest2_x * s_orig1_dest1_y - s_dest1_dest2_y * s_orig1_dest1_x)/denom;
470 if (s >= -tolerance && s <= (1.0 + tolerance) &&
t >= -tolerance &&
t <= (1.0 + tolerance)) {
471 rPointIntersection.
Coordinates()[0] = r_coord_point_orig1[0] +
t * s_orig1_orig2_x;
472 rPointIntersection.
Coordinates()[1] = r_coord_point_orig1[1] +
t * s_orig1_orig2_y;
488 normal[0] = -rVector[1];
489 normal[1] = rVector[0];
511 if (
norm_2(local_edge) > 0.0)
512 local_edge /=
norm_2(local_edge);
514 const double xi =
inner_prod(rAxis1, local_edge);
515 const double eta =
inner_prod(rAxis2, local_edge);
517 return (std::atan2(eta, xi));
532 const double tolerance = 1.0e-15;
533 return rPointDest.
Distance(rPointOrig) < tolerance;
549 const double x10 = rPointOrig2.
X() - rPointOrig1.
X();
550 const double y10 = rPointOrig2.
Y() - rPointOrig1.
Y();
552 const double x20 = rPointOrig3.
X() - rPointOrig1.
X();
553 const double y20 = rPointOrig3.
Y() - rPointOrig1.
Y();
560 return x10 * y20 - y10 * x20;
569 template<SizeType TSizeCheck = TNumNodes>
576 for (
IndexType i_node = 0; i_node < TSizeCheck; ++i_node) {
577 if (rAllInside[i_node]) {
579 bool add_point =
true;
580 for (
IndexType iter = 0; iter < rPointList.size(); ++iter)
581 if (CheckPoints(rThisGeometry[i_node], rPointList[iter])) add_point =
false;
584 rPointList.push_back(rThisGeometry[i_node]);
596 template<SizeType TSizeCheck = TNumNodes>
604 for (
IndexType i_node = 0; i_node < TSizeCheck; ++i_node) {
605 if (rAllInside[i_node]) {
607 bool add_point =
true;
608 for (
IndexType iter = 0; iter < rPointList.size(); ++iter) {
609 if (CheckPoints(rThisGeometry[i_node], rPointList[iter])) {
628 template<SizeType TSizeCheck = TNumNodes>
633 const double Tolerance
636 for (
IndexType i_node = 0; i_node < TSizeCheck; ++i_node) {
638 rAllInside[i_node] = rGeometry1.
IsInside( rGeometry2[i_node].Coordinates( ), projected_gp_local, Tolerance) ;
647 inline std::vector<IndexType> ComputeAnglesIndexes(
648 PointListType& rPointList,
659 inline void ComputeClippingIntersections(
660 PointListType& rPointList,
678 template <
class TGeometryType = GeometryType>
679 inline bool TriangleIntersections(
680 ConditionArrayListType& rConditionsPointsSlave,
681 PointListType& rPointList,
682 const TGeometryType& rOriginalSlaveGeometry,
688 const bool IsAllInside =
false
697 static inline bool CheckCenterIsInside(
722 double mDistanceThreshold;
724 double mZeroToleranceFactor;
726 bool mConsiderDelaunator;
This utility calculates the exact integration necessary for the Mortar Conditions.
Definition: exact_mortar_segmentation_utility.h:89
std::conditional< TNumNodes==2, PointBelongsLine2D2N, typename std::conditional< TNumNodes==3, typename std::conditional< TNumNodesMaster==3, PointBelongsTriangle3D3N, PointBelongsTriangle3D3NQuadrilateral3D4N >::type, typename std::conditional< TNumNodesMaster==3, PointBelongsQuadrilateral3D4NTriangle3D3N, PointBelongsQuadrilateral3D4N >::type >::type >::type BelongType
The type of points belongfs to be considered.
Definition: exact_mortar_segmentation_utility.h:95
void PushBackPoints(VectorPoints &rPointList, const array_1d< bool, TSizeCheck > &rAllInside, GeometryPointType &rThisGeometry)
This function push backs the points that are inside.
Definition: exact_mortar_segmentation_utility.h:570
std::conditional< TBelong, VectorArrayPointsBelong, VectorArrayPoints >::type ConditionArrayListType
The type of array of points to be considered depending if we are interested in derivatives or not.
Definition: exact_mortar_segmentation_utility.h:107
PointBelong< TNumNodes, TNumNodesMaster > PointBelongType
The definition of the point with belonging.
Definition: exact_mortar_segmentation_utility.h:98
void SetEchoLevel(const SizeType EchoLevel)
This method sets the current mEchoLevel.
Definition: exact_mortar_segmentation_utility.h:344
bool GetExactIntegration(const GeometryType &rOriginalSlaveGeometry, const array_1d< double, 3 > &rSlaveNormal, const GeometryType &rOriginalMasterGeometry, const array_1d< double, 3 > &rMasterNormal, ConditionArrayListType &rConditionsPointsSlave)
This utility computes the exact integration of the mortar condition (just the points,...
static array_1d< double, 3 > GetNormalVector2D(const array_1d< double, 3 > &rVector)
This function calculates in 2D the normal vector to a given one.
Definition: exact_mortar_segmentation_utility.h:484
std::conditional< TBelong, ArrayPointsBelong, ArrayPoints >::type ArrayTriangleType
The type of arrayt of points to be used depending if we are interested in derivatives or not.
Definition: exact_mortar_segmentation_utility.h:125
SizeType & GetIntegrationOrder()
This method gets the current mIntegrationOrder.
Definition: exact_mortar_segmentation_utility.h:298
double & GetZeroToleranceFactor()
This method gets the current mZeroToleranceFactor.
Definition: exact_mortar_segmentation_utility.h:353
std::vector< array_1d< PointBelongType, TDim > > VectorArrayPointsBelong
An array of points belong.
Definition: exact_mortar_segmentation_utility.h:101
void SetZeroToleranceFactor(const double ZeroToleranceFactor)
This method sets the current mZeroToleranceFactor.
Definition: exact_mortar_segmentation_utility.h:362
void CheckInside(array_1d< bool, TSizeCheck > &rAllInside, GeometryPointType &rGeometry1, GeometryPointType &rGeometry2, const double Tolerance)
This function checks if the points of Geometry2 are inside Geometry1.
Definition: exact_mortar_segmentation_utility.h:629
void PushBackPoints(VectorPointsBelong &rPointList, const array_1d< bool, TSizeCheck > &rAllInside, GeometryPointType &rThisGeometry, const PointBelongs &rThisBelongs)
This function push backs the points that are inside.
Definition: exact_mortar_segmentation_utility.h:597
double & GetDistanceThreshold()
This method gets the current mDistanceThreshold.
Definition: exact_mortar_segmentation_utility.h:317
void SetIntegrationOrder(const SizeType IntegrationOrder)
This method sets the current mIntegrationOrder.
Definition: exact_mortar_segmentation_utility.h:307
static bool CheckAllInside(const array_1d< bool, TSizeCheck > &rAllInside)
This method checks if the whole array is true.
Definition: exact_mortar_segmentation_utility.h:418
std::vector< PointBelongType > VectorPointsBelong
A vector of points for derivatives.
Definition: exact_mortar_segmentation_utility.h:110
static double FastTriagleCheck2D(const PointType &rPointOrig1, const PointType &rPointOrig2, const PointType &rPointOrig3)
This functions calculates the determinant of a 2D triangle (using points) to check if invert the orde...
Definition: exact_mortar_segmentation_utility.h:543
std::conditional< TDim==2, LineType, TriangleType >::type DecompositionType
The geometry that will be considered for decomposition.
Definition: exact_mortar_segmentation_utility.h:134
std::vector< array_1d< PointType, TDim > > VectorArrayPoints
A vector of points.
Definition: exact_mortar_segmentation_utility.h:104
static bool Clipping2D(PointType &rPointIntersection, const PointType &rPointOrig1, const PointType &rPointOrig2, const PointType &rPointDest1, const PointType &rPointDest2)
This function intersects two lines in a 2D plane.
Definition: exact_mortar_segmentation_utility.h:436
array_1d< PointBelongType, 3 > ArrayPointsBelong
An array of points belong.
Definition: exact_mortar_segmentation_utility.h:119
virtual ~ExactMortarIntegrationUtility()=default
Destructor.
Line2D2< Point > LineType
The points line geometry.
Definition: exact_mortar_segmentation_utility.h:128
ExactMortarIntegrationUtility(const SizeType IntegrationOrder=0, const double DistanceThreshold=std::numeric_limits< double >::max(), const SizeType EchoLevel=0, const double ZeroToleranceFactor=1.0, const bool ConsiderDelaunator=false)
This is the default constructor.
Definition: exact_mortar_segmentation_utility.h:154
static double AnglePoints(const PointType &rPointOrig1, const PointType &rPointOrig2, const array_1d< double, 3 > &rAxis1, const array_1d< double, 3 > &rAxis2)
This function calculates in 2D the angle between two points.
Definition: exact_mortar_segmentation_utility.h:503
std::size_t IndexType
The definition of the index type.
Definition: exact_mortar_segmentation_utility.h:137
SizeType & GetEchoLevel()
This method gets the current mEchoLevel.
Definition: exact_mortar_segmentation_utility.h:335
KRATOS_CLASS_POINTER_DEFINITION(ExactMortarIntegrationUtility)
Pointer definition of ExactMortarIntegrationUtility.
static bool CheckPoints(const PointType &rPointOrig, const PointType &rPointDest)
This function checks if two points are the same one.
Definition: exact_mortar_segmentation_utility.h:526
Triangle3D3< Point > TriangleType
The points triangle geometry.
Definition: exact_mortar_segmentation_utility.h:131
void SetConsiderDelaunator(const bool ConsiderDelaunator)
This method sets the current mConsiderDelaunator.
Definition: exact_mortar_segmentation_utility.h:380
bool & GetConsiderDelaunator()
This method gets the current mConsiderDelaunator.
Definition: exact_mortar_segmentation_utility.h:371
std::conditional< TBelong, VectorPointsBelong, VectorPoints >::type PointListType
The type of vector of points to be considered depending if we are interested in define derivatives or...
Definition: exact_mortar_segmentation_utility.h:116
std::vector< PointType > VectorPoints
A vector of normal points.
Definition: exact_mortar_segmentation_utility.h:113
array_1d< PointType, 3 > ArrayPoints
An array of normal points.
Definition: exact_mortar_segmentation_utility.h:122
void SetDistanceThreshold(const double DistanceThreshold)
This method sets the current mDistanceThreshold.
Definition: exact_mortar_segmentation_utility.h:326
IntegrationMethod
Definition: geometry_data.h:76
Geometry base class.
Definition: geometry.h:71
std::vector< IntegrationPointType > IntegrationPointsArrayType
Definition: geometry.h:161
virtual bool IsInside(const CoordinatesArrayType &rPointGlobalCoordinates, CoordinatesArrayType &rResult, const double Tolerance=std::numeric_limits< double >::epsilon()) const
Checks if given point in global space coordinates is inside the geometry boundaries....
Definition: geometry.h:1918
Short class definition.
Definition: integration_point.h:52
An two node 2D line geometry with linear shape functions.
Definition: line_2d_2.h:65
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
Custom Point container to be used by the mapper.
Definition: mortar_classes.h:1952
Point class.
Definition: point.h:59
CoordinatesArrayType const & Coordinates() const
Definition: point.h:215
double Distance(const Point &rOtherPoint) const
This method computes the distance between this point and another one.
Definition: point.h:166
double Y() const
Definition: point.h:187
double X() const
Definition: point.h:181
A three node 3D triangle geometry with linear shape functions.
Definition: triangle_3d_3.h:77
Short class definition.
Definition: array_1d.h:61
static int EchoLevel
Definition: co_sim_EMPIRE_API.h:42
static double max(double a, double b)
Definition: GeometryFunctions.h:79
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
TExpressionType::data_type norm_2(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression)
Definition: amatrix_interface.h:625
GeometryData::IntegrationMethod IntegrationMethod
Type definition for integration methods.
Definition: exact_mortar_segmentation_utility.h:57
Geometry< PointType > GeometryPointType
Definition: exact_mortar_segmentation_utility.h:54
Node NodeType
The definition of the node.
Definition: tetrahedral_mesh_orientation_check.h:34
TExpression1Type::data_type inner_prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:592
Geometry< Node > GeometryType
The definition of the geometry.
Definition: mortar_classes.h:37
PointBelongs
This enum defines a "hash" used to identify in which combination of cuts the point is found when the ...
Definition: mortar_classes.h:56
std::size_t SizeType
The definition of the size type.
Definition: mortar_classes.h:43
typename GeometryType::IntegrationPointsArrayType IntegrationPointsType
Definition: mortar_classes.h:40
Point PointType
Geometric definitions.
Definition: mortar_classes.h:36
IntegrationPoint< 2 > IntegrationPointType
Definition: exact_mortar_segmentation_utility.h:58
type
Definition: generate_gid_list_file.py:35
int t
Definition: ode_solve.py:392