diff --git a/Geo/GVertex.cpp b/Geo/GVertex.cpp index 85f1c49ce87156bf760c7b64103aa8bd85d708bc..41403765d44e99d3417226dca4e1520f5b7ce07d 100644 --- a/Geo/GVertex.cpp +++ b/Geo/GVertex.cpp @@ -13,6 +13,7 @@ GVertex::GVertex(GModel *m, int tag, double ms) : GEntity(m, tag), meshSize(ms) { + resetMeshAttributes(); } GVertex::~GVertex() @@ -30,6 +31,11 @@ void GVertex::deleteMesh() model()->destroyMeshCaches(); } +void GVertex::resetMeshAttributes() +{ + meshSize = MAX_LC; +} + void GVertex::setPosition(GPoint &p) { Msg::Error("Cannot set position of this kind of vertex"); diff --git a/Geo/GVertex.h b/Geo/GVertex.h index 96e98fd22e00b88ff4b8ff36e674630369032a08..5c39e8f0615481eed74be46d47eeccccc0ee843d 100644 --- a/Geo/GVertex.h +++ b/Geo/GVertex.h @@ -33,6 +33,9 @@ class GVertex : public GEntity // delete mesh data virtual void deleteMesh(); + // reset the mesh attributes to default values + virtual void resetMeshAttributes(); + // get/set the coordinates of the vertex virtual GPoint point() const = 0; virtual double x() const = 0; diff --git a/Geo/gmshVertex.cpp b/Geo/gmshVertex.cpp index cb3d4fffc34af158a026b6732189f6925d8741ec..b2dcce283eaec3ac88fc0257e8243f5e306baa8b 100644 --- a/Geo/gmshVertex.cpp +++ b/Geo/gmshVertex.cpp @@ -17,6 +17,11 @@ gmshVertex::gmshVertex(GModel *m, Vertex *_v) { } +void gmshVertex::resetMeshAttributes() +{ + meshSize = v->lc; +} + void gmshVertex::setPosition(GPoint &p) { v->Pos.X = p.x(); @@ -42,16 +47,14 @@ SPoint2 gmshVertex::reparamOnFace(const GFace *face, int dir) const Surface *s = (Surface*)face->getNativePtr(); - // printf("coucou HERE I AM %d\n",s->Typ); - if(s->geometry){ // It is not always right if it is periodic. - if(l_edges.size() == 1 && + if(l_edges.size() == 1 && (*l_edges.begin())->getBeginVertex() == (*l_edges.begin())->getEndVertex()){ Range<double> bb = (*l_edges.begin())->parBounds(0); return (*l_edges.begin())->reparamOnFace(face, bb.low(), dir); - } + } return v->pntOnGeometry; } @@ -60,7 +63,7 @@ SPoint2 gmshVertex::reparamOnFace(const GFace *face, int dir) const for(int i = 0; i < 4; i++) List_Read(s->Generatrices, i, &C[i]); - double U, V; + double U, V; if ((C[0]->beg == v && C[3]->beg == v) || (C[0]->end == v && C[3]->beg == v) || (C[0]->beg == v && C[3]->end == v) || @@ -95,12 +98,11 @@ SPoint2 gmshVertex::reparamOnFace(const GFace *face, int dir) const return SPoint2(U, V); } else if(s->Typ == MSH_SURF_TRIC){ - // printf("coucou HERE I AM TRIC\n"); Curve *C[3]; for(int i = 0; i < 3; i++) List_Read(s->Generatrices, i, &C[i]); - double U, V; + double U, V; if ((C[0]->beg == v && C[2]->beg == v) || (C[0]->end == v && C[2]->beg == v) || (C[0]->beg == v && C[2]->end == v) || @@ -125,7 +127,6 @@ SPoint2 gmshVertex::reparamOnFace(const GFace *face, int dir) const Msg::Info("Reparameterizing point %d on face %d", v->Num, s->Num); return GVertex::reparamOnFace(face, dir); } - // printf("coucou1 %g %g\n",U,V); return SPoint2(U, V); } else{ diff --git a/Geo/gmshVertex.h b/Geo/gmshVertex.h index 101875e3b5d103a71825076a769a10015c92a472..9477a1bf21974115ca297b9032f652c59cec9592 100644 --- a/Geo/gmshVertex.h +++ b/Geo/gmshVertex.h @@ -16,7 +16,8 @@ class gmshVertex : public GVertex { public: gmshVertex(GModel *m, Vertex *_v); virtual ~gmshVertex() {} - virtual GPoint point() const + virtual void resetMeshAttributes(); + virtual GPoint point() const { return GPoint(v->Pos.X, v->Pos.Y, v->Pos.Z, this); } @@ -27,7 +28,7 @@ class gmshVertex : public GVertex { virtual GeomType geomType() const; ModelType getNativeType() const { return GmshModel; } void *getNativePtr() const { return v; } - virtual void setPrescribedMeshSizeAtVertex(double l) + virtual void setPrescribedMeshSizeAtVertex(double l) { meshSize = l; v->lc = meshSize;