10#include <basix/mdspan.hpp>
13#include <dolfinx/common/MPI.h>
14#include <dolfinx/common/types.h>
15#include <dolfinx/graph/AdjacencyList.h>
35concept CellRange = std::ranges::input_range<R> and std::ranges::sized_range<R>
36 and std::is_integral_v<
37 std::remove_const_t<std::ranges::range_value_t<R>>>;
74 std::shared_ptr<const common::IndexMap> vertex_map,
75 std::vector<std::shared_ptr<const common::IndexMap>> cell_maps,
77 const std::optional<std::vector<std::vector<std::int64_t>>>&
103 int dim() const noexcept;
125 std::vector<std::shared_ptr<const
common::IndexMap>>
152 std::shared_ptr<const
graph::AdjacencyList<std::int32_t>>
153 connectivity(std::array<
int, 2> d0, std::array<
int, 2> d1) const;
164 std::shared_ptr<const
graph::AdjacencyList<std::int32_t>>
361 MPI_Comm
comm() const;
366 std::vector<std::vector<
CellType>> _entity_types;
370 std::map<std::array<
int, 2>, std::shared_ptr<const
common::IndexMap>>
377 std::map<std::pair<std::array<
int, 2>, std::array<
int, 2>>,
378 std::shared_ptr<
graph::AdjacencyList<std::int32_t>>>
387 std::array<std::optional<std::vector<std::uint8_t>>, 3> _entity_permutations;
392 std::optional<std::vector<std::uint32_t>> _cell_permutations;
396 bool _has_facet_orientations = false;
401 std::vector<std::vector<std::int32_t>> _interprocess_facets;
418std::pair<Topology, std::vector<std::int64_t>>
420 std::vector<std::span<const std::int64_t>> cells,
422 std::vector<std::span<const int>> ghost_owners,
423 std::span<const std::int64_t> boundary_vertices,
460 std::vector<std::span<const std::int64_t>> cells,
462 std::vector<std::span<const int>> ghost_owners,
463 std::span<const std::int64_t> boundary_vertices,
495 std::span<const std::int64_t> boundary_vertices,
512std::tuple<Topology, std::vector<std::int32_t>, std::vector<std::int32_t>>
514 std::span<const std::int32_t> entities);
525std::vector<std::int32_t>
527 std::span<const std::int32_t> entities);
546std::vector<std::vector<std::int32_t>>
562md::mdspan<const std::uint8_t, md::dextents<std::size_t, 2>>
Distribution of a global index range [0, N) across MPI ranks.
Definition IndexMap.h:191
This class provides a static adjacency list data structure.
Definition AdjacencyList.h:41
Topology stores the topology of a mesh, consisting of mesh entities and connectivity (incidence relat...
Definition Topology.h:52
std::shared_ptr< const common::IndexMap > index_map(int dim) const
Get the IndexMap that describes the parallel distribution of the mesh entities.
Definition Topology.cpp:938
void create_connectivity(int d0, int d1)
Create connectivity between given pair of dimensions, d0 -> d1.
Definition Topology.cpp:1121
Topology(std::vector< CellType > cell_types, std::shared_ptr< const common::IndexMap > vertex_map, std::vector< std::shared_ptr< const common::IndexMap > > cell_maps, std::vector< std::shared_ptr< graph::AdjacencyList< std::int32_t > > > cells, const std::optional< std::vector< std::vector< std::int64_t > > > &original_cell_index=std::nullopt, int num_threads=1)
Create a mesh topology.
Definition Topology.cpp:854
std::vector< std::vector< std::int64_t > > original_cell_index
Original cell index for each cell type.
Definition Topology.h:357
std::vector< CellType > cell_types() const
Get the types of cells in the topology.
Definition Topology.cpp:920
CellType cell_type() const
Cell type.
Definition Topology.cpp:908
const std::vector< std::uint32_t > & get_cell_permutation_info() const
Get the cell permutation information.
Definition Topology.cpp:979
bool has_facet_orientations() const noexcept
Check if the facet signs have been computed (see create_facet_orientations).
Definition Topology.cpp:1013
void create_facet_orientations()
Sign the facets on which two cells disagree on the normal.
Definition Topology.cpp:990
void create_entity_permutations(int dim, int num_threads=1)
Compute entity permutations and reflections.
Definition Topology.cpp:1161
void create_cell_permutations(int num_threads=1)
Compute the packed per-cell permutation info.
Definition Topology.cpp:1205
std::shared_ptr< const graph::AdjacencyList< std::int32_t > > connectivity(std::array< int, 2 > d0, std::array< int, 2 > d1) const
Get the connectivity from entities of topological dimension d0 to dimension d1.
Definition Topology.cpp:959
Topology(const Topology &topology)=default
Copy constructor.
~Topology()=default
Destructor.
const std::vector< CellType > & entity_types(int dim) const
Entity types in the topology for a given dimension.
Definition Topology.cpp:903
std::vector< std::int8_t > facet_orientations() const
Get the sign carried by each facet of each cell (see create_facet_orientations).
Definition Topology.cpp:1018
int dim() const noexcept
Topological dimension of the mesh.
Definition Topology.cpp:898
const std::vector< std::int32_t > & interprocess_facets(int index) const
List of inter-process facets of a given type.
Definition Topology.cpp:1056
Topology(Topology &&topology)=default
Move constructor.
bool create_entities(int dim, int num_threads=1)
Create entities of given topological dimension.
Definition Topology.cpp:1068
MPI_Comm comm() const
Mesh MPI communicator.
Definition Topology.cpp:1213
const std::vector< std::uint8_t > & get_entity_permutations(int dim) const
Get the numbers that encode the permutation to apply to each cell-local entity of a given dimension.
Definition Topology.cpp:1036
Topology & operator=(Topology &&topology)=default
Move assignment.
std::vector< std::shared_ptr< const common::IndexMap > > index_maps(int dim) const
Get the index maps that describe the parallel distribution of the mesh entities of a given topologica...
Definition Topology.cpp:926
Requirement on range of cell indices.
Definition Topology.h:35
Miscellaneous classes, functions and types.
Definition dolfinx_common.h:8
Graph data structures and algorithms.
Definition AdjacencyList.h:23
Mesh data structures and algorithms on meshes.
Definition DofMap.h:32
CellType
Cell type identifier.
Definition cell_types.h:24
md::mdspan< const std::uint8_t, md::dextents< std::size_t, 2 > > entity_permutations(Topology &topology, int dim, int cell_type_idx)
Permutations of the cell-local entities of a given dimension.
Definition Topology.cpp:1902
std::vector< std::vector< std::int32_t > > compute_mixed_cell_pairs(const Topology &topology, mesh::CellType facet_type)
Compute a list of cell-cell connections for each possible combination in the topology which have the ...
Definition Topology.cpp:1816
std::tuple< Topology, std::vector< std::int32_t >, std::vector< std::int32_t > > create_subtopology(const Topology &topology, int dim, std::span< const std::int32_t > entities)
Create a topology for a subset of entities of a given topological dimension.
Definition Topology.cpp:1651
Topology create_topology(MPI_Comm comm, const std::vector< CellType > &cell_types, std::vector< std::span< const std::int64_t > > cells, std::vector< std::span< const std::int64_t > > original_cell_index, std::vector< std::span< const int > > ghost_owners, std::span< const std::int64_t > boundary_vertices, int num_threads)
Create a mesh topology.
Definition Topology.cpp:1220
std::vector< std::int32_t > entities_to_index(const Topology &topology, int dim, std::span< const std::int32_t > entities)
Get entity indices for entities defined by their vertices.
Definition Topology.cpp:1751