diff --git a/libsrc/meshing/improve3.cpp b/libsrc/meshing/improve3.cpp index 071817e3..5ae6a103 100644 --- a/libsrc/meshing/improve3.cpp +++ b/libsrc/meshing/improve3.cpp @@ -521,7 +521,7 @@ void MeshOptimize3d :: CombineImprove (Mesh & mesh, // return CombineImproveSequential(mesh, goal); - mesh.BoundaryEdge (1,2); // ensure the boundary-elements table is built + mesh.BuildBoundaryEdges(false); int np = mesh.GetNP(); int ne = mesh.GetNE(); @@ -817,7 +817,7 @@ void MeshOptimize3d :: SplitImprove (Mesh & mesh, PrintMessage (3, "SplitImprove"); (*testout) << "start SplitImprove" << "\n"; - mesh.BoundaryEdge (1,2); // ensure the boundary-elements table is built + mesh.BuildBoundaryEdges(false); ParallelFor( mesh.VolumeElements().Range(), [&] (ElementIndex ei) NETGEN_LAMBDA_INLINE { @@ -2713,7 +2713,7 @@ void MeshOptimize3d :: SwapImprove (Mesh & mesh, OPTIMIZEGOAL goal, int np = mesh.GetNP(); int ne = mesh.GetNE(); - mesh.BoundaryEdge (1,2); // ensure the boundary-elements table is built + mesh.BuildBoundaryEdges(false); auto elementsonnode = mesh.CreatePoint2ElementTable(); @@ -3932,7 +3932,7 @@ void MeshOptimize3d :: SwapImprove2 (Mesh & mesh, OPTIMIZEGOAL goal) // return SwapImprove2Sequential(mesh, goal); - mesh.BoundaryEdge (1,2); // ensure the boundary-elements table is built + mesh.BuildBoundaryEdges(false); int cnt = 0; double bad1, bad2; @@ -4177,7 +4177,7 @@ void MeshOptimize3d :: SplitImprove2 (Mesh & mesh) } }); - mesh.BoundaryEdge (1,2); // ensure the boundary-elements table is built + mesh.BuildBoundaryEdges(false); Array> split_candidates(ne); std::atomic improvement_counter(0); diff --git a/libsrc/meshing/meshclass.cpp b/libsrc/meshing/meshclass.cpp index cac7dc97..3aff354b 100644 --- a/libsrc/meshing/meshclass.cpp +++ b/libsrc/meshing/meshclass.cpp @@ -1794,12 +1794,12 @@ namespace netgen volelements.SetAllocSize(nel); } - - void Mesh :: BuildBoundaryEdges(void) + void Mesh :: BuildBoundaryEdges(bool rebuild) { static Timer t("Mesh::BuildBoundaryEdges"); RegionTimer reg(t); - // delete boundaryedges; + if(!rebuild && boundaryedges) + return; boundaryedges = make_unique> (3 * (GetNSE() + GetNOpenElements()) + GetNSeg() + 1); diff --git a/libsrc/meshing/meshclass.hpp b/libsrc/meshing/meshclass.hpp index 65ff082f..e3e61477 100644 --- a/libsrc/meshing/meshclass.hpp +++ b/libsrc/meshing/meshclass.hpp @@ -156,10 +156,10 @@ namespace netgen shared_ptr geometry; - private: - void BuildBoundaryEdges(void); public: + void BuildBoundaryEdges(bool rebuild=true); + bool PointContainedIn2DElement(const Point3d & p, double lami[3], const int element, diff --git a/libsrc/meshing/smoothing3.cpp b/libsrc/meshing/smoothing3.cpp index e84a18ba..0f8652f6 100644 --- a/libsrc/meshing/smoothing3.cpp +++ b/libsrc/meshing/smoothing3.cpp @@ -1460,6 +1460,7 @@ void Mesh :: ImproveMesh (const MeshingParameters & mp, OPTIMIZEGOAL goal) static Timer trange("range"); // return ImproveMeshSequential(mp, goal); + BuildBoundaryEdges(false); (*testout) << "Improve Mesh" << "\n"; PrintMessage (3, "ImproveMesh");