Progressively limited face filtering based on value of filterCount.

This commit is contained in:
graham
2010-01-14 19:05:43 +00:00
parent ecab63cc58
commit e1f953e19e
5 changed files with 77 additions and 22 deletions

View File

@ -545,7 +545,8 @@ private:
pointField& pts,
Map<label>& dualPtIndexMap,
scalar targetFaceSize,
scalar collapseSizeLimitCoeff
scalar collapseSizeLimitCoeff,
label maxFC
) const;
//- Identify the face labels of the deferred collapse faces

View File

@ -497,9 +497,11 @@ void Foam::conformalVoronoiMesh::smoothSurface(pointField& pts)
{
label ptI = cit->cellIndex();
if (cit->filterCount() > 0)
label fC = cit->filterCount();
if (fC > cvMeshControls().filterCountSkipThreshold())
{
// This vertex has been limited, skip
// This vertex has been limited too many times, skip
continue;
}
@ -533,7 +535,11 @@ void Foam::conformalVoronoiMesh::smoothSurface(pointField& pts)
if (surfHit.hit())
{
pt = surfHit.hitPoint();
pt +=
(surfHit.hitPoint() - pt)
*pow(cvMeshControls().filterErrorReductionCoeff(), fC);
// pt = surfHit.hitPoint();
}
}
}
@ -600,9 +606,10 @@ Foam::label Foam::conformalVoronoiMesh::smoothSurfaceDualFaces
label maxFC = maxFilterCount(eit);
if (maxFC > 0)
if (maxFC > cvMeshControls().filterCountSkipThreshold())
{
// A vertex on this face has been limited, skip
// A vertex on this face has been limited too many
// times, skip
continue;
}
@ -665,7 +672,8 @@ Foam::label Foam::conformalVoronoiMesh::smoothSurfaceDualFaces
pts,
dualPtIndexMap,
targetFaceSize,
GREAT
GREAT,
maxFC
);
if (mode == fcmPoint || mode == fcmEdge)
@ -777,9 +785,10 @@ Foam::label Foam::conformalVoronoiMesh::collapseFaces
label maxFC = maxFilterCount(eit);
if (maxFC > 0)
if (maxFC > cvMeshControls().filterCountSkipThreshold())
{
// A vertex on this face has been limited, skip
// A vertex on this face has been limited too many
// times, skip
continue;
}
@ -791,7 +800,8 @@ Foam::label Foam::conformalVoronoiMesh::collapseFaces
pts,
dualPtIndexMap,
targetFaceSize,
collapseSizeLimitCoeff
collapseSizeLimitCoeff,
maxFC
);
if (mode != fcmNone)
@ -834,13 +844,27 @@ Foam::conformalVoronoiMesh::collapseFace
pointField& pts,
Map<label>& dualPtIndexMap,
scalar targetFaceSize,
scalar collapseSizeLimitCoeff
scalar collapseSizeLimitCoeff,
label maxFC
) const
{
bool limitToQuadsOrTris = false;
bool allowEarlyCollapseToPoint = true;
// if (maxFC > cvMeshControls().filterCountSkipThreshold() - 3)
// {
// limitToQuadsOrTris = true;
// allowEarlyCollapseToPoint = false;
// }
collapseSizeLimitCoeff *= pow
(
cvMeshControls().filterErrorReductionCoeff(),
maxFC
);
const vector fC = f.centre(pts);
vector fN = f.normal(pts);
@ -934,11 +958,6 @@ Foam::conformalVoronoiMesh::collapseFace
WarningIn
(
"Foam::conformalVoronoiMesh::collapseFace"
"("
"const face& f,"
"pointField& pts,"
"Map<label>& dualPtIndexMap"
") const"
)
<< "No collapse axis found for face, not collapsing."
<< endl;
@ -1019,11 +1038,6 @@ Foam::conformalVoronoiMesh::collapseFace
WarningIn
(
"Foam::conformalVoronoiMesh::collapseFace"
"("
"const face& f,"
"pointField& pts,"
"Map<label>& dualPtIndexMap"
") const"
)
<< "All points on one side of face centre, not collapsing."
<< endl;
@ -1290,7 +1304,7 @@ Foam::label Foam::conformalVoronoiMesh::checkPolyMeshQuality
motionSmoother::checkMesh
(
false, // report
false,
pMesh,
cvMeshControls().cvMeshDict().subDict("meshQualityControls"),
wrongFaces

View File

@ -166,6 +166,16 @@ Foam::cvControls::cvControls
)
);
filterErrorReductionCoeff_ = readScalar
(
filteringDict.lookup("filterErrorReductionCoeff")
);
filterCountSkipThreshold_ = readLabel
(
filteringDict.lookup("filterCountSkipThreshold")
);
surfaceStepFaceAngle_ = readScalar
(
filteringDict.lookup("surfaceStepFaceAngle")

View File

@ -159,6 +159,16 @@ class cvControls
// with filtering anyway?
Switch continueFilteringOnBadInitialPolyMesh_;
//- When a face is "bad", what fraction should the
//- filterSizeCoeff_ be reduced by. Recursive, so for a
//- filterCount value of fC, the filterSizeCoeff is reduced
//- by pow(filterErrorReductionCoeff_, fC)
scalar filterErrorReductionCoeff_;
//- Maximum number of filterCount applications before a face
// is not attempted to be filtered.
label filterCountSkipThreshold_;
//- The maximum allowed angle between a boundary face normal
// and the local surface normal before face will be
// aggressively collapsed
@ -277,6 +287,12 @@ public:
//- Return the continueFilteringOnBadInitialPolyMesh Switch
inline Switch continueFilteringOnBadInitialPolyMesh() const;
//- Return the filterErrorReductionCoeff
inline scalar filterErrorReductionCoeff() const;
//- Return the filterCountSkipThreshold
inline label filterCountSkipThreshold() const;
//- Return the surfaceStepFaceAngle
inline scalar surfaceStepFaceAngle() const;

View File

@ -159,6 +159,20 @@ Foam::cvControls::continueFilteringOnBadInitialPolyMesh() const
}
inline Foam::scalar
Foam::cvControls::filterErrorReductionCoeff() const
{
return filterErrorReductionCoeff_;
}
inline Foam::label
Foam::cvControls::filterCountSkipThreshold() const
{
return filterCountSkipThreshold_;
}
inline Foam::scalar Foam::cvControls::surfaceStepFaceAngle() const
{
return surfaceStepFaceAngle_;