Skip to content
Snippets Groups Projects
Commit 80983966 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Add generic copy of arrays (value_copy)

parent 4595e9e3
No related branches found
No related tags found
1 merge request!11Feature/mpi
......@@ -155,4 +155,23 @@ class Sum
~Sum() = default;
};
template <template <typename ...SourceT> typename SourceArray,
template <typename ...ImageT> typename ImageArray,
typename ...SourceT, typename ...ImageT>
void value_copy(const SourceArray<SourceT...>& source_array,
ImageArray<ImageT...>& image_array)
{
using SourceDataType = typename SourceArray<SourceT...>::data_type;
using ImageDataType = typename ImageArray<ImageT...>::data_type;
static_assert(std::is_same_v<std::remove_const_t<SourceDataType>,ImageDataType>);
static_assert(not std::is_const_v<ImageDataType>);
Assert(source_array.size() == image_array.size());
parallel_for(source_array.size(), PASTIS_LAMBDA(const size_t& i) {
image_array[i] = source_array[i];
});
}
#endif //ARRAY_UTILS_HPP
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment