From 3d2ba3ab028d36273ae28e1303a2f0daf838a1e7 Mon Sep 17 00:00:00 2001
From: laurence <laurence>
Date: Tue, 7 Feb 2012 12:05:22 +0000
Subject: [PATCH] BUG: cvMesh: Revert the prevention of boundary face filtering

---
 .../conformalVoronoiMeshCalcDualMesh.C        | 106 +++++++++---------
 1 file changed, 54 insertions(+), 52 deletions(-)

diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C
index 06fb6c01acd..d2c23eef51c 100644
--- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C
@@ -79,53 +79,59 @@ void Foam::conformalVoronoiMesh::calcDualMesh
         }
     }
 
-    for
-    (
-        Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
-        vit != finite_vertices_end();
-        vit++
-    )
-    {
-        std::list<Cell_handle> cells;
-        incident_cells(vit, std::back_inserter(cells));
-
-        bool hasProcPt = false;
-
-        for
-        (
-            std::list<Cell_handle>::iterator cit = cells.begin();
-            cit != cells.end();
-            ++cit
-        )
-        {
-            if
-            (
-                !(*cit)->vertex(0)->real()
-             || !(*cit)->vertex(1)->real()
-             || !(*cit)->vertex(2)->real()
-             || !(*cit)->vertex(3)->real()
-            )
-            {
-                hasProcPt = true;
-
-                break;
-            }
-        }
-
-        if (hasProcPt)
-        {
-            for
-            (
-                std::list<Cell_handle>::iterator cit = cells.begin();
-                cit != cells.end();
-                ++cit
-            )
-            {
-                (*cit)->filterCount() =
-                     cvMeshControls().filterCountSkipThreshold() + 1;
-            }
-        }
-    }
+// REMOVED BECAUSE THIS CODE STOPS ALL FACES NEAR ANY BOUNDARY (PROC OR REAL)
+// FROM BEING FILTERED.
+//
+//    for
+//    (
+//        Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
+//        vit != finite_vertices_end();
+//        vit++
+//    )
+//    {
+//        std::list<Cell_handle> cells;
+//        incident_cells(vit, std::back_inserter(cells));
+//
+//        bool hasProcPt = false;
+//
+//        for
+//        (
+//            std::list<Cell_handle>::iterator cit = cells.begin();
+//            cit != cells.end();
+//            ++cit
+//        )
+//        {
+//            // Allow filtering if any vertices are far points. Otherwise faces
+//            // with boundary points attached to a cell with a far point will not
+//            // be filtered.
+//            if
+//            (
+//                ( !(*cit)->vertex(0)->real() && !(*cit)->vertex(0)->farPoint() )
+//             || ( !(*cit)->vertex(1)->real() && !(*cit)->vertex(1)->farPoint() )
+//             || ( !(*cit)->vertex(2)->real() && !(*cit)->vertex(2)->farPoint() )
+//             || ( !(*cit)->vertex(3)->real() && !(*cit)->vertex(3)->farPoint() )
+//            )
+//            {
+//                hasProcPt = true;
+//
+//                break;
+//            }
+//        }
+//
+//        if (hasProcPt)
+//        {
+//            for
+//            (
+//                std::list<Cell_handle>::iterator cit = cells.begin();
+//                cit != cells.end();
+//                ++cit
+//            )
+//            {
+//                (*cit)->filterCount() =
+//                     cvMeshControls().filterCountSkipThreshold() + 1;
+//            }
+//        }
+//    }
 
     PackedBoolList boundaryPts(number_of_cells(), false);
 
@@ -250,7 +256,7 @@ void Foam::conformalVoronoiMesh::calcDualMesh
 
                 timeCheck("End of filtering iteration");
 
-            } while (nBadQualityFaces > nInitialBadQualityFaces);
+            } while (nBadQualityFaces > 0); //nInitialBadQualityFaces);
         }
     }
 
@@ -987,7 +993,6 @@ Foam::label Foam::conformalVoronoiMesh::collapseFaces
 
             if (dualFace.size() < 3)
             {
-                // This face has been collapsed already
                 continue;
             }
 
@@ -995,8 +1000,6 @@ Foam::label Foam::conformalVoronoiMesh::collapseFaces
 
             if (maxFC > cvMeshControls().filterCountSkipThreshold())
             {
-                // A vertex on this face has been limited too many
-                // times, skip
                 continue;
             }
 
@@ -1900,7 +1903,6 @@ void Foam::conformalVoronoiMesh::indexDualVertices
             )
             {
                 // This is a boundary dual vertex
-
                 boundaryPts[dualVertI] = true;
             }
 
-- 
GitLab