15 #ifndef SERIALBOX_CORE_FRONTEND_GRIDTOOLS_STORAGE_VIEW_HELPER_H 16 #define SERIALBOX_CORE_FRONTEND_GRIDTOOLS_STORAGE_VIEW_HELPER_H 18 #include <boost/mpl/max_element.hpp> 19 #include <storage/common/storage_info_rt.hpp> 29 inline std::vector<int> unsigned_to_int(
const std::vector<unsigned int>& in) {
30 std::vector<int> out(in.size());
31 std::copy(in.begin(), in.end(), out.begin());
35 template <
typename StorageType>
36 std::vector<int> get_strides(
const StorageType& storage) {
37 return unsigned_to_int(::gridtools::to_vector(storage.strides()));
43 template <
typename StorageType>
44 std::vector<int> get_dims(
const StorageType& storage) noexcept {
45 return unsigned_to_int(::gridtools::to_vector(
46 ::gridtools::make_unaligned_dims_array(*storage.get_storage_info_ptr())));
49 template <
typename StorageType>
50 void* get_origin_ptr(
const StorageType& storage,
unsigned int field_idx) noexcept {
52 auto* data_ptr = storage.get_storage_ptr()->get_cpu_ptr();
53 auto index = storage.get_storage_info_ptr()->index(
55 return static_cast<void*
>(data_ptr + index);
Namespace of the serialbox library.