Morpheus 1.0.0
Dynamic matrix type and algorithms for sparse matrices
Loading...
Searching...
No Matches
DenseVector/Serial/Morpheus_Convert_Impl.hpp
1
24#ifndef MORPHEUS_DENSEVECTOR_SERIAL_CONVERT_IMPL_HPP
25#define MORPHEUS_DENSEVECTOR_SERIAL_CONVERT_IMPL_HPP
26
27#include <Morpheus_Macros.hpp>
28#if defined(MORPHEUS_ENABLE_SERIAL)
29
30#include <Morpheus_SpaceTraits.hpp>
31#include <Morpheus_FormatTraits.hpp>
32#include <Morpheus_FormatTags.hpp>
33#include <Morpheus_Spaces.hpp>
34
35namespace Morpheus {
36
37namespace Impl {
38
39template <typename ExecSpace, typename SourceType, typename DestinationType>
40void convert(
41 const SourceType& src, DestinationType& dst,
42 typename std::enable_if_t<
43 Morpheus::is_dense_vector_format_container_v<SourceType> &&
44 Morpheus::is_dense_vector_format_container_v<DestinationType> &&
45 Morpheus::has_custom_backend_v<ExecSpace> &&
46 Morpheus::has_serial_execution_space_v<ExecSpace> &&
47 Morpheus::has_access_v<ExecSpace, SourceType, DestinationType>>* =
48 nullptr) {
49 using size_type = typename SourceType::size_type;
50
51 MORPHEUS_ASSERT(dst.size() >= src.size(),
52 "Destination vector must be of equal or larger size to the "
53 "source vector");
54
55 for (size_type i = 0; i < src.size(); i++) {
56 dst[i] = src[i];
57 }
58}
59
60} // namespace Impl
61} // namespace Morpheus
62
63#endif // MORPHEUS_ENABLE_SERIAL
64#endif // MORPHEUS_DENSEVECTOR_SERIAL_CONVERT_IMPL_HPP
Generic Morpheus interfaces.
Definition: dummy.cpp:24