From d043a4fd2e4ca2a86186b3a64e797a63cdd3a4a3 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Thu, 9 Jun 2011 15:52:17 +0000 Subject: [PATCH] removed "partition by extrusion" code: it's not used anymore --- Common/DefaultOptions.h | 4 - Common/Options.cpp | 8 -- Common/Options.h | 1 - Geo/ExtrudeParams.cpp | 71 +-------------- Geo/ExtrudeParams.h | 13 --- Mesh/BoundaryLayers.cpp | 103 ++++++++++++++++++++++ Mesh/meshGEdgeExtruded.cpp | 7 -- Mesh/meshGFaceDelaunayInsertion.cpp | 102 ---------------------- Mesh/meshGFaceExtruded.cpp | 34 ++++---- Mesh/meshGRegionExtruded.cpp | 53 +++++------- Mesh/meshPartition.cpp | 130 +--------------------------- Mesh/meshPartitionOptions.cpp | 1 - Mesh/meshPartitionOptions.h | 2 - Plugin/ModifyComponent.cpp | 7 +- benchmarks/stl/mobilette.geo | 6 +- 15 files changed, 151 insertions(+), 391 deletions(-) diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index 6d68032505..b599b10d7c 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -1168,10 +1168,6 @@ StringXNumber MeshOptions_Number[] = { { F|O, "PartitionTriWeight" , opt_mesh_partition_tri_weight , 1 , "Weight of triangle for METIS load balancing" ,}, - { F|O, "PartitionByExtrusion" , opt_mesh_partition_by_extrusion, 0. , - "Special partitioner that annotates all all extruded elements to the same " - "node as the source element" }, - { F, "NbHexahedra" , opt_mesh_nb_hexahedra , 0. , "Number of hexahedra in the current mesh (read-only)" }, { F, "NbNodes" , opt_mesh_nb_nodes , 0. , diff --git a/Common/Options.cpp b/Common/Options.cpp index fad1ca4b32..4d96b82c13 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -6069,14 +6069,6 @@ double opt_mesh_partition_partitioner(OPT_ARGS_NUM) } return CTX::instance()->partitionOptions.partitioner; } -double opt_mesh_partition_by_extrusion(OPT_ARGS_NUM) -{ - if(action & GMSH_SET) { - const int ival = (int)val; - CTX::instance()->partitionOptions.partitionByExtrusion = ival; - } - return CTX::instance()->partitionOptions.partitionByExtrusion; -} double opt_mesh_partition_num(OPT_ARGS_NUM) { diff --git a/Common/Options.h b/Common/Options.h index a43ed93917..d29b4addd0 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -585,7 +585,6 @@ double opt_mesh_partition_chaco_terminal_propogation(OPT_ARGS_NUM); double opt_mesh_partition_metis_algorithm(OPT_ARGS_NUM); double opt_mesh_partition_metis_edge_matching(OPT_ARGS_NUM); double opt_mesh_partition_metis_refine_algorithm(OPT_ARGS_NUM); -double opt_mesh_partition_by_extrusion(OPT_ARGS_NUM); double opt_mesh_clip(OPT_ARGS_NUM); double opt_solver_listen(OPT_ARGS_NUM); double opt_solver_timeout(OPT_ARGS_NUM); diff --git a/Geo/ExtrudeParams.cpp b/Geo/ExtrudeParams.cpp index cda79dc8e0..1f530f1562 100644 --- a/Geo/ExtrudeParams.cpp +++ b/Geo/ExtrudeParams.cpp @@ -20,7 +20,7 @@ static void Projette(double p[3], double mat[3][3]) p[2] = Z; } -ExtrudeParams::ExtrudeParams(int ModeEx) : elementMap(this) +ExtrudeParams::ExtrudeParams(int ModeEx) { geo.Mode = ModeEx; geo.Source = -1; @@ -124,72 +124,3 @@ double ExtrudeParams::u(int iLayer, int iElemLayer) double t = (double)iElemLayer / (double)mesh.NbElmLayer[iLayer]; return t0 + t * (t1 - t0); } - -ExtrudeParams::ExtrusionElementMap::ExtrusionElementMap(ExtrudeParams*const parent) -{ - _parent = parent; -} - -std::vector<MElement*>* ExtrudeParams:: -ExtrusionElementMap::getExtrudedElems(MElement* source) -{ - std::map<MElement*, std::vector<MElement*> >::iterator it = _extrudedElements.find(source); - if(it != _extrudedElements.end()) - return &(it->second); - return NULL; -} - -void ExtrudeParams::ExtrusionElementMap::clear() -{ - _extrudedElements.clear(); -} - -bool ExtrudeParams::ExtrusionElementMap::empty() -{ - return _extrudedElements.empty(); -} - -void ExtrudeParams:: -ExtrusionElementMap::addExtrudedElem(MElement* source, MElement* extrudedElem) -{ - std::map<MElement*,std::vector<MElement*> >::iterator it = _extrudedElements.find(source); - if(it != _extrudedElements.end()) - it->second.push_back(extrudedElem); - else { - int totalNbElems = 0; - for (int i = 0; i <_parent->mesh.NbLayer;i++) - totalNbElems += _parent->mesh.NbElmLayer[i]; - // This expression automatically creates the new map key - std::vector<MElement*> *vec = &(_extrudedElements[source]); - vec->reserve( totalNbElems ); - vec->push_back( extrudedElem ); - } -} - -// Propagates the partition information from the source elements to -// the extruded elements. Increments the partition sizes if -// partitionSizes is given as argument. For efficient looping, this -// routine is within ExtrusionElementMap class. -void ExtrudeParams:: -ExtrusionElementMap::propagatePartitionInformation(std::vector<int> *partitionSizes) -{ - if (_extrudedElements.empty()) - Msg::Error("No extrusion information found!"); - std::map<MElement*,std::vector<MElement*> >::iterator columnit; - for(columnit=_extrudedElements.begin(); columnit != _extrudedElements.end(); - columnit++) { - MElement* sourceElem = (*columnit).first; - if(!sourceElem) { - Msg::Warning("No source found!"); - continue; - } - std::vector<MElement*> extrudedElements = (*columnit).second; - for(unsigned int iE = 0; iE < extrudedElements.size(); iE++) { - if(extrudedElements[iE]) { - extrudedElements[iE]->setPartition(sourceElem->getPartition()); - if (partitionSizes) - ++(*partitionSizes)[sourceElem->getPartition() - 1]; - } - } - } -} diff --git a/Geo/ExtrudeParams.h b/Geo/ExtrudeParams.h index 3dca383213..9b5d399fca 100644 --- a/Geo/ExtrudeParams.h +++ b/Geo/ExtrudeParams.h @@ -25,19 +25,6 @@ class ExtrudeParams{ public : - class ExtrusionElementMap { - private: - ExtrudeParams* _parent; - // maps source element to all extruded elements - std::map<MElement*,std::vector<MElement*> > _extrudedElements; - public: - ExtrusionElementMap(ExtrudeParams* const parent); - std::vector<MElement*>* getExtrudedElems(MElement* source); - void addExtrudedElem(MElement* source,MElement* extrudedElem); - void clear(); - bool empty(); - void propagatePartitionInformation(std::vector<int>* partitionSizes = NULL); - } elementMap; ExtrudeParams(int Mode = EXTRUDED_ENTITY); void fill(int type, double T0, double T1, double T2, diff --git a/Mesh/BoundaryLayers.cpp b/Mesh/BoundaryLayers.cpp index 153b11ad09..f3dfecaeac 100644 --- a/Mesh/BoundaryLayers.cpp +++ b/Mesh/BoundaryLayers.cpp @@ -328,3 +328,106 @@ int Mesh2DWithBoundaryLayers(GModel *m) return 1; } + +// give it a try : add one quad layer on the + /* +void addOneLayerOnContour(GFace *gf, GVertex *gv){ +, int nbLayers, double hplus, double factor){ + // for each vertex + std::map<MVertex*,std::vector<MVertex*> >layers; + std::vector<MQuadrangle*> newQuads; + std::vector<MTriangle*> newTris; + + std::list<GEdgeLoop>::iterator it = gf->edgeLoops.begin(); + for (; it != gf->edgeLoops.end(); ++it){ + bool found = false; + std::list<GEdge*> ed; + for (GEdgeLoop::iter it2 = it->begin(); it2 != it->end(); ++it2){ + if (it2->ge->getBeginVertex() == gv || it2->ge->getEndVertex() == gv) { + found = true; + } + ed.push_back(it2->ge); + } + // we found an edge loop with the GVertex that was specified + if (found){ + // compute model vertices that will produce fans + for (GEdgeLoop::iter it2 = it->begin(); it2 != it->end(); ++it2){ + GEdgeLoop::iter it3 = it2; ++it3; + GVertex *gv = it2->getEndVertex(); + GEdgeSigned *before,*after = *it2; + if (it3 == it->end()){ + before = *(it->begin()); + } + else{ + before = *it2; + } + } + + for (std::list<GEdge*>::iterator it = ed.begin(); it != ed.end(); ++it){ + GEdge *ge = *it; + for (int i=0;i<ge->lines.size();i++){ + SPoint2 p[2]; + reparamMeshEdgeOnFace ( ge->lines[i]->getVertex(0), ge->lines[i]->getVertex(1),gf,p[0],p[1]); + MVertex *vd[2]; + for (int j=0;j<2;j++){ + MVertex *v = ge->lines[i]->getVertex(j); + std::map<MVertex*,MVertex*>::iterator itv = duplicates.find(v); + if (itv == duplicates.end()){ + vd[j] = new MFaceVertex(v->x(),v->y(),v->z(),gf,p[j].x(),p[j].y()); + duplicates[v] = vd[j]; + gf->mesh_vertices.push_back(vd[j]); + } + else + vd[j] = itv->second; + } + newQuads.push_back(new MQuadrangle(ge->lines[i]->getVertex(0), ge->lines[i]->getVertex(1),vd[1],vd[0])); + } + } + for (int i=0;i<gf->quadrangles.size();i++){ + MQuadrangle *q = gf->quadrangles[i]; + MVertex *vs[4]; + for (int j=0;j<4;j++){ + MVertex *v = q->getVertex(j); + std::map<MVertex*,MVertex*>::iterator itv = duplicates.find(v); + if (itv == duplicates.end()){ + vs[j] = v; + } + else{ + vs[j] = itv->second; + } + } + newQuads.push_back(new MQuadrangle(vs[0],vs[1],vs[2],vs[3])); + delete q; + } + for (int i=0;i<gf->triangles.size();i++){ + MTriangle *t = gf->triangles[i]; + MVertex *vs[3]; + for (int j=0;j<3;j++){ + MVertex *v = t->getVertex(j); + std::map<MVertex*,MVertex*>::iterator itv = duplicates.find(v); + if (itv == duplicates.end()){ + vs[j] = v; + } + else{ + vs[j] = itv->second; + } + } + newTris.push_back(new MTriangle(vs[0],vs[1],vs[2])); + delete t; + } + + gf->triangles = newTris; + gf->quadrangles = newQuads; + } + } +} +*/ + +void addBoundaryLayers(GFace *gf) +{ + //if (backgroundMesh::current()){ + //} + // first compute the cross field if it is not computed yet + // start from a selection of edges and create points in the boundary layer + // connect everybody with delaunay +} diff --git a/Mesh/meshGEdgeExtruded.cpp b/Mesh/meshGEdgeExtruded.cpp index 3348c8110d..2b20844b27 100644 --- a/Mesh/meshGEdgeExtruded.cpp +++ b/Mesh/meshGEdgeExtruded.cpp @@ -83,13 +83,6 @@ int MeshExtrudedCurve(GEdge *ge) ge->getEndVertex()->mesh_vertices[0] : ge->mesh_vertices[i]; MLine* newElem = new MLine(v0, v1); ge->lines.push_back(newElem); - if(ep->geo.Mode == COPIED_ENTITY) { - // Extrusion information is only stored for copied edges - // (the source of extruded edge is a vertex, not an element) - GEdge *from = ge->model()->getEdgeByTag(std::abs(ep->geo.Source)); - MElement* sourceElem = from->getMeshElement(i); - ep->elementMap.addExtrudedElem(sourceElem, newElem); - } } ge->meshStatistics.status = GEdge::DONE; diff --git a/Mesh/meshGFaceDelaunayInsertion.cpp b/Mesh/meshGFaceDelaunayInsertion.cpp index d70a5ca0ab..5751b845fb 100644 --- a/Mesh/meshGFaceDelaunayInsertion.cpp +++ b/Mesh/meshGFaceDelaunayInsertion.cpp @@ -1306,105 +1306,3 @@ void bowyerWatsonFrontalLayers(GFace *gf, bool quad) } -// give it a try : add one quad layer on the - /* -void addOneLayerOnContour(GFace *gf, GVertex *gv){ -, int nbLayers, double hplus, double factor){ - // for each vertex - std::map<MVertex*,std::vector<MVertex*> >layers; - std::vector<MQuadrangle*> newQuads; - std::vector<MTriangle*> newTris; - - std::list<GEdgeLoop>::iterator it = gf->edgeLoops.begin(); - for (; it != gf->edgeLoops.end(); ++it){ - bool found = false; - std::list<GEdge*> ed; - for (GEdgeLoop::iter it2 = it->begin(); it2 != it->end(); ++it2){ - if (it2->ge->getBeginVertex() == gv || it2->ge->getEndVertex() == gv) { - found = true; - } - ed.push_back(it2->ge); - } - // we found an edge loop with the GVertex that was specified - if (found){ - // compute model vertices that will produce fans - for (GEdgeLoop::iter it2 = it->begin(); it2 != it->end(); ++it2){ - GEdgeLoop::iter it3 = it2; ++it3; - GVertex *gv = it2->getEndVertex(); - GEdgeSigned *before,*after = *it2; - if (it3 == it->end()){ - before = *(it->begin()); - } - else{ - before = *it2; - } - } - - for (std::list<GEdge*>::iterator it = ed.begin(); it != ed.end(); ++it){ - GEdge *ge = *it; - for (int i=0;i<ge->lines.size();i++){ - SPoint2 p[2]; - reparamMeshEdgeOnFace ( ge->lines[i]->getVertex(0), ge->lines[i]->getVertex(1),gf,p[0],p[1]); - MVertex *vd[2]; - for (int j=0;j<2;j++){ - MVertex *v = ge->lines[i]->getVertex(j); - std::map<MVertex*,MVertex*>::iterator itv = duplicates.find(v); - if (itv == duplicates.end()){ - vd[j] = new MFaceVertex(v->x(),v->y(),v->z(),gf,p[j].x(),p[j].y()); - duplicates[v] = vd[j]; - gf->mesh_vertices.push_back(vd[j]); - } - else - vd[j] = itv->second; - } - newQuads.push_back(new MQuadrangle(ge->lines[i]->getVertex(0), ge->lines[i]->getVertex(1),vd[1],vd[0])); - } - } - for (int i=0;i<gf->quadrangles.size();i++){ - MQuadrangle *q = gf->quadrangles[i]; - MVertex *vs[4]; - for (int j=0;j<4;j++){ - MVertex *v = q->getVertex(j); - std::map<MVertex*,MVertex*>::iterator itv = duplicates.find(v); - if (itv == duplicates.end()){ - vs[j] = v; - } - else{ - vs[j] = itv->second; - } - } - newQuads.push_back(new MQuadrangle(vs[0],vs[1],vs[2],vs[3])); - delete q; - } - for (int i=0;i<gf->triangles.size();i++){ - MTriangle *t = gf->triangles[i]; - MVertex *vs[3]; - for (int j=0;j<3;j++){ - MVertex *v = t->getVertex(j); - std::map<MVertex*,MVertex*>::iterator itv = duplicates.find(v); - if (itv == duplicates.end()){ - vs[j] = v; - } - else{ - vs[j] = itv->second; - } - } - newTris.push_back(new MTriangle(vs[0],vs[1],vs[2])); - delete t; - } - - gf->triangles = newTris; - gf->quadrangles = newQuads; - } - } -} -*/ - -void addBoundaryLayers(GFace *gf) -{ - if (backgroundMesh::current()){ - } - // first compute the cross field if it is not computed yet - // start from a selection of edges and create points in the boundary layer - // connect everybody with delaunay -} diff --git a/Mesh/meshGFaceExtruded.cpp b/Mesh/meshGFaceExtruded.cpp index 20f303178b..0df1afadc7 100644 --- a/Mesh/meshGFaceExtruded.cpp +++ b/Mesh/meshGFaceExtruded.cpp @@ -13,19 +13,15 @@ #include "GmshMessage.h" static void addTriangle(MVertex* v1, MVertex* v2, MVertex* v3, - GFace *to, MElement* source) + GFace *to) { - MTriangle* newTri = new MTriangle(v1, v2, v3); - to->triangles.push_back(newTri); - to->meshAttributes.extrude->elementMap.addExtrudedElem(source, (MElement*)newTri); + to->triangles.push_back(new MTriangle(v1, v2, v3)); } static void addQuadrangle(MVertex* v1, MVertex* v2, MVertex* v3, MVertex* v4, - GFace *to, MElement* source) + GFace *to) { - MQuadrangle* newQuad = new MQuadrangle(v1, v2, v3, v4); - to->quadrangles.push_back(newQuad); - to->meshAttributes.extrude->elementMap.addExtrudedElem(source, (MElement*)newQuad); + to->quadrangles.push_back(new MQuadrangle(v1, v2, v3, v4)); } static void createQuaTri(std::vector<MVertex*> &v, GFace *to, @@ -34,28 +30,28 @@ static void createQuaTri(std::vector<MVertex*> &v, GFace *to, { ExtrudeParams *ep = to->meshAttributes.extrude; if(v[0] == v[1] || v[1] == v[3]) - addTriangle(v[0], v[3], v[2], to, source); + addTriangle(v[0], v[3], v[2], to); else if(v[0] == v[2] || v[2] == v[3]) - addTriangle(v[0], v[1], v[3], to, source); + addTriangle(v[0], v[1], v[3], to); else if(v[0] == v[3] || v[1] == v[2]) Msg::Error("Uncoherent extruded quadrangle in surface %d", to->tag()); else{ if(ep->mesh.Recombine){ - addQuadrangle(v[0], v[1], v[3], v[2], to, source); + addQuadrangle(v[0], v[1], v[3], v[2], to); } else if(!constrainedEdges){ - addTriangle(v[0], v[1], v[3], to, source); - addTriangle(v[0], v[3], v[2], to, source); + addTriangle(v[0], v[1], v[3], to); + addTriangle(v[0], v[3], v[2], to); } else{ std::pair<MVertex*, MVertex*> p(std::min(v[1], v[2]), std::max(v[1], v[2])); if(constrainedEdges->count(p)){ - addTriangle(v[2], v[1], v[0], to, source); - addTriangle(v[2], v[3], v[1], to, source); + addTriangle(v[2], v[1], v[0], to); + addTriangle(v[2], v[3], v[1], to); } else{ - addTriangle(v[2], v[3], v[0], to, source); - addTriangle(v[0], v[3], v[1], to, source); + addTriangle(v[2], v[3], v[0], to); + addTriangle(v[0], v[3], v[1], to); } } } @@ -159,7 +155,7 @@ static void copyMesh(GFace *from, GFace *to, } verts.push_back(*itp); } - addTriangle(verts[0],verts[1],verts[2],to,from->triangles[i]); + addTriangle(verts[0], verts[1], verts[2], to); } for(unsigned int i = 0; i < from->quadrangles.size(); i++){ std::vector<MVertex*> verts; @@ -180,7 +176,7 @@ static void copyMesh(GFace *from, GFace *to, } verts.push_back(*itp); } - addQuadrangle(verts[0],verts[1],verts[2],verts[3],to,from->quadrangles[i]); + addQuadrangle(verts[0], verts[1], verts[2], verts[3], to); } } diff --git a/Mesh/meshGRegionExtruded.cpp b/Mesh/meshGRegionExtruded.cpp index 9c80ec162c..664f435b3d 100644 --- a/Mesh/meshGRegionExtruded.cpp +++ b/Mesh/meshGRegionExtruded.cpp @@ -18,36 +18,28 @@ #include "GmshMessage.h" static void addTetrahedron(MVertex* v1, MVertex* v2, MVertex* v3, MVertex* v4, - GRegion *to, MElement* source) + GRegion *to) { - MTetrahedron* newElem = new MTetrahedron(v1, v2, v3, v4); - to->tetrahedra.push_back(newElem); - to->meshAttributes.extrude->elementMap.addExtrudedElem(source, (MElement*)newElem); + to->tetrahedra.push_back(new MTetrahedron(v1, v2, v3, v4)); } static void addPyramid(MVertex* v1, MVertex* v2, MVertex* v3, MVertex* v4, - MVertex* v5, GRegion *to, MElement* source) + MVertex* v5, GRegion *to) { - MPyramid* newElem = new MPyramid(v1, v2, v3, v4, v5); - to->pyramids.push_back(newElem); - to->meshAttributes.extrude->elementMap.addExtrudedElem(source, (MElement*)newElem); + to->pyramids.push_back(new MPyramid(v1, v2, v3, v4, v5)); } static void addPrism(MVertex* v1, MVertex* v2, MVertex* v3, MVertex* v4, - MVertex* v5, MVertex* v6, GRegion *to, MElement* source) + MVertex* v5, MVertex* v6, GRegion *to) { - MPrism* newElem = new MPrism(v1, v2, v3, v4, v5, v6); - to->prisms.push_back(newElem); - to->meshAttributes.extrude->elementMap.addExtrudedElem(source, (MElement*)newElem); + to->prisms.push_back(new MPrism(v1, v2, v3, v4, v5, v6)); } static void addHexahedron(MVertex* v1, MVertex* v2, MVertex* v3, MVertex* v4, MVertex* v5, MVertex* v6, MVertex* v7, MVertex* v8, - GRegion *to, MElement* source) + GRegion *to) { - MHexahedron* newElem = new MHexahedron(v1, v2, v3, v4, v5, v6, v7, v8); - to->hexahedra.push_back(newElem); - to->meshAttributes.extrude->elementMap.addExtrudedElem(source, (MElement*)newElem); + to->hexahedra.push_back(new MHexahedron(v1, v2, v3, v4, v5, v6, v7, v8)); } static void createPriPyrTet(std::vector<MVertex*> &v, GRegion *to, MElement* source) @@ -60,22 +52,22 @@ static void createPriPyrTet(std::vector<MVertex*> &v, GRegion *to, MElement* sou if(j == 2) { if(dup[0] == 0 && dup[1] == 1) - addTetrahedron(v[0], v[1], v[2], v[5], to, source); + addTetrahedron(v[0], v[1], v[2], v[5], to); else if(dup[0] == 1 && dup[1] == 2) - addTetrahedron(v[0], v[1], v[2], v[3], to, source); + addTetrahedron(v[0], v[1], v[2], v[3], to); else - addTetrahedron(v[0], v[1], v[2], v[4], to, source); + addTetrahedron(v[0], v[1], v[2], v[4], to); } else if(j == 1) { if(dup[0] == 0) - addPyramid(v[1], v[4], v[5], v[2], v[0], to, source); + addPyramid(v[1], v[4], v[5], v[2], v[0], to); else if(dup[0] == 1) - addPyramid(v[0], v[2], v[5], v[3], v[1], to, source); + addPyramid(v[0], v[2], v[5], v[3], v[1], to); else - addPyramid(v[0], v[1], v[4], v[3], v[2], to, source); + addPyramid(v[0], v[1], v[4], v[3], v[2], to); } else { - addPrism(v[0], v[1], v[2], v[3], v[4], v[5], to, source); + addPrism(v[0], v[1], v[2], v[3], v[4], v[5], to); if(j) Msg::Error("Degenerated prism in extrusion of volume %d", to->tag()); } } @@ -90,18 +82,18 @@ static void createHexPri(std::vector<MVertex*> &v, GRegion *to, MElement* source if(j == 2) { if(dup[0] == 0 && dup[1] == 1) - addPrism(v[0], v[3], v[7], v[1], v[2], v[6], to, source); + addPrism(v[0], v[3], v[7], v[1], v[2], v[6], to); else if(dup[0] == 1 && dup[1] == 2) - addPrism(v[0], v[1], v[4], v[3], v[2], v[7], to, source); + addPrism(v[0], v[1], v[4], v[3], v[2], v[7], to); else if(dup[0] == 2 && dup[1] == 3) - addPrism(v[0], v[3], v[4], v[1], v[2], v[5], to, source); + addPrism(v[0], v[3], v[4], v[1], v[2], v[5], to); else if(dup[0] == 0 && dup[1] == 3) - addPrism(v[0], v[1], v[5], v[3], v[2], v[6], to, source); + addPrism(v[0], v[1], v[5], v[3], v[2], v[6], to); else Msg::Error("Uncoherent hexahedron in extrusion of volume %d", to->tag()); } else { - addHexahedron(v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7], to, source); + addHexahedron(v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7], to); if(j) Msg::Error("Degenerated hexahedron in extrusion of volume %d", to->tag()); } } @@ -110,7 +102,7 @@ static void createTet(MVertex *v1, MVertex *v2, MVertex *v3, MVertex *v4, GRegio MElement* source) { if(v1 != v2 && v1 != v3 && v1 != v4 && v2 != v3 && v2 != v4 && v3 != v4) - addTetrahedron(v1, v2, v3, v4, to, source); + addTetrahedron(v1, v2, v3, v4, to); } static int getExtrudedVertices(MElement *ele, ExtrudeParams *ep, int j, int k, @@ -504,7 +496,6 @@ int SubdivideExtrudedMesh(GModel *m) for(unsigned int i = 0; i < gr->pyramids.size(); i++) delete gr->pyramids[i]; gr->pyramids.clear(); - gr->meshAttributes.extrude->elementMap.clear(); // reconstruct extrusion info phase3(gr, pos, edges); // re-Extrude bounding surfaces using edges as constraint @@ -521,7 +512,6 @@ int SubdivideExtrudedMesh(GModel *m) 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); } } @@ -533,7 +523,6 @@ int SubdivideExtrudedMesh(GModel *m) GRegion *gr = regions[i]; ExtrudeParams *ep = gr->meshAttributes.extrude; if(ep->mesh.Holes.size()){ - ep->elementMap.clear(); std::map<int, std::pair<double, std::vector<int> > >::iterator it; for(it = ep->mesh.Holes.begin(); it != ep->mesh.Holes.end(); it++) carveHole(gr, it->first, it->second.first, it->second.second); diff --git a/Mesh/meshPartition.cpp b/Mesh/meshPartition.cpp index 53a0c25448..98b645cc1a 100644 --- a/Mesh/meshPartition.cpp +++ b/Mesh/meshPartition.cpp @@ -28,9 +28,6 @@ #include "discreteFace.h" #include "discreteRegion.h" #include "GFaceCompound.h" -#include "Context.h" -#include "ExtrudeParams.h" - //--Prototype for Chaco interface @@ -280,8 +277,7 @@ int PartitionMesh(GModel *const model, meshPartitionOptions &options) std::vector<int> ssize(options.num_partitions, 0); const int n = graph.getNumVertex(); for(int i = 0; i != n; ++i) { - if (!options.partitionByExtrusion) - ++ssize[graph.partition[i] - 1]; + ++ssize[graph.partition[i] - 1]; graph.element[i]->setPartition(graph.partition[i]); } // Assign partitions to boundary elements @@ -289,53 +285,6 @@ int PartitionMesh(GModel *const model, meshPartitionOptions &options) for(int i = 0; i != nb; ++i) { boElemGrVec[i].elem->setPartition(graph.partition[boElemGrVec[i].grVert]); } - // propagate partition information to extruded elements - if (options.partitionByExtrusion) { - unsigned numElem[5]; - const int meshDim = model->getNumMeshElements(numElem); - switch(meshDim) { - case 2: - // assing partitions for 2D faces and count number of elems in each partition - for (GModel:: fiter fit = model->firstFace(); fit != model->lastFace(); fit++) { - ExtrudeParams* epFace = (*fit)->meshAttributes.extrude; - GEdge *sourceEdge = model->getEdgeByTag(std::abs(epFace->geo.Source)); - epFace->elementMap.propagatePartitionInformation(&ssize); - // loop over extruded edges to set partitions - std::list<GEdge*> regionEdges = (*fit)->edges(); - for (std::list<GEdge*>::iterator eit = regionEdges.begin(); eit != regionEdges.end(); eit++) { - ExtrudeParams* epEdge = (*eit)->meshAttributes.extrude; - if((*eit)!=sourceEdge && epEdge && !epEdge->elementMap.empty()) - epEdge->elementMap.propagatePartitionInformation(); - } - } - break; - case 3: - // assing partitions for 3D volumes and count number of elems in each partition - for (GModel:: riter rit = model->firstRegion(); rit != model->lastRegion(); rit++) { - ExtrudeParams* epRegion = (*rit)->meshAttributes.extrude; - GFace *sourceFace = model->getFaceByTag(std::abs(epRegion->geo.Source)); - epRegion->elementMap.propagatePartitionInformation(&ssize); - // loop over extruded faces to set partitions - std::list<GFace*> regionFaces = (*rit)->faces(); - for (std::list<GFace*>::iterator fit = regionFaces.begin(); fit != regionFaces.end(); fit++) { - if ((*fit) == sourceFace) - continue; - ExtrudeParams* epFace = (*fit)->meshAttributes.extrude; - epFace->elementMap.propagatePartitionInformation(); - // loop over bounding edges to set partitions - std::list<GEdge*> edges = (*fit)->edges(); - GEdge *sourceEdge = model->getEdgeByTag(std::abs(epFace->geo.Source)); - for (std::list<GEdge*>::iterator eit = edges.begin(); eit != edges.end(); eit++) { - ExtrudeParams* epEdge = (*eit)->meshAttributes.extrude; - if((*eit)!=sourceEdge && epEdge && epEdge->geo.Mode == COPIED_ENTITY) - // extruded edges have no source elements (extruded from vertex) - epEdge->elementMap.propagatePartitionInformation(); - } - } - } // TODO: generalize to 2D too - break; - } - } int sMin = graph.getNumVertex(); int sMax = 0; for(int i = 0; i != options.num_partitions; ++i) { @@ -621,7 +570,7 @@ int MakeGraph(GModel *const model, Graph &graph, meshPartitionOptions &options, int ier = 0; // switch(partitionScope) { // case PartitionEntireDomain: - if(!options.partitionByExtrusion){ + /*--------------------------------------------------------------------* * Make a graph for the entire domain *--------------------------------------------------------------------*/ @@ -685,80 +634,7 @@ int MakeGraph(GModel *const model, Graph &graph, meshPartitionOptions &options, } break; } - } - else { -/*--------------------------------------------------------------------* - * Create graph for extrusion source entity (propagate group ids later) - *--------------------------------------------------------------------*/ - unsigned tmp[5]; - const int meshDim = model->getNumMeshElements(tmp); - if(meshDim < 2) { - Msg::Error("No mesh elements were found"); - return 1; - } - std::vector<const GEntity*> sourceEntities; - std::set<const GEntity*> bannedEntities; - unsigned numElem[5] = {0,0,0,0,0}; - switch(meshDim) { - case 2: - for(GModel::fiter it = model->firstFace(); it != model->lastFace(); ++it){ - ExtrudeParams* ep = (*it)->meshAttributes.extrude; - const GEdge *edge = model->getEdgeByTag(std::abs(ep->geo.Source)); - if(!edge){ - Msg::Error("Unknown source edge %d for extrusion", ep->geo.Source); - continue; - } - // mark face for partitioning if not associated to already processed face - if (bannedEntities.find(edge) == bannedEntities.end()) { - sourceEntities.push_back(edge); - edge->getNumMeshElements(numElem); - } - // do not allow partitioning of the extruded edges - std::list<GEdge*> edges = (*it)->edges(); - for(std::list<GEdge*>::iterator eit = edges.begin(); eit != edges.end(); eit++) { - bannedEntities.insert((*eit)); - } - } - break; - case 3: - for(GModel::riter it = model->firstRegion(); it != model->lastRegion(); ++it){ - ExtrudeParams* ep = (*it)->meshAttributes.extrude; - const GFace *face = model->getFaceByTag(std::abs(ep->geo.Source)); - if(!face){ - Msg::Error("Unknown source surface %d for extrusion", ep->geo.Source); - continue; - } - // mark face for partitioning if not associated to already processed region - if (bannedEntities.find(face) == bannedEntities.end()) { - sourceEntities.push_back(face); - face->getNumMeshElements(numElem); - } - // do not allow partitioning of the extruded faces - std::list<GFace*> faces = (*it)->faces(); - for(std::list<GFace*>::iterator fit = faces.begin(); fit != faces.end(); fit++) { - bannedEntities.insert((*fit)); - } - } - break; - } - // build a graph only on the source entities - try { - // Allocate memory for the graph - const int numGrVert = numElem[ElemTypeTri] + numElem[ElemTypeQuad] - + numElem[ElemTypePolyg]; - const int maxGrEdge = (numElem[ElemTypeTri]*3 + numElem[ElemTypeQuad]*4 - + numElem[ElemTypePolyg]*4)/2; - graph.allocate(numGrVert, maxGrEdge); - // Make the graph - MakeGraphDIM<2>(sourceEntities.begin(), sourceEntities.end(), - model->firstEdge(), model->lastEdge(), graph, - boElemGrVec); - } - catch (...){ - Msg::Error("Exception thrown during graph generation"); - ier = 2; - } - } + // break; // case PartitionByPhysical: diff --git a/Mesh/meshPartitionOptions.cpp b/Mesh/meshPartitionOptions.cpp index c9f4c6dee8..326a6d966f 100644 --- a/Mesh/meshPartitionOptions.cpp +++ b/Mesh/meshPartitionOptions.cpp @@ -39,7 +39,6 @@ void meshPartitionOptions::setDefaults() refine_algorithm = 3; createPartitionBoundaries = true; createGhostCells = true; - partitionByExtrusion =false; triWeight = 1; quaWeight = 1; tetWeight = 1; diff --git a/Mesh/meshPartitionOptions.h b/Mesh/meshPartitionOptions.h index 1620ee2c6f..46e80def72 100644 --- a/Mesh/meshPartitionOptions.h +++ b/Mesh/meshPartitionOptions.h @@ -80,8 +80,6 @@ class meshPartitionOptions // 3 - Random boundary refinement (with // minimization of connectivity // along sub-domains) - int partitionByExtrusion; // if true, all extruded elements belong - // to the same partition as the source element // element weights for load-balancing (currently used in METIS algorithm 3) diff --git a/Plugin/ModifyComponent.cpp b/Plugin/ModifyComponent.cpp index 7a918f41fc..0c6ed51408 100644 --- a/Plugin/ModifyComponent.cpp +++ b/Plugin/ModifyComponent.cpp @@ -14,7 +14,8 @@ StringXNumber ModifyComponentOptions_Number[] = { {GMSH_FULLRC, "TimeStep", NULL, -1.}, {GMSH_FULLRC, "View", NULL, -1.}, {GMSH_FULLRC, "OtherTimeStep", NULL, -1.}, - {GMSH_FULLRC, "OtherView", NULL, -1.} + {GMSH_FULLRC, "OtherView", NULL, -1.}, + {GMSH_FULLRC, "ForceInterpolation", NULL, 0.} }; StringXString ModifyComponentOptions_String[] = { @@ -96,6 +97,7 @@ PView *GMSH_ModifyComponentPlugin::execute(PView *view) int iView = (int)ModifyComponentOptions_Number[2].def; int otherTimeStep = (int)ModifyComponentOptions_Number[3].def; int otherView = (int)ModifyComponentOptions_Number[4].def; + int forceInterpolation = (int)ModifyComponentOptions_Number[5].def; PView *v1 = getView(iView, view); if(!v1) return view; @@ -142,7 +144,8 @@ PView *GMSH_ModifyComponentPlugin::execute(PView *view) std::vector<double> values(numVariables), res(1); OctreePost *octree = 0; - if((data1->getNumEntities() != data2->getNumEntities()) || + if(forceInterpolation || + (data1->getNumEntities() != data2->getNumEntities()) || (data1->getNumElements() != data2->getNumElements())){ Msg::Info("Other view based on different grid: interpolating..."); octree = new OctreePost(v2); diff --git a/benchmarks/stl/mobilette.geo b/benchmarks/stl/mobilette.geo index 96dd603053..815b8b0f58 100644 --- a/benchmarks/stl/mobilette.geo +++ b/benchmarks/stl/mobilette.geo @@ -1,4 +1,4 @@ -Mesh.Algorithm = 8; //(1=MeshAdapt, 2=Automatic, 5=Delaunay, 6=Frontal, 7=bamg) +//Mesh.Algorithm = 8; //(1=MeshAdapt, 2=Automatic, 5=Delaunay, 6=Frontal, 7=bamg) Mesh.CharacteristicLengthMin=1.5/2; Mesh.CharacteristicLengthMax=2.5/2; Mesh.RemeshAlgorithm=1; @@ -26,8 +26,8 @@ EndFor Surface Loop(1) = {s : s + #ss[]-1}; Volume(1) = {1}; -Mesh.RecombineAll=1; -Mesh.RecombinationAlgorithm=1; +//Mesh.RecombineAll=1; +//Mesh.RecombinationAlgorithm=1; Physical Surface(1) = {s : s + #ss[]-1}; Physical Volume(1) = 1; -- GitLab