1#include <muda/ext/field/sub_field.h>
10template <
typename T, FieldEntryLayout Layout,
int M,
int N>
11void FieldEntry<T, Layout, M, N>::copy_to(DeviceBuffer<ElementType>& dst)
const
17template <
typename T, FieldEntryLayout Layout,
int M,
int N>
18void FieldEntry<T, Layout, M, N>::copy_to(std::vector<ElementType>& dst)
const
21 m_workpace.resize(count());
22 FieldEntryLaunch().copy(m_workpace.view(), view());
23 BufferLaunch().copy(dst.data(), std::as_const(m_workpace).view()).wait();
26template <
typename T, FieldEntryLayout Layout,
int M,
int N>
27void FieldEntry<T, Layout, M, N>::copy_from(
const DeviceBuffer<ElementType>& src)
29 MUDA_ASSERT(src.size() == count(),
30 "FieldEntry: size mismatch, src.size()=%d, this count()=%d, field entry can't resize itself when copying!",
33 view().copy_from(src.view());
36template <
typename T, FieldEntryLayout Layout,
int M,
int N>
37void FieldEntry<T, Layout, M, N>::copy_from(
const std::vector<ElementType>& src)
39 MUDA_ASSERT(src.size() == count(),
40 "FieldEntry: size mismatch, src.size()=%d, this count()=%d, field entry can't resize itself when copying!",
43 m_workpace.resize(count());
44 BufferLaunch().copy(m_workpace.view(), src.data()).wait();
45 FieldEntryLaunch().copy(view(), std::as_const(m_workpace).view()).wait();
48template <
typename T, FieldEntryLayout Layout,
int M,
int N>
49void FieldEntry<T, Layout, M, N>::fill(
const ElementType& value)
54template <
typename T, FieldEntryLayout Layout,
int M,
int N>
55template <FieldEntryLayout SrcLayout>
56void FieldEntry<T, Layout, M, N>::copy_from(
const FieldEntry<T, SrcLayout, M, N>& src)
58 MUDA_ASSERT(src.count() == count(),
59 "FieldEntry: size mismatch, src.count()=%d, this count()=%d, field entry can't resize itself when copying!",
62 view().copy_from(src.view());