rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
Loading...
Searching...
No Matches
shape_rule_accessors.hpp
1// SPDX-License-Identifier: GPL-3.0-only
2
3#pragma once
4
5#include <rexlib/core/operation/shape_rule/extent_pivot_source.hpp>
6#include <rexlib/core/operation/shape_rule/named_core.hpp>
7#include <rexlib/core/operation/shape_rule/trailing_core.hpp>
8
9#include <rexlib/core/meta/type_list.hpp>
10#include <rexlib/core/platform/constexpr.hpp>
11#include <rexlib/core/span.hpp>
12
13#include <array>
14#include <cstddef>
15#include <type_traits>
16
17namespace rexlib
18{
19
20namespace detail
21{
22
23template <typename Extents>
25
26template <>
28{
29 using type = type_list<>;
30};
31
32template <typename Head, typename... Tail>
34{
35 using tail_type = typename operation_extent_list<type_list<Tail...>>::type;
36 using type = typename std::conditional<
37 Head::source != extent_pivot_source::inputs,
39 tail_type
40 >::type;
41};
42
43} // namespace detail
44
54template <typename Rule>
56{
57 using operation_extent_list_type = typename detail::operation_extent_list<
58 typename Rule::pivot_list_type
59 >::type;
60
61 static REXLIB_CONST_CONSTEXPR std::size_t operation_extent_count =
63
64 using operation_extent_array_type =
65 std::array<std::size_t, operation_extent_count>;
66
75 template <typename Parameters>
78 ) noexcept;
79
88 template <typename Parameters>
89 static bool get_keep_dimensions(const Parameters &parameters) noexcept;
90
100 template <typename Parameters>
101 static operation_extent_array_type get_operation_extents(
103 ) noexcept;
104};
105
106} // namespace rexlib
107
108#include "shape_rule_accessors.inl"
Container for multidimensional numeric data.
Definition array.hpp:31
Arrays, the operations on them and the devices that run those operations.
Definition cpu_device.hpp:10
@ inputs
Bound by the input axes that name the variable.
Definition shape_rule_accessors.hpp:24
Read the values a shape rule depends on from the parameters of an operation instance.
Definition shape_rule_accessors.hpp:56
static operation_extent_array_type get_operation_extents(const Parameters &parameters) noexcept
Read every extent the operation supplies, whether its instance supplies it or its declaration fixes i...
static span< const std::size_t > get_named_axes(const Parameters &parameters) noexcept
Read the axes the core axes lie along.
static bool get_keep_dimensions(const Parameters &parameters) noexcept
Read whether an output without core axes keeps the named ones.
Utility class to prepend a type to the front of a type_list.
Definition type_list.hpp:63
Utility class to obtain the size of a type_list.
Definition type_list.hpp:28
Helper class to pass a heterogeneous sequence of types to a function.
Definition type_list.hpp:20