diff --git a/Geo/ACISVertex.cpp b/Geo/ACISVertex.cpp index 1c77922e3bdac17a8aa335f302e11f58395bc750..8699be4be3c992a69c01217779b7de486f4382f3 100644 --- a/Geo/ACISVertex.cpp +++ b/Geo/ACISVertex.cpp @@ -17,9 +17,6 @@ ACISVertex::ACISVertex(GModel *m, int num, VERTEX *v) _x = pos.coordinate(0); _y = pos.coordinate(1); _z = pos.coordinate(2); - - mesh_vertices.push_back(new MVertex(x(), y(), z(), this)); - points.push_back(new MPoint(mesh_vertices.back())); } void ACISVertex::setPosition(GPoint &p) diff --git a/Geo/GModel.cpp b/Geo/GModel.cpp index 2b873a0a6016c80e3b8e4533a8b070af86ac9b11..30f13816bad58ba1651e7317a959397eb97a13c1 100644 --- a/Geo/GModel.cpp +++ b/Geo/GModel.cpp @@ -474,8 +474,11 @@ SBoundingBox3d GModel::bounds() // using the mesh vertices for now; should use entities[i]->bounds() instead SBoundingBox3d bb; for(unsigned int i = 0; i < entities.size(); i++) - for(unsigned int j = 0; j < entities[i]->mesh_vertices.size(); j++) - bb += entities[i]->mesh_vertices[j]->point(); + if(entities[i]->dim() == 0) + bb += static_cast<GVertex*>(entities[i])->xyz(); + else + for(unsigned int j = 0; j < entities[i]->mesh_vertices.size(); j++) + bb += entities[i]->mesh_vertices[j]->point(); return bb; } diff --git a/Geo/GVertex.h b/Geo/GVertex.h index 3b6800dd207830888f5aa741435a79b76b300efa..d179e6fac7f9ff2c83c31b6c53b30f1992bb6de8 100644 --- a/Geo/GVertex.h +++ b/Geo/GVertex.h @@ -13,6 +13,7 @@ #include "GEntity.h" #include "GPoint.h" #include "SPoint2.h" +#include "SPoint3.h" #define MAX_LC 1.e22 @@ -37,6 +38,7 @@ class GVertex : public GEntity virtual double x() const = 0; virtual double y() const = 0; virtual double z() const = 0; + virtual SPoint3 xyz() const { return SPoint3(x(), y(), z()); } virtual void setPosition(GPoint &p); // add/delete an edge bounded by this vertex diff --git a/Geo/OCCVertex.cpp b/Geo/OCCVertex.cpp index 3174f0c497551730036c65ef90e9921984f245fa..8c85e9e5f2a683a01350d68f6fe4df1ff865288d 100644 --- a/Geo/OCCVertex.cpp +++ b/Geo/OCCVertex.cpp @@ -21,8 +21,6 @@ OCCVertex::OCCVertex(GModel *m, int num, TopoDS_Vertex _v) _x = pnt.X(); _y = pnt.Y(); _z = pnt.Z(); - mesh_vertices.push_back(new MVertex(x(), y(), z(), this)); - points.push_back(new MPoint(mesh_vertices.back())); } void OCCVertex::setPosition(GPoint &p) diff --git a/Geo/fourierVertex.h b/Geo/fourierVertex.h index 6eb87c7a882372e8bc2686520934c9f090dca752..567ea964c3622e6f4fc85d33ef863dcc9c60e764 100644 --- a/Geo/fourierVertex.h +++ b/Geo/fourierVertex.h @@ -19,10 +19,7 @@ class fourierVertex : public GVertex { protected: FM::TopoVertex *v; public: - fourierVertex(GModel *m, int num, FM::TopoVertex* _v) : GVertex(m, num), v(_v) - { - mesh_vertices.push_back(new MVertex(x(), y(), z(), this)); - } + fourierVertex(GModel *m, int num, FM::TopoVertex* _v) : GVertex(m, num), v(_v){} virtual ~fourierVertex() {} virtual GPoint point() const { return GPoint(x(),y(),z()); } virtual double x() const { return v->GetX(); } diff --git a/Geo/gmshVertex.cpp b/Geo/gmshVertex.cpp index 713992cc780ed3bdc69688b069903318ad96543b..4d724ef422d07ec92b65f2079f63fcaa3b13350d 100644 --- a/Geo/gmshVertex.cpp +++ b/Geo/gmshVertex.cpp @@ -15,8 +15,6 @@ gmshVertex::gmshVertex(GModel *m, Vertex *_v) : GVertex(m, _v->Num, _v->lc), v(_v) { - mesh_vertices.push_back(new MVertex(x(), y(), z(), this)); - points.push_back(new MPoint(mesh_vertices.back())); } void gmshVertex::setPosition(GPoint &p) diff --git a/Mesh/Generator.cpp b/Mesh/Generator.cpp index 930fb3ec9aff5916467703007c99eab539607ce3..da4b10461f375df7335a9825abbc5c0061ab6bdd 100644 --- a/Mesh/Generator.cpp +++ b/Mesh/Generator.cpp @@ -10,6 +10,7 @@ #include "Context.h" #include "OS.h" #include "GModel.h" +#include "MPoint.h" #include "MLine.h" #include "MTriangle.h" #include "MQuadrangle.h" @@ -333,6 +334,17 @@ static bool CancelDelaunayHybrid(GModel *m) return false; } +static void Mesh0D(GModel *m) +{ + for(GModel::viter it = m->firstVertex(); it != m->lastVertex(); ++it){ + GVertex *gv = *it; + if(gv->mesh_vertices.empty()) + gv->mesh_vertices.push_back(new MVertex(gv->x(), gv->y(), gv->z(), gv)); + if(gv->points.empty()) + gv->points.push_back(new MPoint(gv->mesh_vertices.back())); + } +} + static void Mesh1D(GModel *m) { if(TooManyElements(m, 1)) return; @@ -593,6 +605,7 @@ void GenerateMesh(GModel *m, int ask) if(ask == 1 || (ask > 1 && old < 1)) { std::for_each(m->firstRegion(), m->lastRegion(), deMeshGRegion()); std::for_each(m->firstFace(), m->lastFace(), deMeshGFace()); + Mesh0D(m); Mesh1D(m); }