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 typedef Index SharedBy[2];
53 std::vector<Index> shared_by_vec(
size_t(2)*num_facets);
54 auto shared_by =
reinterpret_cast<SharedBy*
>(shared_by_vec.data());
57 FEAT_PRAGMA_OMP(parallel
for)
58 for(Index l = 0; l < num_facets; ++l)
60 shared_by[l][0] = ~Index(0);
61 shared_by[l][1] = ~Index(0);
65 for(Index k = 0; k < num_cells; ++k)
67 for(
int j = 0; j < facet_idx.num_indices; ++j)
70 Index l(facet_idx[k][j]);
72 if(shared_by[l][0] == ~
Index(0))
74 else if(shared_by[l][1] == ~
Index(0))
83 FEAT_PRAGMA_OMP(parallel
for)
84 for(Index k = 0; k < num_cells; ++k)
86 for(
int j = 0; j < facet_idx.num_indices; ++j)
89 Index l(facet_idx[k][j]);
91 if(shared_by[l][0] == k)
92 neighbors[k][j] = shared_by[l][1];
93 else if(shared_by[l][1] == k)
94 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.