ENH: foamyHexMesh: Edge conformation improvements

This commit is contained in:
laurence
2013-06-06 13:42:55 +01:00
parent 0004dc6d12
commit c574abb243
2 changed files with 50 additions and 53 deletions

View File

@ -764,6 +764,7 @@ private:
pointIndexHitAndFeatureDynList& featureEdgeHits, pointIndexHitAndFeatureDynList& featureEdgeHits,
DynamicList<label>& surfaceToTreeShape, DynamicList<label>& surfaceToTreeShape,
DynamicList<label>& edgeToTreeShape, DynamicList<label>& edgeToTreeShape,
Map<scalar>& surfacePtToEdgePtDist,
bool firstPass bool firstPass
) const; ) const;

View File

@ -298,6 +298,8 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation()
DynamicList<label> edgeToTreeShape(AtoV/4); DynamicList<label> edgeToTreeShape(AtoV/4);
DynamicList<label> surfaceToTreeShape(AtoV); DynamicList<label> surfaceToTreeShape(AtoV);
Map<scalar> surfacePtToEdgePtDist(AtoV/4);
for for
( (
Delaunay::Finite_vertices_iterator vit = finite_vertices_begin(); Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
@ -332,6 +334,7 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation()
featureEdgeHits, featureEdgeHits,
surfaceToTreeShape, surfaceToTreeShape,
edgeToTreeShape, edgeToTreeShape,
surfacePtToEdgePtDist,
true true
); );
} }
@ -463,6 +466,8 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation()
DynamicList<label> surfaceToTreeShape(AtoV/2); DynamicList<label> surfaceToTreeShape(AtoV/2);
DynamicList<label> edgeToTreeShape(AtoV/4); DynamicList<label> edgeToTreeShape(AtoV/4);
Map<scalar> surfacePtToEdgePtDist;
for for
( (
Delaunay::Finite_vertices_iterator vit = finite_vertices_begin(); Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
@ -507,6 +512,7 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation()
featureEdgeHits, featureEdgeHits,
surfaceToTreeShape, surfaceToTreeShape,
edgeToTreeShape, edgeToTreeShape,
surfacePtToEdgePtDist,
false false
); );
} }
@ -552,6 +558,7 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation()
featureEdgeHits, featureEdgeHits,
surfaceToTreeShape, surfaceToTreeShape,
edgeToTreeShape, edgeToTreeShape,
surfacePtToEdgePtDist,
false false
); );
} }
@ -630,6 +637,7 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation()
featureEdgeHits, featureEdgeHits,
surfaceToTreeShape, surfaceToTreeShape,
edgeToTreeShape, edgeToTreeShape,
surfacePtToEdgePtDist,
false false
); );
} }
@ -2089,6 +2097,7 @@ void Foam::conformalVoronoiMesh::addSurfaceAndEdgeHits
pointIndexHitAndFeatureDynList& featureEdgeHits, pointIndexHitAndFeatureDynList& featureEdgeHits,
DynamicList<label>& surfaceToTreeShape, DynamicList<label>& surfaceToTreeShape,
DynamicList<label>& edgeToTreeShape, DynamicList<label>& edgeToTreeShape,
Map<scalar>& surfacePtToEdgePtDist,
bool firstPass bool firstPass
) const ) const
{ {
@ -2195,60 +2204,47 @@ void Foam::conformalVoronoiMesh::addSurfaceAndEdgeHits
( (
pointIndexHitAndFeature(edHit, featureHit) pointIndexHitAndFeature(edHit, featureHit)
); );
// Info<< "Add " << existingEdgeLocations_.size() - 1
// << " " << magSqr(edPt - surfPt) << endl;
surfacePtToEdgePtDist.insert
(
existingEdgeLocations_.size() - 1,
magSqr(edPt - surfPt)
);
}
else if (firstPass)
{
label hitIndex = nearestEdgeHit.index();
// Info<< "Close to " << nearestEdgeHit << endl;
if
(
magSqr(edPt - surfPt)
< surfacePtToEdgePtDist[hitIndex]
)
{
featureEdgeHits[hitIndex] =
pointIndexHitAndFeature(edHit, featureHit);
existingEdgeLocations_[hitIndex] =
edHit.hitPoint();
surfacePtToEdgePtDist[hitIndex] =
magSqr(edPt - surfPt);
// Change edge location in featureEdgeHits
// remove index from edge tree
// reinsert new point into tree
edgeLocationTreePtr_().remove(hitIndex);
edgeLocationTreePtr_().insert
(
hitIndex,
hitIndex + 1
);
}
} }
// else if (firstPass)
// {
// label hitIndex = nearestEdgeHit.index();
//
// // Calc new edge location
//// Foam::point newPt =
//// 0.5
//// *(
//// nearestEdgeHit.hitPoint()
//// + edHit.hitPoint()
//// );
//
// pointIndexHit pHitOld =
// edgeLocationTreePtr_().findNearest
// (
// nearestEdgeHit.hitPoint(), GREAT
// );
//
// pointIndexHit pHitNew =
// edgeLocationTreePtr_().findNearest
// (
// edHit.hitPoint(), GREAT
// );
//
// if
// (
// magSqr(pHitNew.hitPoint() - edHit.hitPoint())
// < magSqr
// (
// pHitOld.hitPoint()
// - nearestEdgeHit.hitPoint()
// )
// )
// {
// edHit.setPoint(edHit.hitPoint());
//
// featureEdgeHits[hitIndex] =
// pointIndexHitAndFeature(edHit, featureHit);
//
// existingEdgeLocations_[hitIndex] =
// edHit.hitPoint();
//
// // Change edge location in featureEdgeHits
// // remove index from edge tree
// // reinsert new point into tree
// edgeLocationTreePtr_().remove(hitIndex);
// edgeLocationTreePtr_().insert
// (
// hitIndex,
// hitIndex + 1
// );
// }
// }
} }
} }
} }