Loading...
Searching...
No Matches
CUDAArrayView.hpp
Go to the documentation of this file.
1// This code is based on Jet framework.
2// Copyright (c) 2018 Doyub Kim
3// CubbyFlow is voxel-based fluid simulation engine for computer games.
4// Copyright (c) 2020 CubbyFlow Team
5// Core Part: Chris Ohk, Junwoo Hwang, Jihong Sin, Seungwoo Yoo
6// AI Part: Dongheon Cho, Minseo Kim
7// We are making my contributions/submissions to this project solely in our
8// personal capacity and are not conveying any rights to any intellectual
9// property of any third parties.
10
11#ifndef CUBBYFLOW_CUDA_ARRAY_VIEW_HPP
12#define CUBBYFLOW_CUDA_ARRAY_VIEW_HPP
13
14#ifdef CUBBYFLOW_USE_CUDA
15
17
18namespace CubbyFlow
19{
20template <typename T, size_t N>
21class CUDAArrayView final : public CUDAArrayBase<T, N, CUDAArrayView<T, N>>
22{
24 using Base::At;
25 using Base::m_size;
26 using Base::SetPtrAndSize;
27
28 public:
29 using Base::data;
30
32
35
36 template <size_t M = N>
38 typename std::enable_if<(M == 1), T>::type* ptr, size_t size);
39
41
43
45
47 const CUDAArrayView& other);
48
50 CUDAArrayView&& other) noexcept;
51
53
55
56 CUBBYFLOW_CUDA_HOST void Fill(const T& val);
57};
58
59template <typename T, size_t N>
61 : public CUDAArrayBase<const T, N, CUDAArrayView<const T, N>>
62{
64 using Base::m_size;
65 using Base::SetPtrAndSize;
66
67 public:
68 using Base::data;
69
71
73 const T* ptr, const CUDAStdArray<size_t, N>& size);
74
75 template <size_t M = N>
77 const typename std::enable_if<(M == 1), T>::type* ptr, size_t size);
78
80
82
84
86
89
92
95
97
99
101};
102
105
108
111
114
117
120
123
126} // namespace CubbyFlow
127
128#include <Core/CUDA/CUDAArrayView-Impl.hpp>
129
130#endif
131
132#endif
Definition pybind11Utils.hpp:21
void Fill(ArrayView< T, N > a, const Vector< size_t, N > &begin, const Vector< size_t, N > &end, const T &val)
Definition ArrayUtils-Impl.hpp:19
Matrix< T, Rows, 1 > Vector
Definition Matrix.hpp:738