From 45d4642a2d3e3482fb19cd3c5f51e2651fb28a53 Mon Sep 17 00:00:00 2001 From: Vuko Vukcevic Date: Wed, 24 Jan 2018 12:37:57 +0100 Subject: [PATCH] Bugfixes in polyhedralRefinement.? 1. TypeName macro instead of ClassName 2. Need all points (original + added) when checking internal/boundary face orientation --- .../polyhedralRefinement.C | 40 ++++++++++++++----- .../polyhedralRefinement.H | 2 +- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/src/dynamicMesh/dynamicMesh/polyMeshModifiers/polyhedralRefinement/polyhedralRefinement.C b/src/dynamicMesh/dynamicMesh/polyMeshModifiers/polyhedralRefinement/polyhedralRefinement.C index e47ef47b1..e67f20df1 100644 --- a/src/dynamicMesh/dynamicMesh/polyMeshModifiers/polyhedralRefinement/polyhedralRefinement.C +++ b/src/dynamicMesh/dynamicMesh/polyMeshModifiers/polyhedralRefinement/polyhedralRefinement.C @@ -2691,17 +2691,27 @@ void Foam::polyhedralRefinement::checkInternalOrientation // Get list of polyAddPoint objects const DynamicList& polyAddedPoints(ref.addedPoints()); - // Create a list of newly added points - pointField addedPoints(polyAddedPoints.size()); - forAll (addedPoints, i) + // Create a list of all points + const label nOrigPoints = mesh_.nPoints(); + pointField allPoints(nOrigPoints + polyAddedPoints.size()); + + // Set ordinary points first + const pointField& meshPoints = mesh_.points(); + forAll (meshPoints, i) { - addedPoints[i] = polyAddedPoints[i].newPoint(); + allPoints[i] = meshPoints[i]; + } + + // Set newly added points next + forAll (polyAddedPoints, i) + { + allPoints[i + nOrigPoints] = polyAddedPoints[i].newPoint(); } // Get compact points const pointField compactPoints ( - IndirectList(addedPoints, newFace)() + IndirectList(allPoints, newFace)() ); const vector n(compactFace.normal(compactPoints)); @@ -2768,17 +2778,27 @@ void Foam::polyhedralRefinement::checkBoundaryOrientation // Get list of polyAddPoint objects const DynamicList& polyAddedPoints(ref.addedPoints()); - // Create a list of newly added points - pointField addedPoints(polyAddedPoints.size()); - forAll (addedPoints, i) + // Create a list of all points + const label nOrigPoints = mesh_.nPoints(); + pointField allPoints(nOrigPoints + polyAddedPoints.size()); + + // Set ordinary points first + const pointField& meshPoints = mesh_.points(); + forAll (meshPoints, i) { - addedPoints[i] = polyAddedPoints[i].newPoint(); + allPoints[i] = meshPoints[i]; + } + + // Set newly added points next + forAll (polyAddedPoints, i) + { + allPoints[i + nOrigPoints] = polyAddedPoints[i].newPoint(); } // Get compact points const pointField compactPoints ( - IndirectList(addedPoints, newFace)() + IndirectList(allPoints, newFace)() ); const vector n(compactFace.normal(compactPoints)); diff --git a/src/dynamicMesh/dynamicMesh/polyMeshModifiers/polyhedralRefinement/polyhedralRefinement.H b/src/dynamicMesh/dynamicMesh/polyMeshModifiers/polyhedralRefinement/polyhedralRefinement.H index 1dc600322..ed9edcf0d 100644 --- a/src/dynamicMesh/dynamicMesh/polyMeshModifiers/polyhedralRefinement/polyhedralRefinement.H +++ b/src/dynamicMesh/dynamicMesh/polyMeshModifiers/polyhedralRefinement/polyhedralRefinement.H @@ -366,7 +366,7 @@ class polyhedralRefinement public: //- Runtime type information - ClassName("polyhedralRefinement"); + TypeName("polyhedralRefinement"); // Constructors