Loading...
Searching...
No Matches
Vertex.h
// Copyright (C) 2006-2010 Anders Logg
//
// This file is part of DOLFIN.
//
// DOLFIN is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// DOLFIN is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
//
// First added: 2006-06-01
// Last changed: 2013-01-09
#ifndef __VERTEX_H
#define __VERTEX_H
#include <memory>
#include <dolfin/geometry/Point.h>
#include "Mesh.h"
#include "MeshEntity.h"
#include "MeshEntityIteratorBase.h"
#include "MeshFunction.h"
namespace dolfin
{
class Vertex : public MeshEntity
{
public:
Vertex(const Mesh& mesh, std::size_t index) : MeshEntity(mesh, 0, index) {}
Vertex(MeshEntity& entity) : MeshEntity(entity.mesh(), 0, entity.index()) {}
~Vertex() {}
double x(std::size_t i) const
{ return _mesh->geometry().x(_local_index, i); }
Point point() const
{ return _mesh->geometry().point(_local_index); }
const double* x() const
{ return _mesh->geometry().x(_local_index); }
};
typedef MeshEntityIteratorBase<Vertex> VertexIterator;
}
#endif
dolfin::MeshEntityIteratorBase
Base class for MeshEntityIterators.
Definition MeshEntityIteratorBase.h:37
dolfin::MeshEntity::mesh
const Mesh & mesh() const
Definition MeshEntity.h:99
dolfin::MeshEntity::MeshEntity
MeshEntity()
Default Constructor.
Definition MeshEntity.h:47
dolfin::MeshEntity::index
std::size_t index() const
Definition MeshEntity.h:113
dolfin::Mesh
Definition Mesh.h:84
dolfin::Point
Definition Point.h:41
dolfin::Vertex::Vertex
Vertex(MeshEntity &entity)
Create vertex from mesh entity.
Definition Vertex.h:45
dolfin::Vertex::x
double x(std::size_t i) const
Return value of vertex coordinate i.
Definition Vertex.h:51
dolfin::Vertex::x
const double * x() const
Return array of vertex coordinates (const version).
Definition Vertex.h:59
dolfin::Vertex::Vertex
Vertex(const Mesh &mesh, std::size_t index)
Create vertex on given mesh.
Definition Vertex.h:42
dolfin::Vertex::point
Point point() const
Return vertex coordinates as a 3D point value.
Definition Vertex.h:55
dolfin::Vertex::~Vertex
~Vertex()
Destructor.
Definition Vertex.h:48
dolfin
Definition adapt.h:30
dolfin::VertexIterator
MeshEntityIteratorBase< Vertex > VertexIterator
A VertexIterator is a MeshEntityIterator of topological dimension 0.
Definition Vertex.h:65