38 bool Foam::featurePointConformer::createSpecialisedFeaturePoint
40 const extendedFeatureEdgeMesh& feMesh,
42 const pointFeatureEdgesTypes& pFEdgesTypes,
43 const List<extendedFeatureEdgeMesh::edgeStatus>& allEdStat,
71 && !foamyHexMesh_.decomposition().positionOnThisProcessor(featPt)
79 const label initialNumOfPoints =
pts.size();
81 const scalar ppDist = foamyHexMesh_.pointPairDistance(featPt);
87 label concaveEdgeI = -1;
97 concaveEdgeI = pEds[i];
101 convexEdgesI[nConvex++] = pEds[i];
106 <<
"Edge " << eS <<
" is flat" 112 <<
"Edge " << eS <<
" not concave/convex" 117 const vector& concaveEdgePlaneANormal =
118 normals[edgeNormals[concaveEdgeI][0]];
120 const vector& concaveEdgePlaneBNormal =
121 normals[edgeNormals[concaveEdgeI][1]];
127 featPt + ppDist*concaveEdgePlaneANormal,
128 concaveEdgePlaneANormal
133 featPt + ppDist*concaveEdgePlaneBNormal,
134 concaveEdgePlaneBNormal
137 const vector& concaveEdgeDir = feMesh.edgeDirection
145 featPt + ppDist*concaveEdgeDir;
150 plane planeF(concaveEdgeLocalFeatPt, concaveEdgeDir);
152 const Foam::point concaveEdgeExternalPt = planeF.planePlaneIntersect
160 planeA = plane(featPt, concaveEdgePlaneANormal);
162 planeB = plane(featPt, concaveEdgePlaneBNormal);
165 concaveEdgeExternalPt
166 - 2.0*planeA.distance(concaveEdgeExternalPt)
167 *concaveEdgePlaneANormal;
174 foamyHexMesh_.vertexCount() +
pts.size(),
180 const label internalPtAIndex(
pts.last().index());
183 concaveEdgeExternalPt
184 - 2.0*planeB.distance(concaveEdgeExternalPt)
185 *concaveEdgePlaneBNormal;
192 foamyHexMesh_.vertexCount() +
pts.size(),
198 const label internalPtBIndex(
pts.last().index());
208 const labelList& concaveEdgeNormals = edgeNormals[concaveEdgeI];
209 const labelList& convexEdgeANormals = edgeNormals[convexEdgesI[0]];
210 const labelList& convexEdgeBNormals = edgeNormals[convexEdgesI[1]];
212 forAll(concaveEdgeNormals, edgeNormalI)
214 bool convexEdgeA =
false;
215 bool convexEdgeB =
false;
217 forAll(convexEdgeANormals, edgeAnormalI)
219 const vector& concaveNormal
220 = normals[concaveEdgeNormals[edgeNormalI]];
221 const vector& convexNormal
222 = normals[convexEdgeANormals[edgeAnormalI]];
226 Info<<
"Angle between vectors = " 232 if (
areParallel(concaveNormal, convexNormal, tolParallel))
238 forAll(convexEdgeBNormals, edgeBnormalI)
240 const vector& concaveNormal
241 = normals[concaveEdgeNormals[edgeNormalI]];
242 const vector& convexNormal
243 = normals[convexEdgeBNormals[edgeBnormalI]];
247 Info<<
"Angle between vectors = " 253 if (
areParallel(concaveNormal, convexNormal, tolParallel))
259 if ((convexEdgeA && convexEdgeB) || (!convexEdgeA && !convexEdgeB))
262 <<
"Both or neither of the convex edges share the concave " 264 <<
" convexEdgeA = " << convexEdgeA
265 <<
" convexEdgeB = " << convexEdgeB
277 forAll(convexEdgeANormals, edgeAnormalI)
279 const vector& concaveNormal
280 = normals[concaveEdgeNormals[edgeNormalI]];
281 const vector& convexNormal
282 = normals[convexEdgeANormals[edgeAnormalI]];
286 !
areParallel(concaveNormal, convexNormal, tolParallel)
289 convexEdgePlaneCNormal = convexNormal;
291 plane planeC(featPt, convexEdgePlaneCNormal);
295 + 2.0*planeC.distance(internalPtA)
296 *convexEdgePlaneCNormal;
303 foamyHexMesh_.vertexCount() +
pts.size(),
309 ftPtPairs_.addPointPair
320 forAll(convexEdgeBNormals, edgeBnormalI)
322 const vector& concaveNormal
323 = normals[concaveEdgeNormals[edgeNormalI]];
324 const vector& convexNormal
325 = normals[convexEdgeBNormals[edgeBnormalI]];
329 !
areParallel(concaveNormal, convexNormal, tolParallel)
332 convexEdgePlaneDNormal = convexNormal;
334 plane planeD(featPt, convexEdgePlaneDNormal);
338 + 2.0*planeD.distance(internalPtB)
339 *convexEdgePlaneDNormal;
346 foamyHexMesh_.vertexCount() +
pts.size(),
352 ftPtPairs_.addPointPair
366 concaveEdgeExternalPt,
367 foamyHexMesh_.vertexCount() +
pts.size(),
373 ftPtPairs_.addPointPair
379 ftPtPairs_.addPointPair
385 const label concaveEdgeExternalPtIndex(
pts.last().index());
393 if (totalAngle > foamyHexMeshControls_.maxQuadAngle())
399 vector convexEdgesPlaneNormal =
400 0.5*(convexEdgePlaneCNormal + convexEdgePlaneDNormal);
402 plane planeM(featPt, convexEdgesPlaneNormal);
427 concaveEdgeExternalPt
429 + 2.0*(concaveEdgeLocalFeatPt - concaveEdgeExternalPt);
436 foamyHexMesh_.vertexCount() +
pts.size(),
442 const label internalPtFIndex(
pts.last().index());
444 ftPtPairs_.addPointPair
446 concaveEdgeExternalPtIndex,
452 + 2.0*planeM.distance(internalPtF)*convexEdgesPlaneNormal;
459 foamyHexMesh_.vertexCount() +
pts.size(),
465 ftPtPairs_.addPointPair
474 for (label ptI = initialNumOfPoints; ptI <
pts.size(); ++ptI)
476 Info<<
"Point " << ptI <<
" : ";
492 Info<<
"nExternal == 1 && nInternal == 2" <<
endl;
500 && !foamyHexMesh_.decomposition().positionOnThisProcessor(featPt)
508 const label initialNumOfPoints =
pts.size();
510 const scalar ppDist = foamyHexMesh_.pointPairDistance(featPt);
516 label convexEdgeI = -1;
526 convexEdgeI = pEds[i];
530 concaveEdgesI[nConcave++] = pEds[i];
535 <<
"Edge " << eS <<
" is flat" 541 <<
"Edge " << eS <<
" not concave/convex" 546 const vector& convexEdgePlaneANormal =
547 normals[edgeNormals[convexEdgeI][0]];
549 const vector& convexEdgePlaneBNormal =
550 normals[edgeNormals[convexEdgeI][1]];
556 featPt - ppDist*convexEdgePlaneANormal,
557 convexEdgePlaneANormal
562 featPt - ppDist*convexEdgePlaneBNormal,
563 convexEdgePlaneBNormal
566 const vector& convexEdgeDir = feMesh.edgeDirection
574 featPt + ppDist*convexEdgeDir;
579 plane planeF(convexEdgeLocalFeatPt, convexEdgeDir);
581 const Foam::point convexEdgeExternalPt = planeF.planePlaneIntersect
589 planeA = plane(featPt, convexEdgePlaneANormal);
591 planeB = plane(featPt, convexEdgePlaneBNormal);
595 + 2.0*planeA.distance(convexEdgeExternalPt)
596 *convexEdgePlaneANormal;
603 foamyHexMesh_.vertexCount() +
pts.size(),
609 const label internalPtAIndex(
pts.last().index());
613 + 2.0*planeB.distance(convexEdgeExternalPt)
614 *convexEdgePlaneBNormal;
621 foamyHexMesh_.vertexCount() +
pts.size(),
627 const label internalPtBIndex(
pts.last().index());
637 const labelList& convexEdgeNormals = edgeNormals[convexEdgeI];
638 const labelList& concaveEdgeANormals = edgeNormals[concaveEdgesI[0]];
639 const labelList& concaveEdgeBNormals = edgeNormals[concaveEdgesI[1]];
641 forAll(convexEdgeNormals, edgeNormalI)
643 bool concaveEdgeA =
false;
644 bool concaveEdgeB =
false;
646 forAll(concaveEdgeANormals, edgeAnormalI)
648 const vector& convexNormal
649 = normals[convexEdgeNormals[edgeNormalI]];
650 const vector& concaveNormal
651 = normals[concaveEdgeANormals[edgeAnormalI]];
655 Info<<
"Angle between vectors = " 661 if (
areParallel(convexNormal, concaveNormal, tolParallel))
667 forAll(concaveEdgeBNormals, edgeBnormalI)
669 const vector& convexNormal
670 = normals[convexEdgeNormals[edgeNormalI]];
671 const vector& concaveNormal
672 = normals[concaveEdgeBNormals[edgeBnormalI]];
676 Info<<
"Angle between vectors = " 682 if (
areParallel(convexNormal, concaveNormal, tolParallel))
690 (concaveEdgeA && concaveEdgeB)
691 || (!concaveEdgeA && !concaveEdgeB)
695 <<
"Both or neither of the concave edges share the convex " 697 <<
" concaveEdgeA = " << concaveEdgeA
698 <<
" concaveEdgeB = " << concaveEdgeB
710 forAll(concaveEdgeANormals, edgeAnormalI)
712 const vector& convexNormal
713 = normals[convexEdgeNormals[edgeNormalI]];
714 const vector& concaveNormal
715 = normals[concaveEdgeANormals[edgeAnormalI]];
719 !
areParallel(convexNormal, concaveNormal, tolParallel)
722 concaveEdgePlaneCNormal = concaveNormal;
724 plane planeC(featPt, concaveEdgePlaneCNormal);
728 - 2.0*planeC.distance(internalPtA)
729 *concaveEdgePlaneCNormal;
736 foamyHexMesh_.vertexCount() +
pts.size(),
742 ftPtPairs_.addPointPair
753 forAll(concaveEdgeBNormals, edgeBnormalI)
755 const vector& convexNormal
756 = normals[convexEdgeNormals[edgeNormalI]];
757 const vector& concaveNormal
758 = normals[concaveEdgeBNormals[edgeBnormalI]];
762 !
areParallel(convexNormal, concaveNormal, tolParallel)
765 concaveEdgePlaneDNormal = concaveNormal;
767 plane planeD(featPt, concaveEdgePlaneDNormal);
771 - 2.0*planeD.distance(internalPtB)
772 *concaveEdgePlaneDNormal;
779 foamyHexMesh_.vertexCount() +
pts.size(),
785 ftPtPairs_.addPointPair
799 convexEdgeExternalPt,
800 foamyHexMesh_.vertexCount() +
pts.size(),
806 ftPtPairs_.addPointPair
812 ftPtPairs_.addPointPair
824 if (totalAngle > foamyHexMeshControls_.maxQuadAngle())
830 vector convexEdgesPlaneNormal =
831 0.5*(concaveEdgePlaneCNormal + concaveEdgePlaneDNormal);
833 plane planeM(featPt, convexEdgesPlaneNormal);
860 + 2.0*(convexEdgeLocalFeatPt - convexEdgeExternalPt);
867 foamyHexMesh_.vertexCount() +
pts.size(),
873 ftPtPairs_.addPointPair
875 pts[
pts.size() - 2].index(),
881 - 2.0*planeM.distance(internalPtF)*convexEdgesPlaneNormal;
888 foamyHexMesh_.vertexCount() +
pts.size(),
894 ftPtPairs_.addPointPair
896 pts[
pts.size() - 2].index(),
903 for (label ptI = initialNumOfPoints; ptI <
pts.size(); ++ptI)
905 Info<<
"Point " << ptI <<
" "
pointFromPoint topoint(const Point &P)
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool & parRun() noexcept
Test if this a parallel run.
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Can be negative if the process i...
List< labelList > labelListList
List of labelList.
An indexed form of CGAL::Triangulation_vertex_base_3<K> used to keep track of the Delaunay vertices i...
#define forAll(list, i)
Loop across all elements in list.
constexpr scalar pi(M_PI)
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
int debug
Static debugging option.
vector point
Point is a vector.
#define WarningInFunction
Report a warning using Foam::Warning.
constexpr scalar radToDeg(const scalar rad) noexcept
Conversion from radians to degrees.
static const Enum< vertexType > vertexTypeNames_
messageStream Info
Information stream (stdout output on master, null elsewhere)
Field< vector > vectorField
Specialisation of Field<T> for vector.
List< label > labelList
A List of labels.
Neither concave or convex, on a flat surface.
static constexpr const zero Zero
Global zero (0)