18template <
class SimplexType>
21template <std::size_t K,
class... Tag>
22struct BoundaryType<
Simplex<K, Tag...>>
24 using type =
Simplex<K - 1, Tag...>;
27template <
class SimplexType,
class LayoutStr
idedPolicy,
class MemorySpace>
28struct BoundaryType<
Chain<SimplexType, LayoutStridedPolicy, MemorySpace>>
36using boundary_t =
typename detail::BoundaryType<T>::type;
41template <
class SimplexType, misc::Specialization<Kokkos::View> AllocationType>
42KOKKOS_FUNCTION
constexpr Chain<
44 typename AllocationType::array_layout,
45 typename AllocationType::memory_space>
46generate_half_subchain(
47 AllocationType allocation,
48 typename SimplexType::discrete_element_type elem,
49 typename SimplexType::discrete_vector_type vect,
50 bool negative =
false)
52 auto array = ddc::detail::array(vect);
54 typename AllocationType::array_layout,
55 typename AllocationType::memory_space>
58 for (std::size_t i = 0; i < SimplexType::dimension(); ++i) {
60 auto j = array_.begin() + id_dist + 1;
61 auto id = std::find_if(j, array_.end(), [](
int k) { return k != 0; });
62 id_dist = std::distance(array_.begin(),
id);
64 typename SimplexType::discrete_vector_type vect_;
65 ddc::detail::array(vect_) = array_;
74template <misc::Specialization<Kokkos::View> AllocationType,
class SimplexType>
77 KOKKOS_FUNCTION
static Chain<
79 typename AllocationType::array_layout,
80 typename AllocationType::memory_space>
81 run(AllocationType allocation, SimplexType simplex)
84 typename AllocationType::array_layout,
85 typename AllocationType::memory_space>
87 detail::generate_half_subchain<SimplexType>(
90 std::pair<std::size_t, std::size_t>(0, SimplexType::dimension())),
91 simplex.discrete_element(),
92 simplex.discrete_vector(),
93 SimplexType::dimension() % 2);
94 chain += SimplexType::dimension();
95 detail::generate_half_subchain<SimplexType>(
98 std::pair<std::size_t, std::size_t>(
99 SimplexType::dimension(),
100 2 * SimplexType::dimension())),
101 simplex.discrete_element() + simplex.discrete_vector(),
102 -simplex.discrete_vector());
103 chain += SimplexType::dimension();
104 chain *= (SimplexType::dimension() % 2 ? 1 : -1) * (simplex.negative() ? -1 : 1);
108 KOKKOS_FUNCTION
static Chain<
110 typename AllocationType::array_layout,
111 typename AllocationType::memory_space>
112 run(AllocationType allocation,
114 typename AllocationType::array_layout,
115 typename AllocationType::memory_space> chain)
118 typename AllocationType::array_layout,
119 typename AllocationType::memory_space>
120 boundary_chain(allocation);
121 for (
auto i = chain.begin(); i < chain.end(); ++i) {
122 std::size_t
const distance = Kokkos::Experimental::distance(chain.begin(), i);
126 std::pair<std::size_t, std::size_t>(
127 2 * SimplexType::dimension() * distance,
128 2 * SimplexType::dimension() * (distance + 1))),
130 boundary_chain += 2 * SimplexType::dimension();
133 return boundary_chain;
137template <misc::Specialization<Kokkos::View> AllocationType,
class SimplexType>
138KOKKOS_FUNCTION
Chain<
140 typename AllocationType::array_layout,
141 typename AllocationType::memory_space>
142boundary(AllocationType allocation, SimplexType simplex)
147template <misc::Specialization<Kokkos::View> AllocationType,
class SimplexType>
148KOKKOS_FUNCTION
Chain<
150 typename AllocationType::array_layout,
151 typename AllocationType::memory_space>
153 AllocationType allocation,
155 typename AllocationType::array_layout,
156 typename AllocationType::memory_space> chain)
static KOKKOS_FUNCTION Chain< boundary_t< SimplexType >, typename AllocationType::array_layout, typename AllocationType::memory_space > run(AllocationType allocation, Chain< SimplexType, typename AllocationType::array_layout, typename AllocationType::memory_space > chain)