← Back to team overview

dolfin team mailing list archive

Re: NewVertex bug?

 

Thanks for spotting this. This is obviously wrong.

I'll remove the functions x(), y(), z() since they don't belong in the
vertex interface.

/Anders

On Tue, Oct 10, 2006 at 05:41:08PM +0200, Ola Skavhaug wrote:
> 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
> _______________________________________________
> DOLFIN-dev mailing list
> DOLFIN-dev@xxxxxxxxxx
> http://www.fenics.org/mailman/listinfo/dolfin-dev


References