diff --git a/Geo/GFace.cpp b/Geo/GFace.cpp index 3f2c4e2fe0e862d04167e0516755da9b2e222674..6600a4bb6789d2607cba8ad76396e57b9befc71f 100644 --- a/Geo/GFace.cpp +++ b/Geo/GFace.cpp @@ -16,7 +16,6 @@ #include "fullMatrix.h" #include "Numeric.h" #include "GaussLegendre1D.h" -#include "ExtrudeParams.h" #include "Context.h" #include "meshGFaceLloyd.h" #include "Bindings.h" @@ -138,13 +137,6 @@ void GFace::resetMeshAttributes() meshAttributes.extrude = 0; } -bool GFace::isMeshExtruded() -{ - ExtrudeParams *ep = meshAttributes.extrude; - if(ep && ep->mesh.ExtrudeMesh) return true; - return false; -} - SBoundingBox3d GFace::bounds() const { SBoundingBox3d res; diff --git a/Geo/GFace.h b/Geo/GFace.h index f9f3fef914ff7202c4ad3d39990bc6902396ebfa..00aee5a100a99577dff8b6b3ceae1d0dc568a4bf 100644 --- a/Geo/GFace.h +++ b/Geo/GFace.h @@ -235,9 +235,6 @@ class GFace : public GEntity // reset the mesh attributes to default values virtual void resetMeshAttributes(); - // tells if the mesh is obtained by extrusion - bool isMeshExtruded(); - // for periodic faces, move parameters into the range chosen // for that face void moveToValidRange(SPoint2 &pt) const; diff --git a/Mesh/Generator.cpp b/Mesh/Generator.cpp index 6ab042e0eb6cd064d23aeda0d2f2a4b674e64053..316cd00603eefaf3e2ba9ed3d91278e0dd557296 100644 --- a/Mesh/Generator.cpp +++ b/Mesh/Generator.cpp @@ -438,42 +438,25 @@ static void Mesh2D(GModel *m) // and curve meshes) is global as it depends on a smooth normal // field generated from the surface mesh of the source surfaces if(!Mesh2DWithBoundaryLayers(m)){ - - std::set<GFace*> compoundFaces, extrudedFaces, otherFaces; - for(GModel::fiter it = m->firstFace(); it != m->lastFace(); ++it){ - GFace *gf = *it; - if (gf->geomType() == GEntity::CompoundSurface) - compoundFaces.insert(*it); - else if(gf->isMeshExtruded()) - extrudedFaces.insert(gf); - else - otherFaces.insert(gf); - } - std::for_each(otherFaces.begin(), otherFaces.end(), meshGFace()); - std::for_each(extrudedFaces.begin(), extrudedFaces.end(), meshGFace()); - std::for_each(compoundFaces.begin(), compoundFaces.end(), meshGFace()); - - // lloyd optimization - if (CTX::instance()->mesh.optimizeLloyd){ - for(GModel::fiter it = m->firstFace(); it != m->lastFace(); ++it){ - GFace *gf = *it; - if(gf->geomType() == GEntity::DiscreteSurface) continue; - if(gf->geomType() == GEntity::CompoundSurface) { - GFaceCompound *gfc = (GFaceCompound*) gf; - if(gfc->getNbSplit() != 0) continue; - } - int recombine = gf->meshAttributes.recombine; - Msg::StatusBar(2, true, "Lloyd optimization for face %d", gf->tag()); - gf->lloyd(25, recombine); - if(recombine) recombineIntoQuads(gf); - } - } + std::set<GFace*> cf, f; + for(GModel::fiter it = m->firstFace(); it != m->lastFace(); ++it) + if ((*it)->geomType() == GEntity::CompoundSurface) + cf.insert(*it); + else + f.insert(*it); + int nIter = 0; while(1){ meshGFace mesher; int nbPending = 0; - for(GModel::fiter it = m->firstFace(); it != m->lastFace(); ++it){ + for(GModel::fiter it = f.begin(); it != f.end(); ++it){ + if ((*it)->meshStatistics.status == GFace::PENDING){ + mesher(*it); + nbPending++; + } + } + for(GModel::fiter it = cf.begin(); it != cf.end(); ++it){ if ((*it)->meshStatistics.status == GFace::PENDING){ mesher(*it); nbPending++; @@ -483,7 +466,23 @@ static void Mesh2D(GModel *m) if(nIter++ > 10) break; } } - + + // lloyd optimization + if (CTX::instance()->mesh.optimizeLloyd){ + for(GModel::fiter it = m->firstFace(); it != m->lastFace(); ++it){ + GFace *gf = *it; + if(gf->geomType() == GEntity::DiscreteSurface) continue; + if(gf->geomType() == GEntity::CompoundSurface) { + GFaceCompound *gfc = (GFaceCompound*) gf; + if(gfc->getNbSplit() != 0) continue; + } + int recombine = gf->meshAttributes.recombine; + Msg::StatusBar(2, true, "Lloyd optimization for face %d", gf->tag()); + gf->lloyd(25, recombine); + if(recombine) recombineIntoQuads(gf); + } + } + // collapseSmallEdges(*m); double t2 = Cpu(); diff --git a/Mesh/meshGEdge.cpp b/Mesh/meshGEdge.cpp index ecb0ae8336cd55829ab44750724c36967a8c1c60..34601dc6e6be4595cadcc229a55a050551a465a9 100644 --- a/Mesh/meshGEdge.cpp +++ b/Mesh/meshGEdge.cpp @@ -451,5 +451,6 @@ void meshGEdge::operator() (GEdge *ge) v0->y() = beg_p.y(); v0->z() = beg_p.z(); } + ge->meshStatistics.status = GEdge::DONE; } diff --git a/Mesh/meshGEdgeExtruded.cpp b/Mesh/meshGEdgeExtruded.cpp index c06de9aaf21a90deca6f06e69c8fae9cdd43b25d..b2e6b59abf7bb8f64615ed5b9193f7920e7758a9 100644 --- a/Mesh/meshGEdgeExtruded.cpp +++ b/Mesh/meshGEdgeExtruded.cpp @@ -54,6 +54,8 @@ int MeshExtrudedCurve(GEdge *ge) if(!ep || !ep->mesh.ExtrudeMesh) return 0; + Msg::StatusBar(2, true, "Meshing curve %d (extruded)", ge->tag()); + GEdge *from = ge->model()->getEdgeByTag(std::abs(ep->geo.Source)); if(ep->geo.Mode == EXTRUDED_ENTITY) { // curve is extruded from a point @@ -65,6 +67,10 @@ int MeshExtrudedCurve(GEdge *ge) Msg::Error("Unknown source curve %d for extrusion", ep->geo.Source); return 0; } + else if(from->meshStatistics.status != GEdge::DONE){ + // cannot mesh this edge yet: will do it later + return 1; + } copyMesh(from, ge); } @@ -80,8 +86,10 @@ int MeshExtrudedCurve(GEdge *ge) // Extrusion information is only stored for copied edges // (the source of extruded edge is a vertex, not an element) MElement* sourceElem = from->getMeshElement(i); - ep->elementMap.addExtrudedElem(sourceElem,newElem); + ep->elementMap.addExtrudedElem(sourceElem, newElem); } } + + ge->meshStatistics.status = GEdge::DONE; return 1; } diff --git a/Mesh/meshGFace.cpp b/Mesh/meshGFace.cpp index c656a985b4bcaa4182786e2ffcd0da5e91fbf166..d43aa1137933dd86038605836ed095398595a0c0 100644 --- a/Mesh/meshGFace.cpp +++ b/Mesh/meshGFace.cpp @@ -1671,7 +1671,7 @@ void partitionAndRemesh(GFaceCompound *gf) GFaceCompound *gfc = new GFaceCompound(gf->model(), num_gfc, f_compound, b[0], b[1], b[2], b[3], 0, gf->getTypeOfMapping()); - gfc->meshAttributes.recombine = gf->meshAttributes.recombine; + gfc->meshAttributes.recombine = gf->meshAttributes.recombine; gf->model()->add(gfc); gfc->parametrize(); diff --git a/Mesh/meshGFaceExtruded.cpp b/Mesh/meshGFaceExtruded.cpp index 00c8761086a447e0c971cfbd63fc0fd31909647c..9d22d9f7c96be0b09fb791684b056629f43fad19 100644 --- a/Mesh/meshGFaceExtruded.cpp +++ b/Mesh/meshGFaceExtruded.cpp @@ -231,6 +231,10 @@ int MeshExtrudedSurface(GFace *gf, Msg::Error("Unknown source surface %d for extrusion", ep->geo.Source); return 0; } + else if(from->meshStatistics.status != GFace::DONE){ + // cannot mesh this face yet: will do it later + return 1; + } copyMesh(from, gf, pos); } diff --git a/Mesh/meshGRegionExtruded.cpp b/Mesh/meshGRegionExtruded.cpp index f4d658099da8422d446a0c3bc8c73f1b89b65c92..50c76ae6dc49cef3e340a208ebabd5bba48b51da 100644 --- a/Mesh/meshGRegionExtruded.cpp +++ b/Mesh/meshGRegionExtruded.cpp @@ -523,29 +523,6 @@ int SubdivideExtrudedMesh(GModel *m) } } -// std::set<GFace*> faces; -// for(unsigned int i = 0; i < regions.size(); i++){ -// std::list<GFace*> f = regions[i]->faces(); -// faces.insert(f.begin(), f.end()); -// } -// for(std::set<GFace*>::iterator it = faces.begin(); it != faces.end(); it++){ -// ExtrudeParams *ep = (*it)->meshAttributes.extrude; -// if(ep && ep->mesh.ExtrudeMesh && ep->geo.Mode == EXTRUDED_ENTITY && -// !ep->mesh.Recombine){ -// GFace *gf = *it; -// Msg::Info("Remeshing surface %d", gf->tag()); -// for(unsigned int i = 0; i < gf->triangles.size(); i++) -// delete gf->triangles[i]; -// gf->triangles.clear(); -// for(unsigned int i = 0; i < gf->quadrangles.size(); i++) -// delete gf->quadrangles[i]; -// gf->quadrangles.clear(); -// ep->elementMap.clear(); // reconstruct extrusion info -// MeshExtrudedSurface(gf, &edges); -// } -// } - - // carve holes if any // TODO: update extrusion information for(unsigned int i = 0; i < regions.size(); i++){