Skip to content
Snippets Groups Projects
Commit 7068f45f authored by Tristan Carrier Baudouin's avatar Tristan Carrier Baudouin
Browse files

Lloyd's algorithm needs to be applied before the mesh extrusion in order to...

Lloyd's algorithm needs to be applied before the mesh extrusion in order to keep identical starting and ending faces
parent a835efbc
No related branches found
No related tags found
No related merge requests found
...@@ -493,6 +493,24 @@ static void Mesh2D(GModel *m) ...@@ -493,6 +493,24 @@ static void Mesh2D(GModel *m)
if (temp[K]->meshStatistics.status == GFace::PENDING){ if (temp[K]->meshStatistics.status == GFace::PENDING){
meshGFace mesher(true, CTX::instance()->mesh.multiplePasses); meshGFace mesher(true, CTX::instance()->mesh.multiplePasses);
mesher(temp[K]); mesher(temp[K]);
#if defined(HAVE_BFGS)
if (temp[K]->geomType()==GEntity::CompoundSurface ||
temp[K]->geomType()==GEntity::Plane) {
if (temp[K]->meshAttributes.method != MESH_TRANSFINITE && !temp[K]->meshAttributes.extrude) {
smoothing smm(CTX::instance()->mesh.optimizeLloyd,6);
//m->writeMSH("beforeLLoyd.msh");
smm.optimize_face(temp[K]);
int rec = ((CTX::instance()->mesh.recombineAll ||
temp[K]->meshAttributes.recombine) &&
!CTX::instance()->mesh.recombine3DAll);
//m->writeMSH("afterLLoyd.msh");
if (rec) recombineIntoQuads(temp[K]);
//m->writeMSH("afterRecombine.msh");
}
}
#endif
#if defined(_OPENMP) #if defined(_OPENMP)
#pragma omp critical #pragma omp critical
#endif #endif
...@@ -508,8 +526,26 @@ static void Mesh2D(GModel *m) ...@@ -508,8 +526,26 @@ static void Mesh2D(GModel *m)
for(std::set<GFace*, GEntityLessThan>::iterator it = cf.begin(); for(std::set<GFace*, GEntityLessThan>::iterator it = cf.begin();
it != cf.end(); ++it){ it != cf.end(); ++it){
if ((*it)->meshStatistics.status == GFace::PENDING){ if ((*it)->meshStatistics.status == GFace::PENDING){
meshGFace mesher(true, CTX::instance()->mesh.multiplePasses); meshGFace mesher(true, CTX::instance()->mesh.multiplePasses);
mesher(*it); mesher(*it);
#if defined(HAVE_BFGS)
if ((*it)->geomType()==GEntity::CompoundSurface ||
(*it)->geomType()==GEntity::Plane) {
if ((*it)->meshAttributes.method != MESH_TRANSFINITE && !(*it)->meshAttributes.extrude) {
smoothing smm(CTX::instance()->mesh.optimizeLloyd,6);
//m->writeMSH("beforeLLoyd.msh");
smm.optimize_face(*it);
int rec = ((CTX::instance()->mesh.recombineAll ||
(*it)->meshAttributes.recombine) &&
!CTX::instance()->mesh.recombine3DAll);
//m->writeMSH("afterLLoyd.msh");
if (rec) recombineIntoQuads(*it);
//m->writeMSH("afterRecombine.msh");
}
}
#endif
nPending++; nPending++;
} }
if(!nIter) Msg::ProgressMeter(nPending, nTot, false, "Meshing 2D..."); if(!nIter) Msg::ProgressMeter(nPending, nTot, false, "Meshing 2D...");
...@@ -519,39 +555,41 @@ static void Mesh2D(GModel *m) ...@@ -519,39 +555,41 @@ static void Mesh2D(GModel *m)
} }
} }
#if defined(HAVE_BFGS) // #if defined(HAVE_BFGS)
//lloyd optimization // //lloyd optimization
if(CTX::instance()->mesh.optimizeLloyd){ // if(CTX::instance()->mesh.optimizeLloyd){
for(GModel::fiter it = m->firstFace(); it != m->lastFace(); ++it){ // for(GModel::fiter it = m->firstFace(); it != m->lastFace(); ++it){
if((*it)->geomType()==GEntity::CompoundSurface || // printf("face %d --> type : %d, attributs method : %d\n", (*it)->tag(), (*it)->geomType(), (*it)->meshAttributes.method);
(*it)->geomType()==GEntity::Plane){ // if((*it)->geomType()==GEntity::CompoundSurface ||
if((*it)->meshAttributes.method != MESH_TRANSFINITE){ // (*it)->geomType()==GEntity::Plane){
smoothing smm(CTX::instance()->mesh.optimizeLloyd,6); // if((*it)->meshAttributes.method != MESH_TRANSFINITE && !(*it)->meshAttributes.extrude){
//m->writeMSH("beforeLLoyd.msh"); // printf("--> smoothing\n");
smm.optimize_face(*it); // smoothing smm(CTX::instance()->mesh.optimizeLloyd,6);
int rec = ((CTX::instance()->mesh.recombineAll || // //m->writeMSH("beforeLLoyd.msh");
(*it)->meshAttributes.recombine) && // smm.optimize_face(*it);
!CTX::instance()->mesh.recombine3DAll); // int rec = ((CTX::instance()->mesh.recombineAll ||
//m->writeMSH("afterLLoyd.msh"); // (*it)->meshAttributes.recombine) &&
if(rec) recombineIntoQuads(*it); // !CTX::instance()->mesh.recombine3DAll);
//m->writeMSH("afterRecombine.msh"); // //m->writeMSH("afterLLoyd.msh");
} // if(rec) recombineIntoQuads(*it);
} // //m->writeMSH("afterRecombine.msh");
} // }
/* // }
for(GModel::fiter it = m->firstFace(); it != m->lastFace(); ++it){ // }
GFace *gf = *it; // /*
if(gf->geomType() == GEntity::DiscreteSurface) continue; // for(GModel::fiter it = m->firstFace(); it != m->lastFace(); ++it){
if(gf->geomType() == GEntity::CompoundSurface) { // GFace *gf = *it;
GFaceCompound *gfc = (GFaceCompound*) gf; // if(gf->geomType() == GEntity::DiscreteSurface) continue;
if(gfc->getNbSplit() != 0) continue; // if(gf->geomType() == GEntity::CompoundSurface) {
} // GFaceCompound *gfc = (GFaceCompound*) gf;
Msg::Info("Lloyd optimization for face %d", gf->tag()); // if(gfc->getNbSplit() != 0) continue;
gf->lloyd(25, rec); // }
} // Msg::Info("Lloyd optimization for face %d", gf->tag());
*/ // gf->lloyd(25, rec);
} // }
#endif // */
// }
// #endif
// collapseSmallEdges(*m); // collapseSmallEdges(*m);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment