Morpheus 1.0.0
Dynamic matrix type and algorithms for sparse matrices
Loading...
Searching...
No Matches
Morpheus_Copy.hpp
1
24#ifndef MORPHEUS_COPY_HPP
25#define MORPHEUS_COPY_HPP
26
27#include <impl/Morpheus_Utils.hpp>
28#include <impl/Morpheus_Copy_Impl.hpp>
29#include <impl/Dynamic/Morpheus_Copy_Impl.hpp>
30
31namespace Morpheus {
51template <typename SourceType, typename DestinationType>
52void copy(const SourceType& src, DestinationType& dst) {
53 Morpheus::Impl::copy(src, dst);
54}
55
70template <typename SourceType, typename DestinationType>
71void copy(const SourceType& src, DestinationType& dst,
72 const typename SourceType::index_type src_begin,
73 const typename SourceType::index_type src_end,
74 const typename DestinationType::index_type dst_begin,
75 const typename DestinationType::index_type dst_end) {
76 static_assert(is_dense_vector_format_container_v<SourceType> &&
77 is_dense_vector_format_container_v<DestinationType>,
78 "Both src and dst must be vectors.");
79 MORPHEUS_ASSERT((src_end - src_begin) == (dst_end - dst_begin),
80 "Source slice range ("
81 << src_begin << ", " << src_end
82 << ") should be equal to the destination slice range ("
83 << dst_begin << ", " << dst_end << ").");
84
85 Morpheus::Impl::copy(src, dst, src_begin, src_end, dst_begin, dst_end);
86}
87
100template <typename SourceType, typename DestinationType>
101void copy(const SourceType& src, DestinationType& dst,
102 const typename SourceType::index_type begin,
103 const typename SourceType::index_type end) {
104 Morpheus::copy(src, dst, begin, end, begin, end);
105}
106
124template <typename ExecSpace, typename KeyType, typename SourceType,
125 typename DestinationType>
126void copy_by_key(const KeyType keys, const SourceType& src,
127 DestinationType& dst) {
128 static_assert(is_dense_vector_format_container_v<SourceType> &&
129 is_dense_vector_format_container_v<DestinationType>,
130 "Both src and dst must be vectors.");
131 Impl::copy_by_key<ExecSpace>(keys, src, dst);
132}
135} // namespace Morpheus
136
137#endif // MORPHEUS_COPY_HPP
void copy_by_key(const KeyType keys, const SourceType &src, DestinationType &dst)
Performs an indirect copy between two containers using a set of key values.
Definition: Morpheus_Copy.hpp:126
void copy(const SourceType &src, DestinationType &dst)
Performs a deep copy operation between two containers.
Definition: Morpheus_Copy.hpp:52
Generic Morpheus interfaces.
Definition: dummy.cpp:24