Loading...
Searching...
No Matches
ArrayView-Impl.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_ARRAY_VIEW_IMPL_HPP
12#define CUBBYFLOW_ARRAY_VIEW_IMPL_HPP
13
14#include <Core/Array/Array.hpp>
15
16namespace CubbyFlow
17{
18template <typename T, size_t N>
20{
21 // Do nothing
22}
23
24template <typename T, size_t N>
29
30template <typename T, size_t N>
31template <size_t M>
32ArrayView<T, N>::ArrayView(std::enable_if_t<(M == 1), T*> ptr, size_t size)
34{
35 // Do nothing
36}
37
38template <typename T, size_t N>
43
44template <typename T, size_t N>
46
47template <typename T, size_t N>
49
50template <typename T, size_t N>
53template <typename T, size_t N>
55 default;
57template <typename T, size_t N>
59{
60 Base::SetPtrAndSize(other.data(), other.Size());
61}
62
63template <typename T, size_t N>
65{
66 Base::SetPtrAndSize(other.m_ptr, other.Size());
67}
68
69template <typename T, size_t N>
71{
73 [this, &val](auto... idx) { this->At(idx...) = val; });
74}
75
76template <typename T, size_t N>
78{
79 // Do nothing
80}
81
82template <typename T, size_t N>
84 : ArrayView()
85{
87}
88
89template <typename T, size_t N>
90template <size_t M>
91ArrayView<const T, N>::ArrayView(const std::enable_if_t<(M == 1), T*> ptr,
92 size_t size)
94{
95 // Do nothing
96}
97
98template <typename T, size_t N>
100{
101 Set(other);
102}
103
104template <typename T, size_t N>
109
110template <typename T, size_t N>
112
113template <typename T, size_t N>
115
116template <typename T, size_t N>
118 const ArrayView<T, N>& other)
119{
120 Set(other);
121
122 return *this;
123}
124
125template <typename T, size_t N>
127 const ArrayView<const T, N>& other) = default;
128
129template <typename T, size_t N>
131 ArrayView<const T, N>&& other) noexcept = default;
132
133template <typename T, size_t N>
135{
136 Base::SetPtrAndSize(other.data(), other.Size());
137}
138
139template <typename T, size_t N>
141{
142 Base::SetPtrAndSize(other.data(), other.Size());
143}
144
145template <typename T, size_t N>
146void ArrayView<const T, N>::Set(const ArrayView<const T, N>& other)
147{
148 Base::SetPtrAndSize(other.data(), other.Size());
149}
150} // namespace CubbyFlow
151
152#endif
void SetPtrAndSize(Pointer ptr, size_t ni, Args... args)
Definition ArrayBase-Impl.hpp:250
Generic N-dimensional array class interface.
Definition ArrayView.hpp:26
ArrayView()
Definition ArrayView-Impl.hpp:19
void Set(Array< T, N > &other)
Definition ArrayView-Impl.hpp:58
void Fill(const T &val)
Definition ArrayView-Impl.hpp:70
ArrayView & operator=(const ArrayView &other)
Definition ArrayView-Impl.hpp:117
Definition Matrix.hpp:30
Pointer data()
Definition Matrix-Impl.hpp:298
Definition pybind11Utils.hpp:22
void ForEachIndex(const Vector< IndexType, N > &begin, const Vector< IndexType, N > &end, const Func &func)
Definition IterationUtils-Impl.hpp:51
Matrix< T, Rows, 1 > Vector
Definition Matrix.hpp:648