DOLFIN
DOLFIN C++ interface
Facet.h
1 // Copyright (C) 2006-2015 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 // Modified by Garth N. Wells, 2009-2011.
19 // Modified by Martin Alnaes, 2015
20 
21 #ifndef __FACET_H
22 #define __FACET_H
23 
24 #include <memory>
25 
26 #include <utility>
27 #include <vector>
28 #include "Cell.h"
29 #include "Mesh.h"
30 #include "MeshEntity.h"
31 #include "MeshEntityIteratorBase.h"
32 #include "MeshFunction.h"
33 
34 namespace dolfin
35 {
36 
38 
39  class Facet : public MeshEntity
40  {
41  public:
42 
44  Facet(const Mesh& mesh, std::size_t index)
45  : MeshEntity(mesh, mesh.topology().dim() - 1, index) {}
46 
48  ~Facet() {}
49 
51  double normal(std::size_t i) const;
52 
54  Point normal() const;
55 
62  double squared_distance(const Point& point) const;
63 
70  double distance(const Point& point) const
71  {
72  return sqrt(squared_distance(point));
73  }
74 
79  bool exterior() const;
80 
81  };
82 
86 
87 }
88 
89 #endif
~Facet()
Destructor.
Definition: Facet.h:48
Point normal() const
Compute normal to the facet.
Definition: Facet.cpp:47
double distance(const Point &point) const
Definition: Facet.h:70
Definition: adapt.h:29
Facet(const Mesh &mesh, std::size_t index)
Constructor.
Definition: Facet.h:44
Definition: Point.h:40
MeshEntityIteratorBase< Facet > FacetIterator
Definition: Facet.h:85
double squared_distance(const Point &point) const
Definition: Facet.cpp:63
std::size_t dim() const
Definition: MeshEntity.h:106
bool exterior() const
Definition: Facet.cpp:96
Definition: MeshEntity.h:42
const Mesh & mesh() const
Definition: MeshEntity.h:99
A Facet is a MeshEntity of topological codimension 1.
Definition: Facet.h:39
std::size_t index() const
Definition: MeshEntity.h:113
Definition: Mesh.h:82
Base class for MeshEntityIterators.
Definition: MeshEntityIteratorBase.h:36