DOLFIN
DOLFIN C++ interface
Vertex.h
1 // Copyright (C) 2006-2010 Anders Logg
2 //
3 // This file is part of DOLFIN.
4 //
5 // DOLFIN is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // DOLFIN is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
17 //
18 // First added: 2006-06-01
19 // Last changed: 2013-01-09
20 
21 #ifndef __VERTEX_H
22 #define __VERTEX_H
23 
24 #include <memory>
25 
26 #include <dolfin/geometry/Point.h>
27 #include "Mesh.h"
28 #include "MeshEntity.h"
29 #include "MeshEntityIteratorBase.h"
30 #include "MeshFunction.h"
31 
32 namespace dolfin
33 {
34 
36 
37  class Vertex : public MeshEntity
38  {
39  public:
40 
42  Vertex(const Mesh& mesh, std::size_t index) : MeshEntity(mesh, 0, index) {}
43 
45  Vertex(MeshEntity& entity) : MeshEntity(entity.mesh(), 0, entity.index()) {}
46 
48  ~Vertex() {}
49 
51  double x(std::size_t i) const
52  { return _mesh->geometry().x(_local_index, i); }
53 
55  Point point() const
56  { return _mesh->geometry().point(_local_index); }
57 
59  const double* x() const
60  { return _mesh->geometry().x(_local_index); }
61 
62  };
63 
66 
67 }
68 
69 #endif
const Mesh & mesh() const
Definition: MeshEntity.h:99
std::size_t index() const
Definition: MeshEntity.h:113
A Vertex is a MeshEntity of topological dimension 0.
Definition: Vertex.h:37
Definition: adapt.h:29
const double * x() const
Return array of vertex coordinates (const version)
Definition: Vertex.h:59
Definition: Point.h:40
double x(std::size_t i) const
Return value of vertex coordinate i.
Definition: Vertex.h:51
double x(std::size_t n, std::size_t i) const
Return value of coordinate with local index n in direction i.
Definition: MeshGeometry.h:99
MeshGeometry & geometry()
Definition: Mesh.h:233
Point point(std::size_t n) const
Return coordinate with local index n as a 3D point value.
Definition: MeshGeometry.cpp:60
Vertex(MeshEntity &entity)
Create vertex from mesh entity.
Definition: Vertex.h:45
Point point() const
Return vertex coordinates as a 3D point value.
Definition: Vertex.h:55
~Vertex()
Destructor.
Definition: Vertex.h:48
Vertex(const Mesh &mesh, std::size_t index)
Create vertex on given mesh.
Definition: Vertex.h:42
Definition: MeshEntity.h:42
MeshEntityIteratorBase< Vertex > VertexIterator
A VertexIterator is a MeshEntityIterator of topological dimension 0.
Definition: Vertex.h:65
Definition: Mesh.h:82
Base class for MeshEntityIterators.
Definition: MeshEntityIteratorBase.h:36