53 throw std::invalid_argument(
"topology must not be null.");
55 throw std::invalid_argument(
"sub_topology must not be null.");
58 throw std::invalid_argument(
59 "dim out of range for topology/sub_topology.");
63 std::size_t num_ents = e_imap->size_local() + e_imap->num_ghosts();
64 if (num_ents != _sub_topology_to_topology.size())
66 throw std::invalid_argument(
67 "Size mismatch between `sub_topology_to_topology` and index map.");
122 std::size_t num_entities = std::ranges::size(entities);
130 = std::forward<decltype(entities)>(entities)
131 | std::views::transform([
this](std::int32_t i)
132 {
return _sub_topology_to_topology[i]; });
133 std::vector<std::int32_t> mapped_v;
134 mapped_v.reserve(num_entities);
135 std::ranges::copy(mapped, std::back_inserter(mapped_v));
143 std::unordered_map<std::int32_t, std::int32_t> topology_to_sub_topology;
144 topology_to_sub_topology.reserve(_sub_topology_to_topology.size());
145 for (std::size_t i = 0; i < _sub_topology_to_topology.size(); ++i)
147 topology_to_sub_topology.insert(
148 {_sub_topology_to_topology[i],
static_cast<std::int32_t
>(i)});
158 auto mapped = std::forward<decltype(entities)>(entities)
159 | std::views::transform(
160 [&topology_to_sub_topology](std::int32_t i)
164 auto it = topology_to_sub_topology.find(i);
165 return (it != topology_to_sub_topology.end())
169 std::vector<std::int32_t> mapped_v;
170 mapped_v.reserve(num_entities);
171 std::ranges::copy(mapped, std::back_inserter(mapped_v));