mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: foamyHexMesh: Allow feature edge point insertion on close features edges
If two feature edges are close, allow points to be inserted on both edges if the angle is large enough
This commit is contained in:
@ -734,7 +734,8 @@ private:
|
||||
//- edge conformation location
|
||||
bool nearFeatureEdgeLocation
|
||||
(
|
||||
pointIndexHit& pHit
|
||||
const pointIndexHit& pHit,
|
||||
pointIndexHit& nearestEdgeHit
|
||||
) const;
|
||||
|
||||
//- Build or rebuild the edge location tree
|
||||
|
||||
@ -1897,87 +1897,87 @@ void Foam::conformalVoronoiMesh::indexDualVertices
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
// Snapping points far outside
|
||||
if (cit->boundaryDualVertex() && !cit->parallelDualVertex())
|
||||
{
|
||||
pointFromPoint dual = cit->dual();
|
||||
|
||||
pointIndexHit hitInfo;
|
||||
label surfHit;
|
||||
|
||||
// Find nearest surface point
|
||||
geometryToConformTo_.findSurfaceNearest
|
||||
(
|
||||
dual,
|
||||
sqr(targetCellSize(dual)),
|
||||
hitInfo,
|
||||
surfHit
|
||||
);
|
||||
|
||||
if (!hitInfo.hit())
|
||||
{
|
||||
// Project dual to nearest point on tet
|
||||
|
||||
tetPointRef tet
|
||||
(
|
||||
topoint(cit->vertex(0)->point()),
|
||||
topoint(cit->vertex(1)->point()),
|
||||
topoint(cit->vertex(2)->point()),
|
||||
topoint(cit->vertex(3)->point())
|
||||
);
|
||||
|
||||
pointFromPoint nearestPointOnTet =
|
||||
tet.nearestPoint(dual).rawPoint();
|
||||
|
||||
// Get nearest point on surface from tet.
|
||||
geometryToConformTo_.findSurfaceNearest
|
||||
(
|
||||
nearestPointOnTet,
|
||||
sqr(targetCellSize(nearestPointOnTet)),
|
||||
hitInfo,
|
||||
surfHit
|
||||
);
|
||||
|
||||
vector snapDir = nearestPointOnTet - dual;
|
||||
snapDir /= mag(snapDir) + SMALL;
|
||||
|
||||
drawDelaunayCell(tetToSnapTo, cit, offset);
|
||||
offset += 1;
|
||||
|
||||
vectorField norm(1);
|
||||
allGeometry_[surfHit].getNormal
|
||||
(
|
||||
List<pointIndexHit>(1, hitInfo),
|
||||
norm
|
||||
);
|
||||
norm[0] /= mag(norm[0]) + SMALL;
|
||||
|
||||
if
|
||||
(
|
||||
hitInfo.hit()
|
||||
&& (mag(snapDir & norm[0]) > 0.5)
|
||||
)
|
||||
{
|
||||
snapping1.write
|
||||
(
|
||||
linePointRef(dual, nearestPointOnTet)
|
||||
);
|
||||
|
||||
snapping2.write
|
||||
(
|
||||
linePointRef
|
||||
(
|
||||
nearestPointOnTet,
|
||||
hitInfo.hitPoint()
|
||||
)
|
||||
);
|
||||
|
||||
pts[cit->cellIndex()] = hitInfo.hitPoint();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// {
|
||||
// // Snapping points far outside
|
||||
// if (cit->boundaryDualVertex() && !cit->parallelDualVertex())
|
||||
// {
|
||||
// pointFromPoint dual = cit->dual();
|
||||
//
|
||||
// pointIndexHit hitInfo;
|
||||
// label surfHit;
|
||||
//
|
||||
// // Find nearest surface point
|
||||
// geometryToConformTo_.findSurfaceNearest
|
||||
// (
|
||||
// dual,
|
||||
// sqr(targetCellSize(dual)),
|
||||
// hitInfo,
|
||||
// surfHit
|
||||
// );
|
||||
//
|
||||
// if (!hitInfo.hit())
|
||||
// {
|
||||
// // Project dual to nearest point on tet
|
||||
//
|
||||
// tetPointRef tet
|
||||
// (
|
||||
// topoint(cit->vertex(0)->point()),
|
||||
// topoint(cit->vertex(1)->point()),
|
||||
// topoint(cit->vertex(2)->point()),
|
||||
// topoint(cit->vertex(3)->point())
|
||||
// );
|
||||
//
|
||||
// pointFromPoint nearestPointOnTet =
|
||||
// tet.nearestPoint(dual).rawPoint();
|
||||
//
|
||||
// // Get nearest point on surface from tet.
|
||||
// geometryToConformTo_.findSurfaceNearest
|
||||
// (
|
||||
// nearestPointOnTet,
|
||||
// sqr(targetCellSize(nearestPointOnTet)),
|
||||
// hitInfo,
|
||||
// surfHit
|
||||
// );
|
||||
//
|
||||
// vector snapDir = nearestPointOnTet - dual;
|
||||
// snapDir /= mag(snapDir) + SMALL;
|
||||
//
|
||||
// drawDelaunayCell(tetToSnapTo, cit, offset);
|
||||
// offset += 1;
|
||||
//
|
||||
// vectorField norm(1);
|
||||
// allGeometry_[surfHit].getNormal
|
||||
// (
|
||||
// List<pointIndexHit>(1, hitInfo),
|
||||
// norm
|
||||
// );
|
||||
// norm[0] /= mag(norm[0]) + SMALL;
|
||||
//
|
||||
// if
|
||||
// (
|
||||
// hitInfo.hit()
|
||||
// && (mag(snapDir & norm[0]) > 0.5)
|
||||
// )
|
||||
// {
|
||||
// snapping1.write
|
||||
// (
|
||||
// linePointRef(dual, nearestPointOnTet)
|
||||
// );
|
||||
//
|
||||
// snapping2.write
|
||||
// (
|
||||
// linePointRef
|
||||
// (
|
||||
// nearestPointOnTet,
|
||||
// hitInfo.hitPoint()
|
||||
// )
|
||||
// );
|
||||
//
|
||||
// pts[cit->cellIndex()] = hitInfo.hitPoint();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
if (cit->boundaryDualVertex())
|
||||
{
|
||||
|
||||
@ -1928,14 +1928,16 @@ bool Foam::conformalVoronoiMesh::pointIsNearSurfaceLocation
|
||||
|
||||
bool Foam::conformalVoronoiMesh::nearFeatureEdgeLocation
|
||||
(
|
||||
pointIndexHit& pHit
|
||||
const pointIndexHit& pHit,
|
||||
pointIndexHit& nearestEdgeHit
|
||||
) const
|
||||
{
|
||||
Foam::point pt = pHit.hitPoint();
|
||||
const Foam::point& pt = pHit.hitPoint();
|
||||
|
||||
const scalar exclusionRangeSqr = featureEdgeExclusionDistanceSqr(pt);
|
||||
|
||||
bool closeToFeatureEdge = pointIsNearFeatureEdgeLocation(pt);
|
||||
bool closeToFeatureEdge =
|
||||
pointIsNearFeatureEdgeLocation(pt, nearestEdgeHit);
|
||||
|
||||
if (closeToFeatureEdge)
|
||||
{
|
||||
@ -1978,15 +1980,11 @@ bool Foam::conformalVoronoiMesh::nearFeatureEdgeLocation
|
||||
if
|
||||
(
|
||||
mag(cosAngle) < searchConeAngle
|
||||
&& (
|
||||
mag(lineBetweenPoints)
|
||||
> foamyHexMeshControls().pointPairDistanceCoeff()
|
||||
*targetCellSize(pt)
|
||||
)
|
||||
&& (mag(lineBetweenPoints) > pointPairDistance(pt))
|
||||
)
|
||||
{
|
||||
pt = edgeHit.hitPoint();
|
||||
pHit.setPoint(pt);
|
||||
//pt = edgeHit.hitPoint();
|
||||
//pHit.setPoint(pt);
|
||||
closeToFeatureEdge = false;
|
||||
}
|
||||
else
|
||||
@ -2183,12 +2181,12 @@ void Foam::conformalVoronoiMesh::addSurfaceAndEdgeHits
|
||||
|
||||
if
|
||||
(
|
||||
!pointIsNearFeatureEdgeLocation
|
||||
(
|
||||
edPt,
|
||||
nearestEdgeHit
|
||||
)
|
||||
// !nearFeatureEdgeLocation(edHit)
|
||||
// !pointIsNearFeatureEdgeLocation
|
||||
// (
|
||||
// edPt,
|
||||
// nearestEdgeHit
|
||||
// )
|
||||
!nearFeatureEdgeLocation(edHit, nearestEdgeHit)
|
||||
)
|
||||
{
|
||||
appendToEdgeLocationTree(edPt);
|
||||
|
||||
Reference in New Issue
Block a user