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
17 {
18 namespace mesh
19 {
20 
22 enum class CellType : int
23 {
24  // NOTE: Simplex cells have index > 0, see mesh::is_simplex
25  point = 1,
26  interval = 2,
27  triangle = 3,
28  tetrahedron = 4,
29  quadrilateral = -4,
30  hexahedron = -8
31 };
32 
36 std::string to_string(CellType type);
37 
41 CellType to_type(const std::string& cell);
42 
45 
50 
54 Eigen::Array<int, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>
55 get_entity_vertices(CellType type, int dim);
56 
59 Eigen::Array<int, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>
60 get_sub_entities(CellType type, int dim0, int dim1);
61 
63 int cell_dim(CellType type);
64 
69 int cell_num_entities(mesh::CellType type, int dim);
70 
74 bool is_simplex(CellType type);
75 
79 int num_cell_vertices(CellType type);
80 
81 // [dim, entity] -> closure{sub_dim, (sub_entities)}
82 
86 std::map<std::array<int, 2>, std::vector<std::set<int>>>
88 
89 } // namespace mesh
90 } // namespace dolfinx
dolfinx::mesh::is_simplex
bool is_simplex(CellType type)
Check if cell is a simplex.
Definition: cell_types.cpp:410
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:22
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