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 <array>
10 #include <map>
11 #include <set>
12 #include <string>
13 #include <vector>
14 
15 #include "dolfinx/common/array2d.h"
16 
17 namespace dolfinx::mesh
18 {
19 
21 enum class CellType : int
22 {
23  // NOTE: Simplex cells have index > 0, see mesh::is_simplex
24  point = 1,
25  interval = 2,
26  triangle = 3,
27  tetrahedron = 4,
28  quadrilateral = -4,
29  hexahedron = -8
30 };
31 
35 std::string to_string(CellType type);
36 
40 CellType to_type(const std::string& cell);
41 
44 
49 
54 
57 dolfinx::array2d<int> get_sub_entities(CellType type, int dim0, int dim1);
58 
60 int cell_dim(CellType type);
61 
66 int cell_num_entities(mesh::CellType type, int dim);
67 
71 bool is_simplex(CellType type);
72 
76 int num_cell_vertices(CellType type);
77 
78 // [dim, entity] -> closure{sub_dim, (sub_entities)}
79 
83 std::map<std::array<int, 2>, std::vector<std::set<int>>>
85 
86 } // namespace dolfinx::mesh
This class provides a dynamic 2-dimensional row-wise array data structure.
Definition: array2d.h:21
Mesh data structures and algorithms on meshes.
Definition: DirichletBC.h:22
int cell_num_entities(mesh::CellType type, int dim)
Number of entities of dimension dim.
Definition: cell_types.cpp:182
dolfinx::array2d< int > 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:94
CellType to_type(const std::string &cell)
Get the cell type from a cell string.
Definition: cell_types.cpp:41
int num_cell_vertices(CellType type)
Number vertices for a cell type.
Definition: cell_types.cpp:216
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:222
int cell_dim(CellType type)
Return topological dimension of cell type.
Definition: cell_types.cpp:160
dolfinx::array2d< int > get_sub_entities(CellType type, int dim0, int dim1)
Get entities of dimension dim1 and that make up entities of dimension dim0.
Definition: cell_types.cpp:107
CellType
Cell type identifier.
Definition: cell_types.h:22
std::string to_string(CellType type)
Get the cell string type for a cell type.
Definition: cell_types.cpp:19
bool is_simplex(CellType type)
Check if cell is a simplex.
Definition: cell_types.cpp:211
CellType cell_facet_type(CellType type)
Return facet type of cell.
Definition: cell_types.cpp:72
CellType cell_entity_type(CellType type, int d)
Return type of cell for entity of dimension d.
Definition: cell_types.cpp:59