31 #include <boost/multi_array.hpp> 39 template <
typename T>
class MeshFunction;
51 enum class Type : int { point, interval, triangle, quadrilateral, tetrahedron, hexahedron };
73 {
return _cell_type; }
77 {
return _facet_type; }
86 virtual std::size_t
dim()
const = 0;
96 virtual std::size_t
num_vertices(std::size_t dim)
const = 0;
108 const unsigned int* v)
const = 0;
127 const Point& point)
const = 0;
130 virtual double normal(
const Cell& cell, std::size_t facet,
131 std::size_t i)
const = 0;
140 virtual double facet_area(
const Cell& cell, std::size_t facet)
const = 0;
147 const std::vector<std::int64_t>& local_to_global_vertex_indices)
const = 0;
151 const std::vector<std::int64_t>& local_to_global_vertex_indices)
const;
160 virtual std::string
description(
bool plural)
const = 0;
163 virtual std::vector<std::int8_t>
vtk_mapping()
const = 0;
172 unsigned int* vertices,
173 const std::vector<std::int64_t>& local_to_global_vertex_indices);
178 static bool increasing(std::size_t num_vertices,
const unsigned int* vertices,
179 const std::vector<std::int64_t>& local_to_global_vertex_indices);
182 static bool increasing(std::size_t n0,
const unsigned int* v0,
183 std::size_t n1,
const unsigned int* v1,
184 std::size_t num_vertices,
const unsigned int* vertices,
185 const std::vector<std::int64_t>& local_to_global_vertex_indices);
std::size_t num_vertices() const
Return number of vertices for cell.
Definition: CellType.h:92
virtual double normal(const Cell &cell, std::size_t facet, std::size_t i) const =0
Compute component i of normal of given facet with respect to the cell.
virtual double inradius(const Cell &cell) const
Compute inradius of cell.
Definition: CellType.cpp:178
static Type string2type(std::string type)
Convert from string to cell type.
Definition: CellType.cpp:85
virtual bool is_simplex() const =0
Check if cell is a simplex.
Type
Enum for different cell types.
Definition: CellType.h:51
virtual double facet_area(const Cell &cell, std::size_t facet) const =0
Compute the area/length of given facet with respect to the cell.
virtual double h(const MeshEntity &entity) const
Compute greatest distance between any two vertices.
Definition: CellType.cpp:151
A Cell is a MeshEntity of topological codimension 0.
Definition: Cell.h:42
virtual ~CellType()
Destructor.
Definition: CellType.cpp:50
Type entity_type(std::size_t i) const
Return type of cell for entity of dimension i.
Definition: CellType.cpp:134
virtual bool collides(const Cell &cell, const Point &point) const =0
Check whether given point collides with cell.
virtual double volume(const MeshEntity &entity) const =0
Compute (generalized) volume of mesh entity.
Definition: CellType.h:46
static void sort_entities(std::size_t num_vertices, unsigned int *vertices, const std::vector< std::int64_t > &local_to_global_vertex_indices)
Sort vertices based on global entity indices.
Definition: CellType.cpp:276
static CellType * create(Type type)
Create cell type from type (factory function)
Definition: CellType.cpp:55
virtual double radius_ratio(const Cell &cell) const
Compute dim*inradius/circumradius for given cell.
Definition: CellType.cpp:210
virtual void create_entities(boost::multi_array< unsigned int, 2 > &e, std::size_t dim, const unsigned int *v) const =0
virtual double circumradius(const MeshEntity &entity) const =0
Compute circumradius of mesh entity.
virtual std::vector< std::int8_t > vtk_mapping() const =0
Mapping of DOLFIN/UFC vertex ordering to VTK/XDMF ordering.
virtual std::size_t num_entities(std::size_t dim) const =0
Return number of entities of given topological dimension.
virtual Point cell_normal(const Cell &cell) const =0
Compute normal to given cell (viewed as embedded in 3D)
Type cell_type() const
Return type of cell.
Definition: CellType.h:72
virtual std::string description(bool plural) const =0
Return description of cell type.
static std::string type2string(Type type)
Convert from cell type to string.
Definition: CellType.cpp:109
Type facet_type() const
Return type of cell for facets.
Definition: CellType.h:76
Definition: MeshEntity.h:42
virtual double squared_distance(const Cell &cell, const Point &point) const =0
Compute squared distance to given point.
CellType(Type cell_type, Type facet_type)
Constructor.
Definition: CellType.cpp:44
bool ordered(const Cell &cell, const std::vector< std::int64_t > &local_to_global_vertex_indices) const
Check if entities are ordered.
Definition: CellType.cpp:221
virtual std::size_t dim() const =0
Return topological dimension of cell.
virtual std::size_t orientation(const Cell &cell) const =0
Return orientation of the cell (assuming flat space)
virtual void order(Cell &cell, const std::vector< std::int64_t > &local_to_global_vertex_indices) const =0
Order entities locally.