Skip to content

Commit 9f9f52e

Browse files
Merge pull request #13589 from KratosMultiphysics/core/minor-clean
[Core] Minor clean up and modernization of `ExactMortarIntegrationUtility`
2 parents d273f33 + 03e4e49 commit 9f9f52e

File tree

7 files changed

+198
-224
lines changed

7 files changed

+198
-224
lines changed

applications/ContactStructuralMechanicsApplication/custom_conditions/mesh_tying_mortar_condition.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ class KRATOS_API(CONTACT_STRUCTURAL_MECHANICS_APPLICATION) MeshTyingMortarCondit
9797
/// Definition of a point
9898
using PointType = Point;
9999

100+
/// Geometry point type definition
101+
using GeometryPointType = Geometry<PointType>;
102+
100103
/// Definition of the geometry type
101104
using GeometryType = Geometry<Node>;
102105

applications/ContactStructuralMechanicsApplication/custom_utilities/mortar_explicit_contribution_utilities.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ class KRATOS_API(CONTACT_STRUCTURAL_MECHANICS_APPLICATION) MortarExplicitContrib
7676
/// Point definition
7777
using PointType = Point;
7878

79+
/// Geometry point type definition
80+
using GeometryPointType = Geometry<PointType>;
81+
7982
/// Geometry type definition
8083
using GeometryType = Geometry<Node>;
8184

@@ -204,7 +207,7 @@ class KRATOS_API(CONTACT_STRUCTURAL_MECHANICS_APPLICATION) MortarExplicitContrib
204207
GeneralVariables& rVariables,
205208
const ConditionArrayListType& rConditionsPointsSlave,
206209
BoundedMatrix<double, TNumNodes, TNumNodes>& rAe,
207-
const IntegrationMethod& rIntegrationMethod,
210+
const GeometryData::IntegrationMethod& rIntegrationMethod,
208211
const double AxiSymCoeff = 1.0
209212
);
210213

kratos/processes/simple_mortar_mapper_process.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -595,11 +595,10 @@ void SimpleMortarMapperProcess<TDim, TNumNodes, TVarType, TNumNodesMaster>::Crea
595595
/***********************************************************************************/
596596

597597
template<SizeType TDim, SizeType TNumNodes, class TVarType, const SizeType TNumNodesMaster>
598-
IntegrationMethod SimpleMortarMapperProcess<TDim, TNumNodes, TVarType, TNumNodesMaster>::GetIntegrationMethod()
598+
GeometryData::IntegrationMethod SimpleMortarMapperProcess<TDim, TNumNodes, TVarType, TNumNodesMaster>::GetIntegrationMethod()
599599
{
600600
const int integration_order = mThisParameters["integration_order"].GetInt();
601-
switch ( integration_order )
602-
{
601+
switch ( integration_order ) {
603602
case 1: return GeometryData::IntegrationMethod::GI_GAUSS_1;
604603
case 2: return GeometryData::IntegrationMethod::GI_GAUSS_2;
605604
case 3: return GeometryData::IntegrationMethod::GI_GAUSS_3;
@@ -860,7 +859,7 @@ void SimpleMortarMapperProcess<TDim, TNumNodes, TVarType, TNumNodesMaster>::Exec
860859
residual_norm[i_size] = 0.0;
861860
}
862861

863-
block_for_each(mDestinationModelPart.Nodes(), [&](NodeType& rNode) {
862+
block_for_each(mDestinationModelPart.Nodes(), [&](Node& rNode) {
864863
if(mOptions.Is(DESTINATION_IS_HISTORICAL)) {
865864
MortarUtilities::AddAreaWeightedNodalValue<TVarType, MortarUtilitiesSettings::SaveAsHistoricalVariable>(rNode, *mpDestinationVariable, ref_area);
866865
} else {

kratos/utilities/exact_mortar_segmentation_utility.cpp

Lines changed: 108 additions & 108 deletions
Large diffs are not rendered by default.

kratos/utilities/exact_mortar_segmentation_utility.h

Lines changed: 59 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
// _|\_\_| \__,_|\__|\___/ ____/
66
// Multi-Physics
77
//
8-
// License: BSD License
9-
// Kratos default license: kratos/license.txt
8+
// License: BSD License
9+
// Kratos default license: kratos/license.txt
1010
//
1111
// Main authors: Vicente Mataix Ferrandiz
1212
//
13-
#if !defined(KRATOS_EXACT_MORTAR_INTEGRATION_UTILITY_H_INCLUDED)
14-
#define KRATOS_EXACT_MORTAR_INTEGRATION_UTILITY_H_INCLUDED
13+
14+
#pragma once
1515

1616
// System includes
1717
#include <iostream>
@@ -47,19 +47,8 @@ namespace Kratos {
4747
///@name Type Definitions
4848
///@{
4949

50-
/// Geometric definitions
51-
typedef Point PointType;
52-
typedef Node NodeType;
53-
typedef Geometry<NodeType> GeometryType;
54-
typedef Geometry<PointType> GeometryPointType;
55-
56-
///Type definition for integration methods
57-
typedef GeometryData::IntegrationMethod IntegrationMethod;
58-
typedef IntegrationPoint<2> IntegrationPointType;
59-
typedef GeometryType::IntegrationPointsArrayType IntegrationPointsType;
60-
6150
/// The definition of the size type
62-
typedef std::size_t SizeType;
51+
using SizeType = std::size_t;
6352

6453
///@}
6554
///@name Enum's
@@ -91,50 +80,70 @@ class KRATOS_API(KRATOS_CORE) ExactMortarIntegrationUtility
9180
///@name Type Definitions
9281
///@{
9382

94-
/// The type of points belongfs to be considered
95-
typedef typename 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;
83+
/// The definition of the class
84+
using ClassType = ExactMortarIntegrationUtility<TDim, TNumNodes, TBelong, TNumNodesMaster>;
85+
86+
/// Geometric definitions
87+
using GeometryType = Geometry<Node>;
88+
using GeometryPointType = Geometry<Point>;
89+
90+
/// Type definition for integration methods
91+
using IntegrationMethod = GeometryData::IntegrationMethod;
92+
using IntegrationPointType = IntegrationPoint<2>;
93+
using IntegrationPointsType = GeometryType::IntegrationPointsArrayType;
94+
95+
/// The type of points to be considered
96+
using BelongType = typename std::conditional<TNumNodes == 2,
97+
PointBelongsLine2D2N,
98+
typename std::conditional<TNumNodes == 3,
99+
typename std::conditional<TNumNodesMaster == 3,
100+
PointBelongsTriangle3D3N,
101+
PointBelongsTriangle3D3NQuadrilateral3D4N>::type,
102+
typename std::conditional<TNumNodesMaster == 3,
103+
PointBelongsQuadrilateral3D4NTriangle3D3N,
104+
PointBelongsQuadrilateral3D4N>::type>::type>::type;
96105

97106
/// The definition of the point with belonging
98-
typedef PointBelong<TNumNodes, TNumNodesMaster> PointBelongType;
107+
using PointBelongType = PointBelong<TNumNodes, TNumNodesMaster>;
99108

100-
/// An array of points belong
101-
typedef std::vector<array_1d<PointBelongType, TDim>> VectorArrayPointsBelong;
109+
/// An array of points with belonging
110+
using VectorArrayPointsBelong = std::vector<array_1d<PointBelongType, TDim>>;
102111

103-
/// A vector of points
104-
typedef std::vector<array_1d<PointType, TDim>> VectorArrayPoints;
112+
/// A vector of normal points
113+
using VectorArrayPoints = std::vector<array_1d<Point, TDim>>;
105114

106115
/// The type of array of points to be considered depending if we are interested in derivatives or not
107-
typedef typename std::conditional<TBelong, VectorArrayPointsBelong,VectorArrayPoints>::type ConditionArrayListType;
116+
using ConditionArrayListType = typename std::conditional<TBelong, VectorArrayPointsBelong, VectorArrayPoints>::type;
108117

109118
/// A vector of points for derivatives
110-
typedef std::vector<PointBelongType> VectorPointsBelong;
119+
using VectorPointsBelong = std::vector<PointBelongType>;
111120

112121
/// A vector of normal points
113-
typedef std::vector<PointType> VectorPoints;
122+
using VectorPoints = std::vector<Point>;
114123

115124
/// The type of vector of points to be considered depending if we are interested in define derivatives or not
116-
typedef typename std::conditional<TBelong, VectorPointsBelong, VectorPoints>::type PointListType;
125+
using PointListType = typename std::conditional<TBelong, VectorPointsBelong, VectorPoints>::type;
117126

118-
/// An array of points belong
119-
typedef array_1d<PointBelongType, 3> ArrayPointsBelong;
127+
/// An array of points with belonging
128+
using ArrayPointsBelong = array_1d<PointBelongType, 3>;
120129

121130
/// An array of normal points
122-
typedef array_1d<PointType, 3> ArrayPoints;
131+
using ArrayPoints = array_1d<Point, 3>;
123132

124-
/// The type of arrayt of points to be used depending if we are interested in derivatives or not
125-
typedef typename std::conditional<TBelong, ArrayPointsBelong, ArrayPoints>::type ArrayTriangleType;
133+
/// The type of array of points to be used depending if we are interested in derivatives or not
134+
using ArrayTriangleType = typename std::conditional<TBelong, ArrayPointsBelong, ArrayPoints>::type;
126135

127136
/// The points line geometry
128-
typedef Line2D2<Point> LineType;
137+
using LineType = Line2D2<Point>;
129138

130139
/// The points triangle geometry
131-
typedef Triangle3D3<Point> TriangleType;
140+
using TriangleType = Triangle3D3<Point>;
132141

133142
/// The geometry that will be considered for decomposition
134-
typedef typename std::conditional<TDim == 2, LineType, TriangleType>::type DecompositionType;
143+
using DecompositionType = typename std::conditional<TDim == 2, LineType, TriangleType>::type;
135144

136145
/// The definition of the index type
137-
typedef std::size_t IndexType;
146+
using IndexType = std::size_t;
138147

139148
/// Definition of epsilon
140149
static constexpr double ZeroTolerance = std::numeric_limits<double>::epsilon();
@@ -434,11 +443,11 @@ class KRATOS_API(KRATOS_CORE) ExactMortarIntegrationUtility
434443
* @return True if there is a intersection point, false otherwise
435444
*/
436445
static inline bool Clipping2D(
437-
PointType& rPointIntersection,
438-
const PointType& rPointOrig1,
439-
const PointType& rPointOrig2,
440-
const PointType& rPointDest1,
441-
const PointType& rPointDest2
446+
Point& rPointIntersection,
447+
const Point& rPointOrig1,
448+
const Point& rPointOrig2,
449+
const Point& rPointDest1,
450+
const Point& rPointDest2
442451
)
443452
{
444453
const array_1d<double, 3>& r_coord_point_orig1 = rPointOrig1.Coordinates();
@@ -501,8 +510,8 @@ class KRATOS_API(KRATOS_CORE) ExactMortarIntegrationUtility
501510
* @return angle The angle formed
502511
*/
503512
static inline double AnglePoints(
504-
const PointType& rPointOrig1,
505-
const PointType& rPointOrig2,
513+
const Point& rPointOrig1,
514+
const Point& rPointOrig2,
506515
const array_1d<double, 3>& rAxis1,
507516
const array_1d<double, 3>& rAxis2
508517
)
@@ -524,8 +533,8 @@ class KRATOS_API(KRATOS_CORE) ExactMortarIntegrationUtility
524533
* @return check The check done
525534
*/
526535
static inline bool CheckPoints(
527-
const PointType& rPointOrig,
528-
const PointType& rPointDest
536+
const Point& rPointOrig,
537+
const Point& rPointDest
529538
)
530539
{
531540
// const double tolerance = std::numeric_limits<double>::epsilon(); // NOTE: Giving some problems, too tight
@@ -541,9 +550,9 @@ class KRATOS_API(KRATOS_CORE) ExactMortarIntegrationUtility
541550
* @return The DetJ
542551
*/
543552
static inline double FastTriagleCheck2D(
544-
const PointType& rPointOrig1,
545-
const PointType& rPointOrig2,
546-
const PointType& rPointOrig3
553+
const Point& rPointOrig1,
554+
const Point& rPointOrig2,
555+
const Point& rPointOrig3
547556
)
548557
{
549558
const double x10 = rPointOrig2.X() - rPointOrig1.X();
@@ -660,7 +669,7 @@ class KRATOS_API(KRATOS_CORE) ExactMortarIntegrationUtility
660669
PointListType& rPointList,
661670
const GeometryPointType& rSlaveGeometry,
662671
const GeometryPointType& rMasterGeometry,
663-
const PointType& rRefCenter
672+
const Point& rRefCenter
664673
);
665674

666675
/**
@@ -684,7 +693,7 @@ class KRATOS_API(KRATOS_CORE) ExactMortarIntegrationUtility
684693
const GeometryPointType& rMasterGeometry,
685694
const array_1d<double, 3>& rSlaveTangentXi,
686695
const array_1d<double, 3>& rSlaveTangentEta,
687-
const PointType& rRefCenter,
696+
const Point& rRefCenter,
688697
const bool IsAllInside = false
689698
);
690699

@@ -700,21 +709,7 @@ class KRATOS_API(KRATOS_CORE) ExactMortarIntegrationUtility
700709
);
701710

702711
///@}
703-
///@name Protected Access
704-
///@{
705-
706-
///@}
707-
///@name Protected Inquiry
708-
///@{
709-
710-
///@}
711-
///@name Protected LifeCycle
712-
///@{
713-
///@}
714712
private:
715-
///@name Static Member Variables
716-
///@{
717-
///@}
718713
///@name Member Variables
719714
///@{
720715

@@ -726,29 +721,5 @@ class KRATOS_API(KRATOS_CORE) ExactMortarIntegrationUtility
726721
bool mConsiderDelaunator; /// If consider the DelaunatorUtilities in 3D in order to construct the triangles
727722

728723
///@}
729-
///@name Private Operators
730-
///@{
731-
732-
///@}
733-
///@name Private Operations
734-
///@{
735-
736-
///@}
737-
///@name Private Access
738-
///@{
739-
///@}
740-
741-
///@}
742-
///@name Serialization
743-
///@{
744-
745-
///@name Private Inquiry
746-
///@{
747-
///@}
748-
749-
///@name Unaccessible methods
750-
///@{
751-
///@}
752724
}; // Class ExactMortarIntegrationUtility
753725
}
754-
#endif /* KRATOS_EXACT_MORTAR_INTEGRATION_UTILITY_H_INCLUDED defined */

kratos/utilities/mortar_utilities.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
// _|\_\_| \__,_|\__|\___/ ____/
55
// Multi-Physics
66
//
7-
// License: BSD License
8-
// Kratos default license: kratos/license.txt
7+
// License: BSD License
8+
// Kratos default license: kratos/license.txt
99
//
1010
// Main authors: Vicente Mataix Ferrandiz
1111
//
@@ -208,7 +208,7 @@ void ComputeNodesTangentFromNormalModelPart(ModelPart& rModelPart)
208208
/***********************************************************************************/
209209

210210
void ComputeTangentsFromNormal(
211-
NodeType& rNode,
211+
Node& rNode,
212212
const array_1d<double, 3>& rNormal,
213213
const std::size_t Dimension
214214
)
@@ -235,7 +235,7 @@ void ComputeTangentsFromNormal(
235235
/***********************************************************************************/
236236

237237
void ComputeTangentNodeWithLMAndSlip(
238-
NodeType& rNode,
238+
Node& rNode,
239239
const std::size_t StepLM,
240240
const Variable<array_1d<double, 3>>* pSlipVariable,
241241
const double SlipCoefficient,
@@ -293,7 +293,7 @@ void ComputeTangentNodeWithLMAndSlip(
293293
/***********************************************************************************/
294294

295295
void ComputeTangentNodeWithSlip(
296-
NodeType& rNode,
296+
Node& rNode,
297297
const std::size_t StepLM,
298298
const Variable<array_1d<double, 3>>* pSlipVariable,
299299
const double SlipCoefficient,
@@ -453,7 +453,7 @@ const std::string GetAuxiliarVariable<Variable<array_1d<double, 3>>>()
453453

454454
template< >
455455
double GetAuxiliarValue<Variable<double>>(
456-
NodeType& rThisNode,
456+
Node& rThisNode,
457457
const std::size_t iSize
458458
)
459459
{
@@ -465,7 +465,7 @@ double GetAuxiliarValue<Variable<double>>(
465465

466466
template< >
467467
double GetAuxiliarValue<Variable<array_1d<double, 3>>>(
468-
NodeType& rThisNode,
468+
Node& rThisNode,
469469
const std::size_t iSize
470470
)
471471
{
@@ -636,7 +636,7 @@ void AddValue<Variable<array_1d<double, 3>>, MortarUtilitiesSettings::SaveAsNonH
636636

637637
template<>
638638
void AddAreaWeightedNodalValue<Variable<double>, MortarUtilitiesSettings::SaveAsHistoricalVariable>(
639-
NodeType& rThisNode,
639+
Node& rThisNode,
640640
const Variable<double>& rThisVariable,
641641
const double RefArea,
642642
const double Tolerance
@@ -653,7 +653,7 @@ void AddAreaWeightedNodalValue<Variable<double>, MortarUtilitiesSettings::SaveAs
653653

654654
template<>
655655
void AddAreaWeightedNodalValue<Variable<array_1d<double, 3>>, MortarUtilitiesSettings::SaveAsHistoricalVariable>(
656-
NodeType& rThisNode,
656+
Node& rThisNode,
657657
const Variable<array_1d<double, 3>>& rThisVariable,
658658
const double RefArea,
659659
const double Tolerance
@@ -670,7 +670,7 @@ void AddAreaWeightedNodalValue<Variable<array_1d<double, 3>>, MortarUtilitiesSet
670670

671671
template<>
672672
void AddAreaWeightedNodalValue<Variable<double>, MortarUtilitiesSettings::SaveAsNonHistoricalVariable>(
673-
NodeType& rThisNode,
673+
Node& rThisNode,
674674
const Variable<double>& rThisVariable,
675675
const double RefArea,
676676
const double Tolerance
@@ -687,7 +687,7 @@ void AddAreaWeightedNodalValue<Variable<double>, MortarUtilitiesSettings::SaveAs
687687

688688
template<>
689689
void AddAreaWeightedNodalValue<Variable<array_1d<double, 3>>, MortarUtilitiesSettings::SaveAsNonHistoricalVariable>(
690-
NodeType& rThisNode,
690+
Node& rThisNode,
691691
const Variable<array_1d<double, 3>>& rThisVariable,
692692
const double RefArea,
693693
const double Tolerance

0 commit comments

Comments
 (0)