From 04f0835af8412e733f5f99652315f0a3ff6509c0 Mon Sep 17 00:00:00 2001 From: Emilie Marchandise <emilie.marchandise@uclouvain.be> Date: Wed, 4 Apr 2012 07:20:16 +0000 Subject: [PATCH] extrudeBoundaryLayer interface ok for GModelFactory --- Geo/GModelFactory.cpp | 8 -------- Geo/Geo.cpp | 4 +--- Mesh/BoundaryLayers.cpp | 4 ---- Mesh/CenterlineField.cpp | 26 +++++++++++++++++++------- Mesh/CenterlineField.h | 1 + 5 files changed, 21 insertions(+), 22 deletions(-) diff --git a/Geo/GModelFactory.cpp b/Geo/GModelFactory.cpp index c88833d111..765619e0e2 100644 --- a/Geo/GModelFactory.cpp +++ b/Geo/GModelFactory.cpp @@ -288,15 +288,7 @@ std::vector<GFace *> GeoFactory::addRuledFaces(GModel *gm, GEntity* GeoFactory::extrudeBoundaryLayer(GModel *gm, GEntity *e, int nbLayers, double hLayer, int dir, int view) { - printf("coucou dans geo extrude normals \n"); - Msg::Debug("Gmsh model (GModel) before extrude has:"); - Msg::Debug("%d Vertices", gm->getNumVertices()); - Msg::Debug("%d Edges", gm->getNumEdges()); - Msg::Debug("%d Faces", gm->getNumFaces()); - Msg::Debug("%d Regions", gm->getNumRegions()); - ExtrudeParams ep; - printf("***** BL INDEX =%d \n", dir); ep.mesh.BoundaryLayerIndex = dir; ep.mesh.ViewIndex = view; ep.mesh.NbLayer = 1; //this may be more general for defining different layers diff --git a/Geo/Geo.cpp b/Geo/Geo.cpp index 34f20c9108..fbbd0d4239 100644 --- a/Geo/Geo.cpp +++ b/Geo/Geo.cpp @@ -2753,8 +2753,7 @@ void ExtrudeShapes(int type, List_T *list_in, Shape top; top.Num = Extrude_ProtudeSurface(type, shape.Num, T0, T1, T2, A0, A1, A2, X0, X1, X2, alpha, - &pv, e); - printf("extruded surface =%d \n", top.Num); + &pv, e); Surface *ps = FindSurface(top.Num); top.Type = ps ? ps->Typ : 0; @@ -2763,7 +2762,6 @@ void ExtrudeShapes(int type, List_T *list_in, Shape body; body.Num = pv->Num; body.Type = pv->Typ; - printf("extruded volume =%d \n", pv->Num); List_Add(list_out, &body); if(CTX::instance()->geom.extrudeReturnLateral){ for(int j = 0; j < List_Nbr(pv->Surfaces); j++){ diff --git a/Mesh/BoundaryLayers.cpp b/Mesh/BoundaryLayers.cpp index 844a4ff60f..02c6b467b5 100644 --- a/Mesh/BoundaryLayers.cpp +++ b/Mesh/BoundaryLayers.cpp @@ -45,7 +45,6 @@ static void addExtrudeNormals(std::vector<T*> &elements, int invert, } } else{ // get extrusion direction from Gouraud-shaded element normals - printf("get extrusion from normals \n"); for(unsigned int i = 0; i < elements.size(); i++){ MElement *ele = elements[i]; SVector3 n(0, 0, 0); @@ -83,7 +82,6 @@ static void addExtrudeNormals(std::set<T*> &entities, OctreePost *octree = 0; #if defined(HAVE_POST) if(view != -1){ - printf("extrude normals with view %d \n", view); if(view >= 0 && view < (int)PView::list.size()){ octree = new OctreePost(PView::list[view]); if(PView::list[view]->getData()->getNumVectors()) @@ -188,7 +186,6 @@ int Mesh2DWithBoundaryLayers(GModel *m) Msg::Error("Unknown source curve %d for boundary layer", ep->geo.Source); return 0; } - //printf("index edge (%d) =%d \n", ge->tag(), ep->mesh.BoundaryLayerIndex); std::pair<bool, std::pair<int, int> > tags (ep->geo.Source < 0, std::pair<int, int> (ep->mesh.BoundaryLayerIndex, ep->mesh.ViewIndex)); @@ -210,7 +207,6 @@ int Mesh2DWithBoundaryLayers(GModel *m) Msg::Error("Unknown source face %d for boundary layer", ep->geo.Source); return 0; } - //printf("index surface (%d) =%d \n", gf->tag(), ep->mesh.BoundaryLayerIndex); std::pair<bool, std::pair<int, int> > tags (ep->geo.Source < 0, std::pair<int, int> (ep->mesh.BoundaryLayerIndex, ep->mesh.ViewIndex)); diff --git a/Mesh/CenterlineField.cpp b/Mesh/CenterlineField.cpp index 6b68c98706..9d1a9eab90 100644 --- a/Mesh/CenterlineField.cpp +++ b/Mesh/CenterlineField.cpp @@ -345,19 +345,19 @@ Centerline::Centerline(): kdtree(0), kdtreeR(0), nodes(0), nodesR(0){ nbPoints = 25; hLayer = 0.3; nbElemLayer = 3; + is_cut = false; + is_closed = false; + is_extruded = false; - options["FileName"] = new FieldOptionString (fileName, "File name for the centerlines", &update_needed); - options["nbPoints"] = new FieldOptionInt(nbPoints, "Number of mesh elements in a circle"); callbacks["closeVolume"] = new FieldCallbackGeneric<Centerline>(this, &Centerline::closeVolume, "Create In/Outlet planar faces \n"); + callbacks["extrudeWall"] = new FieldCallbackGeneric<Centerline>(this, &Centerline::extrudeWall, "Extrude wall \n"); callbacks["cutMesh"] = new FieldCallbackGeneric<Centerline>(this, &Centerline::cutMesh, "Cut the initial mesh in different mesh partitions using the centerlines \n"); - callbacks["extrudeWall"] = new FieldCallbackGeneric<Centerline>(this, &Centerline::extrudeWall, "Extrude wall \n"); + options["FileName"] = new FieldOptionString (fileName, "File name for the centerlines", &update_needed); + options["nbPoints"] = new FieldOptionInt(nbPoints, "Number of mesh elements in a circle"); options["nbElemLayer"] = new FieldOptionInt(nbElemLayer, "Number of mesh elements the extruded layer"); options["hLayer"] = new FieldOptionDouble(hLayer, "Thickness (% of radius) of the extruded layer"); - is_cut = false; - is_closed = false; - is_extruded = false; } @@ -830,6 +830,18 @@ void Centerline::createClosedVolume(){ } +void Centerline::extrudeBoundaryLayerWall(){ + + printf("extrude boundary layer wall %d %g \n", nbElemLayer, hLayer); + for (int i= 0; i< NF; i++){ + GFace *gf = current->getFaceByTag(NF+i+1);//at this moment compound is not meshed yet exist yet + current->setFactory("Gmsh"); + current->extrudeBoundaryLayer(gf, nbElemLayer, hLayer, 0, -1); + //view -5 to scale hLayer by radius in BoundaryLayers.cpp + } + +} + void Centerline::closeVolume(){ is_closed = true; @@ -941,7 +953,7 @@ void Centerline::cutMesh(){ if (is_closed) createClosedVolume(); //extrude wall - //if(is_extruded) extrudeNormalWall(); + if(is_extruded) extrudeBoundaryLayerWall(); Msg::Info("Splitting mesh by centerlines done "); diff --git a/Mesh/CenterlineField.h b/Mesh/CenterlineField.h index 6d17118177..a8adc32a72 100644 --- a/Mesh/CenterlineField.h +++ b/Mesh/CenterlineField.h @@ -148,6 +148,7 @@ class Centerline : public Field{ //Create extruded wall void extrudeWall(); + void extrudeBoundaryLayerWall(); // Cut the tubular structure with a disk // perpendicular to the tubular structure -- GitLab