From 7e99cd26c1868c1d3e84c844996e33a2dc23c5be Mon Sep 17 00:00:00 2001 From: laurence Date: Tue, 4 Jun 2013 14:39:59 +0100 Subject: [PATCH 001/104] ENH: Add enhanced edge conformation method --- .../conformalVoronoiMeshConformToSurface.C | 101 +++++++++--------- 1 file changed, 53 insertions(+), 48 deletions(-) diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C index da1c31dc69..cb0dbd703b 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C @@ -2183,54 +2183,59 @@ void Foam::conformalVoronoiMesh::addSurfaceAndEdgeHits pointIndexHitAndFeature(edHit, featureHit) ); } -// 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 -// ( -// pHitNew.hitPoint() - pHitOld.hitPoint() -// ) -// { -// edHit.setPoint(pHit.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 -// ); -// } -// } + 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 + ); + } + } } } } From af9e7cc72c7c8b61a9bef0ba1e5f72073b7edfae Mon Sep 17 00:00:00 2001 From: laurence Date: Tue, 4 Jun 2013 14:40:45 +0100 Subject: [PATCH 002/104] ENH: foamyHexMesh: clean up ostream operator of indexedVertex --- .../indexedVertex/indexedVertex.C | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertex.C b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertex.C index 36c84fd19a..7be77f96cf 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertex.C +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertex.C @@ -113,13 +113,12 @@ Foam::Ostream& Foam::operator<< const CGAL::indexedVertex& p ) { - os << p.point() - << p.index() - << static_cast(p.type()) - << p.procIndex() - << p.alignment() - << p.targetCellSize() - << token::SPACE + os << p.point() << ' ' + << p.index() << ' ' + << static_cast(p.type()) << ' ' + << p.procIndex() << ' ' + << p.alignment() << ' ' + << p.targetCellSize() << ' ' << static_cast(p.fixed()); return os; From 96aba9e8ea0cbd5f1da1ccb6f1fb02738da6d032 Mon Sep 17 00:00:00 2001 From: laurence Date: Tue, 4 Jun 2013 14:53:37 +0100 Subject: [PATCH 003/104] ENH: foamyHexMesh: Update flange tutorial --- tutorials/mesh/foamyHexMesh/flange/Allrun | 3 +++ tutorials/mesh/foamyHexMesh/flange/Allrun-parallel | 3 +++ tutorials/mesh/foamyHexMesh/flange/Alltest | 4 ++++ tutorials/mesh/foamyHexMesh/flange/constant/triSurface/README | 4 ++++ tutorials/mesh/foamyHexMesh/flange/system/foamyHexMeshDict | 2 +- 5 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 tutorials/mesh/foamyHexMesh/flange/constant/triSurface/README diff --git a/tutorials/mesh/foamyHexMesh/flange/Allrun b/tutorials/mesh/foamyHexMesh/flange/Allrun index 6936782122..fe467dd3c6 100755 --- a/tutorials/mesh/foamyHexMesh/flange/Allrun +++ b/tutorials/mesh/foamyHexMesh/flange/Allrun @@ -4,6 +4,9 @@ cd ${0%/*} || exit 1 # run from this directory # Source tutorial run functions . $WM_PROJECT_DIR/bin/tools/RunFunctions +# copy flange surface from resources folder +cp $FOAM_TUTORIALS/resources/geometry/flange.stl.gz constant/triSurface/ + runApplication foamyHexMesh runApplication collapseEdges -latestTime -collapseFaces runApplication checkMesh -latestTime -allGeometry -allTopology diff --git a/tutorials/mesh/foamyHexMesh/flange/Allrun-parallel b/tutorials/mesh/foamyHexMesh/flange/Allrun-parallel index 4b56361f2d..2542d324d9 100755 --- a/tutorials/mesh/foamyHexMesh/flange/Allrun-parallel +++ b/tutorials/mesh/foamyHexMesh/flange/Allrun-parallel @@ -7,6 +7,9 @@ cd ${0%/*} || exit 1 # run from this directory # Get the number of processors to run on from system/decomposeParDict nProc=$(getNumberOfProcessors) +# copy flange surface from resources folder +cp $FOAM_TUTORIALS/resources/geometry/flange.stl.gz constant/triSurface/ + # Create tight-fitting background mesh runApplication blockMesh runApplication topoSet -dict system/topoSetDict-background diff --git a/tutorials/mesh/foamyHexMesh/flange/Alltest b/tutorials/mesh/foamyHexMesh/flange/Alltest index 87587982d8..ee9a8862c7 100755 --- a/tutorials/mesh/foamyHexMesh/flange/Alltest +++ b/tutorials/mesh/foamyHexMesh/flange/Alltest @@ -4,6 +4,9 @@ cd ${0%/*} || exit 1 # run from this directory # Source tutorial run functions . $WM_PROJECT_DIR/bin/tools/RunFunctions +# copy flange surface from resources folder +cp $FOAM_TUTORIALS/resources/geometry/flange.stl.gz constant/triSurface/ + # Create tight-fitting background mesh runApplication blockMesh runApplication foamyHexMesh @@ -16,4 +19,5 @@ system/collapseDict.org > system/collapseDict runApplication collapseEdges -latestTime -collapseFaces + # ----------------------------------------------------------------- end-of-file diff --git a/tutorials/mesh/foamyHexMesh/flange/constant/triSurface/README b/tutorials/mesh/foamyHexMesh/flange/constant/triSurface/README new file mode 100644 index 0000000000..dbf3b73d5f --- /dev/null +++ b/tutorials/mesh/foamyHexMesh/flange/constant/triSurface/README @@ -0,0 +1,4 @@ +Folder to house tri-surfaces + +The Allrun script copies the surface from the $FOAM_TUTORIALS/resources/geometry +folder diff --git a/tutorials/mesh/foamyHexMesh/flange/system/foamyHexMeshDict b/tutorials/mesh/foamyHexMesh/flange/system/foamyHexMeshDict index 4ba0ceafe6..cf6a3cafdf 100644 --- a/tutorials/mesh/foamyHexMesh/flange/system/foamyHexMeshDict +++ b/tutorials/mesh/foamyHexMesh/flange/system/foamyHexMeshDict @@ -22,7 +22,7 @@ FoamFile geometry { - flange.obj + flange.stl { name flange; type triSurfaceMesh; From f98d55fd4774f07b764ecb695319bd23ad39bcd5 Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 4 Jun 2013 15:16:47 +0100 Subject: [PATCH 004/104] TimeIO: write entries in