Note: this is documentation for an old release. View the latest documentation at docs.fenicsproject.org/dolfinx/v0.9.0/cpp/doxygen/d9/d93/Topology_8h_source.html
DOLFINx 0.6.0
DOLFINx C++ interface
Loading...
Searching...
No Matches
Topology.h
1// Copyright (C) 2006-2022 Anders Logg and 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 <cstdint>
11#include <dolfinx/common/MPI.h>
12#include <memory>
13#include <span>
14#include <vector>
15
16namespace dolfinx::common
17{
18class IndexMap;
19}
20
21namespace dolfinx::graph
22{
23template <typename T>
24class AdjacencyList;
25}
26
27namespace dolfinx::mesh
28{
29enum class CellType;
30
43{
44public:
46 Topology(MPI_Comm comm, CellType type);
47
49 Topology(const Topology& topology) = default;
50
52 Topology(Topology&& topology) = default;
53
55 ~Topology() = default;
56
58 Topology& operator=(const Topology& topology) = delete;
59
61 Topology& operator=(Topology&& topology) = default;
62
64 int dim() const noexcept;
65
70 void set_index_map(int dim, std::shared_ptr<const common::IndexMap> map);
71
78 std::shared_ptr<const common::IndexMap> index_map(int dim) const;
79
88 std::shared_ptr<const graph::AdjacencyList<std::int32_t>>
89 connectivity(int d0, int d1) const;
90
93 void set_connectivity(std::shared_ptr<graph::AdjacencyList<std::int32_t>> c,
94 int d0, int d1);
95
97 const std::vector<std::uint32_t>& get_cell_permutation_info() const;
98
111 const std::vector<std::uint8_t>& get_facet_permutations() const;
112
115 CellType cell_type() const noexcept;
116
121 std::int32_t create_entities(int dim);
122
127 void create_connectivity(int d0, int d1);
128
131
133 const std::vector<std::int32_t>& interprocess_facets() const;
134
136 std::vector<std::int64_t> original_cell_index;
137
140 MPI_Comm comm() const;
141
142private:
143 // MPI communicator
144 dolfinx::MPI::Comm _comm;
145
146 // Cell type
147 CellType _cell_type;
148
149 // Parallel layout of entities for each dimension
150 std::array<std::shared_ptr<const common::IndexMap>, 4> _index_map;
151
152 // AdjacencyList for pairs [d0][d1] == d0 -> d1 connectivity
153 std::vector<std::vector<std::shared_ptr<graph::AdjacencyList<std::int32_t>>>>
154 _connectivity;
155
156 // The facet permutations (local facet, cell))
157 // [cell0_0, cell0_1, ,cell0_2, cell1_0, cell1_1, ,cell1_2, ...,
158 // celln_0, celln_1, ,celln_2,]
159 std::vector<std::uint8_t> _facet_permutations;
160
161 // Cell permutation info. See the documentation for
162 // get_cell_permutation_info for documentation of how this is encoded.
163 std::vector<std::uint32_t> _cell_permutations;
164
165 // List of facets that are on the inter-process boundary
166 std::vector<std::int32_t> _interprocess_facets;
167};
168
187 const graph::AdjacencyList<std::int64_t>& cells,
188 std::span<const std::int64_t> original_cell_index,
189 std::span<const int> ghost_owners,
190 const CellType& cell_type,
191 std::span<const std::int64_t> boundary_vertices);
192
203std::vector<std::int32_t>
204entities_to_index(const Topology& topology, int dim,
205 const graph::AdjacencyList<std::int32_t>& entities);
206} // namespace dolfinx::mesh
Topology stores the topology of a mesh, consisting of mesh entities and connectivity (incidence relat...
Definition: Topology.h:43
std::shared_ptr< const common::IndexMap > index_map(int dim) const
Get the IndexMap that described the parallel distribution of the mesh entities.
Definition: Topology.cpp:740
void create_connectivity(int d0, int d1)
Create connectivity between given pair of dimensions, d0 -> d1.
Definition: Topology.cpp:779
std::shared_ptr< const graph::AdjacencyList< std::int32_t > > connectivity(int d0, int d1) const
Return connectivity from entities of dimension d0 to entities of dimension d1.
Definition: Topology.cpp:828
void set_connectivity(std::shared_ptr< graph::AdjacencyList< std::int32_t > > c, int d0, int d1)
Set connectivity for given pair of topological dimensions.
Definition: Topology.cpp:835
void create_entity_permutations()
Compute entity permutations and reflections.
Definition: Topology.cpp:807
std::int32_t create_entities(int dim)
Create entities of given topological dimension.
Definition: Topology.cpp:746
const std::vector< std::uint32_t > & get_cell_permutation_info() const
Returns the permutation information.
Definition: Topology.cpp:843
const std::vector< std::int32_t > & interprocess_facets() const
List of inter-process facets, if facet topology has been computed.
Definition: Topology.cpp:872
const std::vector< std::uint8_t > & get_facet_permutations() const
Get the permutation number to apply to a facet.
Definition: Topology.cpp:858
Topology(const Topology &topology)=default
Copy constructor.
~Topology()=default
Destructor.
int dim() const noexcept
Return the topological dimension of the mesh.
Definition: Topology.cpp:731
std::vector< std::int64_t > original_cell_index
Original cell index.
Definition: Topology.h:136
Topology(Topology &&topology)=default
Move constructor.
void set_index_map(int dim, std::shared_ptr< const common::IndexMap > map)
Definition: Topology.cpp:733
Topology & operator=(const Topology &topology)=delete
Assignment.
MPI_Comm comm() const
Mesh MPI communicator.
Definition: Topology.cpp:879
CellType cell_type() const noexcept
Cell type.
Definition: Topology.cpp:877
Topology & operator=(Topology &&topology)=default
Assignment.
Miscellaneous classes, functions and types.
Graph data structures and algorithms.
Definition: dofmapbuilder.h:25
Mesh data structures and algorithms on meshes.
Definition: DofMap.h:31
Topology create_topology(MPI_Comm comm, const graph::AdjacencyList< std::int64_t > &cells, std::span< const std::int64_t > original_cell_index, std::span< const int > ghost_owners, const CellType &cell_type, std::span< const std::int64_t > boundary_vertices)
Create a distributed mesh topology.
Definition: Topology.cpp:881
std::vector< std::int32_t > entities_to_index(const Topology &topology, int dim, const graph::AdjacencyList< std::int32_t > &entities)
Get entity indices for entities defined by their vertices.
Definition: Topology.cpp:1139
CellType
Cell type identifier.
Definition: cell_types.h:22