47 const Foam::scalar Foam::featurePointConformer::tolParallel = 1
e-3;
52 Foam::vector Foam::featurePointConformer::sharedFaceNormal
54 const extendedFeatureEdgeMesh& feMesh,
59 const labelList& edgeInormals = feMesh.edgeNormals()[edgeI];
60 const labelList& nextEdgeInormals = feMesh.edgeNormals()[nextEdgeI];
62 const vector& A1 = feMesh.normals()[edgeInormals[0]];
63 const vector& A2 = feMesh.normals()[edgeInormals[1]];
65 const vector& B1 = feMesh.normals()[nextEdgeInormals[0]];
66 const vector& B2 = feMesh.normals()[nextEdgeInormals[1]];
73 const scalar A1B1 =
mag((A1 & B1) - 1.0);
74 const scalar A1B2 =
mag((A1 & B2) - 1.0);
75 const scalar A2B1 =
mag((A2 & B1) - 1.0);
76 const scalar A2B2 =
mag((A2 & B2) - 1.0);
83 if (A1B1 < A1B2 && A1B1 < A2B1 && A1B1 < A2B2)
87 else if (A1B2 < A1B1 && A1B2 < A2B1 && A1B2 < A2B2)
91 else if (A2B1 < A1B1 && A2B1 < A1B2 && A2B1 < A2B2)
102 Foam::label Foam::featurePointConformer::getSign
120 void Foam::featurePointConformer::addMasterAndSlavePoints
122 const DynamicList<Foam::point>& masterPoints,
123 const DynamicList<Foam::indexedVertexEnum::vertexType>& masterPointsTypes,
124 const Map<DynamicList<autoPtr<plane>>>& masterPointReflections,
125 DynamicList<Vb>&
pts,
129 typedef DynamicList<autoPtr<plane>> planeDynList;
137 const vertexType masterType = masterPointsTypes[pI];
144 foamyHexMesh_.vertexCount() +
pts.
size(),
150 const label masterIndex =
pts.
last().index();
154 const planeDynList& masterPointPlanes = masterPointReflections[pI];
156 forAll(masterPointPlanes, planeI)
160 const plane& reflPlane = masterPointPlanes[planeI]();
162 const Foam::point slavePt = reflPlane.mirror(masterPt);
164 const vertexType slaveType =
176 foamyHexMesh_.vertexCount() +
pts.
size(),
182 ftPtPairs_.addPointPair
194 void Foam::featurePointConformer::createMasterAndSlavePoints
196 const extendedFeatureEdgeMesh& feMesh,
201 typedef DynamicList<autoPtr<plane>> planeDynList;
211 && !foamyHexMesh_.decomposition().positionOnThisProcessor(featPt)
213 || geometryToConformTo_.outside(featPt)
219 const scalar ppDist = foamyHexMesh_.pointPairDistance(featPt);
222 DynamicList<Foam::point> masterPoints;
223 DynamicList<vertexType> masterPointsTypes;
224 Map<planeDynList> masterPointReflections;
226 const labelList& featPtEdges = feMesh.featurePointEdges()[ptI];
228 pointFeatureEdgesTypes pointEdgeTypes(feMesh, ptI);
230 const List<extendedFeatureEdgeMesh::edgeStatus> allEdStat =
231 pointEdgeTypes.calcPointFeatureEdgesTypes();
235 ConstCirculator<labelList> circ(featPtEdges);
241 const edgeStatus eStatusCurr = feMesh.getEdgeStatus(circ.curr());
254 label
sign = getSign(eStatusCurr);
256 const vector n = sharedFaceNormal(feMesh, circ.curr(), circ.next());
258 const vector pointMotionDirection =
sign*0.5*ppDist*
n;
264 if (masterPoints.empty())
269 planeDynList firstPlane;
272 masterPoints.append(pt);
274 masterPointsTypes.append
281 masterPointReflections.insert
283 masterPoints.size() - 1,
284 std::move(firstPlane)
326 masterPoints.last() += pointMotionDirection;
328 masterPointReflections[masterPoints.size() - 1].append
336 addMasterAndSlavePoints
340 masterPointReflections,
347 void Foam::featurePointConformer::createMixedFeaturePoints
352 if (foamyHexMeshControls_.mixedFeaturePointPPDistanceCoeff() < 0)
355 <<
"Skipping specialised handling for mixed feature points" <<
endl;
360 const PtrList<extendedFeatureEdgeMesh>& feMeshes
362 geometryToConformTo_.features()
367 const extendedFeatureEdgeMesh& feMesh = feMeshes[i];
373 label ptI = feMesh.mixedStart();
374 ptI < feMesh.nonFeatureStart();
383 && !foamyHexMesh_.decomposition().positionOnThisProcessor(featPt))
388 const labelList& pEds = pointsEdges[ptI];
390 pointFeatureEdgesTypes pFEdgeTypes(feMesh, ptI);
392 const List<extendedFeatureEdgeMesh::edgeStatus> allEdStat =
393 pFEdgeTypes.calcPointFeatureEdgesTypes();
395 bool specialisedSuccess =
false;
397 if (foamyHexMeshControls_.specialiseFeaturePoints())
400 createSpecialisedFeaturePoint
402 feMesh, pEds, pFEdgeTypes, allEdStat, ptI,
pts 406 if (!specialisedSuccess && foamyHexMeshControls_.edgeAiming())
448 const scalar edgeGroupDistance =
449 foamyHexMesh_.mixedFeaturePointDistance(pt);
453 const label edgeI = pEds[
e];
456 pt + edgeGroupDistance*feMesh.edgeDirection(edgeI, ptI);
460 foamyHexMesh_.createEdgePointGroup(feMesh, edgeHit,
pts);
468 void Foam::featurePointConformer::createFeaturePoints(DynamicList<Vb>&
pts)
470 const PtrList<extendedFeatureEdgeMesh>& feMeshes
472 geometryToConformTo_.features()
477 const extendedFeatureEdgeMesh& feMesh(feMeshes[i]);
481 label ptI = feMesh.convexStart();
482 ptI < feMesh.mixedStart();
487 createMasterAndSlavePoints(feMesh, ptI,
pts);
490 if (foamyHexMeshControls_.guardFeaturePoints())
495 label ptI = feMesh.mixedStart();
496 ptI < feMesh.nonFeatureStart();
504 feMesh.points()[ptI],
516 Foam::featurePointConformer::featurePointConformer
518 const conformalVoronoiMesh& foamyHexMesh
521 foamyHexMesh_(foamyHexMesh),
522 foamyHexMeshControls_(foamyHexMesh.foamyHexMeshControls()),
523 geometryToConformTo_(foamyHexMesh.geometryToConformTo()),
524 featurePointVertices_(),
525 ftPtPairs_(foamyHexMesh)
528 <<
"Conforming to feature points" <<
endl;
531 <<
indent <<
"Circulating edges is: " 533 <<
indent <<
"Guarding feature points is: " 535 <<
indent <<
"Snapping to feature points is: " 537 <<
indent <<
"Specialising feature points is: " 544 createFeaturePoints(
pts);
546 createMixedFeaturePoints(
pts);
573 featurePointVertices_.transfer(
pts);
587 const backgroundMeshDecomposition& decomposition
591 decomposition.distributePoints(featurePointVertices_);
594 forAll(featurePointVertices_, vI)
605 const Map<label>& oldToNewIndices
608 forAll(featurePointVertices_, vI)
610 const label currentIndex = featurePointVertices_[vI].index();
612 const auto newIndexIter = oldToNewIndices.cfind(currentIndex);
614 if (newIndexIter.good())
616 featurePointVertices_[vI].index() = *newIndexIter;
620 ftPtPairs_.reIndex(oldToNewIndices);
dimensionedScalar sign(const dimensionedScalar &ds)
void size(const label n)
Older name for setAddressableSize.
Ostream & indent(Ostream &os)
Indent stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
const char * c_str() const noexcept
A C-string representation of the Switch value.
void append(const T &val)
Append an element at the end of the list.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
PointIndexHit< point > pointIndexHit
A PointIndexHit with a 3D point.
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.
bool externalBoundaryPoint() const
vectorField pointField
pointField is a vectorField.
const dimensionedScalar e
Elementary charge.
bool internalBoundaryPoint() const
Switch objOutput() const
Return the objOutput Switch.
Switch snapFeaturePoints() const
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
defineTypeNameAndDebug(combustionModel, 0)
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
T & last()
Access last element of the list, position [size()-1].
Switch circulateEdges() const
Switch specialiseFeaturePoints() const
Return whether to use specialised feature points.
messageStream Info
Information stream (stdout output on master, null elsewhere)
List< label > labelList
A List of labels.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Switch guardFeaturePoints() const