11#include <kernel/util/string.hpp>
28 return "FacetNeighbors";
42 template<
typename NeighborIndexSetType_,
typename FacetIndexSetType_>
43 static void compute(NeighborIndexSetType_& neighbors,
const FacetIndexSetType_& facet_idx)
45 Index num_cells(facet_idx.get_num_entities());
46 Index num_facets(facet_idx.get_index_bound());
48 XASSERT(neighbors.get_num_entities() == num_cells);
52 constexpr Index unset = ~Index(0);
53 std::vector<std::array<Index, 2>> shared_by (num_facets, {unset, unset} );
56 for(Index k = 0; k < num_cells; ++k)
58 for(
int j = 0; j < facet_idx.num_indices; ++j)
61 Index l(facet_idx[k][j]);
63 if(shared_by[l][0] == unset)
65 else if(shared_by[l][1] == unset)
74 FEAT_PRAGMA_OMP(parallel
for)
75 for(Index k = 0; k < num_cells; ++k)
77 for(
int j = 0; j < facet_idx.num_indices; ++j)
80 Index l(facet_idx[k][j]);
82 if(shared_by[l][0] == k)
83 neighbors[k][j] = shared_by[l][1];
84 else if(shared_by[l][1] == k)
85 neighbors[k][j] = shared_by[l][0];
#define XABORTM(msg)
Abortion macro definition with custom message.
#define XASSERT(expr)
Assertion macro definition.
String stringify(const T_ &item)
Converts an item into a String.
std::uint64_t Index
Index data type.