Fix ImproveMesh

This commit is contained in:
Matthias Hochsteger 2021-02-26 12:18:43 +01:00
parent 298cbc2523
commit f5432718c1
4 changed files with 11 additions and 10 deletions

View File

@ -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<std::tuple<double, ElementIndex>> split_candidates(ne);
std::atomic<int> improvement_counter(0);

View File

@ -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<INDEX_2_CLOSED_HASHTABLE<int>>
(3 * (GetNSE() + GetNOpenElements()) + GetNSeg() + 1);

View File

@ -156,10 +156,10 @@ namespace netgen
shared_ptr<NetgenGeometry> geometry;
private:
void BuildBoundaryEdges(void);
public:
void BuildBoundaryEdges(bool rebuild=true);
bool PointContainedIn2DElement(const Point3d & p,
double lami[3],
const int element,

View File

@ -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");