diff --git a/Geo/GPoint.h b/Geo/GPoint.h index bd6a60b1dfeea29b44aba8526decc995e190ff8f..f2e5dabf528528f19baf08884c88a058c5418384 100644 --- a/Geo/GPoint.h +++ b/Geo/GPoint.h @@ -31,13 +31,17 @@ class GPoint const GEntity *e; double par[2]; public: - inline double x() const {return X;} - inline double y() const {return Y;} - inline double z() const {return Z;} - inline double u() const {return par[0];} - inline double v() const {return par[1];} + inline double x() const { return X; } + inline double y() const { return Y; } + inline double z() const { return Z; } + inline double &x() { return X; } + inline double &y() { return Y; } + inline double &z() { return Z; } + inline double u() const { return par[0]; } + inline double v() const { return par[1]; } GPoint (double _x=0, double _y=0, double _z=0, const GEntity *onwhat=0) - : X(_x), Y(_y), Z(_z), e(onwhat){ + : X(_x), Y(_y), Z(_z), e(onwhat) + { } GPoint (double _x, double _y, double _z, const GEntity *onwhat, double p) : X(_x), Y(_y), Z(_z), e(onwhat) diff --git a/Geo/GVertex.cpp b/Geo/GVertex.cpp index a915d4a1b9edeb38ef947b736e82ed510b848eb1..ee938919107c6fed7291ef054d810f9eac019a02 100644 --- a/Geo/GVertex.cpp +++ b/Geo/GVertex.cpp @@ -1,4 +1,4 @@ -// $Id: GVertex.cpp,v 1.12 2007-01-18 13:18:42 geuzaine Exp $ +// $Id: GVertex.cpp,v 1.13 2007-09-03 12:00:28 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -19,9 +19,10 @@ // // Please report all bugs and problems to <gmsh@geuz.org>. +#include <algorithm> #include "GVertex.h" #include "GFace.h" -#include <algorithm> +#include "Message.h" GVertex::GVertex(GModel *m, int tag, double ms) : GEntity (m, tag), meshSize (ms) { @@ -33,6 +34,11 @@ GVertex::~GVertex() delete mesh_vertices[i]; } +void GVertex::setPosition(GPoint &p) +{ + Msg(GERROR, "Cannot set position of this kind of vertex"); +} + void GVertex::addEdge(GEdge *e) { l_edges.push_back(e); diff --git a/Geo/GVertex.h b/Geo/GVertex.h index a0d1ddad5d5079eed06a901ad8129da4e3e88e8d..df66e2ab6b1facdab086429f4f480be3d6e697a2 100644 --- a/Geo/GVertex.h +++ b/Geo/GVertex.h @@ -38,6 +38,7 @@ class GVertex : public GEntity virtual double x() const = 0; virtual double y() const = 0; virtual double z() const = 0; + virtual void setPosition(GPoint &p); void addEdge(GEdge *e); void delEdge(GEdge *e); virtual int dim() const {return 0;} diff --git a/Geo/gmshVertex.h b/Geo/gmshVertex.h index 42ecd6d71538b84739b7ece615b0439dc526cc28..26af6c855996f08f70c40d98cd2135bfad656222 100644 --- a/Geo/gmshVertex.h +++ b/Geo/gmshVertex.h @@ -59,6 +59,19 @@ class gmshVertex : public GVertex { { return v ? v->Pos.Z : mesh_vertices.size() ? mesh_vertices[0]->z() : 0.; } + virtual void setPosition(GPoint &p) + { + if(v){ + v->Pos.X = p.x(); + v->Pos.Y = p.y(); + v->Pos.Z = p.z(); + } + if(mesh_vertices.size()){ + mesh_vertices[0]->x() = p.x(); + mesh_vertices[0]->y() = p.y(); + mesh_vertices[0]->z() = p.z(); + } + } virtual GeomType geomType() const; ModelType getNativeType() const { return GmshModel; } void * getNativePtr() const { return v; } diff --git a/Mesh/BoundaryLayer.cpp b/Mesh/BoundaryLayer.cpp index 6ea20007ed1855b2270e87b6f723ad9f8d4831fd..969cbe761af96647aef3f2be810a7a5e98ae9292 100644 --- a/Mesh/BoundaryLayer.cpp +++ b/Mesh/BoundaryLayer.cpp @@ -1,4 +1,4 @@ -// $Id: BoundaryLayer.cpp,v 1.2 2007-03-05 09:30:53 geuzaine Exp $ +// $Id: BoundaryLayer.cpp,v 1.3 2007-09-03 12:00:28 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -45,7 +45,7 @@ static void addExtrudeNormals(std::vector<T*> &elements) } } } - + int MeshBoundaryLayerFaces(GModel *m) { bool haveBoundaryLayers = false; @@ -107,14 +107,10 @@ int MeshBoundaryLayerFaces(GModel *m) for(GModel::viter it = m->firstVertex(); it != m->lastVertex(); it++){ GVertex *gv = *it; if(gv->geomType() == GEntity::BoundaryLayerPoint){ - double x = gv->x(); - double y = gv->y(); - double z = gv->z(); + GPoint p = gv->point(); myep->Extrude(myep->mesh.NbLayer - 1, myep->mesh.NbElmLayer[myep->mesh.NbLayer - 1], - x, y, z); - gv->mesh_vertices[0]->x() = x; - gv->mesh_vertices[0]->y() = y; - gv->mesh_vertices[0]->z() = z; + p.x(), p.y(), p.z()); + gv->setPosition(p); } }