24#ifndef MORPHEUS_CONTAINER_TRAITS_HPP
25#define MORPHEUS_CONTAINER_TRAITS_HPP
27#include <Morpheus_Spaces.hpp>
29#include <impl/Morpheus_ContainerTraits_Impl.hpp>
52template <
template <
class,
class...>
class Container,
class ValueType,
59 using IndexType =
typename std::conditional_t<
60 !std::is_same_v<typename prop::index_type, void>,
61 typename prop::index_type,
int>;
63 using ExecutionSpace =
typename std::conditional_t<
64 !std::is_same_v<typename prop::execution_space, void>,
65 typename prop::execution_space, Kokkos::DefaultExecutionSpace>;
67 using MemorySpace =
typename std::conditional_t<
68 !std::is_same_v<typename prop::memory_space, void>,
69 typename prop::memory_space,
typename ExecutionSpace::memory_space>;
72 typename std::conditional_t<!std::is_same_v<typename prop::backend, void>,
73 typename prop::backend,
76 using ArrayLayout =
typename std::conditional_t<
77 !std::is_same_v<typename prop::array_layout, void>,
78 typename prop::array_layout,
typename ExecutionSpace::array_layout>;
80 using MemoryTraits =
typename std::conditional<
81 !std::is_same<typename prop::memory_traits, void>::value,
82 typename prop::memory_traits,
typename Kokkos::MemoryManaged>
::type;
85 static_assert(std::is_arithmetic_v<ValueType>,
86 "ValueType must be an arithmetic type such as int or double");
133 Container<value_type, index_type, array_layout, backend, memory_traits>;
141 typename host_mirror_backend::memory_space,
142 typename host_mirror_backend::backend>,
143 typename Kokkos::MemoryManaged>;
147 using pointer =
typename std::add_pointer<type>::type;
151 typename std::add_pointer<typename std::add_const<type>::type>
::type;
154 using reference =
typename std::add_lvalue_reference<type>::type;
158 typename std::add_const<type>::type>
::type;
160 enum { is_hostspace = std::is_same<MemorySpace, Kokkos::HostSpace>::value };
161 enum { is_managed = MemoryTraits::is_unmanaged == 0 };
Generic Morpheus interfaces.
Definition: dummy.cpp:24
Traits class for accessing attributes of a Container (Matrix or Vector)
Definition: Morpheus_ContainerTraits.hpp:54
typename std::add_lvalue_reference< typename std::add_const< type >::type >::type const_reference
The const reference type of the container.
Definition: Morpheus_ContainerTraits.hpp:158
MemorySpace memory_space
The space in which data will be stored in.
Definition: Morpheus_ContainerTraits.hpp:119
MemoryTraits memory_traits
Represents the user's intended access behaviour.
Definition: Morpheus_ContainerTraits.hpp:125
ArrayLayout array_layout
The storage layout of data held by the container.
Definition: Morpheus_ContainerTraits.hpp:110
size_t size_type
The size type of the container.
Definition: Morpheus_ContainerTraits.hpp:103
typename Morpheus::HostMirror< backend >::backend host_mirror_backend
The host equivalent backend.
Definition: Morpheus_ContainerTraits.hpp:128
IndexType index_type
The type of indices held by the container.
Definition: Morpheus_ContainerTraits.hpp:100
typename std::remove_const< ValueType >::type non_const_value_type
The non-const type of values held by the container.
Definition: Morpheus_ContainerTraits.hpp:97
typename std::add_pointer< typename std::add_const< type >::type >::type const_pointer
The const pointer type of the container.
Definition: Morpheus_ContainerTraits.hpp:151
typename std::add_pointer< type >::type pointer
The pointer type of the container.
Definition: Morpheus_ContainerTraits.hpp:147
Backend backend
The backend out of which algorithms will be dispatched from.
Definition: Morpheus_ContainerTraits.hpp:113
Container< value_type, index_type, array_layout, backend, memory_traits > type
The complete type of the container.
Definition: Morpheus_ContainerTraits.hpp:133
typename std::add_const< ValueType >::type const_value_type
The const type of values held by the container.
Definition: Morpheus_ContainerTraits.hpp:94
ExecutionSpace execution_space
The space in which member functions will be executed in.
Definition: Morpheus_ContainerTraits.hpp:116
typename std::add_lvalue_reference< type >::type reference
The reference type of the container.
Definition: Morpheus_ContainerTraits.hpp:154
Container< non_const_value_type, non_const_index_type, array_layout, Morpheus::Device< typename host_mirror_backend::execution_space, typename host_mirror_backend::memory_space, typename host_mirror_backend::backend >, typename Kokkos::MemoryManaged > HostMirror
The host mirror equivalent for the container.
Definition: Morpheus_ContainerTraits.hpp:143
typename std::remove_const< IndexType >::type non_const_index_type
The non-const type of indices held by the container.
Definition: Morpheus_ContainerTraits.hpp:106
A wrapper that converts a valid space into a custom backend.
Definition: Morpheus_CustomBackend.hpp:75
A type that binds together the execution, memory space and backend.
Definition: Morpheus_Spaces.hpp:39
Definition: Morpheus_ContainerTraits_Impl.hpp:38
A wrapper that checks if the provided type is a scalar type.
Definition: Morpheus_TypeTraits.hpp:85