ENH: Move commented out testing code to proper function.

This commit is contained in:
graham
2011-03-22 16:54:33 +00:00
parent 4d369ccba4
commit 20aad955d8
2 changed files with 117 additions and 108 deletions

View File

@ -474,6 +474,10 @@ private:
label& hitSurfaceLargest
) const;
//- Write out debugging information about the surface conformation
// quality
void reportSurfaceConformationQuality();
//- Limit the displacement of a point so that it doesn't penetrate the
// surface to be meshed or come too close to it
void limitDisplacement

View File

@ -368,115 +368,9 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation
}
}
// Info<< nl << "After iterations, check penetrations" << endl;
//reportSurfaceConformationQuality();
// for
// (
// Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
// vit != finite_vertices_end();
// vit++
// )
// {
// if (vit->internalOrBoundaryPoint())
// {
// Foam::point vert(topoint(vit->point()));
// pointIndexHit surfHit;
// label hitSurface;
// dualCellLargestSurfaceProtrusion(vit, surfHit, hitSurface);
// if (surfHit.hit())
// {
// Info<< nl << "Residual penetration: " << nl
// << vit->index() << nl
// << vit->type() << nl
// << vit->ppMaster() << nl
// << "nearFeaturePt "
// << nearFeaturePt(surfHit.hitPoint()) << nl
// << vert << nl
// << surfHit.hitPoint()
// << endl;
// }
// }
// }
// {
// // TEST - ASSESS CLOSE SURFACE POINTS
// setVertexSizeAndAlignment();
// for
// (
// Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
// vit != finite_vertices_end();
// vit++
// )
// {
// if
// (
// vit->index() >= startOfSurfacePoints_
// && vit->internalOrBoundaryPoint()
// )
// {
// std::list<Vertex_handle> adjacentVertices;
// adjacent_vertices(vit, std::back_inserter(adjacentVertices));
// Foam::point pt = topoint(vit->point());
// // Info<< nl << "vit: " << vit->index() << " "
// // << topoint(vit->point())
// // << endl;
// // Info<< adjacentVertices.size() << endl;
// for
// (
// std::list<Vertex_handle>::iterator
// avit = adjacentVertices.begin();
// avit != adjacentVertices.end();
// ++avit
// )
// {
// Vertex_handle avh = *avit;
// // The lower indexed vertex will perform the assessment
// if
// (
// avh->index() >= startOfSurfacePoints_
// && avh->internalOrBoundaryPoint()
// && vit->index() < avh->index()
// && vit->type() != avh->type()
// )
// {
// scalar targetSize = 0.2*averageAnyCellSize(vit, avh);
// // Info<< "diff " << mag(pt - topoint(avh->point()))
// // << " " << targetSize << endl;
// if
// (
// magSqr(pt - topoint(avh->point()))
// < sqr(targetSize)
// )
// {
// Info<< nl << "vit: " << vit->index() << " "
// << topoint(vit->point())
// << endl;
// Info<< " adjacent too close: "
// << avh->index() << " "
// << topoint(avh->point())
// << endl;
// }
// }
// }
// }
// }
// }
Pout<< "NOT STORING SURFACE CONFORMATION" << endl;
// storeSurfaceConformation();
storeSurfaceConformation();
}
@ -1294,6 +1188,117 @@ void Foam::conformalVoronoiMesh::dualCellLargestSurfaceIncursion
}
void Foam::conformalVoronoiMesh::reportSurfaceConformationQuality()
{
Info<< nl << "Check surface conformation quality" << endl;
for
(
Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
vit != finite_vertices_end();
vit++
)
{
if (vit->internalOrBoundaryPoint())
{
Foam::point vert(topoint(vit->point()));
pointIndexHit surfHit;
label hitSurface;
dualCellLargestSurfaceProtrusion(vit, surfHit, hitSurface);
if (surfHit.hit())
{
Pout<< nl << "Residual penetration: " << nl
<< vit->index() << nl
<< vit->type() << nl
<< vit->ppMaster() << nl
<< "nearFeaturePt "
<< nearFeaturePt(surfHit.hitPoint()) << nl
<< vert << nl
<< surfHit.hitPoint()
<< endl;
}
}
}
{
// Assess close surface points
setVertexSizeAndAlignment();
for
(
Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
vit != finite_vertices_end();
vit++
)
{
if
(
vit->index() >= startOfSurfacePoints_
&& vit->internalOrBoundaryPoint()
)
{
std::list<Vertex_handle> adjacentVertices;
adjacent_vertices(vit, std::back_inserter(adjacentVertices));
Foam::point pt = topoint(vit->point());
// Pout<< nl << "vit: " << vit->index() << " "
// << topoint(vit->point())
// << endl;
// Pout<< adjacentVertices.size() << endl;
for
(
std::list<Vertex_handle>::iterator
avit = adjacentVertices.begin();
avit != adjacentVertices.end();
++avit
)
{
Vertex_handle avh = *avit;
// The lower indexed vertex will perform the assessment
if
(
avh->index() >= startOfSurfacePoints_
&& avh->internalOrBoundaryPoint()
&& vit->index() < avh->index()
&& vit->type() != avh->type()
)
{
scalar targetSize = 0.2*averageAnyCellSize(vit, avh);
// Pout<< "diff " << mag(pt - topoint(avh->point()))
// << " " << targetSize << endl;
if
(
magSqr(pt - topoint(avh->point()))
< sqr(targetSize)
)
{
Pout<< nl << "vit: " << vit->index() << " "
<< topoint(vit->point())
<< endl;
Pout<< " adjacent too close: "
<< avh->index() << " "
<< topoint(avh->point())
<< endl;
}
}
}
}
}
}
}
void Foam::conformalVoronoiMesh::limitDisplacement
(
const Delaunay::Finite_vertices_iterator& vit,