Fixes to point insertion, making faceAreaWeight normalised, not hard coded to cell size, adding tweak to fertex removal criteria to allow selective insertion at short-edge midpoint if the vertices have not already been flagged for removal.
This commit is contained in:
parent
8695977fc5
commit
7f2f779779
@ -267,21 +267,19 @@ Foam::scalar Foam::CV3D::alignmentDistanceWeight(scalar dist) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::scalar Foam::CV3D::faceAreaWeight(scalar faceArea) const
|
Foam::scalar Foam::CV3D::faceAreaWeight(scalar faceAreaFraction) const
|
||||||
{
|
{
|
||||||
scalar fl2 = 0.5;
|
scalar fl2 = 0.5;
|
||||||
|
|
||||||
scalar fu2 = 1.0;
|
scalar fu2 = 1.0;
|
||||||
|
|
||||||
scalar m2 = controls_.minCellSize2;
|
if (faceAreaFraction < fl2)
|
||||||
|
|
||||||
if (faceArea < fl2*m2)
|
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (faceArea < fu2*m2)
|
else if (faceAreaFraction < fu2)
|
||||||
{
|
{
|
||||||
return faceArea/((fu2 - fl2)*m2) - 1/((fu2/fl2) - 1);
|
return faceAreaFraction/((fu2 - fl2)) - 1/((fu2/fl2) - 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -357,7 +355,6 @@ void Foam::CV3D::insertPoints
|
|||||||
Info<< "insertInitialPoints(const pointField& points): ";
|
Info<< "insertInitialPoints(const pointField& points): ";
|
||||||
|
|
||||||
startOfInternalPoints_ = number_of_vertices();
|
startOfInternalPoints_ = number_of_vertices();
|
||||||
label nVert = startOfInternalPoints_;
|
|
||||||
|
|
||||||
// Add the points and index them
|
// Add the points and index them
|
||||||
forAll(points, i)
|
forAll(points, i)
|
||||||
@ -366,7 +363,7 @@ void Foam::CV3D::insertPoints
|
|||||||
|
|
||||||
if (qSurf_.wellInside(p, nearness))
|
if (qSurf_.wellInside(p, nearness))
|
||||||
{
|
{
|
||||||
insert(toPoint(p))->index() = nVert++;
|
insertPoint(p, Vb::INTERNAL_POINT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -374,7 +371,8 @@ void Foam::CV3D::insertPoints
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< nVert << " vertices inserted" << endl;
|
Info<< number_of_vertices() - startOfInternalPoints_
|
||||||
|
<< " vertices inserted" << endl;
|
||||||
|
|
||||||
if (controls_.writeInitialTriangulation)
|
if (controls_.writeInitialTriangulation)
|
||||||
{
|
{
|
||||||
@ -1077,6 +1075,15 @@ void Foam::CV3D::relaxPoints(const scalar relaxation)
|
|||||||
|
|
||||||
scalar targetCellSize = controls_.minCellSize;
|
scalar targetCellSize = controls_.minCellSize;
|
||||||
|
|
||||||
|
// if (0.5*(dVA.y() + dVB.y()) < -0.1525)
|
||||||
|
// {
|
||||||
|
// targetCellSize *= 0.5;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// scalar midEdgeY = 0.5*(dVA.y() + dVB.y());
|
||||||
|
|
||||||
|
// targetCellSize *= 0.56222 - 0.413*midEdgeY;
|
||||||
|
|
||||||
scalar targetFaceArea = targetCellSize*targetCellSize;
|
scalar targetFaceArea = targetCellSize*targetCellSize;
|
||||||
|
|
||||||
if (alignmentDotProd > cosAcceptanceAngle)
|
if (alignmentDotProd > cosAcceptanceAngle)
|
||||||
@ -1088,11 +1095,11 @@ void Foam::CV3D::relaxPoints(const scalar relaxation)
|
|||||||
|
|
||||||
scalar faceArea = dualFace.mag(dualVertices);
|
scalar faceArea = dualFace.mag(dualVertices);
|
||||||
|
|
||||||
delta *= faceAreaWeight(faceArea);
|
delta *= faceAreaWeight(faceArea/targetFaceArea);
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
rABMag > 1.55*targetCellSize
|
rABMag > 1.75*targetCellSize
|
||||||
&& vA->internalPoint()
|
&& vA->internalPoint()
|
||||||
&& vB->internalPoint()
|
&& vB->internalPoint()
|
||||||
&& faceArea > 0.0025*targetFaceArea
|
&& faceArea > 0.0025*targetFaceArea
|
||||||
@ -1125,7 +1132,17 @@ void Foam::CV3D::relaxPoints(const scalar relaxation)
|
|||||||
// << nl << dVB
|
// << nl << dVB
|
||||||
// << endl;
|
// << endl;
|
||||||
|
|
||||||
//insertionPoints.append(0.5*(dVA + dVB));
|
// Only insert a point at the midpoint of the short edge
|
||||||
|
// if neither attached point has already been identified
|
||||||
|
// to be removed.
|
||||||
|
if
|
||||||
|
(
|
||||||
|
pointToBeRetained[vA->index()]
|
||||||
|
&& pointToBeRetained[vB->index()]
|
||||||
|
)
|
||||||
|
{
|
||||||
|
insertionPoints.append(0.5*(dVA + dVB));
|
||||||
|
}
|
||||||
|
|
||||||
if (vA->internalPoint())
|
if (vA->internalPoint())
|
||||||
{
|
{
|
||||||
@ -1498,6 +1515,11 @@ void Foam::CV3D::relaxPoints(const scalar relaxation)
|
|||||||
{
|
{
|
||||||
writeMesh(true);
|
writeMesh(true);
|
||||||
|
|
||||||
|
if (controls_.writeFinalTriangulation)
|
||||||
|
{
|
||||||
|
writePoints("points.obj", true);
|
||||||
|
}
|
||||||
|
|
||||||
pointIOField internalDVs
|
pointIOField internalDVs
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
@ -1519,12 +1541,8 @@ void Foam::CV3D::relaxPoints(const scalar relaxation)
|
|||||||
|
|
||||||
reinsertFeaturePoints();
|
reinsertFeaturePoints();
|
||||||
|
|
||||||
if(runTime_.timeOutputValue() > 80)
|
//reinsertPoints(internalDelaunayVertices);
|
||||||
{
|
|
||||||
reinsertPoints(internalDelaunayVertices);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// INCLUDED FROM reinsertPoints TEMPORARILY -->
|
// INCLUDED FROM reinsertPoints TEMPORARILY -->
|
||||||
Info<< nl << "Reinserting points after motion. ";
|
Info<< nl << "Reinserting points after motion. ";
|
||||||
|
|
||||||
@ -1561,7 +1579,6 @@ void Foam::CV3D::relaxPoints(const scalar relaxation)
|
|||||||
insertPoint(p, Vb::INTERNAL_POINT);
|
insertPoint(p, Vb::INTERNAL_POINT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::CV3D::insertSurfacePointPairs()
|
void Foam::CV3D::insertSurfacePointPairs()
|
||||||
|
@ -106,10 +106,12 @@ inline void Foam::CV3D::insertVb(const Vb& v)
|
|||||||
<< "Failed to reinsert Vb at " << topoint(Pt)
|
<< "Failed to reinsert Vb at " << topoint(Pt)
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
vh->index() = v.index();
|
vh->index() = v.index();
|
||||||
vh->type() = v.type();
|
vh->type() = v.type();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::CV3D::movePoint(const Vertex_handle& vh, const point& p)
|
void Foam::CV3D::movePoint(const Vertex_handle& vh, const point& p)
|
||||||
|
Loading…
Reference in New Issue
Block a user