DOLFIN-X
DOLFIN-X C++ interface
cell_types.h
1 // Copyright (C) 2019-2020 Garth N. Wells
2 //
3 // This file is part of DOLFINX (https://www.fenicsproject.org)
4 //
5 // SPDX-License-Identifier: LGPL-3.0-or-later
6 
7 #pragma once
8 
9 #include <Eigen/Dense>
10 #include <array>
11 #include <map>
12 #include <set>
13 #include <string>
14 #include <vector>
15 
16 namespace dolfinx::mesh
17 {
18 
20 enum class CellType : int
21 {
22  // NOTE: Simplex cells have index > 0, see mesh::is_simplex
23  point = 1,
24  interval = 2,
25  triangle = 3,
26  tetrahedron = 4,
27  quadrilateral = -4,
28  hexahedron = -8
29 };
30 
34 std::string to_string(CellType type);
35 
39 CellType to_type(const std::string& cell);
40 
43 
48 
52 Eigen::Array<int, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>
53 get_entity_vertices(CellType type, int dim);
54 
57 Eigen::Array<int, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>
58 get_sub_entities(CellType type, int dim0, int dim1);
59 
61 int cell_dim(CellType type);
62 
67 int cell_num_entities(mesh::CellType type, int dim);
68 
72 bool is_simplex(CellType type);
73 
77 int num_cell_vertices(CellType type);
78 
79 // [dim, entity] -> closure{sub_dim, (sub_entities)}
80 
84 std::map<std::array<int, 2>, std::vector<std::set<int>>>
86 
87 } // namespace dolfinx::mesh
dolfinx::mesh::is_simplex
bool is_simplex(CellType type)
Check if cell is a simplex.
Definition: cell_types.cpp:410
dolfinx::mesh
Mesh data structures.
Definition: DirichletBC.h:27
dolfinx::mesh::to_type
CellType to_type(const std::string &cell)
Get the cell type from a cell string.
Definition: cell_types.cpp:227
dolfinx::mesh::cell_num_entities
int cell_num_entities(mesh::CellType type, int dim)
Number of entities of dimension dim.
Definition: cell_types.cpp:381
dolfinx::mesh::cell_entity_type
CellType cell_entity_type(CellType type, int d)
Return type of cell for entity of dimension d.
Definition: cell_types.cpp:245
dolfinx::mesh::CellType
CellType
Cell type identifier.
Definition: cell_types.h:21
dolfinx::mesh::to_string
std::string to_string(CellType type)
Get the cell string type for a cell type.
Definition: cell_types.cpp:205
dolfinx::mesh::cell_dim
int cell_dim(CellType type)
Return topological dimension of cell type.
Definition: cell_types.cpp:359
dolfinx::mesh::get_sub_entities
Eigen::Array< int, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > get_sub_entities(CellType type, int dim0, int dim1)
Get entities of dimsion dim1 and that make up entities of dimension dim0.
Definition: cell_types.cpp:304
dolfinx::mesh::cell_facet_type
CellType cell_facet_type(CellType type)
Return facet type of cell.
Definition: cell_types.cpp:258
dolfinx::mesh::get_entity_vertices
Eigen::Array< int, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > get_entity_vertices(CellType type, int dim)
Return array entities(num entities, num vertices per entity), where entities(e, k) is the local verte...
Definition: cell_types.cpp:281
dolfinx::mesh::cell_entity_closure
std::map< std::array< int, 2 >, std::vector< std::set< int > > > cell_entity_closure(mesh::CellType cell_type)
Closure entities for a cell, i.e., all lower-dimensional entities attached to a cell entity....
Definition: cell_types.cpp:421
dolfinx::mesh::num_cell_vertices
int num_cell_vertices(CellType type)
Number vertices for a cell type.
Definition: cell_types.cpp:415