17 #ifndef OPENKALMAN_PACKED_TRIANGLE_MDSPAN_POLICIES_HPP 18 #define OPENKALMAN_PACKED_TRIANGLE_MDSPAN_POLICIES_HPP 21 #include "patterns/patterns.hpp" 29 template<
typename Triangle,
typename StorageOrder>
32 template<
class Extents>
35 using extents_type = Extents;
36 using index_type =
typename extents_type::index_type;
37 using size_type =
typename extents_type::size_type;
38 using rank_type =
typename extents_type::rank_type;
42 mapping(
const extents_type& e) : extents_(e) {}
44 constexpr
const extents_type&
45 extents()
const noexcept {
return extents_; }
49 operator() ()
const requires (extents_type::rank() == 0)
51 template<
bool Enable = true, std::enable_if_t<Enable and (extents_type::rank() == 0),
int> = 0>
56 return access_with_padded_indices();
62 std::convertible_to<index_type>
auto i0,
63 std::convertible_to<index_type>
auto...is)
const requires (1 +
sizeof...(is) == extents_type::rank())
65 template<
typename IndexType0,
typename...IndexTypes, std::enable_if_t<
66 std::is_convertible_v<IndexType0, index_type> and
67 (... and std::is_convertible_v<IndexTypes, index_type>) and
68 (1 +
sizeof...(IndexTypes) == extents_type::rank()),
int> = 0>
70 operator() (IndexType0 i0, IndexTypes...is)
const 73 return access_with_padded_indices(i0, i0, is...);
77 required_span_size()
const noexcept {
return nested_mapping_.required_span_size(); }
79 static constexpr
bool is_always_unique() noexcept {
return nested_mapping_type::is_always_unique(); }
82 is_always_exhaustive() noexcept
84 if constexpr (not nested_mapping_type::is_always_exhaustive())
return false;
85 else if constexpr (nested_extents_type::rank() == 0)
return true;
86 else if constexpr (nested_extents_type::rank() == 1)
return nested_extents_type::static_extent(0) == 1;
87 else return nested_extents_type::static_extent(0) == 1 and nested_extents_type::static_extent(1) == 1;
91 is_always_strided() noexcept {
return nested_mapping_type::is_always_strided(); }
94 is_unique()
const {
return nested_mapping_type::is_unique(); }
99 if (not nested_mapping_type::is_exhaustive())
return false;
100 if constexpr (nested_extents_type::rank() == 0)
return true;
101 else if constexpr (nested_extents_type::rank() == 1)
return nested_mapping_.extents().extent(0) == 1;
102 else return nested_mapping_.extents().extent(0) == 1 and nested_mapping_.extents().extent(1) == 1;
106 is_strided()
const {
return nested_mapping_type::is_strided(); }
109 stride(std::size_t r)
const 111 if (r == 0)
return nested_mapping_.stride(0) + nested_mapping_.stride(1);
112 return nested_mapping_.stride(r - 1);
115 template<
class OtherExtents>
116 friend constexpr
bool 124 extents_type extents_;
Definition: basics.hpp:41
Definition: packed_triangle_mdspan_policies.hpp:33
constexpr auto compare_pattern_collections(const A &a, const B &b)
Compare each element of two pattern_collection objects lexicographically.
Definition: compare_pattern_collections.hpp:137
Definition: packed_triangle_mdspan_policies.hpp:30