From 1e56e433804343a11ea5e90c3afbeb96d531da5c Mon Sep 17 00:00:00 2001 From: ws <ws@plaxis.nl> Date: Fri, 20 Jul 2018 14:16:43 +0200 Subject: [PATCH] Enable edgeSwapPass again, but comment out all possible erroneous calls to this function as the function is not fully bulletproof yet. E.g. it might happen that in case of the quality criterium the new elements are better, but their normal is not according to the local surface normal anymore. --- Mesh/meshGFaceDelaunayInsertion.cpp | 28 +++++++++++++++------------- Mesh/meshGFaceOptimize.cpp | 1 - 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Mesh/meshGFaceDelaunayInsertion.cpp b/Mesh/meshGFaceDelaunayInsertion.cpp index da0948727d..322b977bf2 100644 --- a/Mesh/meshGFaceDelaunayInsertion.cpp +++ b/Mesh/meshGFaceDelaunayInsertion.cpp @@ -1128,7 +1128,7 @@ void bowyerWatson(GFace *gf, int MAXPNT, buildMeshGenerationDataStructures(gf, AllTris, DATA); // if (equivalence)_printTris ("before.pos", AllTris.begin(), AllTris.end(), DATA); - int nbSwaps = edgeSwapPass(gf, AllTris, SWCR_DEL, DATA); + // int nbSwaps = edgeSwapPass(gf, AllTris, SWCR_DEL, DATA); // _printTris ("after2.pos", AllTris, Us,Vs); Msg::Debug("Delaunization of the initial mesh done (%d swaps)", nbSwaps); @@ -1183,7 +1183,7 @@ void bowyerWatson(GFace *gf, int MAXPNT, insertAPoint(gf, AllTris.begin(), center, metric, DATA, AllTris); } } - nbSwaps = edgeSwapPass(gf, AllTris, SWCR_QUAL, DATA); + // nbSwaps = edgeSwapPass(gf, AllTris, SWCR_QUAL, DATA); // printf("%12.5E %12.5E %12.5E %12.5E %12.5E\n",DT1,DT2,DT3,__DT1,__DT2); // printf("%12.5E \n",__DT2); @@ -1420,10 +1420,12 @@ void bowyerWatsonFrontal(GFace *gf, // Check whether we need edge swaps to get rid of elements with zero area // in parametric space. If we do, make sure that it is conform Delaunay again. - edgeSwapPass(gf, AllTris, SWCR_ZEROAREA, DATA); - edgeSwapPass(gf, AllTris, SWCR_DEL, DATA); - // Msg::Info("Delaunization of the initial mesh done (%d swaps zero area, %d swaps delaunay)", - // nbEdgeSwapsZeroArea, nbEdgeSwapsDelaunay); + const int nbEdgeSwapsZeroArea = edgeSwapPass(gf, AllTris, SWCR_ZEROAREA, DATA); + if (nbEdgeSwapsZeroArea > 0){ + const int nbEdgeSwapsDelaunay = edgeSwapPass(gf, AllTris, SWCR_DEL, DATA); + Msg::Info("Delaunization of the initial mesh done (%d swaps zero area, %d swaps delaunay)", + nbEdgeSwapsZeroArea, nbEdgeSwapsDelaunay); + } int ITER = 0, active_edge; // compute active triangle @@ -1467,7 +1469,7 @@ void bowyerWatsonFrontal(GFace *gf, } } - edgeSwapPass(gf, AllTris, SWCR_QUAL, DATA); + // edgeSwapPass(gf, AllTris, SWCR_QUAL, DATA); transferDataStructure(gf, AllTris, DATA); // removeThreeTrianglesNodes(gf); @@ -1641,8 +1643,8 @@ void bowyerWatsonFrontalLayers(GFace *gf, bool quad, buildMeshGenerationDataStructures (gf, AllTris, DATA); // delaunise the initial mesh - int nbSwaps = edgeSwapPass(gf, AllTris, SWCR_DEL, DATA); - Msg::Debug("Delaunization of the initial mesh done (%d swaps)", nbSwaps); + //int nbSwaps = edgeSwapPass(gf, AllTris, SWCR_DEL, DATA); + //Msg::Debug("Delaunization of the initial mesh done (%d swaps)", nbSwaps); int ITER = 0, active_edge; // compute active triangle @@ -1776,8 +1778,8 @@ void bowyerWatsonParallelograms(GFace *gf, buildMeshGenerationDataStructures (gf, AllTris, DATA); // delaunise the initial mesh - int nbSwaps = edgeSwapPass(gf, AllTris, SWCR_DEL, DATA); - Msg::Debug("Delaunization of the initial mesh done (%d swaps)", nbSwaps); + //int nbSwaps = edgeSwapPass(gf, AllTris, SWCR_DEL, DATA); + //Msg::Debug("Delaunization of the initial mesh done (%d swaps)", nbSwaps); //std::sort(packed.begin(), packed.end(), MVertexLessThanLexicographic()); SortHilbert(packed); @@ -1861,8 +1863,8 @@ void bowyerWatsonParallelogramsConstrained( std::cout<<"out of buildMeshGenerationDataStructures"<<std::endl; // delaunise the initial mesh - int nbSwaps = edgeSwapPass(gf, AllTris, SWCR_DEL, DATA); - Msg::Debug("Delaunization of the initial mesh done (%d swaps)", nbSwaps); + //int nbSwaps = edgeSwapPass(gf, AllTris, SWCR_DEL, DATA); + //Msg::Debug("Delaunization of the initial mesh done (%d swaps)", nbSwaps); std::sort(packed.begin(), packed.end(), MVertexLessThanLexicographic()); std::cout<<"out of sort"<<std::endl; diff --git a/Mesh/meshGFaceOptimize.cpp b/Mesh/meshGFaceOptimize.cpp index da5a5f5f30..893f8f175b 100644 --- a/Mesh/meshGFaceOptimize.cpp +++ b/Mesh/meshGFaceOptimize.cpp @@ -1248,7 +1248,6 @@ bool edgeSwap(std::set<swapquad> &configs, MTri3 *t1, GFace *gf, int iLocalEdge, int edgeSwapPass(GFace *gf, std::set<MTri3 *, compareTri3Ptr> &allTris, const swapCriterion &cr, bidimMeshData &data) { - return 0; typedef std::set<MTri3 *, compareTri3Ptr> CONTAINER; int nbSwapTot = 0; -- GitLab