diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 319212e11a3583fc1e83e0023d22136dfb1b3f59..86d0add34f1c6eb6c25cb0f33704bc12447290d8 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.494 2006-12-14 02:44:01 geuzaine Exp $ +// $Id: Callbacks.cpp,v 1.495 2006-12-16 01:25:58 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -3344,9 +3344,6 @@ static void _action_point_line_surface_volume(int action, int mode, char *what) case 9: add_recosurf(List1, CTX.filename); break; - case 10: - Msg(GERROR, "BDS->get_geom and set status must be reinterfaced"); - break; default: Msg(GERROR, "Unknown action on selected entities"); break; @@ -3359,9 +3356,6 @@ static void _action_point_line_surface_volume(int action, int mode, char *what) } } if(ib == 'q') { - if(action == 10){ - Msg(GERROR, "BDS->classify() must be reinterfaced"); - } ZeroHighlight(); Draw(); break; @@ -3942,7 +3936,7 @@ void mesh_define_transfinite_cb(CALLBACK_ARGS) WID->set_context(menu_mesh_define_transfinite, 0); } -static void _add_transfinite_elliptic(int type, int dim) +static void _add_transfinite(int dim) { std::vector<GVertex*> vertices; std::vector<GEdge*> edges; @@ -4017,9 +4011,11 @@ static void _add_transfinite_elliptic(int type, int dim) if(ib == 'l') { switch (dim) { case 1: - HighlightEntity(edges[0]); + for(unsigned int i = 0; i < edges.size(); i++){ + HighlightEntity(edges[i]); + p[n++] = edges[i]->tag(); + } Draw(); - p[n++] = edges[0]->tag(); break; case 2: case 3: @@ -4060,11 +4056,10 @@ static void _add_transfinite_elliptic(int type, int dim) switch (dim) { case 2: if(n == 3 + 1 || n == 4 + 1) - add_trsfellisurf(type, n, p, CTX.filename, - (char*)WID->context_mesh_choice[1]->text()); + add_trsfsurf(n, p, CTX.filename, + (char*)WID->context_mesh_choice[1]->text()); else - Msg(GERROR, "Wrong number of points for %s surface", - type ? "elliptic" : "transfinite"); + Msg(GERROR, "Wrong number of points for transfinite surface"); break; case 3: if(n == 6 + 1 || n == 8 + 1) @@ -4096,18 +4091,18 @@ stopall: void mesh_define_transfinite_line_cb(CALLBACK_ARGS) { WID->create_mesh_context_window(1); - _add_transfinite_elliptic(0, 1); + _add_transfinite(1); } void mesh_define_transfinite_surface_cb(CALLBACK_ARGS) { WID->create_mesh_context_window(2); - _add_transfinite_elliptic(0, 2); + _add_transfinite(2); } void mesh_define_transfinite_volume_cb(CALLBACK_ARGS) { - _add_transfinite_elliptic(0, 3); + _add_transfinite(3); } // Dynamic Solver Menus diff --git a/Geo/GEdge.cpp b/Geo/GEdge.cpp index 18b3e84cfea1b3c4771914ac1eb08080b2a2d4a0..b87d30de42f5ba91486769e04ea76e197bec6d50 100644 --- a/Geo/GEdge.cpp +++ b/Geo/GEdge.cpp @@ -1,4 +1,4 @@ -// $Id: GEdge.cpp,v 1.20 2006-11-29 16:57:00 remacle Exp $ +// $Id: GEdge.cpp,v 1.21 2006-12-16 01:25:58 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -30,13 +30,7 @@ GEdge::GEdge(GModel *model, int tag, GVertex *_v0, GVertex *_v1) { if(v0) v0->addEdge(this); if(v1) v1->addEdge(this); - - meshAttributes.Method = LIBRE; - meshAttributes.coeffTransfinite = 0.; - meshAttributes.nbPointsTransfinite = 0; - meshAttributes.typeTransfinite = 0; - meshAttributes.extrude = 0; - meshAttributes.meshSize = 1.e22; + resetMeshAttributes(); } GEdge::~GEdge() @@ -53,6 +47,16 @@ GEdge::~GEdge() lines.clear(); } +void GEdge::resetMeshAttributes() +{ + meshAttributes.Method = LIBRE; + meshAttributes.coeffTransfinite = 0.; + meshAttributes.nbPointsTransfinite = 0; + meshAttributes.typeTransfinite = 0; + meshAttributes.extrude = 0; + meshAttributes.meshSize = 1.e22; +} + void GEdge::addFace(GFace *e) { l_faces.push_back(e); diff --git a/Geo/GEdge.h b/Geo/GEdge.h index 58e2d10ef2ca6fbb8128c204a0d1c76292bb1d03..512798b9c41f6b56d1522c5c892f55dbdb9b857d 100644 --- a/Geo/GEdge.h +++ b/Geo/GEdge.h @@ -104,9 +104,11 @@ class GEdge : public GEntity { inline double length () const {return _length;} inline void setLength (const double l) {_length = l;} - // onr can impose the mesh size at an edge + // one can impose the mesh size at an edge virtual double prescribedMeshSizeAtVertex() const {return meshAttributes.meshSize;} + // Resets the mesh attributes to default values + virtual void resetMeshAttributes(); struct { char Method; diff --git a/Geo/GEntity.h b/Geo/GEntity.h index 4acc2a0cfa7b91a9fb1d8f487b933196d0ca2f8d..f1756a873f2ee087aafc2a86362ef5754a656853 100644 --- a/Geo/GEntity.h +++ b/Geo/GEntity.h @@ -206,6 +206,9 @@ class GEntity { // Returns a type-specific additional information string virtual std::string getAdditionalInfoString() { return std::string(""); } + // Resets the mesh attributes to default values + virtual void resetMeshAttributes() { return; } + // The mesh vertices uniquely owned by the entity std::vector<MVertex*> mesh_vertices; diff --git a/Geo/GFace.cpp b/Geo/GFace.cpp index 67522421fec99dcd13e98f9d4b795d180f811222..fbd663f958521e64df6a045eabdf586239774cbe 100644 --- a/Geo/GFace.cpp +++ b/Geo/GFace.cpp @@ -1,4 +1,4 @@ -// $Id: GFace.cpp,v 1.28 2006-12-04 16:41:39 geuzaine Exp $ +// $Id: GFace.cpp,v 1.29 2006-12-16 01:25:58 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -39,11 +39,7 @@ extern Context_T CTX; GFace::GFace(GModel *model, int tag) : GEntity(model, tag), r1(0), r2(0) { - meshAttributes.recombine = 0; - meshAttributes.recombineAngle = 0.; - meshAttributes.Method = LIBRE; - meshAttributes.transfiniteArrangement = 0; - meshAttributes.extrude = 0; + resetMeshAttributes(); } GFace::~GFace() @@ -68,6 +64,15 @@ GFace::~GFace() quadrangles.clear(); } +void GFace::resetMeshAttributes() +{ + meshAttributes.recombine = 0; + meshAttributes.recombineAngle = 0.; + meshAttributes.Method = LIBRE; + meshAttributes.transfiniteArrangement = 0; + meshAttributes.extrude = 0; +} + SBoundingBox3d GFace::bounds() const { SBoundingBox3d res; diff --git a/Geo/GFace.h b/Geo/GFace.h index ed4f9b4d08916fb9f79bb35c1cd92224098d9285..c8038a4966b75a9e06b8a953a84f7fc8963dfe62 100644 --- a/Geo/GFace.h +++ b/Geo/GFace.h @@ -136,16 +136,8 @@ class GFace : public GEntity double &x, double &y, double &z) const; void getMeanPlaneData(double plan[3][3]) const; - // a crude graphical representation using a "cross" defined by pairs - // of start/end points - std::vector<SPoint3> cross; - - // a map for accessing the transfinite vertices using a pair of indices - std::map<std::pair<int, int>, MVertex*> transfinite_vertices; - - std::vector<MTriangle*> triangles; - std::vector<MQuadrangle*> quadrangles; - std::list<GEdgeLoop> edgeLoops; + // Resets the mesh attributes to default values + virtual void resetMeshAttributes(); struct { // do we recombine the triangles of the mesh ? @@ -164,6 +156,16 @@ class GFace : public GEntity // edge loops } meshAttributes ; + // a crude graphical representation using a "cross" defined by pairs + // of start/end points + std::vector<SPoint3> cross; + + // a map for accessing the transfinite vertices using a pair of indices + std::map<std::pair<int, int>, MVertex*> transfinite_vertices; + + std::vector<MTriangle*> triangles; + std::vector<MQuadrangle*> quadrangles; + std::list<GEdgeLoop> edgeLoops; }; #endif diff --git a/Geo/GModelIO_Geo.cpp b/Geo/GModelIO_Geo.cpp index cdaf5d8f1affbceb209791d794a0bb4f46418828..69454a6cfc9c9ebbe5e34982113bdfa3d77ede52 100644 --- a/Geo/GModelIO_Geo.cpp +++ b/Geo/GModelIO_Geo.cpp @@ -1,4 +1,4 @@ -// $Id: GModelIO_Geo.cpp,v 1.3 2006-11-27 22:22:13 geuzaine Exp $ +// $Id: GModelIO_Geo.cpp,v 1.4 2006-12-16 01:25:58 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -67,6 +67,8 @@ int GModel::importTHEM() vertexByTag(c->end->Num)); add(e); } + else + e->resetMeshAttributes(); if(!c->Visible) e->setVisibility(0); if(c->Color.type) e->setColor(c->Color.mesh); } @@ -83,6 +85,8 @@ int GModel::importTHEM() f = new gmshFace(this, s); add(f); } + else + f->resetMeshAttributes(); if(!s->Visible) f->setVisibility(0); if(s->Color.type) f->setColor(s->Color.mesh); } @@ -98,6 +102,8 @@ int GModel::importTHEM() r = new gmshRegion(this, v); add(r); } + else + r->resetMeshAttributes(); if(!v->Visible) r->setVisibility(0); if(v->Color.type) r->setColor(v->Color.mesh); } diff --git a/Geo/GRegion.cpp b/Geo/GRegion.cpp index 8baba82656d08c459b0929848953e56df71d1c2e..1a82331ef3cb1a68a77fe66556e30760bb41279a 100644 --- a/Geo/GRegion.cpp +++ b/Geo/GRegion.cpp @@ -1,4 +1,4 @@ -// $Id: GRegion.cpp,v 1.13 2006-11-27 22:22:13 geuzaine Exp $ +// $Id: GRegion.cpp,v 1.14 2006-12-16 01:25:58 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -25,8 +25,7 @@ GRegion::GRegion(GModel *model, int tag) : GEntity (model, tag) { - meshAttributes.Method = LIBRE; - meshAttributes.extrude = 0; + resetMeshAttributes(); } GRegion::~GRegion() @@ -58,6 +57,12 @@ GRegion::~GRegion() pyramids.clear(); } +void GRegion::resetMeshAttributes() +{ + meshAttributes.Method = LIBRE; + meshAttributes.extrude = 0; +} + SBoundingBox3d GRegion::bounds() const { SBoundingBox3d res; diff --git a/Geo/GRegion.h b/Geo/GRegion.h index b2bcd6529c2178323965809a6c85cf618c80f76b..fb8e1e19a73d20cef277f874c29a001d401c84cc 100644 --- a/Geo/GRegion.h +++ b/Geo/GRegion.h @@ -49,8 +49,11 @@ class GRegion : public GEntity { // Delete the mesh partitions defined on this region. void deleteMeshPartitions(); + // Resets the mesh attributes to default values + virtual void resetMeshAttributes(); + struct { - char Method; + char Method; // the extrusion parameters (if any) ExtrudeParams *extrude; // corners of the transfinite interpolation diff --git a/Geo/GeoStringInterface.cpp b/Geo/GeoStringInterface.cpp index 69515dfe57d6be00b2ed708cc095d02acf8a5363..eed7fd8c8ee18fd3db201f18e7a92d3309cd8275 100644 --- a/Geo/GeoStringInterface.cpp +++ b/Geo/GeoStringInterface.cpp @@ -1,4 +1,4 @@ -// $Id: GeoStringInterface.cpp,v 1.2 2006-11-27 22:22:13 geuzaine Exp $ +// $Id: GeoStringInterface.cpp,v 1.3 2006-12-16 01:25:58 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -138,12 +138,11 @@ void delet(List_T *list, char *fich, char *what) add_infile(text, fich, true); } -void add_trsfellisurf(int type, int N, int *l, char *fich, char *dir) +void add_trsfsurf(int N, int *l, char *fich, char *dir) { char text[BUFFSIZE], text2[BUFFSIZE]; - snprintf(text, BUFFSIZE, "%s Surface {%d} = {", - type ? "Elliptic" : "Transfinite", l[0]); + snprintf(text, BUFFSIZE, "Transfinite Surface {%d} = {", l[0]); for(int i = 1; i < N; i++) { if(i == 1) snprintf(text2, BUFFSIZE, "%d", l[i]); diff --git a/Geo/GeoStringInterface.h b/Geo/GeoStringInterface.h index 3b2757a901413789fe67a4a1897eafa1890e2bbe..5ab4cd5a49004989a908be53a63fd00756cda2fb 100644 --- a/Geo/GeoStringInterface.h +++ b/Geo/GeoStringInterface.h @@ -29,7 +29,7 @@ void coherence(char *fich); void delet(List_T *list, char *fich, char *what); void add_infile(char *text, char *fich, bool deleted_something=false); void add_trsfline(int N, int *l, char *fich, char *type, char *typearg, char *pts); -void add_trsfellisurf(int type, int N, int *l, char *fich, char *dir); +void add_trsfsurf(int N, int *l, char *fich, char *dir); void add_trsfvol(int N, int *l, char *fich); void add_charlength(List_T *list, char *fich, char *lc); void add_recosurf(List_T *list, char *fich); diff --git a/Geo/gmshEdge.cpp b/Geo/gmshEdge.cpp index 96df0e76e9892ae17e4b6538b77e52304be0f219..65e849a3ae55e4bc0c43e441108601f608ea53e1 100644 --- a/Geo/gmshEdge.cpp +++ b/Geo/gmshEdge.cpp @@ -1,4 +1,4 @@ -// $Id: gmshEdge.cpp,v 1.21 2006-11-27 22:22:14 geuzaine Exp $ +// $Id: gmshEdge.cpp,v 1.22 2006-12-16 01:25:58 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -30,11 +30,7 @@ extern Mesh *THEM; gmshEdge::gmshEdge(GModel *model, Curve *edge, GVertex *v1, GVertex *v2) : GEdge(model, edge->Num, v1, v2), c(edge) { - meshAttributes.Method = c->Method; - meshAttributes.nbPointsTransfinite = c->ipar[0]; - meshAttributes.coeffTransfinite = c->dpar[0]; - meshAttributes.typeTransfinite = c->ipar[1]; - meshAttributes.extrude = c->Extrude; + resetMeshAttributes(); } gmshEdge::gmshEdge(GModel *model, int num) @@ -45,6 +41,15 @@ gmshEdge::gmshEdge(GModel *model, int num) CreateReversedCurve(c); } +void gmshEdge::resetMeshAttributes() +{ + meshAttributes.Method = c->Method; + meshAttributes.nbPointsTransfinite = c->ipar[0]; + meshAttributes.coeffTransfinite = c->dpar[0]; + meshAttributes.typeTransfinite = c->ipar[1]; + meshAttributes.extrude = c->Extrude; +} + Range<double> gmshEdge::parBounds(int i) const { return(Range<double>(c->ubeg, c->uend)); diff --git a/Geo/gmshEdge.h b/Geo/gmshEdge.h index e2ed7df911bf7aa95834f877c7de0b7d58ed9d0c..fe214653bf792c2e4269a2108a13924a46ff8345 100644 --- a/Geo/gmshEdge.h +++ b/Geo/gmshEdge.h @@ -49,6 +49,7 @@ class gmshEdge : public GEdge { virtual double parFromPoint(const SPoint3 &pt) const; virtual int minimumMeshSegments () const; virtual int minimumDrawSegments () const; + virtual void resetMeshAttributes (); }; #endif diff --git a/Geo/gmshFace.cpp b/Geo/gmshFace.cpp index a4485bbf9f8c70604c5f9edf4ec1128d51b1391e..399de136554abd6b1f53c6f3ab9ce0b872c506ea 100644 --- a/Geo/gmshFace.cpp +++ b/Geo/gmshFace.cpp @@ -1,4 +1,4 @@ -// $Id: gmshFace.cpp,v 1.30 2006-12-03 17:45:37 geuzaine Exp $ +// $Id: gmshFace.cpp,v 1.31 2006-12-16 01:25:58 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -66,16 +66,29 @@ gmshFace::gmshFace(GModel *m, Surface *face) } } + resetMeshAttributes(); +} + +gmshFace::gmshFace(GModel *m, int num) + : GFace(m, num) +{ + s = Create_Surface(num, MSH_SURF_DISCRETE); + Tree_Add(THEM->Surfaces, &s); +} + +void gmshFace::resetMeshAttributes() +{ meshAttributes.recombine = s->Recombine; meshAttributes.recombineAngle = s->RecombineAngle; meshAttributes.Method = s->Method; meshAttributes.extrude = s->Extrude; if(meshAttributes.Method == TRANSFINI){ meshAttributes.transfiniteArrangement = s->Recombine_Dir; + meshAttributes.corners.clear(); for(int i = 0; i < List_Nbr(s->TrsfPoints); i++){ Vertex *corn; List_Read(s->TrsfPoints, i, &corn); - GVertex *gv = m->vertexByTag(corn->Num); + GVertex *gv = model()->vertexByTag(corn->Num); if(gv) meshAttributes.corners.push_back(gv); else @@ -84,13 +97,6 @@ gmshFace::gmshFace(GModel *m, Surface *face) } } -gmshFace::gmshFace(GModel *m, int num) - : GFace(m, num) -{ - s = Create_Surface(num, MSH_SURF_DISCRETE); - Tree_Add(THEM->Surfaces, &s); -} - Range<double> gmshFace::parBounds(int i) const { return Range<double>(0, 1); diff --git a/Geo/gmshFace.h b/Geo/gmshFace.h index 21e29c6bef277e1a6b3a8bd9ca9d1f4175e1a2f8..e4d3344dd9a609297a78f3720fea39259f0d3de9 100644 --- a/Geo/gmshFace.h +++ b/Geo/gmshFace.h @@ -59,6 +59,7 @@ class gmshFace : public GFace { void * getNativePtr() const { return s; } virtual bool surfPeriodic(int dim) const { return false;} virtual SPoint2 parFromPoint(const SPoint3 &) const; + virtual void resetMeshAttributes(); }; #endif diff --git a/Geo/gmshRegion.cpp b/Geo/gmshRegion.cpp index 5ec9f572c6dfba595daf74ade06d81bea1addddc..cfd3af9cebee3d1032bb7792d12e1cd143dd903e 100644 --- a/Geo/gmshRegion.cpp +++ b/Geo/gmshRegion.cpp @@ -1,4 +1,4 @@ -// $Id: gmshRegion.cpp,v 1.12 2006-12-03 03:19:55 geuzaine Exp $ +// $Id: gmshRegion.cpp,v 1.13 2006-12-16 01:25:58 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -41,13 +41,26 @@ gmshRegion::gmshRegion(GModel *m, ::Volume * volume) l_dirs.push_back(ori); } - meshAttributes.Method = volume->Method; - meshAttributes.extrude = volume->Extrude; + resetMeshAttributes(); +} + +gmshRegion::gmshRegion(GModel *m, int num) + : GRegion(m, num) +{ + v = Create_Volume(num, MSH_VOLUME_DISCRETE); + Tree_Add(THEM->Volumes, &v); +} + +void gmshRegion::resetMeshAttributes() +{ + meshAttributes.Method = v->Method; + meshAttributes.extrude = v->Extrude; if(meshAttributes.Method == TRANSFINI){ - for(int i = 0; i < List_Nbr(volume->TrsfPoints); i++){ + meshAttributes.corners.clear(); + for(int i = 0; i < List_Nbr(v->TrsfPoints); i++){ Vertex *corn; - List_Read(volume->TrsfPoints, i, &corn); - GVertex *gv = m->vertexByTag(corn->Num); + List_Read(v->TrsfPoints, i, &corn); + GVertex *gv = model()->vertexByTag(corn->Num); if(gv) meshAttributes.corners.push_back(gv); else @@ -56,13 +69,6 @@ gmshRegion::gmshRegion(GModel *m, ::Volume * volume) } } -gmshRegion::gmshRegion(GModel *m, int num) - : GRegion(m, num) -{ - v = Create_Volume(num, MSH_VOLUME_DISCRETE); - Tree_Add(THEM->Volumes, &v); -} - GEntity::GeomType gmshRegion::geomType() const { switch (v->Typ){ diff --git a/Geo/gmshRegion.h b/Geo/gmshRegion.h index d351f105a864a3b9e16906327472e8747823efbe..6b562415f1d39be8d64b3ddaea766690b0e3bd39 100644 --- a/Geo/gmshRegion.h +++ b/Geo/gmshRegion.h @@ -34,6 +34,7 @@ class gmshRegion : public GRegion { virtual GeomType geomType() const; ModelType getNativeType() const { return GmshModel; } void * getNativePtr() const { return v; } + virtual void resetMeshAttributes(); }; #endif diff --git a/doc/TODO b/doc/TODO index c52385f5d8f1884e89880d7895e964715b0763ce..725cd3edb6e63965560669b408880f604bba845a 100644 --- a/doc/TODO +++ b/doc/TODO @@ -1,4 +1,4 @@ -$Id: TODO,v 1.33 2006-12-12 01:39:15 geuzaine Exp $ +$Id: TODO,v 1.34 2006-12-16 01:25:58 geuzaine Exp $ ******************************************************************** @@ -18,11 +18,6 @@ bug: quads orientation is wrong after recombine ******************************************************************** -return error when trying to mesh a volume with netgen/tetgen whose -boundary contains quads - -******************************************************************** - physical groups->add->line/surface: pressing '-' after/while selecting a surface should add it with reverse orientation?