31 using Index =
typename GeometryType::Index;
32 using IndexList =
typename Connectivity<GeometryType>::IndexList;
36 std::unique_ptr<Connectivity<GeometryType>> temporary_conn_ptr =
nullptr;
39 temporary_conn_ptr = compute_connectivity<GeometryType>(geometry);
40 conn = temporary_conn_ptr.get();
44 const auto num_facets = geometry.get_num_facets();
45 std::vector<bool> visited(num_facets,
false);
46 for (Index i = 0; i < num_facets; i++) {
47 if (visited[i])
continue;
48 m_components.emplace_back();
49 auto& comp = m_components.back();
59 const auto& adj_facets = conn->get_facets_adjacent_to_facet(f);
60 for (
const Index& adj_f : adj_facets) {
61 if (!visited[adj_f]) {
63 visited[adj_f] =
true;
69 m_per_facet_component_ids.resize(num_facets);
71 for (
const auto& comp : m_components) {
72 for (
const auto fid : comp) {
73 m_per_facet_component_ids[fid] = comp_id;
79 const std::vector<IndexList>& get_components()
const {
return m_components; }
81 const IndexList& get_per_facet_component_ids()
const {
return m_per_facet_component_ids; }
83 Index get_num_components()
const {
return safe_cast<Index>(m_components.size()); }
86 std::vector<IndexList> m_components;
87 IndexList m_per_facet_component_ids;
constexpr auto safe_cast(SourceType value) -> std::enable_if_t<!std::is_same< SourceType, TargetType >::value, TargetType >
Perform safe cast from SourceType to TargetType, where "safe" means:
Definition safe_cast.h:50