Newer
Older
// Gmsh - Copyright (C) 1997-2009 C. Geuzaine, J.-F. Remacle
// See the LICENSE.txt file for license information. Please report all
// bugs and problems to <gmsh@geuz.org>.
#include "gmshVertex.h"
#include "Geo.h"
#include "GeoInterpolation.h"

Christophe Geuzaine
committed
#include "GmshMessage.h"
#include "MVertex.h"
#include "MElement.h"
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)
{
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();
}
}
GEntity::GeomType gmshVertex::geomType() const
{
if(v->Typ == MSH_POINT_BND_LAYER)
return BoundaryLayerPoint;
else
return Point;
}
Stefen Guzik
committed
SPoint2 gmshVertex::reparamOnFace(const GFace *face, int dir) const
Surface *s = (Surface*)face->getNativePtr();
if(s->geometry){
// It is not always right if it is periodic.
if(l_edges.size() == 1 &&
(*l_edges.begin())->getBeginVertex() ==
(*l_edges.begin())->getEndVertex()){
Curve *C[4];
for(int i = 0; i < 4; i++)
List_Read(s->Generatrices, i, &C[i]);
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) ||
(C[0]->end == v && C[3]->end == v)){
(C[0]->end == v && C[1]->beg == v) ||
(C[0]->beg == v && C[1]->end == v) ||
(C[0]->end == v && C[1]->end == v)){
U = 1;
V = 0;
}
else if ((C[2]->beg == v && C[1]->beg == v) ||
(C[2]->end == v && C[1]->beg == v) ||
(C[2]->beg == v && C[1]->end == v) ||
(C[2]->end == v && C[1]->end == v)){
U = 1;
V = 1;
}
else if ((C[2]->beg == v && C[3]->beg == v) ||
(C[2]->end == v && C[3]->beg == v) ||
(C[2]->beg == v && C[3]->end == v) ||
(C[2]->end == v && C[3]->end == v)){
Msg::Info("Reparameterizing point %d on face %d", v->Num, s->Num);