10#include "vecmem/edm/details/device_traits.hpp"
11#include "vecmem/edm/details/schema_traits.hpp"
12#include "vecmem/memory/device_atomic_ref.hpp"
20template <
typename... VARTYPES,
template <
typename>
class INTERFACE>
23 : m_capacity{
view.capacity()},
24 m_size{details::device_size_pointer<
vecmem::details::disjunction_v<
26 m_data{
view.variables()} {
29 assert(details::device_capacities_match<VARTYPES...>(
30 m_capacity, m_data, std::index_sequence_for<VARTYPES...>{}));
38 assert(details::device_capacities_match<VARTYPES...>(
39 m_capacity, m_data, std::index_sequence_for<VARTYPES...>{}));
41 return (m_size ==
nullptr ? m_capacity : *m_size);
49 assert(details::device_capacities_match<VARTYPES...>(
50 m_capacity, m_data, std::index_sequence_for<VARTYPES...>{}));
56VECMEM_HOST_AND_DEVICE
auto
62 "Containers with jagged vector variables cannot be resized!");
66 "This function requires at least one vector variable.");
70 assert(details::device_capacities_match<VARTYPES...>(
71 m_capacity, m_data, std::index_sequence_for<VARTYPES...>{}));
77 assert(index < m_capacity);
80 construct_default(index, std::index_sequence_for<VARTYPES...>{});
91 const size_type index = push_back_default();
101template <std::
size_t INDEX>
102VECMEM_HOST_AND_DEVICE
111template <std::
size_t INDEX>
112VECMEM_HOST_AND_DEVICE
121VECMEM_HOST_AND_DEVICE
129 return this->operator[](index);
133VECMEM_HOST_AND_DEVICE
141 return this->operator[](index);
145VECMEM_HOST_AND_DEVICE
154VECMEM_HOST_AND_DEVICE
177template <std::size_t
INDEX, std::size_t...
Is>
178VECMEM_HOST_AND_DEVICE
void
180 size_type index, std::index_sequence<INDEX, Is...>)
const {
185 construct_default(index, std::index_sequence<Is...>{});
188template <
typename... VARTYPES,
template <
typename>
class INTERFACE>
189VECMEM_HOST_AND_DEVICE
void
190device<schema<VARTYPES...>, INTERFACE>::construct_default(
191 size_type, std::index_sequence<>)
const {
195template <
typename... VARTYPES,
template <
typename>
class INTERFACE>
197VECMEM_HOST_AND_DEVICE
void
198device<schema<VARTYPES...>, INTERFACE>::construct_vector(size_type, T&)
const {
202template <
typename... VARTYPES,
template <
typename>
class INTERFACE>
204VECMEM_HOST_AND_DEVICE
void
205device<schema<VARTYPES...>, INTERFACE>::construct_vector(
206 size_type index, device_vector<T>& vec)
const {
208 vec.construct(index, {});
An allocator class that wraps a memory resource.
Definition allocator.hpp:37
interface_type< proxy< schema_type, details::proxy_domain::device, details::proxy_access::non_constant, details::proxy_type::standalone > > object_type
Type type of standalone proxy objects for the container.
Definition device.hpp:67
typename view< schema_type >::size_type size_type
Size type used for the container.
Definition device.hpp:46
Technical base type for device<schema<VARTYPES...>,INTERFACE>
Definition device_vector.hpp:25
Technical base type for view<schema<VARTYPES...>>
Definition view.hpp:29
Main namespace for the vecmem classes/functions.
Definition atomic_ref.hpp:16
VECMEM_HOST_AND_DEVICE constexpr const auto & get(const tuple< Ts... > &t) noexcept
Get a constant element out of a tuple.
Definition tuple.ipp:58
typename tuple_element< I, T >::type tuple_element_t
Convenience accessor for the I-th element of a tuple.
Definition tuple.hpp:204
Implementation for std::disjunction.
Definition type_traits.hpp:72
Definition device_traits.hpp:70
Definition device_traits.hpp:55
Meta type describing the "schema" of an SoA container.
Definition schema.hpp:46
Definition schema_traits.hpp:108
Definition schema_traits.hpp:90
Default tuple type.
Definition tuple.hpp:24