← Back to team overview

dolfin team mailing list archive

NewVertex bug?

 

The NewVertex constructors looks as follows:

    /// Create vertex on given mesh
    NewVertex(NewMesh& mesh, uint index) : MeshEntity(mesh, 0, index) {}

    /// Create vertex from mesh entity
    NewVertex(MeshEntity& entity) : MeshEntity(entity.mesh(), 0, entity.index()) {} 


The MeshEntity constructor is:

    /// Constructor
    MeshEntity(NewMesh& mesh, uint dim, uint index) : _mesh(mesh), _dim(dim), _index(index) {}


So, regardless of the dimension of the mesh, a vertex is told to be of zero
dimension. That might be true (for the topological dimension?), but in
NewVertex, the methods x(), y(), and z(), that return the _coordinates_ of
the vertex (in the geometrical dimension), _dim is used to
figure out whether or not to return the coordinate or simply zero:

    /// Return x-coordinate of vertex
    inline real x() const { return _mesh.geometry().x(_index, 0); }

    /// Return y-coordinate of vertex
    inline real y() const { return (_dim >= 1 ? _mesh.geometry().x(_index, 1) : 0.0); }

    /// Return z-coordinate of vertex
    inline real z() const { return (_dim >= 2 ? _mesh.geometry().x(_index, 2) : 0.0); }


Sincerely,
Ola


Follow ups