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
34namespace 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
A Facet is a MeshEntity of topological codimension 1.
Definition: Facet.h:40
~Facet()
Destructor.
Definition: Facet.h:48
double squared_distance(const Point &point) const
Definition: Facet.cpp:63
Point normal() const
Compute normal to the facet.
Definition: Facet.cpp:47
Facet(const Mesh &mesh, std::size_t index)
Constructor.
Definition: Facet.h:44
bool exterior() const
Definition: Facet.cpp:96
double distance(const Point &point) const
Definition: Facet.h:70
Base class for MeshEntityIterators.
Definition: MeshEntityIteratorBase.h:37
Definition: MeshEntity.h:43
const Mesh & mesh() const
Definition: MeshEntity.h:99
std::size_t dim() const
Definition: MeshEntity.h:106
std::size_t index() const
Definition: MeshEntity.h:113
Definition: Mesh.h:84
Definition: Point.h:41
Definition: adapt.h:30
MeshEntityIteratorBase< Facet > FacetIterator
Definition: Facet.h:85