Skip to content
Snippets Groups Projects
Commit 11ae0eb1 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

make sure to re-orient 2D mesh before meshing in 3D (fixes e.g. bug when 2D...

make sure to re-orient 2D mesh before meshing in 3D (fixes e.g. bug when 2D Frontal leaves badly oriented elements, that 3D frontal cannot handle)
parent 80486220
No related branches found
No related tags found
No related merge requests found
......@@ -255,6 +255,9 @@ static void Mesh1D(GModel *m)
if(nIter++ > 10) break;
}
// re-orient according to geometrical/user constraints
std::for_each(m->firstEdge(), m->lastEdge(), orientMeshGEdge());
double t2 = Cpu();
CTX::instance()->meshTimer[0] = t2 - t1;
Msg::StatusBar(true, "Done meshing 1D (%g s)", CTX::instance()->meshTimer[0]);
......@@ -355,11 +358,11 @@ static void Mesh2D(GModel *m)
backgroundMesh::current()->unset();
meshGFace mesher(true);
mesher(temp[K]);
#if defined(HAVE_BFGS)
if(CTX::instance()->mesh.optimizeLloyd){
if (temp[K]->geomType()==GEntity::CompoundSurface ||
temp[K]->geomType()==GEntity::Plane || temp[K]->geomType()==GEntity::RuledSurface) {
temp[K]->geomType()==GEntity::Plane ||
temp[K]->geomType()==GEntity::RuledSurface) {
if (temp[K]->meshAttributes.method != MESH_TRANSFINITE &&
!temp[K]->meshAttributes.extrude) {
smoothing smm(CTX::instance()->mesh.optimizeLloyd,6);
......@@ -375,7 +378,6 @@ static void Mesh2D(GModel *m)
}
}
#endif
#if defined(_OPENMP)
#pragma omp critical
#endif
......@@ -394,11 +396,11 @@ static void Mesh2D(GModel *m)
backgroundMesh::current()->unset();
meshGFace mesher(true);
mesher(*it);
#if defined(HAVE_BFGS)
if(CTX::instance()->mesh.optimizeLloyd){
if ((*it)->geomType()==GEntity::CompoundSurface ||
(*it)->geomType()==GEntity::Plane || (*it)->geomType()==GEntity::RuledSurface) {
(*it)->geomType()==GEntity::Plane ||
(*it)->geomType()==GEntity::RuledSurface) {
if ((*it)->meshAttributes.method != MESH_TRANSFINITE &&
!(*it)->meshAttributes.extrude) {
smoothing smm(CTX::instance()->mesh.optimizeLloyd,6);
......@@ -414,7 +416,6 @@ static void Mesh2D(GModel *m)
}
}
#endif
nPending++;
}
if(!nIter) Msg::ProgressMeter(nPending, nTot, false, "Meshing 2D...");
......@@ -426,6 +427,10 @@ static void Mesh2D(GModel *m)
// collapseSmallEdges(*m);
// re-orient according to geometrical/user constraints
std::for_each(m->firstEdge(), m->lastEdge(), orientMeshGEdge());
std::for_each(m->firstFace(), m->lastFace(), orientMeshGFace());
double t2 = GetTimeInSeconds();
CTX::instance()->meshTimer[1] = t2 - t1;
Msg::StatusBar(true, "Done meshing 2D (%g s)", CTX::instance()->meshTimer[1]);
......@@ -567,6 +572,12 @@ static void Mesh3D(GModel *m)
// Ensure that all volume Jacobians are positive
m->setAllVolumesPositive();
// Ensure that all edge/surface meshes that could have been changed by the 3D
// algo (e.g. the Frontal), are re-oriented according to the geometrical/user
// constraints
std::for_each(m->firstEdge(), m->lastEdge(), orientMeshGEdge());
std::for_each(m->firstFace(), m->lastFace(), orientMeshGFace());
double t2 = Cpu();
CTX::instance()->meshTimer[2] = t2 - t1;
Msg::StatusBar(true, "Done meshing 3D (%g s)", CTX::instance()->meshTimer[2]);
......@@ -668,13 +679,6 @@ void GenerateMesh(GModel *m, int ask)
Mesh3D(m);
}
// Orient the line and surface meshes so that they match the orientation of
// the geometrical entities and/or the user orientation constraints
if(m->getMeshStatus() >= 1)
std::for_each(m->firstEdge(), m->lastEdge(), orientMeshGEdge());
if(m->getMeshStatus() >= 2)
std::for_each(m->firstFace(), m->lastFace(), orientMeshGFace());
// Optimize quality of 3D tet mesh
if(m->getMeshStatus() == 3){
for(int i = 0; i < std::max(CTX::instance()->mesh.optimize,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment