DOLFIN
DOLFIN C++ interface
IntervalCell.h
1// Copyright (C) 2006-2017 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 Kristoffer Selim 2008
19//
20// First added: 2006-06-05
21// Last changed: 2017-09-26
22
23#ifndef __INTERVAL_CELL_H
24#define __INTERVAL_CELL_H
25
26#include <string>
27#include <vector>
28#include <boost/multi_array.hpp>
29#include "CellType.h"
30
31namespace dolfin
32{
33
34 class Cell;
35 class MeshEditor;
36 class MeshEntity;
37 template<typename T> class MeshFunction;
38
40
41 class IntervalCell : public CellType
42 {
43 public:
44
46 IntervalCell() : CellType(Type::interval, Type::point) {}
47
49 bool is_simplex() const
50 { return true; }
51
53 std::size_t dim() const;
54
56 std::size_t num_entities(std::size_t dim) const;
57
60 std::size_t num_vertices(std::size_t dim) const;
61
63 std::size_t orientation(const Cell& cell) const;
64
66 void create_entities(boost::multi_array<unsigned int, 2>& e,
67 std::size_t dim,
68 const unsigned int* v) const;
69
71 double volume(const MeshEntity& interval) const;
72
74 double circumradius(const MeshEntity& interval) const;
75
77 double squared_distance(const Cell& cell, const Point& point) const;
78
83 static double squared_distance(const Point& point,
84 const Point& a,
85 const Point& b);
86
89 double normal(const Cell& cell, std::size_t facet, std::size_t i) const;
90
92 Point normal(const Cell& cell, std::size_t facet) const;
93
95 Point cell_normal(const Cell& cell) const;
96
98 double facet_area(const Cell& cell, std::size_t facet) const;
99
101 void order(Cell& cell, const std::vector<std::int64_t>&
102 local_to_global_vertex_indices) const;
103
105 virtual
106 bool collides(const Cell& cell, const Point& point) const;
107
109 virtual
110 bool collides(const Cell& cell, const MeshEntity& entity) const;
111
113 std::string description(bool plural) const;
114
116 std::vector<std::int8_t> vtk_mapping() const
117 { return {0, 1}; }
118
119 };
120
121}
122
123#endif
Definition: CellType.h:47
std::size_t num_vertices() const
Return number of vertices for cell.
Definition: CellType.h:92
Type
Enum for different cell types.
Definition: CellType.h:51
A Cell is a MeshEntity of topological codimension 0.
Definition: Cell.h:43
This class implements functionality for interval cell meshes.
Definition: IntervalCell.h:42
std::string description(bool plural) const
Return description of cell type.
Definition: IntervalCell.cpp:252
void order(Cell &cell, const std::vector< std::int64_t > &local_to_global_vertex_indices) const
Order entities locally.
Definition: IntervalCell.cpp:225
double normal(const Cell &cell, std::size_t facet, std::size_t i) const
Definition: IntervalCell.cpp:166
void create_entities(boost::multi_array< unsigned int, 2 > &e, std::size_t dim, const unsigned int *v) const
Create entities e of given topological dimension from vertices v.
Definition: IntervalCell.cpp:83
std::size_t dim() const
Return topological dimension of cell.
Definition: IntervalCell.cpp:38
IntervalCell()
Specify cell type and facet type.
Definition: IntervalCell.h:46
double circumradius(const MeshEntity &interval) const
Compute circumradius of interval.
Definition: IntervalCell.cpp:116
std::vector< std::int8_t > vtk_mapping() const
Mapping of DOLFIN/UFC vertex ordering to VTK/XDMF ordering.
Definition: IntervalCell.h:116
double volume(const MeshEntity &interval) const
Compute (generalized) volume (length) of interval.
Definition: IntervalCell.cpp:95
virtual bool collides(const Cell &cell, const Point &point) const
Check whether given point collides with cell.
Definition: IntervalCell.cpp:242
Point cell_normal(const Cell &cell) const
Compute normal to given cell (viewed as embedded in 2D)
Definition: IntervalCell.cpp:193
bool is_simplex() const
Check if cell is a simplex.
Definition: IntervalCell.h:49
double squared_distance(const Cell &cell, const Point &point) const
Compute squared distance to given point (3D enabled)
Definition: IntervalCell.cpp:130
std::size_t num_entities(std::size_t dim) const
Return number of entities of given topological dimension.
Definition: IntervalCell.cpp:43
double facet_area(const Cell &cell, std::size_t facet) const
Compute the area/length of given facet with respect to the cell.
Definition: IntervalCell.cpp:220
std::size_t orientation(const Cell &cell) const
Return orientation of the cell (assuming flat space)
Definition: IntervalCell.cpp:77
Definition: MeshEntity.h:43
Definition: Point.h:41
Definition: adapt.h:30