6 #include "../ProxyRefOpMixin.hpp"
17 static_assert(
sizeof(F) == 0,
"F is not an unary function");
20 template<
typename Arg,
typename Ret>
27 template<
typename ProjectionMap,
typename Coord,
typename RecordDimType>
30 if constexpr(mp_map_contains<ProjectionMap, Coord>::value)
31 return mp_identity<mp_second<mp_map_find<ProjectionMap, Coord>>>{};
32 else if constexpr(mp_map_contains<ProjectionMap, RecordDimType>::value)
33 return mp_identity<mp_second<mp_map_find<ProjectionMap, RecordDimType>>>{};
35 return mp_identity<void>{};
38 template<
typename ProjectionMap,
typename Coord,
typename RecordDimType>
39 using ProjectionOrVoid =
typename decltype(projectionOrVoidImpl<ProjectionMap, Coord, RecordDimType>())::type;
41 template<
typename ProjectionMap>
44 template<
typename Coord,
typename RecordDimType>
48 if constexpr(std::is_void_v<Projection>)
49 return mp_identity<RecordDimType>{};
55 static_assert(std::is_same_v<typename LoadFunc::ReturnType, RecordDimType>);
56 static_assert(std::is_same_v<typename StoreFunc::ArgumentType, RecordDimType>);
57 static_assert(std::is_same_v<typename LoadFunc::ArgumentType, typename StoreFunc::ReturnType>);
59 return mp_identity<typename StoreFunc::ReturnType>{};
63 template<
typename Coord,
typename RecordDimType>
64 using fn =
typename decltype(replacedTypeProj<Coord, RecordDimType>())::type;
67 template<
typename RecordDim,
typename ProjectionMap>
71 template<
typename Reference,
typename Projection>
75 ProjectionReference<Reference, Projection>,
76 decltype(Projection::load(std::declval<Reference>()))>
82 using value_type = decltype(Projection::load(std::declval<Reference>()));
85 : storageRef{storageRef}
102 return Projection::load(storageRef);
109 storageRef = Projection::store(v);
126 typename TArrayExtents,
128 template<
typename,
typename>
129 typename InnerMapping,
130 typename TProjectionMap>
132 :
private InnerMapping<TArrayExtents, internal::ReplaceTypesByProjectionResults<TRecordDim, TProjectionMap>>
135 = InnerMapping<TArrayExtents, internal::ReplaceTypesByProjectionResults<TRecordDim, TProjectionMap>>;
139 using Inner::blobCount;
140 using Inner::blobSize;
141 using Inner::extents;
148 template<
typename RecordCoord>
151 return !std::is_void_v<
155 template<std::size_t... RecordCoords,
typename BlobArray>
159 BlobArray& blobs)
const
163 using Reference = decltype(
mapToMemory(
static_cast<const Inner&
>(*
this), ai, rc, blobs));
165 static_assert(!std::is_void_v<Projection>);
173 template<std::size_t... RecordCoords>
178 return Inner::blobNrAndOffset(ai, rc);
185 template<
template<
typename,
typename>
typename InnerMapping,
typename ProjectionMap>
188 template<
typename ArrayExtents,
typename RecordDim>
193 template<
typename Mapping>
198 typename TArrayExtents,
200 template<
typename,
typename>
201 typename InnerMapping,
202 typename ReplacementMap>
203 inline constexpr
bool isProjection<Projection<TArrayExtents, TRecordDim, InnerMapping, ReplacementMap>> =
true;
#define LLAMA_BEGIN_SUPPRESS_HOST_DEVICE_WARNING
#define LLAMA_FN_HOST_ACC_INLINE
#define LLAMA_END_SUPPRESS_HOST_DEVICE_WARNING
typename decltype(projectionOrVoidImpl< ProjectionMap, Coord, RecordDimType >())::type ProjectionOrVoid
auto projectionOrVoidImpl()
TransformLeavesWithCoord< RecordDim, MakeReplacerProj< ProjectionMap >::template fn > ReplaceTypesByProjectionResults
constexpr bool isProjection
ArrayExtents(Args...) -> ArrayExtents< typename internal::IndexTypeFromArgs< std::size_t, Args... >::type,(Args{}, dyn)... >
typename internal::TransformLeavesWithCoordImpl< RecordCoord<>, RecordDim, FieldTypeFunctor >::type TransformLeavesWithCoord
typename internal::GetTypeImpl< RecordDim, RecordCoordOrTags... >::type GetType
auto mapToMemory(Mapping &mapping, typename Mapping::ArrayExtents::Index ai, RecordCoord rc, Blobs &blobs) -> decltype(auto)
ArrayIndex< T, rank > Index
CRTP mixin for proxy reference types to support all compound assignment and increment/decrement opera...
constexpr auto compute(ArrayIndex ai, RecordCoord< RecordCoords... > rc, BlobArray &blobs) const
TProjectionMap ProjectionMap
InnerMapping< TArrayExtents, internal::ReplaceTypesByProjectionResults< TRecordDim, TProjectionMap > > Inner
typename Inner::ArrayExtents ArrayExtents
constexpr auto blobNrAndOffset(ArrayIndex ai, RecordCoord< RecordCoords... > rc={}) const -> NrAndOffset< typename ArrayExtents::value_type >
typename ArrayExtents::Index ArrayIndex
static constexpr auto isComputed(RecordCoord) -> bool
typename decltype(replacedTypeProj< Coord, RecordDimType >())::type fn
static auto replacedTypeProj()
constexpr ProjectionReference(Reference storageRef)
constexpr auto operator=(value_type v) -> ProjectionReference &
ProjectionReference(const ProjectionReference &)=default
decltype(Projection::load(std::declval< Reference >())) value_type
constexpr auto operator=(const ProjectionReference &other) -> ProjectionReference &