Line | Branch | Exec | Source |
---|---|---|---|
1 | // Copyright Contributors to the OpenVDB Project | ||
2 | // SPDX-License-Identifier: MPL-2.0 | ||
3 | |||
4 | /// @file compiler/VolumeExecutable.cc | ||
5 | |||
6 | #include "VolumeExecutable.h" | ||
7 | #include "Logger.h" | ||
8 | |||
9 | #include "openvdb_ax/Exceptions.h" | ||
10 | // @TODO refactor so we don't have to include VolumeComputeGenerator.h, | ||
11 | // but still have the functions defined in one place | ||
12 | #include "openvdb_ax/codegen/VolumeComputeGenerator.h" | ||
13 | #include "openvdb_ax/codegen/String.h" | ||
14 | |||
15 | #include <openvdb/Exceptions.h> | ||
16 | #include <openvdb/Types.h> | ||
17 | #include <openvdb/math/Coord.h> | ||
18 | #include <openvdb/math/Transform.h> | ||
19 | #include <openvdb/math/Vec3.h> | ||
20 | #include <openvdb/tree/ValueAccessor.h> | ||
21 | #include <openvdb/tree/LeafManager.h> | ||
22 | #include <openvdb/tree/NodeManager.h> | ||
23 | |||
24 | #include <tbb/parallel_for.h> | ||
25 | #include <tbb/task_group.h> | ||
26 | #include <tbb/concurrent_vector.h> | ||
27 | |||
28 | #include <memory> | ||
29 | |||
30 | namespace openvdb { | ||
31 | OPENVDB_USE_VERSION_NAMESPACE | ||
32 | namespace OPENVDB_VERSION_NAME { | ||
33 | |||
34 | namespace ax { | ||
35 | |||
36 | /// @brief Settings which are stored on the volume executer | ||
37 | /// and are configurable by the user. | ||
38 |
1/4✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 752 times.
|
1504 | struct VolumeExecutable::Settings |
39 | { | ||
40 | Index mTreeExecutionLevelMin = 0; | ||
41 | Index mTreeExecutionLevelMax = FloatTree::DEPTH-1; | ||
42 | bool mCreateMissing = true; | ||
43 | IterType mValueIterator = IterType::ON; | ||
44 | Streaming mActiveTileStreaming = Streaming::AUTO; | ||
45 | size_t mGrainSize = 1; | ||
46 | size_t mTileGrainSize = 32; | ||
47 | AttributeBindings mBindings; | ||
48 | }; | ||
49 | |||
50 | namespace { | ||
51 | |||
52 | /// @brief Volume Kernel types | ||
53 | /// | ||
54 | using KernelBufferFunctionPtr = std::add_pointer<codegen::VolumeKernelBuffer::Signature>::type; | ||
55 | using KernelNodeFunctionPtr = std::add_pointer<codegen::VolumeKernelNode::Signature>::type; | ||
56 | |||
57 | template <typename ValueT> | ||
58 | using ConverterT = typename openvdb::BoolGrid::ValueConverter<ValueT>::Type; | ||
59 | using SupportedTypeList = openvdb::TypeList< | ||
60 | ConverterT<double>, | ||
61 | ConverterT<float>, | ||
62 | ConverterT<int64_t>, | ||
63 | ConverterT<int32_t>, | ||
64 | ConverterT<int16_t>, | ||
65 | ConverterT<bool>, | ||
66 | ConverterT<openvdb::math::Vec2<double>>, | ||
67 | ConverterT<openvdb::math::Vec2<float>>, | ||
68 | ConverterT<openvdb::math::Vec2<int32_t>>, | ||
69 | ConverterT<openvdb::math::Vec3<double>>, | ||
70 | ConverterT<openvdb::math::Vec3<float>>, | ||
71 | ConverterT<openvdb::math::Vec3<int32_t>>, | ||
72 | ConverterT<openvdb::math::Vec4<double>>, | ||
73 | ConverterT<openvdb::math::Vec4<float>>, | ||
74 | ConverterT<openvdb::math::Vec4<int32_t>>, | ||
75 | ConverterT<openvdb::math::Mat3<double>>, | ||
76 | ConverterT<openvdb::math::Mat3<float>>, | ||
77 | ConverterT<openvdb::math::Mat4<double>>, | ||
78 | ConverterT<openvdb::math::Mat4<float>>, | ||
79 | ConverterT<std::string>>; | ||
80 | |||
81 | inline bool supported(const ast::tokens::CoreType type) | ||
82 | { | ||
83 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5054 times.
|
5054 | switch (type) { |
84 | case ast::tokens::BOOL : return true; | ||
85 | case ast::tokens::INT16 : return true; | ||
86 | case ast::tokens::INT32 : return true; | ||
87 | case ast::tokens::INT64 : return true; | ||
88 | case ast::tokens::FLOAT : return true; | ||
89 | case ast::tokens::DOUBLE : return true; | ||
90 | case ast::tokens::VEC2I : return true; | ||
91 | case ast::tokens::VEC2F : return true; | ||
92 | case ast::tokens::VEC2D : return true; | ||
93 | case ast::tokens::VEC3I : return true; | ||
94 | case ast::tokens::VEC3F : return true; | ||
95 | case ast::tokens::VEC3D : return true; | ||
96 | case ast::tokens::VEC4I : return true; | ||
97 | case ast::tokens::VEC4F : return true; | ||
98 | case ast::tokens::VEC4D : return true; | ||
99 | case ast::tokens::MAT3F : return true; | ||
100 | case ast::tokens::MAT3D : return true; | ||
101 | case ast::tokens::MAT4F : return true; | ||
102 | case ast::tokens::MAT4D : return true; | ||
103 | case ast::tokens::STRING : return true; | ||
104 | case ast::tokens::UNKNOWN : | ||
105 | default : return false; | ||
106 | } | ||
107 | } | ||
108 | |||
109 | inline openvdb::GridBase::Ptr | ||
110 | 4 | createGrid(const ast::tokens::CoreType& type) | |
111 | { | ||
112 | // assert so the executer can be marked as noexcept (assuming nothing throws in compute) | ||
113 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | assert(supported(type) && "Could not retrieve accessor from unsupported type"); |
114 |
2/21✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
|
4 | switch (type) { |
115 | ✗ | case ast::tokens::BOOL : return ConverterT<bool>::create(); | |
116 | ✗ | case ast::tokens::INT16 : return ConverterT<int16_t>::create(); | |
117 | ✗ | case ast::tokens::INT32 : return ConverterT<int32_t>::create(); | |
118 | ✗ | case ast::tokens::INT64 : return ConverterT<int64_t>::create(); | |
119 | 3 | case ast::tokens::FLOAT : return ConverterT<float>::create(); | |
120 | ✗ | case ast::tokens::DOUBLE : return ConverterT<double>::create(); | |
121 | ✗ | case ast::tokens::VEC2D : return ConverterT<openvdb::math::Vec2<double>>::create(); | |
122 | ✗ | case ast::tokens::VEC2F : return ConverterT<openvdb::math::Vec2<float>>::create(); | |
123 | ✗ | case ast::tokens::VEC2I : return ConverterT<openvdb::math::Vec2<int32_t>>::create(); | |
124 | ✗ | case ast::tokens::VEC3D : return ConverterT<openvdb::math::Vec3<double>>::create(); | |
125 | 2 | case ast::tokens::VEC3F : return ConverterT<openvdb::math::Vec3<float>>::create(); | |
126 | ✗ | case ast::tokens::VEC3I : return ConverterT<openvdb::math::Vec3<int32_t>>::create(); | |
127 | ✗ | case ast::tokens::VEC4D : return ConverterT<openvdb::math::Vec4<double>>::create(); | |
128 | ✗ | case ast::tokens::VEC4F : return ConverterT<openvdb::math::Vec4<float>>::create(); | |
129 | ✗ | case ast::tokens::VEC4I : return ConverterT<openvdb::math::Vec4<int32_t>>::create(); | |
130 | ✗ | case ast::tokens::MAT3D : return ConverterT<openvdb::math::Mat3<double>>::create(); | |
131 | ✗ | case ast::tokens::MAT3F : return ConverterT<openvdb::math::Mat3<float>>::create(); | |
132 | ✗ | case ast::tokens::MAT4D : return ConverterT<openvdb::math::Mat4<double>>::create(); | |
133 | ✗ | case ast::tokens::MAT4F : return ConverterT<openvdb::math::Mat4<float>>::create(); | |
134 | ✗ | case ast::tokens::STRING : return ConverterT<std::string>::create(); | |
135 | case ast::tokens::UNKNOWN : | ||
136 | default : return nullptr; | ||
137 | } | ||
138 | } | ||
139 | |||
140 | struct GridCache | ||
141 | { | ||
142 | inline void addWriteGrid(GridBase& grid) | ||
143 | { | ||
144 |
2/4✓ Branch 1 taken 334 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4581 times.
✗ Branch 5 not taken.
|
4915 | mWrite.emplace_back(&grid); |
145 | 4915 | } | |
146 | |||
147 | 5054 | inline void addReadGrid(GridBase& grid, const bool copy) | |
148 | { | ||
149 |
2/2✓ Branch 0 taken 334 times.
✓ Branch 1 taken 4720 times.
|
5054 | if (copy) { |
150 | // deepCopyGrid returns a shared pointer | ||
151 |
1/2✓ Branch 2 taken 334 times.
✗ Branch 3 not taken.
|
334 | mReadCache.emplace_back(grid.deepCopyGrid()); |
152 | 334 | mRead.emplace_back(mReadCache.back().get()); | |
153 | } | ||
154 | else { | ||
155 | 4720 | mRead.emplace_back(&grid); | |
156 | } | ||
157 | 5054 | } | |
158 | |||
159 | std::vector<GridBase*> mWrite; | ||
160 | std::vector<GridBase*> mRead; | ||
161 | std::vector<GridBase::Ptr> mReadCache; | ||
162 | }; | ||
163 | |||
164 | /// @brief Shared data for the parallel operator | ||
165 | struct OpData | ||
166 | { | ||
167 | KernelBufferFunctionPtr mKernelValueBuffer; | ||
168 | KernelNodeFunctionPtr mKernelNode; | ||
169 | const CustomData* mCustomData; | ||
170 | const AttributeRegistry* mAttributeRegistry; | ||
171 | std::vector<void*> mVoidTransforms; | ||
172 | openvdb::GridBase** mGrids; | ||
173 | size_t mActiveIndex; | ||
174 | Index mTreeLevelMin; // only used with NodeManagers | ||
175 | Index mTreeLevelMax; // only used with NodeManagers | ||
176 | size_t mIterMode; // 0 = OFF, 1 = ON, 2 = ALL | ||
177 | bool mActiveTileStreaming; | ||
178 | size_t mTileGrainSize; | ||
179 | }; | ||
180 | |||
181 | /// The arguments of the generated function | ||
182 | struct VolumeFunctionArguments | ||
183 | { | ||
184 | struct Accessors | ||
185 | { | ||
186 | using UniquePtr = std::unique_ptr<Accessors>; | ||
187 | virtual ~Accessors() = default; | ||
188 | }; | ||
189 | |||
190 | template <typename TreeT> | ||
191 | struct TypedAccessor final : public Accessors | ||
192 | { | ||
193 | using UniquePtr = std::unique_ptr<TypedAccessor<TreeT>>; | ||
194 | 19478848 | TypedAccessor(TreeT& tree) : mAccessor(new tree::ValueAccessor<TreeT>(tree)) {} | |
195 |
1/2✓ Branch 0 taken 4869712 times.
✗ Branch 1 not taken.
|
19478848 | ~TypedAccessor() override final = default; |
196 | const std::unique_ptr<tree::ValueAccessor<TreeT>> mAccessor; | ||
197 | }; | ||
198 | |||
199 | /////////////////////////////////////////////////////////////////////// | ||
200 | /////////////////////////////////////////////////////////////////////// | ||
201 | |||
202 | 4264813 | VolumeFunctionArguments(const OpData& data, openvdb::GridBase** read, const AttributeRegistry& reg) | |
203 | 4264813 | : mData(data) | |
204 | , mAccessors() | ||
205 |
1/2✓ Branch 1 taken 4264813 times.
✗ Branch 2 not taken.
|
4264813 | , mVoidAccessors() |
206 | { | ||
207 |
1/2✓ Branch 1 taken 4264813 times.
✗ Branch 2 not taken.
|
4264813 | mAccessors.reserve(data.mVoidTransforms.size()); |
208 |
1/2✓ Branch 1 taken 4264813 times.
✗ Branch 2 not taken.
|
4264813 | mVoidAccessors.reserve(data.mVoidTransforms.size()); |
209 |
2/2✓ Branch 0 taken 4869712 times.
✓ Branch 1 taken 4264813 times.
|
9134525 | for (const auto& regdata : reg.data()) { |
210 |
1/4✓ Branch 1 taken 4869712 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
4869712 | this->addAccessor(*read, regdata.type()); |
211 | 4869712 | ++read; | |
212 | } | ||
213 | 4264813 | } | |
214 | |||
215 | /// @brief Given a built version of the function signature, automatically | ||
216 | /// bind the current arguments and return a callable function | ||
217 | /// which takes no arguments | ||
218 | inline auto bindBufferKernel() | ||
219 | { | ||
220 | using FunctionTraitsT = codegen::VolumeKernelBuffer::FunctionTraitsT; | ||
221 | using ReturnT = FunctionTraitsT::ReturnType; | ||
222 | |||
223 | return [&](const openvdb::Coord& origin, void* buffer, Index64* mask, const size_t size) -> ReturnT { | ||
224 | 135256966 | return mData.mKernelValueBuffer(static_cast<FunctionTraitsT::Arg<0>::Type>(mData.mCustomData), | |
225 | reinterpret_cast<FunctionTraitsT::Arg<1>::Type>(origin.data()), | ||
226 | static_cast<FunctionTraitsT::Arg<2>::Type>(buffer), | ||
227 | static_cast<FunctionTraitsT::Arg<3>::Type>(mask), | ||
228 | static_cast<FunctionTraitsT::Arg<4>::Type>(size), | ||
229 |
43/200✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 4 taken 49169 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 10 taken 40980 times.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 16 taken 40980 times.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✓ Branch 22 taken 40980 times.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✓ Branch 28 taken 65568 times.
✗ Branch 29 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✓ Branch 40 taken 42 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 36882 times.
✗ Branch 44 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✗ Branch 52 not taken.
✗ Branch 53 not taken.
✓ Branch 55 taken 62 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 36882 times.
✗ Branch 59 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✓ Branch 70 taken 67 times.
✗ Branch 71 not taken.
✓ Branch 73 taken 36882 times.
✗ Branch 74 not taken.
✗ Branch 76 not taken.
✗ Branch 77 not taken.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
✗ Branch 82 not taken.
✗ Branch 83 not taken.
✓ Branch 85 taken 60 times.
✗ Branch 86 not taken.
✓ Branch 88 taken 36882 times.
✗ Branch 89 not taken.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✗ Branch 97 not taken.
✗ Branch 98 not taken.
✓ Branch 100 taken 67 times.
✗ Branch 101 not taken.
✓ Branch 103 taken 36882 times.
✗ Branch 104 not taken.
✗ Branch 106 not taken.
✗ Branch 107 not taken.
✗ Branch 109 not taken.
✗ Branch 110 not taken.
✗ Branch 112 not taken.
✗ Branch 113 not taken.
✓ Branch 115 taken 63 times.
✗ Branch 116 not taken.
✓ Branch 118 taken 36882 times.
✗ Branch 119 not taken.
✗ Branch 121 not taken.
✗ Branch 122 not taken.
✗ Branch 124 not taken.
✗ Branch 125 not taken.
✗ Branch 127 not taken.
✗ Branch 128 not taken.
✓ Branch 130 taken 64 times.
✗ Branch 131 not taken.
✓ Branch 133 taken 49176 times.
✗ Branch 134 not taken.
✗ Branch 136 not taken.
✗ Branch 137 not taken.
✗ Branch 139 not taken.
✗ Branch 140 not taken.
✗ Branch 142 not taken.
✗ Branch 143 not taken.
✓ Branch 145 taken 67 times.
✗ Branch 146 not taken.
✓ Branch 148 taken 49176 times.
✗ Branch 149 not taken.
✗ Branch 151 not taken.
✗ Branch 152 not taken.
✗ Branch 154 not taken.
✗ Branch 155 not taken.
✗ Branch 157 not taken.
✗ Branch 158 not taken.
✓ Branch 160 taken 71 times.
✗ Branch 161 not taken.
✓ Branch 163 taken 49176 times.
✗ Branch 164 not taken.
✗ Branch 166 not taken.
✗ Branch 167 not taken.
✗ Branch 169 not taken.
✗ Branch 170 not taken.
✗ Branch 172 not taken.
✗ Branch 173 not taken.
✓ Branch 175 taken 112 times.
✗ Branch 176 not taken.
✓ Branch 178 taken 53267 times.
✗ Branch 179 not taken.
✗ Branch 181 not taken.
✗ Branch 182 not taken.
✗ Branch 184 not taken.
✗ Branch 185 not taken.
✗ Branch 187 not taken.
✗ Branch 188 not taken.
✓ Branch 190 taken 128 times.
✗ Branch 191 not taken.
✓ Branch 193 taken 32784 times.
✗ Branch 194 not taken.
✗ Branch 196 not taken.
✗ Branch 197 not taken.
✗ Branch 199 not taken.
✗ Branch 200 not taken.
✗ Branch 202 not taken.
✗ Branch 203 not taken.
✓ Branch 205 taken 47 times.
✗ Branch 206 not taken.
✓ Branch 208 taken 65568 times.
✗ Branch 209 not taken.
✗ Branch 211 not taken.
✗ Branch 212 not taken.
✗ Branch 214 not taken.
✗ Branch 215 not taken.
✗ Branch 217 not taken.
✗ Branch 218 not taken.
✓ Branch 220 taken 47 times.
✗ Branch 221 not taken.
✓ Branch 223 taken 65568 times.
✗ Branch 224 not taken.
✗ Branch 226 not taken.
✗ Branch 227 not taken.
✓ Branch 229 taken 4097 times.
✗ Branch 230 not taken.
✗ Branch 232 not taken.
✗ Branch 233 not taken.
✓ Branch 235 taken 47 times.
✗ Branch 236 not taken.
✓ Branch 238 taken 134311973 times.
✗ Branch 239 not taken.
✗ Branch 241 not taken.
✗ Branch 242 not taken.
✗ Branch 244 not taken.
✗ Branch 245 not taken.
✗ Branch 247 not taken.
✗ Branch 248 not taken.
✓ Branch 250 taken 443 times.
✗ Branch 251 not taken.
✓ Branch 253 taken 114744 times.
✗ Branch 254 not taken.
✗ Branch 256 not taken.
✗ Branch 257 not taken.
✗ Branch 259 not taken.
✗ Branch 260 not taken.
✓ Branch 262 taken 34 times.
✗ Branch 263 not taken.
✗ Branch 265 not taken.
✗ Branch 266 not taken.
✗ Branch 268 not taken.
✗ Branch 269 not taken.
✓ Branch 271 taken 280 times.
✗ Branch 272 not taken.
✗ Branch 274 not taken.
✗ Branch 275 not taken.
✗ Branch 277 not taken.
✗ Branch 278 not taken.
✓ Branch 280 taken 93 times.
✗ Branch 281 not taken.
✓ Branch 283 taken 1 times.
✗ Branch 284 not taken.
✓ Branch 286 taken 1 times.
✗ Branch 287 not taken.
✓ Branch 289 taken 280 times.
✗ Branch 290 not taken.
✗ Branch 292 not taken.
✗ Branch 293 not taken.
✗ Branch 295 not taken.
✗ Branch 296 not taken.
✓ Branch 298 taken 392 times.
✗ Branch 299 not taken.
|
135256966 | static_cast<FunctionTraitsT::Arg<5>::Type>(mData.mIterMode), |
230 | static_cast<FunctionTraitsT::Arg<6>::Type>(mVoidAccessors.data()), | ||
231 | static_cast<FunctionTraitsT::Arg<7>::Type>(mData.mVoidTransforms.data()), | ||
232 |
22/120✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 7 taken 42 times.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 16 taken 62 times.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✓ Branch 25 taken 67 times.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✓ Branch 34 taken 60 times.
✗ Branch 35 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✓ Branch 43 taken 67 times.
✗ Branch 44 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✓ Branch 52 taken 63 times.
✗ Branch 53 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✓ Branch 61 taken 64 times.
✗ Branch 62 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✓ Branch 70 taken 67 times.
✗ Branch 71 not taken.
✗ Branch 73 not taken.
✗ Branch 74 not taken.
✗ Branch 76 not taken.
✗ Branch 77 not taken.
✓ Branch 79 taken 71 times.
✗ Branch 80 not taken.
✗ Branch 82 not taken.
✗ Branch 83 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✓ Branch 88 taken 112 times.
✗ Branch 89 not taken.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✓ Branch 97 taken 128 times.
✗ Branch 98 not taken.
✗ Branch 100 not taken.
✗ Branch 101 not taken.
✗ Branch 103 not taken.
✗ Branch 104 not taken.
✓ Branch 106 taken 47 times.
✗ Branch 107 not taken.
✗ Branch 109 not taken.
✗ Branch 110 not taken.
✗ Branch 112 not taken.
✗ Branch 113 not taken.
✓ Branch 115 taken 47 times.
✗ Branch 116 not taken.
✗ Branch 118 not taken.
✗ Branch 119 not taken.
✗ Branch 121 not taken.
✗ Branch 122 not taken.
✓ Branch 124 taken 47 times.
✗ Branch 125 not taken.
✗ Branch 127 not taken.
✗ Branch 128 not taken.
✗ Branch 130 not taken.
✗ Branch 131 not taken.
✓ Branch 133 taken 443 times.
✗ Branch 134 not taken.
✗ Branch 136 not taken.
✗ Branch 137 not taken.
✗ Branch 139 not taken.
✗ Branch 140 not taken.
✓ Branch 142 taken 34 times.
✗ Branch 143 not taken.
✗ Branch 145 not taken.
✗ Branch 146 not taken.
✗ Branch 148 not taken.
✗ Branch 149 not taken.
✓ Branch 151 taken 280 times.
✗ Branch 152 not taken.
✗ Branch 154 not taken.
✗ Branch 155 not taken.
✗ Branch 157 not taken.
✗ Branch 158 not taken.
✓ Branch 160 taken 93 times.
✗ Branch 161 not taken.
✓ Branch 163 taken 1 times.
✗ Branch 164 not taken.
✓ Branch 166 taken 1 times.
✗ Branch 167 not taken.
✓ Branch 169 taken 280 times.
✗ Branch 170 not taken.
✗ Branch 172 not taken.
✗ Branch 173 not taken.
✗ Branch 175 not taken.
✗ Branch 176 not taken.
✓ Branch 178 taken 392 times.
✗ Branch 179 not taken.
|
135256966 | static_cast<FunctionTraitsT::Arg<8>::Type>(mData.mActiveIndex)); |
233 | }; | ||
234 | } | ||
235 | |||
236 | inline auto bindNodeKernel(void* activeAccessor) | ||
237 | { | ||
238 | using FunctionTraitsT = codegen::VolumeKernelNode::FunctionTraitsT; | ||
239 | using ReturnT = FunctionTraitsT::ReturnType; | ||
240 | |||
241 | return [&, activeAccessor](const openvdb::Coord& ijk) -> ReturnT { | ||
242 | 80343 | return mData.mKernelNode(static_cast<FunctionTraitsT::Arg<0>::Type>(mData.mCustomData), | |
243 | reinterpret_cast<FunctionTraitsT::Arg<1>::Type>(ijk.data()), | ||
244 | static_cast<FunctionTraitsT::Arg<2>::Type>(mVoidAccessors.data()), | ||
245 | static_cast<FunctionTraitsT::Arg<3>::Type>(mData.mVoidTransforms.data()), | ||
246 |
44/320✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✓ Branch 19 taken 34 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 68 times.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✓ Branch 43 taken 52 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 104 times.
✗ Branch 47 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✗ Branch 52 not taken.
✗ Branch 53 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✓ Branch 67 taken 57 times.
✗ Branch 68 not taken.
✓ Branch 70 taken 114 times.
✗ Branch 71 not taken.
✗ Branch 73 not taken.
✗ Branch 74 not taken.
✗ Branch 76 not taken.
✗ Branch 77 not taken.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
✗ Branch 82 not taken.
✗ Branch 83 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 88 not taken.
✗ Branch 89 not taken.
✓ Branch 91 taken 50 times.
✗ Branch 92 not taken.
✓ Branch 94 taken 100 times.
✗ Branch 95 not taken.
✗ Branch 97 not taken.
✗ Branch 98 not taken.
✗ Branch 100 not taken.
✗ Branch 101 not taken.
✗ Branch 103 not taken.
✗ Branch 104 not taken.
✗ Branch 106 not taken.
✗ Branch 107 not taken.
✗ Branch 109 not taken.
✗ Branch 110 not taken.
✗ Branch 112 not taken.
✗ Branch 113 not taken.
✓ Branch 115 taken 51 times.
✗ Branch 116 not taken.
✓ Branch 118 taken 102 times.
✗ Branch 119 not taken.
✗ Branch 121 not taken.
✗ Branch 122 not taken.
✗ Branch 124 not taken.
✗ Branch 125 not taken.
✗ Branch 127 not taken.
✗ Branch 128 not taken.
✗ Branch 130 not taken.
✗ Branch 131 not taken.
✗ Branch 133 not taken.
✗ Branch 134 not taken.
✗ Branch 136 not taken.
✗ Branch 137 not taken.
✓ Branch 139 taken 54 times.
✗ Branch 140 not taken.
✓ Branch 142 taken 108 times.
✗ Branch 143 not taken.
✗ Branch 145 not taken.
✗ Branch 146 not taken.
✗ Branch 148 not taken.
✗ Branch 149 not taken.
✗ Branch 151 not taken.
✗ Branch 152 not taken.
✗ Branch 154 not taken.
✗ Branch 155 not taken.
✗ Branch 157 not taken.
✗ Branch 158 not taken.
✗ Branch 160 not taken.
✗ Branch 161 not taken.
✓ Branch 163 taken 55 times.
✗ Branch 164 not taken.
✓ Branch 166 taken 110 times.
✗ Branch 167 not taken.
✗ Branch 169 not taken.
✗ Branch 170 not taken.
✗ Branch 172 not taken.
✗ Branch 173 not taken.
✗ Branch 175 not taken.
✗ Branch 176 not taken.
✗ Branch 178 not taken.
✗ Branch 179 not taken.
✗ Branch 181 not taken.
✗ Branch 182 not taken.
✗ Branch 184 not taken.
✗ Branch 185 not taken.
✓ Branch 187 taken 58 times.
✗ Branch 188 not taken.
✓ Branch 190 taken 116 times.
✗ Branch 191 not taken.
✗ Branch 193 not taken.
✗ Branch 194 not taken.
✗ Branch 196 not taken.
✗ Branch 197 not taken.
✗ Branch 199 not taken.
✗ Branch 200 not taken.
✗ Branch 202 not taken.
✗ Branch 203 not taken.
✗ Branch 205 not taken.
✗ Branch 206 not taken.
✗ Branch 208 not taken.
✗ Branch 209 not taken.
✓ Branch 211 taken 62 times.
✗ Branch 212 not taken.
✓ Branch 214 taken 124 times.
✗ Branch 215 not taken.
✗ Branch 217 not taken.
✗ Branch 218 not taken.
✗ Branch 220 not taken.
✗ Branch 221 not taken.
✗ Branch 223 not taken.
✗ Branch 224 not taken.
✗ Branch 226 not taken.
✗ Branch 227 not taken.
✗ Branch 229 not taken.
✗ Branch 230 not taken.
✗ Branch 232 not taken.
✗ Branch 233 not taken.
✓ Branch 235 taken 102 times.
✗ Branch 236 not taken.
✓ Branch 238 taken 204 times.
✗ Branch 239 not taken.
✗ Branch 241 not taken.
✗ Branch 242 not taken.
✗ Branch 244 not taken.
✗ Branch 245 not taken.
✗ Branch 247 not taken.
✗ Branch 248 not taken.
✗ Branch 250 not taken.
✗ Branch 251 not taken.
✗ Branch 253 not taken.
✗ Branch 254 not taken.
✗ Branch 256 not taken.
✗ Branch 257 not taken.
✓ Branch 259 taken 119 times.
✗ Branch 260 not taken.
✓ Branch 262 taken 238 times.
✗ Branch 263 not taken.
✗ Branch 265 not taken.
✗ Branch 266 not taken.
✗ Branch 268 not taken.
✗ Branch 269 not taken.
✗ Branch 271 not taken.
✗ Branch 272 not taken.
✗ Branch 274 not taken.
✗ Branch 275 not taken.
✗ Branch 277 not taken.
✗ Branch 278 not taken.
✗ Branch 280 not taken.
✗ Branch 281 not taken.
✓ Branch 283 taken 35 times.
✗ Branch 284 not taken.
✓ Branch 286 taken 70 times.
✗ Branch 287 not taken.
✗ Branch 289 not taken.
✗ Branch 290 not taken.
✗ Branch 292 not taken.
✗ Branch 293 not taken.
✗ Branch 295 not taken.
✗ Branch 296 not taken.
✗ Branch 298 not taken.
✗ Branch 299 not taken.
✗ Branch 301 not taken.
✗ Branch 302 not taken.
✗ Branch 304 not taken.
✗ Branch 305 not taken.
✓ Branch 307 taken 35 times.
✗ Branch 308 not taken.
✓ Branch 310 taken 70 times.
✗ Branch 311 not taken.
✗ Branch 313 not taken.
✗ Branch 314 not taken.
✗ Branch 316 not taken.
✗ Branch 317 not taken.
✗ Branch 319 not taken.
✗ Branch 320 not taken.
✗ Branch 322 not taken.
✗ Branch 323 not taken.
✗ Branch 325 not taken.
✗ Branch 326 not taken.
✗ Branch 328 not taken.
✗ Branch 329 not taken.
✓ Branch 331 taken 35 times.
✗ Branch 332 not taken.
✓ Branch 334 taken 70 times.
✗ Branch 335 not taken.
✗ Branch 337 not taken.
✗ Branch 338 not taken.
✗ Branch 340 not taken.
✗ Branch 341 not taken.
✗ Branch 343 not taken.
✗ Branch 344 not taken.
✗ Branch 346 not taken.
✗ Branch 347 not taken.
✗ Branch 349 not taken.
✗ Branch 350 not taken.
✗ Branch 352 not taken.
✗ Branch 353 not taken.
✓ Branch 355 taken 434 times.
✗ Branch 356 not taken.
✓ Branch 358 taken 868 times.
✗ Branch 359 not taken.
✗ Branch 361 not taken.
✗ Branch 362 not taken.
✗ Branch 364 not taken.
✗ Branch 365 not taken.
✗ Branch 367 not taken.
✗ Branch 368 not taken.
✗ Branch 370 not taken.
✗ Branch 371 not taken.
✗ Branch 373 not taken.
✗ Branch 374 not taken.
✗ Branch 376 not taken.
✗ Branch 377 not taken.
✓ Branch 379 taken 26 times.
✗ Branch 380 not taken.
✓ Branch 382 taken 52 times.
✗ Branch 383 not taken.
✗ Branch 385 not taken.
✗ Branch 386 not taken.
✗ Branch 388 not taken.
✗ Branch 389 not taken.
✗ Branch 391 not taken.
✗ Branch 392 not taken.
✗ Branch 394 not taken.
✗ Branch 395 not taken.
✗ Branch 397 not taken.
✗ Branch 398 not taken.
✗ Branch 400 not taken.
✗ Branch 401 not taken.
✓ Branch 403 taken 255 times.
✗ Branch 404 not taken.
✓ Branch 406 taken 510 times.
✗ Branch 407 not taken.
✗ Branch 409 not taken.
✗ Branch 410 not taken.
✗ Branch 412 not taken.
✗ Branch 413 not taken.
✗ Branch 415 not taken.
✗ Branch 416 not taken.
✗ Branch 418 not taken.
✗ Branch 419 not taken.
✗ Branch 421 not taken.
✗ Branch 422 not taken.
✗ Branch 424 not taken.
✗ Branch 425 not taken.
✓ Branch 427 taken 77 times.
✗ Branch 428 not taken.
✓ Branch 430 taken 154 times.
✗ Branch 431 not taken.
✓ Branch 433 taken 32766 times.
✗ Branch 434 not taken.
✗ Branch 436 not taken.
✗ Branch 437 not taken.
✓ Branch 439 taken 4094 times.
✗ Branch 440 not taken.
✗ Branch 442 not taken.
✗ Branch 443 not taken.
✓ Branch 445 taken 32766 times.
✗ Branch 446 not taken.
✓ Branch 448 taken 4094 times.
✗ Branch 449 not taken.
✓ Branch 451 taken 253 times.
✗ Branch 452 not taken.
✓ Branch 454 taken 500 times.
✗ Branch 455 not taken.
✗ Branch 457 not taken.
✗ Branch 458 not taken.
✗ Branch 460 not taken.
✗ Branch 461 not taken.
✗ Branch 463 not taken.
✗ Branch 464 not taken.
✗ Branch 466 not taken.
✗ Branch 467 not taken.
✗ Branch 469 not taken.
✗ Branch 470 not taken.
✗ Branch 472 not taken.
✗ Branch 473 not taken.
✓ Branch 475 taken 364 times.
✗ Branch 476 not taken.
✓ Branch 478 taken 728 times.
✗ Branch 479 not taken.
|
80338 | static_cast<FunctionTraitsT::Arg<4>::Type>(mData.mActiveIndex), |
247 | 80343 | static_cast<FunctionTraitsT::Arg<5>::Type>(activeAccessor)); | |
248 | }; | ||
249 | } | ||
250 | |||
251 | private: | ||
252 | template <typename TreeT> | ||
253 | inline void | ||
254 | 9739424 | addAccessor(TreeT& tree) | |
255 | { | ||
256 |
1/2✓ Branch 2 taken 4869712 times.
✗ Branch 3 not taken.
|
9739424 | typename TypedAccessor<TreeT>::UniquePtr accessor(new TypedAccessor<TreeT>(tree)); |
257 |
1/4✓ Branch 1 taken 4869712 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
9739424 | mVoidAccessors.emplace_back(accessor->mAccessor.get()); |
258 |
1/2✓ Branch 1 taken 4869712 times.
✗ Branch 2 not taken.
|
9739424 | mAccessors.emplace_back(std::move(accessor)); |
259 | 9739424 | } | |
260 | |||
261 | inline void | ||
262 | 4869712 | addAccessor(openvdb::GridBase* grid, const ast::tokens::CoreType& type) | |
263 | { | ||
264 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4869712 times.
|
4869712 | assert(grid); |
265 | // assert so the executer can be marked as noexcept (assuming nothing throws in compute) | ||
266 |
1/2✓ Branch 0 taken 4869712 times.
✗ Branch 1 not taken.
|
4869712 | assert(supported(type) && "Could not retrieve accessor from unsupported type"); |
267 |
20/21✓ Branch 0 taken 50869 times.
✓ Branch 1 taken 19254 times.
✓ Branch 2 taken 47812 times.
✓ Branch 3 taken 40226 times.
✓ Branch 4 taken 4240317 times.
✓ Branch 5 taken 60840 times.
✓ Branch 6 taken 29458 times.
✓ Branch 7 taken 29458 times.
✓ Branch 8 taken 29458 times.
✓ Branch 9 taken 31123 times.
✓ Branch 10 taken 31058 times.
✓ Branch 11 taken 30226 times.
✓ Branch 12 taken 29932 times.
✓ Branch 13 taken 29878 times.
✓ Branch 14 taken 29866 times.
✓ Branch 15 taken 33690 times.
✓ Branch 16 taken 30510 times.
✓ Branch 17 taken 30822 times.
✓ Branch 18 taken 30615 times.
✓ Branch 19 taken 14300 times.
✗ Branch 20 not taken.
|
4869712 | switch (type) { |
268 | 50869 | case ast::tokens::BOOL : { this->addAccessor(static_cast<ConverterT<bool>*>(grid)->tree()); return; } | |
269 | 19254 | case ast::tokens::INT16 : { this->addAccessor(static_cast<ConverterT<int16_t>*>(grid)->tree()); return; } | |
270 | 47812 | case ast::tokens::INT32 : { this->addAccessor(static_cast<ConverterT<int32_t>*>(grid)->tree()); return; } | |
271 | 40226 | case ast::tokens::INT64 : { this->addAccessor(static_cast<ConverterT<int64_t>*>(grid)->tree()); return; } | |
272 | 4240317 | case ast::tokens::FLOAT : { this->addAccessor(static_cast<ConverterT<float>*>(grid)->tree()); return; } | |
273 | 60840 | case ast::tokens::DOUBLE : { this->addAccessor(static_cast<ConverterT<double>*>(grid)->tree()); return; } | |
274 | 29458 | case ast::tokens::VEC2D : { this->addAccessor(static_cast<ConverterT<openvdb::math::Vec2<double>>*>(grid)->tree()); return; } | |
275 | 29458 | case ast::tokens::VEC2F : { this->addAccessor(static_cast<ConverterT<openvdb::math::Vec2<float>>*>(grid)->tree()); return; } | |
276 | 29458 | case ast::tokens::VEC2I : { this->addAccessor(static_cast<ConverterT<openvdb::math::Vec2<int32_t>>*>(grid)->tree()); return; } | |
277 | 31123 | case ast::tokens::VEC3D : { this->addAccessor(static_cast<ConverterT<openvdb::math::Vec3<double>>*>(grid)->tree()); return; } | |
278 | 31058 | case ast::tokens::VEC3F : { this->addAccessor(static_cast<ConverterT<openvdb::math::Vec3<float>>*>(grid)->tree()); return; } | |
279 | 30226 | case ast::tokens::VEC3I : { this->addAccessor(static_cast<ConverterT<openvdb::math::Vec3<int32_t>>*>(grid)->tree()); return; } | |
280 | 29932 | case ast::tokens::VEC4D : { this->addAccessor(static_cast<ConverterT<openvdb::math::Vec4<double>>*>(grid)->tree()); return; } | |
281 | 29878 | case ast::tokens::VEC4F : { this->addAccessor(static_cast<ConverterT<openvdb::math::Vec4<float>>*>(grid)->tree()); return; } | |
282 | 29866 | case ast::tokens::VEC4I : { this->addAccessor(static_cast<ConverterT<openvdb::math::Vec4<int32_t>>*>(grid)->tree()); return; } | |
283 | 33690 | case ast::tokens::MAT3D : { this->addAccessor(static_cast<ConverterT<openvdb::math::Mat3<double>>*>(grid)->tree()); return; } | |
284 | 30510 | case ast::tokens::MAT3F : { this->addAccessor(static_cast<ConverterT<openvdb::math::Mat3<float>>*>(grid)->tree()); return; } | |
285 | 30822 | case ast::tokens::MAT4D : { this->addAccessor(static_cast<ConverterT<openvdb::math::Mat4<double>>*>(grid)->tree()); return; } | |
286 | 30615 | case ast::tokens::MAT4F : { this->addAccessor(static_cast<ConverterT<openvdb::math::Mat4<float>>*>(grid)->tree()); return; } | |
287 | 14300 | case ast::tokens::STRING : { this->addAccessor(static_cast<ConverterT<std::string>*>(grid)->tree()); return; } | |
288 | case ast::tokens::UNKNOWN : | ||
289 | default : return; | ||
290 | } | ||
291 | } | ||
292 | |||
293 | private: | ||
294 | const OpData& mData; | ||
295 | std::vector<Accessors::UniquePtr> mAccessors; | ||
296 | std::vector<void*> mVoidAccessors; | ||
297 | }; | ||
298 | |||
299 | struct ValueOnIter | ||
300 | { | ||
301 | template<typename NodeT> | ||
302 | using IterTraitsT = typename tree::IterTraits<NodeT, typename NodeT::ValueOnIter>; | ||
303 | }; | ||
304 | |||
305 | struct ValueAllIter | ||
306 | { | ||
307 | template<typename NodeT> | ||
308 | using IterTraitsT = typename tree::IterTraits<NodeT, typename NodeT::ValueAllIter>; | ||
309 | }; | ||
310 | |||
311 | struct ValueOffIter | ||
312 | { | ||
313 | template<typename NodeT> | ||
314 | using IterTraitsT = typename tree::IterTraits<NodeT, typename NodeT::ValueOffIter>; | ||
315 | }; | ||
316 | |||
317 | template <typename TreeT, typename IterT> | ||
318 | struct VolumeExecuterOp | ||
319 | { | ||
320 | using LeafManagerT = tree::LeafManager<TreeT>; | ||
321 | using LeafRangeT = typename LeafManagerT::LeafRange; | ||
322 | using RootNodeT = typename TreeT::RootNodeType; | ||
323 | using LeafNodeT = typename TreeT::LeafNodeType; | ||
324 | using ValueT = typename TreeT::ValueType; | ||
325 | using IterType = typename IterT::template IterTraitsT<LeafNodeT>; | ||
326 | |||
327 | /// @brief Small struct that represents a single VDB value | ||
328 | ✗ | struct Tile { | |
329 | Tile() = default; | ||
330 | ✗ | Tile(const Index offset, const ValueT& v, const bool on) | |
331 | ✗ | : mOffset(offset), mValue(v), mActive(on) {} | |
332 | Index mOffset; ValueT mValue; bool mActive; | ||
333 | }; | ||
334 | |||
335 | 4915 | VolumeExecuterOp(const OpData& data, TreeT& tree) | |
336 | : mData(data) | ||
337 | 4915 | , mTree(tree) {} | |
338 | |||
339 | /////////////////////////////////////////////////////////////////////////// | ||
340 | /////////////////////////////////////////////////////////////////////////// | ||
341 | |||
342 | /// @brief Public operator for all node types except LeafNodes (i.e. | ||
343 | /// RootNode types and InternalNode types). Active values can be streamed | ||
344 | /// when enabled. Otherwise, depending on the iterator type, Active and | ||
345 | /// Inactive values are processed. | ||
346 | /// @note The steaming of active values can produce child topology, but | ||
347 | /// the non-streamed (standard value iteration) execution does not | ||
348 | /// descend into lower levels of the tree. | ||
349 | template <typename NodeType, typename = | ||
350 | typename std::enable_if<!std::is_same<NodeType, LeafRangeT>::value>::type> | ||
351 | 34370 | void operator()(NodeType& node) const | |
352 | { | ||
353 | // if the current node level does not match, skip | ||
354 | const Index level = node.getLevel(); | ||
355 | assert(level > 0); | ||
356 |
2/2✓ Branch 0 taken 17181 times.
✓ Branch 1 taken 4 times.
|
34370 | if (level < mData.mTreeLevelMin) return; |
357 |
2/2✓ Branch 0 taken 17175 times.
✓ Branch 1 taken 6 times.
|
34362 | if (level > mData.mTreeLevelMax) return; |
358 | |||
359 |
2/2✓ Branch 0 taken 1709 times.
✓ Branch 1 taken 15466 times.
|
34350 | if (mData.mActiveTileStreaming) { |
360 | // Expect that the iterator type is NOT ValueOff if we are | ||
361 | // streaming ACTIVE tiles (this is an artificial limitation to stop | ||
362 | // typical VDBs memory exploding when things like inactive root | ||
363 | // node tiles are streamed). | ||
364 | ✗ | assert((!std::is_same<ValueOffIter, IterT>::value)); | |
365 | // Process ACTIVE values | ||
366 | 3418 | this->process(node); | |
367 | |||
368 | if (std::is_same<ValueAllIter, IterT>::value) { | ||
369 | // If we're streaming active values but processing both active | ||
370 | // and inactive (all) values, manually process OFF value tiles | ||
371 | /// @warning The value off iterator visits child nodes, so skip them | ||
372 | using IterType = ValueOffIter::IterTraitsT<NodeType>; | ||
373 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
2 | auto it = IterType::begin(node); |
374 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2 times.
|
6 | if (!it) return; // only possible if this node only has active tiles |
375 | 8 | VolumeFunctionArguments args(mData, mData.mGrids, *mData.mAttributeRegistry); | |
376 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
4 | tree::ValueAccessor<TreeT> acc(mTree); |
377 | /// @note the node kernel works for any VDB configuration and value type | ||
378 | auto kernel = args.bindNodeKernel(static_cast<void*>(&acc)); | ||
379 |
2/2✓ Branch 0 taken 36864 times.
✓ Branch 1 taken 2 times.
|
73732 | for (; it; ++it) { |
380 | // Manually skip child topology (not-skipped by the ValueOff iterator) | ||
381 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 36860 times.
|
73728 | if (this->isChildMaskOn(node, it.pos())) continue; |
382 |
1/5✓ Branch 1 taken 36860 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
147440 | kernel(it.getCoord()); |
383 | } | ||
384 | } | ||
385 | } | ||
386 | else { | ||
387 | // If we're here, we are not streaming active values - simply process | ||
388 | // each individual tile value pointed at by the value iterator | ||
389 | /// @warning The value off iterator visits child nodes, so skip them | ||
390 | using IterType = typename IterT::template IterTraitsT<NodeType>; | ||
391 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4422 times.
|
8844 | auto it = IterType::begin(node); |
392 |
2/2✓ Branch 0 taken 11043 times.
✓ Branch 1 taken 4423 times.
|
30932 | if (!it) return; |
393 | 17692 | VolumeFunctionArguments args(mData, mData.mGrids, *mData.mAttributeRegistry); | |
394 |
1/2✓ Branch 1 taken 4423 times.
✗ Branch 2 not taken.
|
8846 | tree::ValueAccessor<TreeT> acc(mTree); |
395 | /// @note the node kernel works for any VDB configuration and value type | ||
396 | auto kernel = args.bindNodeKernel(static_cast<void*>(&acc)); | ||
397 |
2/2✓ Branch 0 taken 43485 times.
✓ Branch 1 taken 4423 times.
|
95816 | for (; it; ++it) { |
398 | // Manually skip child topology (not-skipped by the ValueOff iterator) | ||
399 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 36860 times.
|
73724 | if (std::is_same<ValueOffIter, IterT>::value && |
400 | 4 | this->isChildMaskOn(node, it.pos())) continue; | |
401 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6618 times.
|
13246 | assert(!this->isChildMaskOn(node, it.pos())); |
402 |
1/5✓ Branch 1 taken 43483 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
173932 | kernel(it.getCoord()); |
403 | } | ||
404 | } | ||
405 | } | ||
406 | |||
407 | // For use with a LeafManager, when the target execution level is 0 | ||
408 | /// @note We currently don't use the same node manager to process leaf | ||
409 | /// nodes. Instead, we use a unique leaf manager which calls the | ||
410 | /// LeafRangeT operator. | ||
411 | void operator()(const LeafRangeT& range) const | ||
412 | { | ||
413 |
0/240✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 50 not taken.
✗ Branch 51 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 62 not taken.
✗ Branch 63 not taken.
✗ Branch 66 not taken.
✗ Branch 67 not taken.
✗ Branch 70 not taken.
✗ Branch 71 not taken.
✗ Branch 74 not taken.
✗ Branch 75 not taken.
✗ Branch 78 not taken.
✗ Branch 79 not taken.
✗ Branch 82 not taken.
✗ Branch 83 not taken.
✗ Branch 86 not taken.
✗ Branch 87 not taken.
✗ Branch 90 not taken.
✗ Branch 91 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✗ Branch 98 not taken.
✗ Branch 99 not taken.
✗ Branch 102 not taken.
✗ Branch 103 not taken.
✗ Branch 106 not taken.
✗ Branch 107 not taken.
✗ Branch 110 not taken.
✗ Branch 111 not taken.
✗ Branch 114 not taken.
✗ Branch 115 not taken.
✗ Branch 118 not taken.
✗ Branch 119 not taken.
✗ Branch 122 not taken.
✗ Branch 123 not taken.
✗ Branch 126 not taken.
✗ Branch 127 not taken.
✗ Branch 130 not taken.
✗ Branch 131 not taken.
✗ Branch 134 not taken.
✗ Branch 135 not taken.
✗ Branch 138 not taken.
✗ Branch 139 not taken.
✗ Branch 142 not taken.
✗ Branch 143 not taken.
✗ Branch 146 not taken.
✗ Branch 147 not taken.
✗ Branch 150 not taken.
✗ Branch 151 not taken.
✗ Branch 154 not taken.
✗ Branch 155 not taken.
✗ Branch 158 not taken.
✗ Branch 159 not taken.
✗ Branch 162 not taken.
✗ Branch 163 not taken.
✗ Branch 166 not taken.
✗ Branch 167 not taken.
✗ Branch 170 not taken.
✗ Branch 171 not taken.
✗ Branch 174 not taken.
✗ Branch 175 not taken.
✗ Branch 178 not taken.
✗ Branch 179 not taken.
✗ Branch 182 not taken.
✗ Branch 183 not taken.
✗ Branch 186 not taken.
✗ Branch 187 not taken.
✗ Branch 190 not taken.
✗ Branch 191 not taken.
✗ Branch 194 not taken.
✗ Branch 195 not taken.
✗ Branch 198 not taken.
✗ Branch 199 not taken.
✗ Branch 202 not taken.
✗ Branch 203 not taken.
✗ Branch 206 not taken.
✗ Branch 207 not taken.
✗ Branch 210 not taken.
✗ Branch 211 not taken.
✗ Branch 214 not taken.
✗ Branch 215 not taken.
✗ Branch 218 not taken.
✗ Branch 219 not taken.
✗ Branch 222 not taken.
✗ Branch 223 not taken.
✗ Branch 226 not taken.
✗ Branch 227 not taken.
✗ Branch 230 not taken.
✗ Branch 231 not taken.
✗ Branch 234 not taken.
✗ Branch 235 not taken.
✗ Branch 238 not taken.
✗ Branch 239 not taken.
✗ Branch 241 not taken.
✗ Branch 242 not taken.
✗ Branch 245 not taken.
✗ Branch 246 not taken.
✗ Branch 249 not taken.
✗ Branch 250 not taken.
✗ Branch 253 not taken.
✗ Branch 254 not taken.
✗ Branch 257 not taken.
✗ Branch 258 not taken.
✗ Branch 261 not taken.
✗ Branch 262 not taken.
✗ Branch 265 not taken.
✗ Branch 266 not taken.
✗ Branch 269 not taken.
✗ Branch 270 not taken.
✗ Branch 273 not taken.
✗ Branch 274 not taken.
✗ Branch 277 not taken.
✗ Branch 278 not taken.
✗ Branch 281 not taken.
✗ Branch 282 not taken.
✗ Branch 285 not taken.
✗ Branch 286 not taken.
✗ Branch 289 not taken.
✗ Branch 290 not taken.
✗ Branch 293 not taken.
✗ Branch 294 not taken.
✗ Branch 297 not taken.
✗ Branch 298 not taken.
✗ Branch 301 not taken.
✗ Branch 302 not taken.
✗ Branch 305 not taken.
✗ Branch 306 not taken.
✗ Branch 309 not taken.
✗ Branch 310 not taken.
✗ Branch 313 not taken.
✗ Branch 314 not taken.
✗ Branch 317 not taken.
✗ Branch 318 not taken.
✗ Branch 321 not taken.
✗ Branch 322 not taken.
✗ Branch 325 not taken.
✗ Branch 326 not taken.
✗ Branch 329 not taken.
✗ Branch 330 not taken.
✗ Branch 333 not taken.
✗ Branch 334 not taken.
✗ Branch 337 not taken.
✗ Branch 338 not taken.
✗ Branch 341 not taken.
✗ Branch 342 not taken.
✗ Branch 345 not taken.
✗ Branch 346 not taken.
✗ Branch 349 not taken.
✗ Branch 350 not taken.
✗ Branch 353 not taken.
✗ Branch 354 not taken.
✗ Branch 357 not taken.
✗ Branch 358 not taken.
✗ Branch 361 not taken.
✗ Branch 362 not taken.
✗ Branch 365 not taken.
✗ Branch 366 not taken.
✗ Branch 369 not taken.
✗ Branch 370 not taken.
✗ Branch 373 not taken.
✗ Branch 374 not taken.
✗ Branch 377 not taken.
✗ Branch 378 not taken.
✗ Branch 381 not taken.
✗ Branch 382 not taken.
✗ Branch 385 not taken.
✗ Branch 386 not taken.
✗ Branch 389 not taken.
✗ Branch 390 not taken.
✗ Branch 393 not taken.
✗ Branch 394 not taken.
✗ Branch 397 not taken.
✗ Branch 398 not taken.
✗ Branch 401 not taken.
✗ Branch 402 not taken.
✗ Branch 405 not taken.
✗ Branch 406 not taken.
✗ Branch 409 not taken.
✗ Branch 410 not taken.
✗ Branch 413 not taken.
✗ Branch 414 not taken.
✗ Branch 417 not taken.
✗ Branch 418 not taken.
✗ Branch 421 not taken.
✗ Branch 422 not taken.
✗ Branch 425 not taken.
✗ Branch 426 not taken.
✗ Branch 429 not taken.
✗ Branch 430 not taken.
✗ Branch 433 not taken.
✗ Branch 434 not taken.
✗ Branch 437 not taken.
✗ Branch 438 not taken.
✗ Branch 441 not taken.
✗ Branch 442 not taken.
✗ Branch 445 not taken.
✗ Branch 446 not taken.
✗ Branch 449 not taken.
✗ Branch 450 not taken.
✗ Branch 453 not taken.
✗ Branch 454 not taken.
✗ Branch 457 not taken.
✗ Branch 458 not taken.
✗ Branch 461 not taken.
✗ Branch 462 not taken.
✗ Branch 465 not taken.
✗ Branch 466 not taken.
✗ Branch 469 not taken.
✗ Branch 470 not taken.
✗ Branch 473 not taken.
✗ Branch 474 not taken.
✗ Branch 477 not taken.
✗ Branch 478 not taken.
|
2468 | this->processLeafNodes<ValueT>(range); |
414 | } | ||
415 | |||
416 | private: | ||
417 | |||
418 | /////////////////////////////////////////////////////////////////////////// | ||
419 | /////////////////////////////////////////////////////////////////////////// | ||
420 | |||
421 | /// @brief Trivial methods that alias for a RootNode when querying the | ||
422 | /// the state of the child MASK. This is NOT the same as asking the | ||
423 | /// RootNode if a tile is active/inactive - these methods specifically | ||
424 | /// return whether a Node's ChildMask is ON or OFF. As a RootNode does not | ||
425 | /// hold a ChildMask, it always returns false. This allows the main | ||
426 | /// operator of this class to handle Internal and Root node types with | ||
427 | /// the same iterators. | ||
428 | //@{ | ||
429 | template <typename NodeType> | ||
430 | inline static bool isChildMaskOn(const NodeType& node, const Index n) { | ||
431 | return node.isChildMaskOn(n); | ||
432 | } | ||
433 | inline static bool isChildMaskOn(const RootNodeT&, const Index) { | ||
434 | return false; | ||
435 | } | ||
436 | //@} | ||
437 | |||
438 | /////////////////////////////////////////////////////////////////////////// | ||
439 | /////////////////////////////////////////////////////////////////////////// | ||
440 | |||
441 | /// Kernel leaf exec methods for different ValueTypes | ||
442 | |||
443 | /// @brief Default kernel execution for all values types except bools and strings | ||
444 | template <typename ValueType, typename std::enable_if< | ||
445 | !std::is_same<ValueType, bool>::value && | ||
446 | !std::is_same<ValueType, std::string>::value | ||
447 | >::type* = nullptr> | ||
448 | 3966 | void processLeafNodes(const LeafRangeT& range) const | |
449 | { | ||
450 | 7932 | VolumeFunctionArguments args(mData, mData.mGrids, *mData.mAttributeRegistry); | |
451 | auto kernel = args.bindBufferKernel(); | ||
452 |
2/2✓ Branch 1 taken 1983 times.
✓ Branch 2 taken 1983 times.
|
7932 | for (auto leaf = range.begin(); leaf; ++leaf) { |
453 |
1/2✓ Branch 1 taken 1983 times.
✗ Branch 2 not taken.
|
3966 | void* buffer = static_cast<void*>(leaf->buffer().data()); |
454 | Index64* masks = &(leaf->getValueMask().template getWord<Index64>(0)); | ||
455 | kernel(leaf->origin(), buffer, masks, size_t(LeafNodeT::NUM_VOXELS)); | ||
456 | } | ||
457 | } | ||
458 | |||
459 | /// @brief Overload for bool and string value types | ||
460 | template <typename ValueType, typename std::enable_if< | ||
461 | std::is_same<ValueType, bool>::value || | ||
462 | std::is_same<ValueType, std::string>::value | ||
463 | >::type* = nullptr> | ||
464 | 970 | void processLeafNodes(const LeafRangeT& range) const | |
465 | { | ||
466 | using TempBufferT = typename std::conditional< | ||
467 | std::is_same<std::string, ValueType>::value, | ||
468 | ax::codegen::String, bool>::type; | ||
469 | |||
470 | 1940 | VolumeFunctionArguments args(mData, mData.mGrids, *mData.mAttributeRegistry); | |
471 | auto kernel = args.bindBufferKernel(); | ||
472 |
5/10✓ Branch 0 taken 21504 times.
✓ Branch 1 taken 42 times.
✓ Branch 2 taken 21504 times.
✓ Branch 3 taken 42 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 21504 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
86184 | TempBufferT values[LeafNodeT::NUM_VOXELS]; |
473 | |||
474 |
2/2✓ Branch 1 taken 485 times.
✓ Branch 2 taken 485 times.
|
1940 | for (auto leaf = range.begin(); leaf; ++leaf) { |
475 | Index64* masks = &(leaf->getValueMask().template getWord<Index64>(0)); | ||
476 | auto& buffer = leaf->buffer(); | ||
477 |
2/2✓ Branch 0 taken 485 times.
✓ Branch 1 taken 485 times.
|
1940 | for (auto it = IterType::begin(*leaf); it; ++it) { |
478 | 970 | values[it.pos()] = *it; | |
479 | } | ||
480 | kernel(leaf->origin(), values, masks, size_t(LeafNodeT::NUM_VOXELS)); | ||
481 |
2/2✓ Branch 1 taken 485 times.
✓ Branch 2 taken 485 times.
|
2910 | for (auto it = IterType::begin(*leaf); it; ++it) { |
482 |
2/4✓ Branch 1 taken 42 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 42 times.
✗ Branch 5 not taken.
|
1054 | buffer.setValue(it.pos(), ValueT(values[it.pos()])); |
483 | } | ||
484 | } | ||
485 | } | ||
486 | |||
487 | /////////////////////////////////////////////////////////////////////////// | ||
488 | /////////////////////////////////////////////////////////////////////////// | ||
489 | |||
490 | /// @brief Recursively process an active or inactive tile with a LEVEL | ||
491 | /// greater than 1. | ||
492 | /// @details This algorithm recursively breaks up tile domains into child | ||
493 | /// domains until a node which represents a leaf parent (LEVEL == 1) is | ||
494 | /// reached. Each child node domain is looped over and the node results | ||
495 | /// are returned. If any child nodes were created, this method returns a | ||
496 | /// new node of NodeT which the child nodes added. If any tiles were | ||
497 | /// created which do NOT match the value and active state of the parent | ||
498 | /// domain, a new node of NodeT is created and returned with the unique | ||
499 | /// tiles added. If, however, all child domain values and active states | ||
500 | /// are constant, a nullptr is returned and the input value and active | ||
501 | /// arguments are set to the new states (possibly the same). | ||
502 | template <typename NodeT, typename std::enable_if<(NodeT::LEVEL > 1)>::type* = nullptr> | ||
503 | 2 | NodeT* processTile(const Coord& origin, ValueT& value, bool& active) const | |
504 | { | ||
505 | using ChildNodeT = typename NodeT::ChildNodeType; | ||
506 | |||
507 | 2 | tbb::concurrent_vector<ChildNodeT*> childs; | |
508 | 2 | tbb::concurrent_vector<Tile> tiles; | |
509 | |||
510 | const tbb::blocked_range<Index> | ||
511 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
2 | totalRange(0, NodeT::NUM_VALUES, mData.mTileGrainSize); |
512 | |||
513 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
2 | if (mData.mTileGrainSize > 0) { |
514 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
33026 | tbb::parallel_for(totalRange, [&](const auto& range) { |
515 | Coord ijk; | ||
516 |
2/80✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 32768 times.
✓ Branch 5 taken 128 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 53 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 57 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 66 not taken.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✗ Branch 69 not taken.
✗ Branch 70 not taken.
✗ Branch 71 not taken.
✗ Branch 72 not taken.
✗ Branch 73 not taken.
✗ Branch 74 not taken.
✗ Branch 75 not taken.
✗ Branch 76 not taken.
✗ Branch 77 not taken.
✗ Branch 78 not taken.
✗ Branch 79 not taken.
|
32896 | for (Index n = range.begin(), N = range.end(); n < N; ++n) { |
517 | 32768 | NodeT::offsetToLocalCoord(n, ijk); | |
518 | ijk <<= ChildNodeT::TOTAL; | ||
519 | ijk += origin; | ||
520 | ✗ | ValueT _value = value; // possible new value | |
521 | 32768 | bool _active = true; // possible new state, starts always active | |
522 |
1/80✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 7 taken 32768 times.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✗ Branch 52 not taken.
✗ Branch 53 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✗ Branch 70 not taken.
✗ Branch 71 not taken.
✗ Branch 73 not taken.
✗ Branch 74 not taken.
✗ Branch 76 not taken.
✗ Branch 77 not taken.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
✗ Branch 82 not taken.
✗ Branch 83 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 88 not taken.
✗ Branch 89 not taken.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✗ Branch 97 not taken.
✗ Branch 98 not taken.
✗ Branch 100 not taken.
✗ Branch 101 not taken.
✗ Branch 103 not taken.
✗ Branch 104 not taken.
✗ Branch 106 not taken.
✗ Branch 107 not taken.
✗ Branch 109 not taken.
✗ Branch 110 not taken.
✗ Branch 112 not taken.
✗ Branch 113 not taken.
✗ Branch 115 not taken.
✗ Branch 116 not taken.
✗ Branch 118 not taken.
✗ Branch 119 not taken.
|
32768 | ChildNodeT* child = this->processTile<ChildNodeT>(ijk, _value, _active); |
523 |
3/160✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 1024 times.
✓ Branch 11 taken 31744 times.
✓ Branch 13 taken 1024 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✗ Branch 51 not taken.
✗ Branch 53 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 66 not taken.
✗ Branch 68 not taken.
✗ Branch 69 not taken.
✗ Branch 70 not taken.
✗ Branch 71 not taken.
✗ Branch 73 not taken.
✗ Branch 74 not taken.
✗ Branch 75 not taken.
✗ Branch 76 not taken.
✗ Branch 78 not taken.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
✗ Branch 81 not taken.
✗ Branch 83 not taken.
✗ Branch 84 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 88 not taken.
✗ Branch 89 not taken.
✗ Branch 90 not taken.
✗ Branch 91 not taken.
✗ Branch 93 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✗ Branch 96 not taken.
✗ Branch 98 not taken.
✗ Branch 99 not taken.
✗ Branch 100 not taken.
✗ Branch 101 not taken.
✗ Branch 103 not taken.
✗ Branch 104 not taken.
✗ Branch 105 not taken.
✗ Branch 106 not taken.
✗ Branch 108 not taken.
✗ Branch 109 not taken.
✗ Branch 110 not taken.
✗ Branch 111 not taken.
✗ Branch 113 not taken.
✗ Branch 114 not taken.
✗ Branch 115 not taken.
✗ Branch 116 not taken.
✗ Branch 118 not taken.
✗ Branch 119 not taken.
✗ Branch 120 not taken.
✗ Branch 121 not taken.
✗ Branch 123 not taken.
✗ Branch 124 not taken.
✗ Branch 125 not taken.
✗ Branch 126 not taken.
✗ Branch 128 not taken.
✗ Branch 129 not taken.
✗ Branch 130 not taken.
✗ Branch 131 not taken.
✗ Branch 133 not taken.
✗ Branch 134 not taken.
✗ Branch 135 not taken.
✗ Branch 136 not taken.
✗ Branch 138 not taken.
✗ Branch 139 not taken.
✗ Branch 140 not taken.
✗ Branch 141 not taken.
✗ Branch 143 not taken.
✗ Branch 144 not taken.
✗ Branch 145 not taken.
✗ Branch 146 not taken.
✗ Branch 148 not taken.
✗ Branch 149 not taken.
✗ Branch 150 not taken.
✗ Branch 151 not taken.
✗ Branch 153 not taken.
✗ Branch 154 not taken.
✗ Branch 155 not taken.
✗ Branch 156 not taken.
✗ Branch 158 not taken.
✗ Branch 159 not taken.
✗ Branch 160 not taken.
✗ Branch 161 not taken.
✗ Branch 163 not taken.
✗ Branch 164 not taken.
✗ Branch 165 not taken.
✗ Branch 166 not taken.
✗ Branch 168 not taken.
✗ Branch 169 not taken.
✗ Branch 170 not taken.
✗ Branch 171 not taken.
✗ Branch 173 not taken.
✗ Branch 174 not taken.
✗ Branch 175 not taken.
✗ Branch 176 not taken.
✗ Branch 178 not taken.
✗ Branch 179 not taken.
✗ Branch 180 not taken.
✗ Branch 181 not taken.
✗ Branch 183 not taken.
✗ Branch 184 not taken.
✗ Branch 185 not taken.
✗ Branch 186 not taken.
✗ Branch 188 not taken.
✗ Branch 189 not taken.
✗ Branch 190 not taken.
✗ Branch 191 not taken.
✗ Branch 193 not taken.
✗ Branch 194 not taken.
✗ Branch 195 not taken.
✗ Branch 196 not taken.
✗ Branch 198 not taken.
✗ Branch 199 not taken.
|
32768 | if (child) { childs.emplace_back(child); } |
524 |
2/124✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 31744 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 31744 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 53 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 57 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 66 not taken.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✗ Branch 69 not taken.
✗ Branch 70 not taken.
✗ Branch 71 not taken.
✗ Branch 72 not taken.
✗ Branch 73 not taken.
✗ Branch 74 not taken.
✗ Branch 75 not taken.
✗ Branch 76 not taken.
✗ Branch 77 not taken.
✗ Branch 78 not taken.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
✗ Branch 81 not taken.
✗ Branch 82 not taken.
✗ Branch 83 not taken.
✗ Branch 84 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 87 not taken.
✗ Branch 88 not taken.
✗ Branch 89 not taken.
✗ Branch 90 not taken.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✗ Branch 93 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✗ Branch 96 not taken.
✗ Branch 97 not taken.
✗ Branch 98 not taken.
✗ Branch 99 not taken.
✗ Branch 100 not taken.
✗ Branch 101 not taken.
✗ Branch 102 not taken.
✗ Branch 103 not taken.
✗ Branch 104 not taken.
✗ Branch 105 not taken.
✗ Branch 106 not taken.
✗ Branch 107 not taken.
✗ Branch 108 not taken.
✗ Branch 109 not taken.
✗ Branch 110 not taken.
✗ Branch 111 not taken.
✗ Branch 112 not taken.
✗ Branch 113 not taken.
✗ Branch 114 not taken.
✗ Branch 115 not taken.
✗ Branch 116 not taken.
✗ Branch 117 not taken.
✗ Branch 118 not taken.
✗ Branch 119 not taken.
✗ Branch 120 not taken.
✗ Branch 121 not taken.
✗ Branch 122 not taken.
✗ Branch 123 not taken.
|
31744 | else if (_value != value || _active != true) { |
525 | ✗ | tiles.emplace_back(n, _value, _active); | |
526 | } | ||
527 | } | ||
528 | }); | ||
529 | } | ||
530 | else { | ||
531 | Coord ijk; | ||
532 | ✗ | for (Index n = totalRange.begin(), N = totalRange.end(); n < N; ++n) { | |
533 | ✗ | NodeT::offsetToLocalCoord(n, ijk); | |
534 | ijk <<= ChildNodeT::TOTAL; | ||
535 | ijk += origin; | ||
536 | ✗ | ValueT _value = value; // possible new value | |
537 | ✗ | bool _active = true; // possible new state, starts always active | |
538 | ✗ | ChildNodeT* child = this->processTile<ChildNodeT>(ijk, _value, _active); | |
539 | ✗ | if (child) { childs.emplace_back(child); } | |
540 | ✗ | else if (_value != value || _active != true) { | |
541 | ✗ | tiles.emplace_back(n, _value, _active); | |
542 | } | ||
543 | } | ||
544 | } | ||
545 | |||
546 | 4 | std::unique_ptr<NodeT> node; | |
547 | |||
548 | // If we have child nodes then we have to create a parent | ||
549 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
2 | if (!childs.empty()) { |
550 |
1/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
2 | node.reset(new NodeT(origin, value, /*active=*/true)); // always starts as active |
551 |
2/2✓ Branch 0 taken 1024 times.
✓ Branch 1 taken 1 times.
|
4098 | for (auto n : childs) node->addChild(n); |
552 | } | ||
553 | |||
554 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
2 | if (!tiles.empty()) { |
555 | ✗ | const auto& tile = tiles.front(); | |
556 | |||
557 | // if !node, we didn't create any child nodes. If we have NodeT::NUM_VALUES | ||
558 | // number of tiles, check their values - they may all be constant, in which | ||
559 | // case we don't need to create a parent at all | ||
560 | ✗ | if (!node) { | |
561 | ✗ | if (tiles.size() == NodeT::NUM_VALUES) { | |
562 | const bool constant = | ||
563 | ✗ | (std::find_if(tiles.cbegin() + 1, tiles.cend(), [&tile](const auto& iter) { | |
564 | ✗ | return iter.mValue != tile.mValue || iter.mActive != tile.mActive; | |
565 | ✗ | }) == tiles.cend()); | |
566 | ✗ | if (!constant) { | |
567 | ✗ | node.reset(new NodeT(origin, value, /*active=*/true)); // always starts as active | |
568 | } | ||
569 | } | ||
570 | } | ||
571 | |||
572 | // If the node exists, add all the tiles, otherwise we are replacing this | ||
573 | // entire node with a new value and state | ||
574 | ✗ | if (node) { | |
575 | ✗ | for (auto& n : tiles) { | |
576 | ✗ | node->addTile(n.mOffset, n.mValue, n.mActive); | |
577 | } | ||
578 | } | ||
579 | else { | ||
580 | ✗ | value = tile.mValue; | |
581 | ✗ | active = tile.mActive; | |
582 | } | ||
583 | } | ||
584 | |||
585 | 2 | return node.release(); | |
586 | } | ||
587 | |||
588 | /// @brief Specialization of the recursive domain splitting to execute on | ||
589 | /// a leaf node parent node (i.e. LEVEL==1). | ||
590 | template <typename NodeT, typename std::enable_if<(NodeT::LEVEL == 1)>::type* = nullptr> | ||
591 | 66042 | NodeT* processTile(const Coord& origin, ValueT& value, bool& active) const | |
592 | { | ||
593 | // @note Always starts off active as streaming only streams active tiles | ||
594 | // @todo This tile create is redundant if process does not create child | ||
595 | // nodes or non-uniform tiles. Could replace this with the 2xvector | ||
596 | // storage solution, needs profiling. | ||
597 |
1/2✓ Branch 2 taken 12 times.
✗ Branch 3 not taken.
|
132084 | std::unique_ptr<NodeT> cache(new NodeT(origin, value, /*active=*/true)); |
598 |
1/2✓ Branch 1 taken 33021 times.
✗ Branch 2 not taken.
|
66042 | this->process(*cache); |
599 | |||
600 | ValueT first; | ||
601 | bool state; | ||
602 |
1/2✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
|
66042 | bool constant = cache->isConstant(first, state); |
603 |
2/2✓ Branch 0 taken 1028 times.
✓ Branch 1 taken 31993 times.
|
66042 | if (!constant) return cache.release(); |
604 | |||
605 | 63964 | value = first; | |
606 | 63986 | active = state; | |
607 | 63986 | return nullptr; | |
608 | } | ||
609 | |||
610 | /////////////////////////////////////////////////////////////////////////// | ||
611 | /////////////////////////////////////////////////////////////////////////// | ||
612 | |||
613 | /// @brief Process a nodes ValueOn/Off/All tiles, where the node's level. | ||
614 | /// is greater than 1. This method calls the above recursive algorithms | ||
615 | /// to evaluate each child tile. | ||
616 | template <typename NodeT, typename std::enable_if<(NodeT::LEVEL > 1)>::type* = nullptr> | ||
617 | 2438 | void process(NodeT& parent) const | |
618 | { | ||
619 | using ChildNodeT = typename NodeT::ChildNodeType; | ||
620 | assert((!std::is_same<ValueOffIter, IterT>::value)); | ||
621 | |||
622 | // Explicitly use a ValueOn Iterator (only stream ON Values) | ||
623 |
2/2✓ Branch 0 taken 254 times.
✓ Branch 1 taken 1219 times.
|
3922 | for (auto it = ValueOnIter::IterTraitsT<NodeT>::begin(parent); it; ++it) { |
624 | 508 | const Coord origin = it.getCoord(); | |
625 | 508 | const ValueT value = it.getValue(); | |
626 | // ValueIter should never point to a child node - only time this is | ||
627 | // possible is with a ValueOff iter, but this code only ever invoked | ||
628 | // with a ValueOnIter | ||
629 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 253 times.
|
508 | assert(!this->isChildMaskOn(parent, it.pos())); |
630 | // only processes active tiles | ||
631 |
3/4✓ Branch 1 taken 12 times.
✓ Branch 2 taken 241 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 12 times.
|
506 | assert(it.isValueOn()); |
632 | |||
633 |
1/2✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
|
508 | ValueT _value = value; |
634 | 508 | bool _active = true; | |
635 |
4/4✓ Branch 1 taken 16 times.
✓ Branch 2 taken 238 times.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 11 times.
|
508 | if (ChildNodeT* child = this->processTile<ChildNodeT>(origin, _value, _active)) { |
636 |
0/2✗ Branch 1 not taken.
✗ Branch 2 not taken.
|
10 | parent.addChild(child); |
637 | } | ||
638 | else { | ||
639 |
2/4✓ Branch 0 taken 133 times.
✓ Branch 1 taken 26 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
318 | if (_value != value) it.setValue(_value); |
640 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 249 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
498 | if (_active != true) it.setValueOn(_active); |
641 | } | ||
642 | } | ||
643 | } | ||
644 | |||
645 | /// @brief Process a leaf parent (i.e LEVEL==1) node's ValueOn tiles | ||
646 | /// densifying tiles into leaf nodes and vice versa where necessary. | ||
647 | template <typename NodeT, typename std::enable_if<(NodeT::LEVEL == 1)>::type* = nullptr> | ||
648 | 67022 | void process(NodeT& parent) const | |
649 | { | ||
650 | using ChildNodeT = typename NodeT::ChildNodeType; | ||
651 | static_assert(ChildNodeT::DIM == LeafNodeT::DIM, | ||
652 | "Expected the parent node type of LeafNodeT to have a " | ||
653 | "CHILD_DIM equal to the DIM of a LeafNodeT."); | ||
654 | assert((!std::is_same<ValueOffIter, IterT>::value)); | ||
655 | |||
656 | // only process active tiles when streaming | ||
657 |
2/2✓ Branch 0 taken 246 times.
✓ Branch 1 taken 33265 times.
|
67022 | if (parent.getValueMask().isOff()) return; |
658 | |||
659 | const tbb::blocked_range<Index> | ||
660 |
1/2✓ Branch 0 taken 33265 times.
✗ Branch 1 not taken.
|
66530 | totalRange(0, NodeT::NUM_VALUES, mData.mTileGrainSize); |
661 | |||
662 |
1/2✓ Branch 0 taken 33265 times.
✗ Branch 1 not taken.
|
66530 | if (mData.mTileGrainSize > 0) { |
663 | 66530 | tbb::concurrent_vector<LeafNodeT*> leafs; | |
664 | 66530 | tbb::concurrent_vector<Tile> tiles; | |
665 |
2/4✓ Branch 1 taken 33265 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 33265 times.
✗ Branch 5 not taken.
|
8590836 | tbb::parallel_for(totalRange, [&](const tbb::blocked_range<Index>& range) { |
666 | std::vector<LeafNodeT*> lleafs; | ||
667 | 2688 | std::vector<Tile> ltiles; | |
668 |
21/80✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 4 taken 2688 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 10 taken 2560 times.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 16 taken 2560 times.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✓ Branch 22 taken 2560 times.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✓ Branch 28 taken 4096 times.
✗ Branch 29 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✓ Branch 34 taken 2304 times.
✗ Branch 35 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✓ Branch 40 taken 2304 times.
✗ Branch 41 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✓ Branch 46 taken 2304 times.
✗ Branch 47 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✓ Branch 52 taken 2304 times.
✗ Branch 53 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✓ Branch 58 taken 2304 times.
✗ Branch 59 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✓ Branch 64 taken 2304 times.
✗ Branch 65 not taken.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✓ Branch 70 taken 3072 times.
✗ Branch 71 not taken.
✗ Branch 73 not taken.
✗ Branch 74 not taken.
✓ Branch 76 taken 3072 times.
✗ Branch 77 not taken.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
✓ Branch 82 taken 3072 times.
✗ Branch 83 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✓ Branch 88 taken 2944 times.
✗ Branch 89 not taken.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✓ Branch 94 taken 2048 times.
✗ Branch 95 not taken.
✗ Branch 97 not taken.
✗ Branch 98 not taken.
✓ Branch 100 taken 4096 times.
✗ Branch 101 not taken.
✗ Branch 103 not taken.
✗ Branch 104 not taken.
✓ Branch 106 taken 4096 times.
✗ Branch 107 not taken.
✓ Branch 109 taken 256 times.
✗ Branch 110 not taken.
✓ Branch 112 taken 4199808 times.
✗ Branch 113 not taken.
✗ Branch 115 not taken.
✗ Branch 116 not taken.
✓ Branch 118 taken 7168 times.
✗ Branch 119 not taken.
|
4257920 | lleafs.reserve(range.size()); |
669 |
21/80✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 4 taken 2688 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 10 taken 2560 times.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 16 taken 2560 times.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✓ Branch 22 taken 2560 times.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✓ Branch 28 taken 4096 times.
✗ Branch 29 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✓ Branch 34 taken 2304 times.
✗ Branch 35 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✓ Branch 40 taken 2304 times.
✗ Branch 41 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✓ Branch 46 taken 2304 times.
✗ Branch 47 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✓ Branch 52 taken 2304 times.
✗ Branch 53 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✓ Branch 58 taken 2304 times.
✗ Branch 59 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✓ Branch 64 taken 2304 times.
✗ Branch 65 not taken.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✓ Branch 70 taken 3072 times.
✗ Branch 71 not taken.
✗ Branch 73 not taken.
✗ Branch 74 not taken.
✓ Branch 76 taken 3072 times.
✗ Branch 77 not taken.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
✓ Branch 82 taken 3072 times.
✗ Branch 83 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✓ Branch 88 taken 2944 times.
✗ Branch 89 not taken.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✓ Branch 94 taken 2048 times.
✗ Branch 95 not taken.
✗ Branch 97 not taken.
✗ Branch 98 not taken.
✓ Branch 100 taken 4096 times.
✗ Branch 101 not taken.
✗ Branch 103 not taken.
✗ Branch 104 not taken.
✓ Branch 106 taken 4096 times.
✗ Branch 107 not taken.
✓ Branch 109 taken 256 times.
✗ Branch 110 not taken.
✓ Branch 112 taken 4199808 times.
✗ Branch 113 not taken.
✗ Branch 115 not taken.
✗ Branch 116 not taken.
✓ Branch 118 taken 7168 times.
✗ Branch 119 not taken.
|
4257920 | ltiles.reserve(range.size()); |
670 | |||
671 |
21/80✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 4 taken 2688 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 10 taken 2560 times.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 16 taken 2560 times.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✓ Branch 22 taken 2560 times.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✓ Branch 28 taken 4096 times.
✗ Branch 29 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✓ Branch 34 taken 2304 times.
✗ Branch 35 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✓ Branch 40 taken 2304 times.
✗ Branch 41 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✓ Branch 46 taken 2304 times.
✗ Branch 47 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✓ Branch 52 taken 2304 times.
✗ Branch 53 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✓ Branch 58 taken 2304 times.
✗ Branch 59 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✓ Branch 64 taken 2304 times.
✗ Branch 65 not taken.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✓ Branch 70 taken 3072 times.
✗ Branch 71 not taken.
✗ Branch 73 not taken.
✗ Branch 74 not taken.
✓ Branch 76 taken 3072 times.
✗ Branch 77 not taken.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
✓ Branch 82 taken 3072 times.
✗ Branch 83 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✓ Branch 88 taken 2944 times.
✗ Branch 89 not taken.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✓ Branch 94 taken 2048 times.
✗ Branch 95 not taken.
✗ Branch 97 not taken.
✗ Branch 98 not taken.
✓ Branch 100 taken 4096 times.
✗ Branch 101 not taken.
✗ Branch 103 not taken.
✗ Branch 104 not taken.
✓ Branch 106 taken 4096 times.
✗ Branch 107 not taken.
✓ Branch 109 taken 256 times.
✗ Branch 110 not taken.
✓ Branch 112 taken 4199808 times.
✗ Branch 113 not taken.
✗ Branch 115 not taken.
✗ Branch 116 not taken.
✓ Branch 118 taken 7168 times.
✗ Branch 119 not taken.
|
4257920 | this->processLeafParent(parent, range, lleafs, ltiles); |
672 | |||
673 |
25/80✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✓ Branch 3 taken 2680 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 2560 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2560 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 2560 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 4096 times.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✓ Branch 23 taken 2304 times.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✓ Branch 27 taken 2304 times.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✓ Branch 31 taken 2304 times.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✓ Branch 35 taken 2304 times.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✓ Branch 39 taken 2304 times.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✓ Branch 43 taken 2304 times.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✓ Branch 47 taken 3072 times.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✓ Branch 51 taken 3072 times.
✗ Branch 52 not taken.
✗ Branch 53 not taken.
✗ Branch 54 not taken.
✓ Branch 55 taken 3072 times.
✗ Branch 56 not taken.
✗ Branch 57 not taken.
✓ Branch 58 taken 8 times.
✓ Branch 59 taken 2936 times.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✓ Branch 63 taken 2048 times.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 66 not taken.
✓ Branch 67 taken 4096 times.
✗ Branch 68 not taken.
✗ Branch 69 not taken.
✗ Branch 70 not taken.
✓ Branch 71 taken 4096 times.
✓ Branch 72 taken 129 times.
✓ Branch 73 taken 127 times.
✓ Branch 74 taken 8321 times.
✓ Branch 75 taken 4191487 times.
✗ Branch 76 not taken.
✗ Branch 77 not taken.
✗ Branch 78 not taken.
✓ Branch 79 taken 7168 times.
|
4257920 | if (!lleafs.empty()) { |
674 |
4/80✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 5 taken 8 times.
✗ Branch 6 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✗ Branch 53 not taken.
✗ Branch 54 not taken.
✗ Branch 57 not taken.
✗ Branch 58 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 65 not taken.
✗ Branch 66 not taken.
✗ Branch 69 not taken.
✗ Branch 70 not taken.
✗ Branch 73 not taken.
✗ Branch 74 not taken.
✗ Branch 77 not taken.
✗ Branch 78 not taken.
✗ Branch 81 not taken.
✗ Branch 82 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 89 not taken.
✗ Branch 90 not taken.
✗ Branch 93 not taken.
✗ Branch 94 not taken.
✗ Branch 97 not taken.
✗ Branch 98 not taken.
✗ Branch 101 not taken.
✗ Branch 102 not taken.
✗ Branch 105 not taken.
✗ Branch 106 not taken.
✗ Branch 109 not taken.
✗ Branch 110 not taken.
✗ Branch 113 not taken.
✗ Branch 114 not taken.
✓ Branch 117 taken 8 times.
✗ Branch 118 not taken.
✗ Branch 121 not taken.
✗ Branch 122 not taken.
✗ Branch 125 not taken.
✗ Branch 126 not taken.
✗ Branch 129 not taken.
✗ Branch 130 not taken.
✗ Branch 133 not taken.
✗ Branch 134 not taken.
✗ Branch 137 not taken.
✗ Branch 138 not taken.
✗ Branch 141 not taken.
✗ Branch 142 not taken.
✓ Branch 145 taken 129 times.
✗ Branch 146 not taken.
✓ Branch 149 taken 8321 times.
✗ Branch 150 not taken.
✗ Branch 153 not taken.
✗ Branch 154 not taken.
✗ Branch 157 not taken.
✗ Branch 158 not taken.
|
8466 | std::move(lleafs.begin(), lleafs.end(), leafs.grow_by(lleafs.size())); |
675 | } | ||
676 |
21/80✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2688 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 2560 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2560 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 2560 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 4096 times.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✓ Branch 23 taken 2304 times.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✓ Branch 27 taken 2304 times.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✓ Branch 31 taken 2304 times.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✓ Branch 35 taken 2304 times.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✓ Branch 39 taken 2304 times.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✓ Branch 43 taken 2304 times.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✓ Branch 47 taken 3072 times.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✓ Branch 51 taken 3072 times.
✗ Branch 52 not taken.
✗ Branch 53 not taken.
✗ Branch 54 not taken.
✓ Branch 55 taken 3072 times.
✗ Branch 56 not taken.
✗ Branch 57 not taken.
✗ Branch 58 not taken.
✓ Branch 59 taken 2944 times.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✓ Branch 63 taken 2048 times.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 66 not taken.
✓ Branch 67 taken 4096 times.
✗ Branch 68 not taken.
✗ Branch 69 not taken.
✗ Branch 70 not taken.
✓ Branch 71 taken 4096 times.
✗ Branch 72 not taken.
✓ Branch 73 taken 256 times.
✗ Branch 74 not taken.
✓ Branch 75 taken 4199808 times.
✗ Branch 76 not taken.
✗ Branch 77 not taken.
✗ Branch 78 not taken.
✓ Branch 79 taken 7168 times.
|
4257920 | if (!ltiles.empty()) { |
677 | ✗ | std::move(ltiles.begin(), ltiles.end(), tiles.grow_by(ltiles.size())); | |
678 | } | ||
679 | }); | ||
680 |
2/2✓ Branch 0 taken 270850 times.
✓ Branch 1 taken 33265 times.
|
1149930 | for (auto n : leafs) parent.addLeaf(n); |
681 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 33265 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
66530 | for (auto& n : tiles) parent.addTile(n.mOffset, n.mValue, n.mActive); |
682 | } | ||
683 | else { | ||
684 | std::vector<LeafNodeT*> leafs; | ||
685 | ✗ | std::vector<Tile> tiles; | |
686 | |||
687 | ✗ | this->processLeafParent(parent, totalRange, leafs, tiles); | |
688 | |||
689 | ✗ | for (auto n : leafs) parent.addLeaf(n); | |
690 | ✗ | for (auto& n : tiles) parent.addTile(n.mOffset, n.mValue, n.mActive); | |
691 | } | ||
692 | } | ||
693 | |||
694 | /////////////////////////////////////////////////////////////////////////// | ||
695 | /////////////////////////////////////////////////////////////////////////// | ||
696 | |||
697 | /// Kernel Leaf parent exec methods for different ValueTypes | ||
698 | |||
699 | /// @brief Default kernel execution for all values types except bools and strings | ||
700 | template <typename NodeT, typename std::enable_if< | ||
701 | !std::is_same<typename NodeT::ValueType, bool>::value && | ||
702 | !std::is_same<typename NodeT::ValueType, std::string>::value | ||
703 | >::type* = nullptr> | ||
704 | 8504576 | void processLeafParent(NodeT& parent, | |
705 | const tbb::blocked_range<Index>& range, | ||
706 | std::vector<LeafNodeT*>& leafs, | ||
707 | std::vector<Tile>& tiles) const | ||
708 | { | ||
709 | // ValueOff iterators should explicitly disable tile streaming | ||
710 | assert((!std::is_same<ValueOffIter, IterT>::value)); | ||
711 | // @todo update to new InternalNode API methods when available | ||
712 | auto* const table = const_cast<typename NodeT::UnionType*>(parent.getTable()); | ||
713 | const auto& mask = parent.getValueMask(); | ||
714 | |||
715 | 17009152 | VolumeFunctionArguments args(mData, mData.mGrids, *mData.mAttributeRegistry); | |
716 | auto kernel = args.bindBufferKernel(); | ||
717 | |||
718 | Index64* word; | ||
719 | ValueT* data, *end; | ||
720 | 17009152 | std::unique_ptr<LeafNodeT> leaf; | |
721 | |||
722 |
2/2✓ Branch 0 taken 136073216 times.
✓ Branch 1 taken 4252288 times.
|
280651008 | for (Index n = range.begin(), N = range.end(); n < N; ++n) { |
723 | // explicitly only process active tiles when streaming | ||
724 |
2/2✓ Branch 1 taken 921154 times.
✓ Branch 2 taken 135152062 times.
|
272146432 | if (!mask.isOn(n)) continue; |
725 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 135152062 times.
|
270304124 | assert(!this->isChildMaskOn(parent, n)); |
726 | |||
727 | 270304124 | const Coord& ijk = parent.offsetToGlobalCoord(n); | |
728 |
2/2✓ Branch 0 taken 4485822 times.
✓ Branch 1 taken 130666240 times.
|
270304124 | const ValueT& value = table[n].getValue(); |
729 | |||
730 |
2/2✓ Branch 0 taken 4485822 times.
✓ Branch 1 taken 130666240 times.
|
270304124 | if (!leaf) { |
731 |
2/4✓ Branch 1 taken 4485822 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4485822 times.
✗ Branch 5 not taken.
|
8971644 | leaf.reset(new LeafNodeT(ijk, value, /*active*/true)); // always starts as active |
732 |
1/2✓ Branch 1 taken 4485822 times.
✗ Branch 2 not taken.
|
8971644 | data = leaf->buffer().data(); |
733 | 8971644 | end = data + LeafNodeT::NUM_VOXELS; | |
734 | word = &(leaf->getValueMask().template getWord<Index64>(0)); | ||
735 | } | ||
736 | else { | ||
737 | leaf->setOrigin(ijk); | ||
738 | leaf->getValueMask().set(true); // always starts as active | ||
739 | 261332480 | std::fill(data, end, value); | |
740 | } | ||
741 | |||
742 |
1/2✓ Branch 1 taken 135152062 times.
✗ Branch 2 not taken.
|
270304124 | kernel(ijk, data, word, size_t(LeafNodeT::NUM_VOXELS)); |
743 | |||
744 | bool ison; | ||
745 | bool constant = leaf->getValueMask().isConstant(ison); | ||
746 |
1/2✓ Branch 0 taken 135152062 times.
✗ Branch 1 not taken.
|
270304124 | if (constant) { |
747 |
105/396✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✓ Branch 14 taken 5204460 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 5204460 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 5204460 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 5204460 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 40980 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 40980 times.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✓ Branch 27 taken 40980 times.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✓ Branch 42 taken 5204460 times.
✗ Branch 43 not taken.
✓ Branch 44 taken 5204460 times.
✗ Branch 45 not taken.
✓ Branch 46 taken 5204460 times.
✗ Branch 47 not taken.
✓ Branch 48 taken 5204460 times.
✗ Branch 49 not taken.
✓ Branch 50 taken 40980 times.
✗ Branch 51 not taken.
✓ Branch 52 taken 40980 times.
✗ Branch 53 not taken.
✗ Branch 54 not taken.
✓ Branch 55 taken 40980 times.
✗ Branch 56 not taken.
✗ Branch 57 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 66 not taken.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✗ Branch 69 not taken.
✓ Branch 70 taken 5204460 times.
✗ Branch 71 not taken.
✓ Branch 72 taken 5204460 times.
✗ Branch 73 not taken.
✓ Branch 74 taken 5204460 times.
✗ Branch 75 not taken.
✓ Branch 76 taken 5204460 times.
✗ Branch 77 not taken.
✓ Branch 78 taken 40980 times.
✗ Branch 79 not taken.
✓ Branch 80 taken 40980 times.
✗ Branch 81 not taken.
✗ Branch 82 not taken.
✓ Branch 83 taken 40980 times.
✗ Branch 84 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 87 not taken.
✗ Branch 88 not taken.
✗ Branch 89 not taken.
✗ Branch 90 not taken.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✗ Branch 93 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✗ Branch 96 not taken.
✗ Branch 97 not taken.
✓ Branch 98 taken 8327136 times.
✗ Branch 99 not taken.
✓ Branch 100 taken 8327136 times.
✗ Branch 101 not taken.
✓ Branch 102 taken 8327136 times.
✗ Branch 103 not taken.
✓ Branch 104 taken 8327136 times.
✗ Branch 105 not taken.
✓ Branch 106 taken 65568 times.
✗ Branch 107 not taken.
✓ Branch 108 taken 65568 times.
✗ Branch 109 not taken.
✗ Branch 110 not taken.
✓ Branch 111 taken 65568 times.
✗ Branch 112 not taken.
✗ Branch 113 not taken.
✗ Branch 114 not taken.
✗ Branch 115 not taken.
✗ Branch 116 not taken.
✗ Branch 117 not taken.
✗ Branch 118 not taken.
✗ Branch 119 not taken.
✓ Branch 120 taken 4684014 times.
✗ Branch 121 not taken.
✓ Branch 122 taken 36882 times.
✗ Branch 123 not taken.
✓ Branch 124 taken 36882 times.
✗ Branch 125 not taken.
✓ Branch 126 taken 36882 times.
✗ Branch 127 not taken.
✗ Branch 128 not taken.
✗ Branch 129 not taken.
✗ Branch 130 not taken.
✗ Branch 131 not taken.
✗ Branch 132 not taken.
✗ Branch 133 not taken.
✗ Branch 134 not taken.
✗ Branch 135 not taken.
✓ Branch 136 taken 4684014 times.
✗ Branch 137 not taken.
✓ Branch 138 taken 36882 times.
✗ Branch 139 not taken.
✓ Branch 140 taken 36882 times.
✗ Branch 141 not taken.
✓ Branch 142 taken 36882 times.
✗ Branch 143 not taken.
✗ Branch 144 not taken.
✗ Branch 145 not taken.
✗ Branch 146 not taken.
✗ Branch 147 not taken.
✗ Branch 148 not taken.
✗ Branch 149 not taken.
✗ Branch 150 not taken.
✗ Branch 151 not taken.
✓ Branch 152 taken 4684014 times.
✗ Branch 153 not taken.
✓ Branch 154 taken 36882 times.
✗ Branch 155 not taken.
✓ Branch 156 taken 36882 times.
✗ Branch 157 not taken.
✓ Branch 158 taken 36882 times.
✗ Branch 159 not taken.
✗ Branch 160 not taken.
✗ Branch 161 not taken.
✗ Branch 162 not taken.
✗ Branch 163 not taken.
✗ Branch 164 not taken.
✗ Branch 165 not taken.
✗ Branch 166 not taken.
✗ Branch 167 not taken.
✓ Branch 168 taken 4684014 times.
✗ Branch 169 not taken.
✓ Branch 170 taken 36882 times.
✗ Branch 171 not taken.
✓ Branch 172 taken 36882 times.
✗ Branch 173 not taken.
✓ Branch 174 taken 36882 times.
✗ Branch 175 not taken.
✗ Branch 176 not taken.
✗ Branch 177 not taken.
✗ Branch 178 not taken.
✗ Branch 179 not taken.
✗ Branch 180 not taken.
✗ Branch 181 not taken.
✗ Branch 182 not taken.
✗ Branch 183 not taken.
✓ Branch 184 taken 4684014 times.
✗ Branch 185 not taken.
✓ Branch 186 taken 36882 times.
✗ Branch 187 not taken.
✓ Branch 188 taken 36882 times.
✗ Branch 189 not taken.
✓ Branch 190 taken 36882 times.
✗ Branch 191 not taken.
✗ Branch 192 not taken.
✗ Branch 193 not taken.
✗ Branch 194 not taken.
✗ Branch 195 not taken.
✗ Branch 196 not taken.
✗ Branch 197 not taken.
✗ Branch 198 not taken.
✗ Branch 199 not taken.
✓ Branch 200 taken 4684014 times.
✗ Branch 201 not taken.
✓ Branch 202 taken 36882 times.
✗ Branch 203 not taken.
✓ Branch 204 taken 36882 times.
✗ Branch 205 not taken.
✓ Branch 206 taken 36882 times.
✗ Branch 207 not taken.
✗ Branch 208 not taken.
✗ Branch 209 not taken.
✗ Branch 210 not taken.
✗ Branch 211 not taken.
✗ Branch 212 not taken.
✗ Branch 213 not taken.
✗ Branch 214 not taken.
✗ Branch 215 not taken.
✓ Branch 216 taken 6245352 times.
✗ Branch 217 not taken.
✓ Branch 218 taken 49176 times.
✗ Branch 219 not taken.
✓ Branch 220 taken 49176 times.
✗ Branch 221 not taken.
✓ Branch 222 taken 49176 times.
✗ Branch 223 not taken.
✗ Branch 224 not taken.
✗ Branch 225 not taken.
✗ Branch 226 not taken.
✗ Branch 227 not taken.
✗ Branch 228 not taken.
✗ Branch 229 not taken.
✗ Branch 230 not taken.
✗ Branch 231 not taken.
✓ Branch 232 taken 6245352 times.
✗ Branch 233 not taken.
✓ Branch 234 taken 49176 times.
✗ Branch 235 not taken.
✓ Branch 236 taken 49176 times.
✗ Branch 237 not taken.
✓ Branch 238 taken 49176 times.
✗ Branch 239 not taken.
✗ Branch 240 not taken.
✗ Branch 241 not taken.
✗ Branch 242 not taken.
✗ Branch 243 not taken.
✗ Branch 244 not taken.
✗ Branch 245 not taken.
✗ Branch 246 not taken.
✗ Branch 247 not taken.
✓ Branch 248 taken 6245352 times.
✗ Branch 249 not taken.
✓ Branch 250 taken 49176 times.
✗ Branch 251 not taken.
✓ Branch 252 taken 49176 times.
✗ Branch 253 not taken.
✓ Branch 254 taken 49176 times.
✗ Branch 255 not taken.
✗ Branch 256 not taken.
✗ Branch 257 not taken.
✗ Branch 258 not taken.
✗ Branch 259 not taken.
✗ Branch 260 not taken.
✗ Branch 261 not taken.
✗ Branch 262 not taken.
✗ Branch 263 not taken.
✗ Branch 264 not taken.
✗ Branch 265 not taken.
✗ Branch 266 not taken.
✗ Branch 267 not taken.
✗ Branch 268 not taken.
✗ Branch 269 not taken.
✓ Branch 270 taken 4163568 times.
✗ Branch 271 not taken.
✓ Branch 272 taken 4163568 times.
✗ Branch 273 not taken.
✓ Branch 274 taken 4163568 times.
✗ Branch 275 not taken.
✓ Branch 276 taken 4163568 times.
✗ Branch 277 not taken.
✓ Branch 278 taken 32784 times.
✗ Branch 279 not taken.
✓ Branch 280 taken 32784 times.
✗ Branch 281 not taken.
✗ Branch 282 not taken.
✓ Branch 283 taken 32784 times.
✗ Branch 284 not taken.
✗ Branch 285 not taken.
✗ Branch 286 not taken.
✗ Branch 287 not taken.
✗ Branch 288 not taken.
✗ Branch 289 not taken.
✗ Branch 290 not taken.
✗ Branch 291 not taken.
✗ Branch 292 not taken.
✗ Branch 293 not taken.
✗ Branch 294 not taken.
✗ Branch 295 not taken.
✗ Branch 296 not taken.
✗ Branch 297 not taken.
✓ Branch 298 taken 8327136 times.
✗ Branch 299 not taken.
✓ Branch 300 taken 8327136 times.
✗ Branch 301 not taken.
✓ Branch 302 taken 8327136 times.
✗ Branch 303 not taken.
✓ Branch 304 taken 8327136 times.
✗ Branch 305 not taken.
✓ Branch 306 taken 65568 times.
✗ Branch 307 not taken.
✓ Branch 308 taken 65568 times.
✗ Branch 309 not taken.
✗ Branch 310 not taken.
✓ Branch 311 taken 65568 times.
✗ Branch 312 not taken.
✗ Branch 313 not taken.
✗ Branch 314 not taken.
✗ Branch 315 not taken.
✗ Branch 316 not taken.
✗ Branch 317 not taken.
✗ Branch 318 not taken.
✗ Branch 319 not taken.
✗ Branch 320 not taken.
✗ Branch 321 not taken.
✗ Branch 322 not taken.
✗ Branch 323 not taken.
✗ Branch 324 not taken.
✗ Branch 325 not taken.
✓ Branch 326 taken 8327136 times.
✗ Branch 327 not taken.
✓ Branch 328 taken 8327136 times.
✗ Branch 329 not taken.
✓ Branch 330 taken 8327136 times.
✗ Branch 331 not taken.
✓ Branch 332 taken 8327136 times.
✗ Branch 333 not taken.
✓ Branch 334 taken 65568 times.
✗ Branch 335 not taken.
✓ Branch 336 taken 65568 times.
✗ Branch 337 not taken.
✗ Branch 338 not taken.
✓ Branch 339 taken 65568 times.
✓ Branch 340 taken 8194 times.
✗ Branch 341 not taken.
✓ Branch 342 taken 8194 times.
✗ Branch 343 not taken.
✓ Branch 344 taken 8194 times.
✗ Branch 345 not taken.
✓ Branch 346 taken 4097 times.
✓ Branch 347 taken 4097 times.
✗ Branch 348 not taken.
✗ Branch 349 not taken.
✗ Branch 350 not taken.
✗ Branch 351 not taken.
✗ Branch 352 not taken.
✗ Branch 353 not taken.
✓ Branch 354 taken 17028067820 times.
✗ Branch 355 not taken.
✓ Branch 356 taken 17028067820 times.
✗ Branch 357 not taken.
✓ Branch 358 taken 17028067820 times.
✗ Branch 359 not taken.
✓ Branch 360 taken 17027801579 times.
✓ Branch 361 taken 266241 times.
✓ Branch 362 taken 134045732 times.
✗ Branch 363 not taken.
✓ Branch 364 taken 134045732 times.
✗ Branch 365 not taken.
✗ Branch 366 not taken.
✓ Branch 367 taken 134045732 times.
✗ Branch 368 not taken.
✗ Branch 369 not taken.
✗ Branch 370 not taken.
✗ Branch 371 not taken.
✗ Branch 372 not taken.
✗ Branch 373 not taken.
✗ Branch 374 not taken.
✗ Branch 375 not taken.
✗ Branch 376 not taken.
✗ Branch 377 not taken.
✗ Branch 378 not taken.
✗ Branch 379 not taken.
✗ Branch 380 not taken.
✗ Branch 381 not taken.
✓ Branch 382 taken 14572488 times.
✗ Branch 383 not taken.
✓ Branch 384 taken 14572488 times.
✗ Branch 385 not taken.
✓ Branch 386 taken 14572488 times.
✗ Branch 387 not taken.
✓ Branch 388 taken 14572488 times.
✗ Branch 389 not taken.
✓ Branch 390 taken 114744 times.
✗ Branch 391 not taken.
✓ Branch 392 taken 114744 times.
✗ Branch 393 not taken.
✗ Branch 394 not taken.
✓ Branch 395 taken 114744 times.
|
17809196294 | constant = (std::find_if(data + 1, end, [&](const auto& v) { return v != data[0]; }) == end); |
748 | } | ||
749 |
2/2✓ Branch 0 taken 270338 times.
✓ Branch 1 taken 134881724 times.
|
270304124 | if (!constant) { |
750 |
1/2✓ Branch 1 taken 270338 times.
✗ Branch 2 not taken.
|
540676 | leafs.emplace_back(leaf.release()); |
751 | } | ||
752 | else { | ||
753 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 134881724 times.
|
269763448 | if (ison != true) { |
754 | // mask changed, we always have to postpone this update | ||
755 | // @todo could update the value here and the mask in serial | ||
756 | ✗ | tiles.emplace_back(n, data[0], ison); | |
757 | } | ||
758 |
2/2✓ Branch 0 taken 594203 times.
✓ Branch 1 taken 134287521 times.
|
269763448 | else if (data[0] != value) { |
759 | 1606402 | table[n].setValue(data[0]); | |
760 | } | ||
761 | } | ||
762 | } | ||
763 | } | ||
764 | |||
765 | /// @brief Overload for bool value types | ||
766 | template <typename NodeT, typename std::enable_if< | ||
767 | std::is_same<typename NodeT::ValueType, bool>::value || | ||
768 | std::is_same<typename NodeT::ValueType, std::string>::value | ||
769 | >::type* = nullptr> | ||
770 | 11264 | void processLeafParent(NodeT& parent, | |
771 | const tbb::blocked_range<Index>& range, | ||
772 | std::vector<LeafNodeT*>& leafs, | ||
773 | std::vector<Tile>& tiles) const | ||
774 | { | ||
775 | // ValueOff iterators should explicitly disable tile streaming | ||
776 | assert((!std::is_same<ValueOffIter, IterT>::value)); | ||
777 | using TempBufferT = typename std::conditional< | ||
778 | std::is_same<std::string, ValueT>::value, | ||
779 | ax::codegen::String, bool>::type; | ||
780 | |||
781 | // @todo update to new InternalNode API methods when available | ||
782 | auto* const table = const_cast<typename NodeT::UnionType*>(parent.getTable()); | ||
783 | const auto& mask = parent.getValueMask(); | ||
784 | |||
785 | 22528 | VolumeFunctionArguments args(mData, mData.mGrids, *mData.mAttributeRegistry); | |
786 | auto kernel = args.bindBufferKernel(); | ||
787 | |||
788 |
5/10✓ Branch 0 taken 1376256 times.
✓ Branch 1 taken 2688 times.
✓ Branch 2 taken 1376256 times.
✓ Branch 3 taken 2688 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1376256 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
5515776 | TempBufferT values[LeafNodeT::NUM_VOXELS]; |
789 | 11264 | TempBufferT* data = values, *end = &values[LeafNodeT::NUM_VOXELS]; | |
790 | typename LeafNodeT::NodeMaskType leafmask; | ||
791 | Index64* word = &(leafmask.template getWord<Index64>(0)); | ||
792 | Coord ijk; | ||
793 | bool reset = true; | ||
794 | |||
795 |
2/2✓ Branch 0 taken 180224 times.
✓ Branch 1 taken 5632 times.
|
371712 | for (Index n = range.begin(), N = range.end(); n < N; ++n) { |
796 | // explicitly only process active tiles when streaming | ||
797 |
2/2✓ Branch 1 taken 77788 times.
✓ Branch 2 taken 102436 times.
|
360448 | if (!mask.isOn(n)) continue; |
798 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 102436 times.
|
204872 | assert(!this->isChildMaskOn(parent, n)); |
799 | |||
800 | 204872 | const Coord& ijk = parent.offsetToGlobalCoord(n); | |
801 | 204872 | const TempBufferT value = table[n].getValue(); | |
802 | |||
803 |
2/2✓ Branch 0 taken 39444 times.
✓ Branch 1 taken 62992 times.
|
204872 | if (reset) { |
804 | 78888 | std::fill(data, end, value); | |
805 | leafmask.set(true); // always starts as active | ||
806 | } | ||
807 | |||
808 |
1/2✓ Branch 1 taken 102436 times.
✗ Branch 2 not taken.
|
204872 | kernel(ijk, data, word, size_t(LeafNodeT::NUM_VOXELS)); |
809 | |||
810 | bool ison; | ||
811 | bool constant = leafmask.isConstant(ison); | ||
812 |
1/2✓ Branch 0 taken 102436 times.
✗ Branch 1 not taken.
|
204872 | if (constant) { |
813 |
12/44✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 6216047 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 48913 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 48913 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 48913 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✓ Branch 30 taken 6736493 times.
✗ Branch 31 not taken.
✓ Branch 32 taken 6736493 times.
✗ Branch 33 not taken.
✓ Branch 34 taken 6736493 times.
✗ Branch 35 not taken.
✓ Branch 36 taken 6736237 times.
✓ Branch 37 taken 256 times.
✓ Branch 38 taken 53011 times.
✗ Branch 39 not taken.
✓ Branch 40 taken 53011 times.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✓ Branch 43 taken 53011 times.
|
13463184 | constant = (std::find_if(data + 1, end, [&](const auto& v) { return v != data[0]; }) == end); |
814 | } | ||
815 | |||
816 |
2/2✓ Branch 0 taken 512 times.
✓ Branch 1 taken 101924 times.
|
204872 | if (!constant) { |
817 |
2/6✓ Branch 1 taken 512 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 256 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
1536 | std::unique_ptr<LeafNodeT> leaf(new LeafNodeT(ijk)); |
818 | leaf->getValueMask() = leafmask; | ||
819 |
2/2✓ Branch 0 taken 262144 times.
✓ Branch 1 taken 512 times.
|
525312 | for (Index i = 0; i < LeafNodeT::NUM_VOXELS; ++i) { |
820 |
2/4✓ Branch 1 taken 131072 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 131072 times.
✗ Branch 5 not taken.
|
786432 | leaf->buffer().setValue(i, ValueT(values[i])); |
821 | } | ||
822 |
1/2✓ Branch 1 taken 512 times.
✗ Branch 2 not taken.
|
1024 | leafs.emplace_back(leaf.release()); |
823 | reset = true; | ||
824 | } | ||
825 | else { | ||
826 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 101924 times.
|
203848 | if (ison != true) { |
827 | // mask changed, we always have to postpone this update | ||
828 | // @todo could update the value here and the mask in serial | ||
829 | ✗ | tiles.emplace_back(n, ValueT(data[0]), ison); | |
830 | reset = true; | ||
831 | } | ||
832 |
2/2✓ Branch 0 taken 36882 times.
✓ Branch 1 taken 65042 times.
|
203848 | else if (data[0] != value) { |
833 |
1/2✓ Branch 1 taken 12294 times.
✗ Branch 2 not taken.
|
98352 | table[n].setValue(ValueT(data[0])); |
834 | reset = true; | ||
835 | } | ||
836 | else { | ||
837 | reset = false; | ||
838 | } | ||
839 | } | ||
840 | } | ||
841 | } | ||
842 | |||
843 | private: | ||
844 | const OpData& mData; | ||
845 | TreeT& mTree; | ||
846 | }; | ||
847 | |||
848 | /// @brief register volumes, create missing and build a GridCache which | ||
849 | /// stores read/write grids with deep copied ownership where necessary | ||
850 | std::unique_ptr<GridCache> | ||
851 | 744 | registerVolumes(GridPtrVec& grids, | |
852 | const AttributeRegistry& registry, | ||
853 | const AttributeBindings& bindings, | ||
854 | const bool createMissing, | ||
855 | Logger& logger) | ||
856 | { | ||
857 | 744 | std::unique_ptr<GridCache> cache(new GridCache); | |
858 | |||
859 |
2/2✓ Branch 0 taken 5056 times.
✓ Branch 1 taken 742 times.
|
5798 | for (auto& iter : registry.data()) { |
860 | |||
861 | openvdb::GridBase* matchedGrid = nullptr; | ||
862 | bool matchedName = false; | ||
863 | ast::tokens::CoreType type = ast::tokens::UNKNOWN; | ||
864 | const std::string& iterName = iter.name(); | ||
865 | const std::string* volumeNamePtr = nullptr; | ||
866 | volumeNamePtr = bindings.isBoundAXName(iterName) ? bindings.dataNameBoundTo(iterName) : &iterName; | ||
867 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5056 times.
|
5056 | assert(volumeNamePtr); |
868 | const std::string& volumeName = *volumeNamePtr; | ||
869 |
2/2✓ Branch 0 taken 34318 times.
✓ Branch 1 taken 6 times.
|
34324 | for (const auto& grid : grids) { |
870 |
3/4✓ Branch 1 taken 34318 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 29268 times.
✓ Branch 4 taken 5050 times.
|
68636 | if (grid->getName() != volumeName) continue; |
871 | matchedName = true; | ||
872 |
2/4✓ Branch 1 taken 5050 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 5050 times.
|
10100 | type = ast::tokens::tokenFromTypeString(grid->valueType()); |
873 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5050 times.
|
5050 | if (type != iter.type()) continue; |
874 | matchedGrid = grid.get(); | ||
875 | 5050 | break; | |
876 | } | ||
877 | |||
878 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 5052 times.
|
5056 | if (createMissing && !matchedGrid) { |
879 |
2/4✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
4 | auto created = createGrid(iter.type()); |
880 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if (created) { |
881 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
4 | created->setName(volumeName); |
882 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
4 | grids.emplace_back(created); |
883 | type = iter.type(); | ||
884 | matchedName = true; | ||
885 | matchedGrid = created.get(); | ||
886 | } | ||
887 | } | ||
888 | |||
889 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 5054 times.
|
5056 | if (!matchedName && !matchedGrid) { |
890 |
4/8✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2 times.
|
8 | logger.error("Missing grid \"" + ast::tokens::typeStringFromToken(iter.type()) + |
891 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
6 | "@" + iter.name() + "\"."); |
892 | } | ||
893 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5054 times.
|
5054 | else if (matchedName && !matchedGrid) { |
894 | ✗ | logger.error("Mismatching grid access type. \"@" + volumeName + | |
895 | ✗ | (volumeName != iter.name() ? "\" [bound to \"" + iter.name() + "\"]" : "\"") + | |
896 | ✗ | " exists but has been accessed with type \"" + | |
897 | ✗ | ast::tokens::typeStringFromToken(iter.type()) + "\"."); | |
898 | } | ||
899 | |||
900 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5054 times.
|
5054 | if (!matchedGrid) continue; |
901 | |||
902 | ✗ | if (!supported(type)) { | |
903 | ✗ | logger.error("Could not register volume '" + matchedGrid->getName() + | |
904 | ✗ | "' as it has an unknown or unsupported value type '" + | |
905 |
0/4✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
2 | matchedGrid->valueType() + "'"); |
906 | ✗ | continue; | |
907 | } | ||
908 | |||
909 | // Populate the write/read grids based on the access registry. If a | ||
910 | // grid is being written to and has non self usage, (influences | ||
911 | // another grids value which isn't it's own) it must be deep copied | ||
912 | |||
913 | // @todo implement better execution order detection which could minimize | ||
914 | // the number of deep copies required | ||
915 | |||
916 |
2/2✓ Branch 0 taken 4915 times.
✓ Branch 1 taken 139 times.
|
5054 | if (iter.writes() && iter.affectsothers()) { |
917 | // if affectsothers(), it's also read from at some point | ||
918 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 334 times.
|
334 | assert(iter.reads()); |
919 |
1/2✓ Branch 1 taken 334 times.
✗ Branch 2 not taken.
|
334 | cache->addReadGrid(*matchedGrid, /*copy=*/true); |
920 | cache->addWriteGrid(*matchedGrid); | ||
921 | } | ||
922 | else { | ||
923 |
2/2✓ Branch 0 taken 4581 times.
✓ Branch 1 taken 139 times.
|
4720 | if (iter.writes()) { |
924 | cache->addWriteGrid(*matchedGrid); | ||
925 | } | ||
926 |
1/2✓ Branch 1 taken 4720 times.
✗ Branch 2 not taken.
|
4720 | cache->addReadGrid(*matchedGrid, /*copy=*/false); |
927 | } | ||
928 | } | ||
929 | |||
930 | 742 | return cache; | |
931 | } | ||
932 | |||
933 | template <class IterT, typename GridT> | ||
934 | 9830 | inline void run(GridT& grid, OpData& data, const VolumeExecutable& E) | |
935 | { | ||
936 | using TreeType = typename GridT::TreeType; | ||
937 | |||
938 | // Get the active index of the grid being executed | ||
939 | 9830 | const ast::tokens::CoreType type = | |
940 | 9830 | ast::tokens::tokenFromTypeString(grid.valueType()); | |
941 | assert(data.mActiveIndex >= 0); | ||
942 | |||
943 | // Set the active tile streaming behaviour for this grid if | ||
944 | // the behaviour is set to AUTO (otherwise it's assigned the | ||
945 | // same value) | ||
946 | 9830 | const bool cache = data.mActiveTileStreaming; | |
947 | // data.mActiveTileStreaming might be OFF if IterT is an OFF iterator | ||
948 | 9830 | data.mActiveTileStreaming &= | |
949 |
1/2✓ Branch 2 taken 4915 times.
✗ Branch 3 not taken.
|
9830 | (E.getActiveTileStreaming(grid.getName(), type) == VolumeExecutable::Streaming::ON); |
950 | |||
951 | VolumeExecuterOp<TreeType, IterT> exec(data, grid.tree()); | ||
952 | |||
953 | // If either grain size is > 0, enable overlapping task execution and other | ||
954 | // multi threaded operations (such as leaf/node manager constructions) | ||
955 | 9830 | const size_t g1 = E.getGrainSize(); | |
956 | 9830 | const size_t g2 = E.getActiveTileStreamingGrainSize(); | |
957 | 9830 | const bool threadOtherOps = g1 > 0 || g2 > 0; | |
958 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4915 times.
|
9830 | assert(data.mTreeLevelMin <= data.mTreeLevelMax); |
959 | |||
960 | // Cache any existing leaf node pointers before doing any execution | ||
961 | 9830 | std::unique_ptr<tree::LeafManager<TreeType>> leafManager; | |
962 |
2/2✓ Branch 0 taken 4910 times.
✓ Branch 1 taken 5 times.
|
9830 | if (data.mTreeLevelMin == 0) { |
963 |
1/2✓ Branch 1 taken 4910 times.
✗ Branch 2 not taken.
|
19640 | leafManager.reset(new tree::LeafManager<TreeType> |
964 |
1/2✓ Branch 1 taken 4910 times.
✗ Branch 2 not taken.
|
9820 | (grid.tree(), /*aux=*/0, /*serial=*/!threadOtherOps)); |
965 | } | ||
966 | |||
967 | tbb::task_group tasks; | ||
968 | |||
969 |
2/2✓ Branch 0 taken 4910 times.
✓ Branch 1 taken 5 times.
|
9830 | if (data.mTreeLevelMin == 0) { |
970 | // It's significantly faster to process leaf nodes using a leaf manager | ||
971 | // so process them first. Additionally, processing tiles can generate | ||
972 | // new leaf nodes if active tile streaming is enabled and we don't want | ||
973 | // to process them twice! | ||
974 |
1/2✓ Branch 0 taken 4910 times.
✗ Branch 1 not taken.
|
9820 | if (threadOtherOps) { |
975 |
1/2✓ Branch 1 taken 4910 times.
✗ Branch 2 not taken.
|
14730 | tasks.run([&]() { |
976 |
22/120✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 85 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 124 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 134 times.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✓ Branch 22 taken 120 times.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✓ Branch 28 taken 134 times.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✓ Branch 34 taken 126 times.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✓ Branch 40 taken 128 times.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✓ Branch 46 taken 134 times.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✗ Branch 51 not taken.
✓ Branch 52 taken 142 times.
✗ Branch 53 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 57 not taken.
✓ Branch 58 taken 223 times.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 63 not taken.
✓ Branch 64 taken 256 times.
✗ Branch 65 not taken.
✗ Branch 66 not taken.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✗ Branch 69 not taken.
✓ Branch 70 taken 94 times.
✗ Branch 71 not taken.
✗ Branch 72 not taken.
✗ Branch 73 not taken.
✗ Branch 74 not taken.
✗ Branch 75 not taken.
✓ Branch 76 taken 94 times.
✗ Branch 77 not taken.
✗ Branch 78 not taken.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
✗ Branch 81 not taken.
✓ Branch 82 taken 94 times.
✗ Branch 83 not taken.
✗ Branch 84 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 87 not taken.
✓ Branch 88 taken 887 times.
✗ Branch 89 not taken.
✗ Branch 90 not taken.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✗ Branch 93 not taken.
✓ Branch 94 taken 68 times.
✗ Branch 95 not taken.
✗ Branch 96 not taken.
✗ Branch 97 not taken.
✗ Branch 98 not taken.
✗ Branch 99 not taken.
✓ Branch 100 taken 545 times.
✗ Branch 101 not taken.
✗ Branch 102 not taken.
✗ Branch 103 not taken.
✗ Branch 104 not taken.
✗ Branch 105 not taken.
✓ Branch 106 taken 186 times.
✗ Branch 107 not taken.
✓ Branch 108 taken 1 times.
✗ Branch 109 not taken.
✓ Branch 110 taken 1 times.
✗ Branch 111 not taken.
✓ Branch 112 taken 550 times.
✗ Branch 113 not taken.
✗ Branch 114 not taken.
✗ Branch 115 not taken.
✗ Branch 116 not taken.
✗ Branch 117 not taken.
✓ Branch 118 taken 784 times.
✗ Branch 119 not taken.
|
4910 | if (g1 > 0) { |
977 | 4910 | tbb::parallel_for(leafManager->leafRange(g1), exec); | |
978 | } | ||
979 | else { | ||
980 | ✗ | exec(leafManager->leafRange()); | |
981 | } | ||
982 | }); | ||
983 | } | ||
984 | else { | ||
985 | ✗ | exec(leafManager->leafRange()); | |
986 | } | ||
987 | } | ||
988 | |||
989 |
2/2✓ Branch 0 taken 4914 times.
✓ Branch 1 taken 1 times.
|
9830 | if (data.mTreeLevelMax > 0) { |
990 | // Only cache to TreeType::RootNodeType::LEVEL-1 | ||
991 | using NodeManagerT = | ||
992 | tree::NodeManager<TreeType, TreeType::RootNodeType::LEVEL-1>; | ||
993 |
1/2✓ Branch 0 taken 4914 times.
✗ Branch 1 not taken.
|
9828 | if (threadOtherOps) { |
994 |
1/2✓ Branch 1 taken 4914 times.
✗ Branch 2 not taken.
|
14742 | tasks.run([&]() { |
995 | 9828 | NodeManagerT manager(grid.tree(), /*serial=*/!threadOtherOps); | |
996 |
63/240✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 68 times.
✓ Branch 11 taken 17 times.
✓ Branch 13 taken 68 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✓ Branch 25 taken 104 times.
✓ Branch 26 taken 20 times.
✓ Branch 28 taken 104 times.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✓ Branch 40 taken 114 times.
✓ Branch 41 taken 20 times.
✓ Branch 43 taken 114 times.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✗ Branch 51 not taken.
✗ Branch 53 not taken.
✗ Branch 54 not taken.
✓ Branch 55 taken 100 times.
✓ Branch 56 taken 20 times.
✓ Branch 58 taken 100 times.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 66 not taken.
✗ Branch 68 not taken.
✗ Branch 69 not taken.
✓ Branch 70 taken 102 times.
✓ Branch 71 taken 32 times.
✓ Branch 73 taken 102 times.
✗ Branch 74 not taken.
✗ Branch 75 not taken.
✗ Branch 76 not taken.
✗ Branch 78 not taken.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
✗ Branch 81 not taken.
✗ Branch 83 not taken.
✗ Branch 84 not taken.
✓ Branch 85 taken 108 times.
✓ Branch 86 taken 18 times.
✓ Branch 88 taken 108 times.
✗ Branch 89 not taken.
✗ Branch 90 not taken.
✗ Branch 91 not taken.
✗ Branch 93 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✗ Branch 96 not taken.
✗ Branch 98 not taken.
✗ Branch 99 not taken.
✓ Branch 100 taken 110 times.
✓ Branch 101 taken 18 times.
✓ Branch 103 taken 110 times.
✗ Branch 104 not taken.
✗ Branch 105 not taken.
✗ Branch 106 not taken.
✗ Branch 108 not taken.
✗ Branch 109 not taken.
✗ Branch 110 not taken.
✗ Branch 111 not taken.
✗ Branch 113 not taken.
✗ Branch 114 not taken.
✓ Branch 115 taken 116 times.
✓ Branch 116 taken 18 times.
✓ Branch 118 taken 116 times.
✗ Branch 119 not taken.
✗ Branch 120 not taken.
✗ Branch 121 not taken.
✗ Branch 123 not taken.
✗ Branch 124 not taken.
✗ Branch 125 not taken.
✗ Branch 126 not taken.
✗ Branch 128 not taken.
✗ Branch 129 not taken.
✓ Branch 130 taken 124 times.
✓ Branch 131 taken 18 times.
✓ Branch 133 taken 124 times.
✗ Branch 134 not taken.
✗ Branch 135 not taken.
✗ Branch 136 not taken.
✗ Branch 138 not taken.
✗ Branch 139 not taken.
✗ Branch 140 not taken.
✗ Branch 141 not taken.
✗ Branch 143 not taken.
✗ Branch 144 not taken.
✓ Branch 145 taken 204 times.
✓ Branch 146 taken 19 times.
✓ Branch 148 taken 204 times.
✗ Branch 149 not taken.
✗ Branch 150 not taken.
✗ Branch 151 not taken.
✗ Branch 153 not taken.
✗ Branch 154 not taken.
✗ Branch 155 not taken.
✗ Branch 156 not taken.
✗ Branch 158 not taken.
✗ Branch 159 not taken.
✓ Branch 160 taken 238 times.
✓ Branch 161 taken 18 times.
✓ Branch 163 taken 238 times.
✗ Branch 164 not taken.
✗ Branch 165 not taken.
✗ Branch 166 not taken.
✗ Branch 168 not taken.
✗ Branch 169 not taken.
✗ Branch 170 not taken.
✗ Branch 171 not taken.
✗ Branch 173 not taken.
✗ Branch 174 not taken.
✓ Branch 175 taken 70 times.
✓ Branch 176 taken 24 times.
✓ Branch 178 taken 70 times.
✗ Branch 179 not taken.
✗ Branch 180 not taken.
✗ Branch 181 not taken.
✗ Branch 183 not taken.
✗ Branch 184 not taken.
✗ Branch 185 not taken.
✗ Branch 186 not taken.
✗ Branch 188 not taken.
✗ Branch 189 not taken.
✓ Branch 190 taken 70 times.
✓ Branch 191 taken 24 times.
✓ Branch 193 taken 70 times.
✗ Branch 194 not taken.
✗ Branch 195 not taken.
✗ Branch 196 not taken.
✗ Branch 198 not taken.
✗ Branch 199 not taken.
✗ Branch 200 not taken.
✗ Branch 201 not taken.
✗ Branch 203 not taken.
✗ Branch 204 not taken.
✓ Branch 205 taken 70 times.
✓ Branch 206 taken 24 times.
✓ Branch 208 taken 70 times.
✗ Branch 209 not taken.
✗ Branch 210 not taken.
✗ Branch 211 not taken.
✗ Branch 213 not taken.
✗ Branch 214 not taken.
✗ Branch 215 not taken.
✗ Branch 216 not taken.
✗ Branch 218 not taken.
✗ Branch 219 not taken.
✓ Branch 220 taken 868 times.
✓ Branch 221 taken 19 times.
✓ Branch 223 taken 868 times.
✗ Branch 224 not taken.
✗ Branch 225 not taken.
✗ Branch 226 not taken.
✗ Branch 228 not taken.
✗ Branch 229 not taken.
✗ Branch 230 not taken.
✗ Branch 231 not taken.
✗ Branch 233 not taken.
✗ Branch 234 not taken.
✓ Branch 235 taken 52 times.
✓ Branch 236 taken 16 times.
✓ Branch 238 taken 52 times.
✗ Branch 239 not taken.
✗ Branch 240 not taken.
✗ Branch 241 not taken.
✗ Branch 243 not taken.
✗ Branch 244 not taken.
✗ Branch 245 not taken.
✗ Branch 246 not taken.
✗ Branch 248 not taken.
✗ Branch 249 not taken.
✓ Branch 250 taken 510 times.
✓ Branch 251 taken 35 times.
✓ Branch 253 taken 510 times.
✗ Branch 254 not taken.
✗ Branch 255 not taken.
✗ Branch 256 not taken.
✗ Branch 258 not taken.
✗ Branch 259 not taken.
✗ Branch 260 not taken.
✗ Branch 261 not taken.
✗ Branch 263 not taken.
✗ Branch 264 not taken.
✓ Branch 265 taken 154 times.
✓ Branch 266 taken 32 times.
✓ Branch 268 taken 154 times.
✗ Branch 269 not taken.
✗ Branch 270 not taken.
✓ Branch 271 taken 1 times.
✗ Branch 273 not taken.
✗ Branch 274 not taken.
✓ Branch 275 taken 1 times.
✗ Branch 276 not taken.
✓ Branch 278 taken 1 times.
✗ Branch 279 not taken.
✓ Branch 280 taken 515 times.
✓ Branch 281 taken 39 times.
✓ Branch 283 taken 515 times.
✗ Branch 284 not taken.
✗ Branch 285 not taken.
✗ Branch 286 not taken.
✗ Branch 288 not taken.
✗ Branch 289 not taken.
✗ Branch 290 not taken.
✗ Branch 291 not taken.
✗ Branch 293 not taken.
✗ Branch 294 not taken.
✓ Branch 295 taken 728 times.
✓ Branch 296 taken 56 times.
✓ Branch 298 taken 728 times.
✗ Branch 299 not taken.
|
4914 | if (!data.mActiveTileStreaming) manager.foreachBottomUp(exec, g1 > 0, g1); |
997 |
21/120✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 7 taken 17 times.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 16 taken 20 times.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✓ Branch 25 taken 20 times.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✓ Branch 34 taken 20 times.
✗ Branch 35 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✓ Branch 43 taken 32 times.
✗ Branch 44 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✓ Branch 52 taken 18 times.
✗ Branch 53 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✓ Branch 61 taken 18 times.
✗ Branch 62 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✓ Branch 70 taken 18 times.
✗ Branch 71 not taken.
✗ Branch 73 not taken.
✗ Branch 74 not taken.
✗ Branch 76 not taken.
✗ Branch 77 not taken.
✓ Branch 79 taken 18 times.
✗ Branch 80 not taken.
✗ Branch 82 not taken.
✗ Branch 83 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✓ Branch 88 taken 19 times.
✗ Branch 89 not taken.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✓ Branch 97 taken 18 times.
✗ Branch 98 not taken.
✗ Branch 100 not taken.
✗ Branch 101 not taken.
✗ Branch 103 not taken.
✗ Branch 104 not taken.
✓ Branch 106 taken 24 times.
✗ Branch 107 not taken.
✗ Branch 109 not taken.
✗ Branch 110 not taken.
✗ Branch 112 not taken.
✗ Branch 113 not taken.
✓ Branch 115 taken 24 times.
✗ Branch 116 not taken.
✗ Branch 118 not taken.
✗ Branch 119 not taken.
✗ Branch 121 not taken.
✗ Branch 122 not taken.
✓ Branch 124 taken 24 times.
✗ Branch 125 not taken.
✗ Branch 127 not taken.
✗ Branch 128 not taken.
✗ Branch 130 not taken.
✗ Branch 131 not taken.
✓ Branch 133 taken 19 times.
✗ Branch 134 not taken.
✗ Branch 136 not taken.
✗ Branch 137 not taken.
✗ Branch 139 not taken.
✗ Branch 140 not taken.
✓ Branch 142 taken 16 times.
✗ Branch 143 not taken.
✗ Branch 145 not taken.
✗ Branch 146 not taken.
✗ Branch 148 not taken.
✗ Branch 149 not taken.
✓ Branch 151 taken 35 times.
✗ Branch 152 not taken.
✗ Branch 154 not taken.
✗ Branch 155 not taken.
✗ Branch 157 not taken.
✗ Branch 158 not taken.
✓ Branch 160 taken 32 times.
✗ Branch 161 not taken.
✓ Branch 163 taken 1 times.
✗ Branch 164 not taken.
✗ Branch 166 not taken.
✗ Branch 167 not taken.
✓ Branch 169 taken 39 times.
✗ Branch 170 not taken.
✗ Branch 172 not taken.
✗ Branch 173 not taken.
✗ Branch 175 not taken.
✗ Branch 176 not taken.
✓ Branch 178 taken 56 times.
✗ Branch 179 not taken.
|
488 | else manager.foreachBottomUp(exec, g2 > 0, /*parent-gs=*/1); |
998 | }); | ||
999 | } | ||
1000 | else { | ||
1001 | // If not thread, don't call through to any tbb primitives | ||
1002 | ✗ | NodeManagerT manager(grid.tree(), /*serial*/true); | |
1003 | ✗ | manager.foreachBottomUp(exec, /*thread*/false); | |
1004 | } | ||
1005 | } | ||
1006 | |||
1007 |
2/4✓ Branch 0 taken 4915 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 4915 times.
✗ Branch 4 not taken.
|
9830 | if (threadOtherOps) tasks.wait(); |
1008 | |||
1009 |
1/2✓ Branch 1 taken 4915 times.
✗ Branch 2 not taken.
|
9830 | data.mActiveTileStreaming = cache; |
1010 | } | ||
1011 | |||
1012 | template <class IterT> | ||
1013 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 742 times.
|
1484 | inline void run(GridCache& cache, |
1014 | const std::unordered_map<std::string, uint64_t>& functions, | ||
1015 | const AttributeRegistry& registry, | ||
1016 | const CustomData* const custom, | ||
1017 | const VolumeExecutable::Settings& S, | ||
1018 | const VolumeExecutable& E, | ||
1019 | Logger& logger) | ||
1020 | { | ||
1021 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 742 times.
|
1484 | assert(cache.mRead.size() == registry.data().size()); |
1022 | |||
1023 | // Initialize the shared op data | ||
1024 | |||
1025 | OpData data; | ||
1026 | 1484 | data.mKernelValueBuffer = | |
1027 | reinterpret_cast<KernelBufferFunctionPtr> | ||
1028 |
2/4✓ Branch 1 taken 742 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 742 times.
✗ Branch 5 not taken.
|
1484 | (functions.at(codegen::VolumeKernelBuffer::getDefaultName())); |
1029 | 1484 | data.mKernelNode = | |
1030 | reinterpret_cast<KernelNodeFunctionPtr> | ||
1031 |
2/4✓ Branch 1 taken 742 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 742 times.
✗ Branch 5 not taken.
|
1484 | (functions.at(codegen::VolumeKernelNode::getDefaultName())); |
1032 | 1484 | data.mCustomData = custom; | |
1033 |
2/3✓ Branch 0 taken 542 times.
✓ Branch 1 taken 200 times.
✗ Branch 2 not taken.
|
1484 | data.mAttributeRegistry = ®istry; |
1034 | 1484 | data.mGrids = cache.mRead.data(); | |
1035 | 1484 | data.mTreeLevelMin = S.mTreeExecutionLevelMin; | |
1036 | 1484 | data.mTreeLevelMax = S.mTreeExecutionLevelMax; | |
1037 | 1484 | data.mIterMode = | |
1038 | std::is_same<IterT, ValueOnIter>::value ? 1 : | ||
1039 | std::is_same<IterT, ValueOffIter>::value ? 0 : | ||
1040 | std::is_same<IterT, ValueAllIter>::value ? 2 : 2; | ||
1041 | 1484 | data.mTileGrainSize = S.mTileGrainSize; | |
1042 | // @note If Streaming::AUTO, this value can be temporarily | ||
1043 | // changed by the next invocation of run(). | ||
1044 |
1/2✓ Branch 1 taken 742 times.
✗ Branch 2 not taken.
|
1484 | data.mActiveTileStreaming = ((data.mIterMode == 1 || data.mIterMode == 2) && |
1045 |
2/2✓ Branch 0 taken 542 times.
✓ Branch 1 taken 199 times.
|
1482 | (S.mActiveTileStreaming != VolumeExecutable::Streaming::OFF)); |
1046 | |||
1047 | openvdb::GridBase** read = cache.mRead.data(); | ||
1048 |
1/2✓ Branch 1 taken 742 times.
✗ Branch 2 not taken.
|
1484 | data.mVoidTransforms.reserve(cache.mRead.size()); |
1049 |
2/2✓ Branch 0 taken 5054 times.
✓ Branch 1 taken 742 times.
|
11592 | for (size_t i = 0; i < registry.data().size(); ++i, ++read) { |
1050 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5054 times.
|
10108 | assert(read); |
1051 |
1/2✓ Branch 1 taken 5054 times.
✗ Branch 2 not taken.
|
10108 | data.mVoidTransforms.emplace_back(static_cast<void*>(&(*read)->transform())); |
1052 | } | ||
1053 | |||
1054 | 1484 | size_t regidx = 0, cacheidx = 0; | |
1055 |
2/2✓ Branch 0 taken 5054 times.
✓ Branch 1 taken 742 times.
|
11592 | for (const auto& attr : registry.data()) { |
1056 |
2/2✓ Branch 0 taken 4915 times.
✓ Branch 1 taken 139 times.
|
10108 | if (attr.writes()) { |
1057 | const auto& grid = cache.mWrite[cacheidx]; | ||
1058 |
1/2✓ Branch 1 taken 4915 times.
✗ Branch 2 not taken.
|
14745 | const bool success = grid->apply<SupportedTypeList>([&](auto& typed) { |
1059 | using GridType = typename std::decay<decltype(typed)>::type; | ||
1060 | 4915 | data.mActiveIndex = regidx; | |
1061 | 4915 | run<IterT, GridType>(typed, data, E); | |
1062 | }); | ||
1063 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4915 times.
|
9830 | if (!success) { |
1064 | ✗ | logger.error("Could not write to volume '" + grid->getName() | |
1065 | ✗ | + "' as it has an unknown or unsupported value type '" + grid->valueType() | |
1066 | + "'"); | ||
1067 | } | ||
1068 | 9830 | ++cacheidx; | |
1069 | } | ||
1070 | 10108 | ++regidx; | |
1071 | } | ||
1072 | 1484 | } | |
1073 | } // anonymous namespace | ||
1074 | |||
1075 | 752 | VolumeExecutable::VolumeExecutable(const std::shared_ptr<const llvm::LLVMContext>& context, | |
1076 | const std::shared_ptr<const llvm::ExecutionEngine>& engine, | ||
1077 | const AttributeRegistry::ConstPtr& accessRegistry, | ||
1078 | const CustomData::ConstPtr& customData, | ||
1079 | const std::unordered_map<std::string, uint64_t>& functionAddresses, | ||
1080 | 752 | const ast::Tree& ast) | |
1081 | : mContext(context) | ||
1082 | , mExecutionEngine(engine) | ||
1083 | , mAttributeRegistry(accessRegistry) | ||
1084 | , mCustomData(customData) | ||
1085 | , mFunctionAddresses(functionAddresses) | ||
1086 |
1/2✓ Branch 1 taken 752 times.
✗ Branch 2 not taken.
|
752 | , mSettings(new Settings) |
1087 | { | ||
1088 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 752 times.
|
752 | assert(mContext); |
1089 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 752 times.
|
752 | assert(mExecutionEngine); |
1090 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 752 times.
|
752 | assert(mAttributeRegistry); |
1091 | |||
1092 | // Determine if this kernel needs automatic streaming | ||
1093 | |||
1094 | // @todo These functions need to be catalogues in the same way as we | ||
1095 | // catalogue attribute dependencies as streaming only needs to be enabled | ||
1096 | // for grids which are directly affected by them. | ||
1097 |
4/6✓ Branch 1 taken 752 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 752 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 749 times.
✓ Branch 7 taken 1 times.
|
1502 | bool stream = ast::callsFunction(ast, "getvoxelpws") || |
1098 |
4/8✓ Branch 1 taken 750 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 750 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 743 times.
✓ Branch 7 taken 6 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
|
2251 | ast::callsFunction(ast, "getcoord") || |
1099 |
6/10✓ Branch 1 taken 749 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 749 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 741 times.
✓ Branch 7 taken 2 times.
✓ Branch 8 taken 750 times.
✓ Branch 9 taken 2 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
2244 | ast::callsFunction(ast, "getcoordx") || |
1100 |
6/10✓ Branch 1 taken 743 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 743 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 740 times.
✓ Branch 7 taken 1 times.
✓ Branch 8 taken 749 times.
✓ Branch 9 taken 3 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
2236 | ast::callsFunction(ast, "getcoordy") || |
1101 |
8/12✓ Branch 0 taken 750 times.
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 741 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 741 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 7 times.
✓ Branch 9 taken 733 times.
✓ Branch 10 taken 743 times.
✓ Branch 11 taken 9 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
|
2985 | ast::callsFunction(ast, "getcoordz") || |
1102 |
6/12✓ Branch 1 taken 740 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 740 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 740 times.
✓ Branch 7 taken 12 times.
✓ Branch 8 taken 741 times.
✓ Branch 9 taken 11 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
|
2232 | ast::callsFunction(ast, "rand"); |
1103 | |||
1104 |
2/2✓ Branch 0 taken 19 times.
✓ Branch 1 taken 733 times.
|
752 | if (stream) { |
1105 | 19 | mSettings->mActiveTileStreaming = Streaming::ON; | |
1106 | } | ||
1107 | else { | ||
1108 |
2/2✓ Branch 0 taken 3727 times.
✓ Branch 1 taken 547 times.
|
4274 | for (const auto& data : mAttributeRegistry->data()) { |
1109 | stream = data.affectsothers(); | ||
1110 | if (stream) break; | ||
1111 | } | ||
1112 |
2/2✓ Branch 0 taken 186 times.
✓ Branch 1 taken 547 times.
|
733 | if (stream) mSettings->mActiveTileStreaming = Streaming::AUTO; |
1113 | 547 | else mSettings->mActiveTileStreaming = Streaming::OFF; | |
1114 | } | ||
1115 | |||
1116 | // Set up the default attribute bindings | ||
1117 |
2/2✓ Branch 0 taken 5060 times.
✓ Branch 1 taken 752 times.
|
5812 | for (const auto& iter : mAttributeRegistry->data()) { |
1118 |
1/2✓ Branch 1 taken 5060 times.
✗ Branch 2 not taken.
|
5060 | mSettings->mBindings.set(iter.name(), iter.name()); |
1119 | } | ||
1120 | 752 | } | |
1121 | |||
1122 | ✗ | VolumeExecutable::VolumeExecutable(const VolumeExecutable& other) | |
1123 | : mContext(other.mContext) | ||
1124 | , mExecutionEngine(other.mExecutionEngine) | ||
1125 | , mAttributeRegistry(other.mAttributeRegistry) | ||
1126 | , mCustomData(other.mCustomData) | ||
1127 | , mFunctionAddresses(other.mFunctionAddresses) | ||
1128 | ✗ | , mSettings(new Settings(*other.mSettings)) {} | |
1129 | |||
1130 | 752 | VolumeExecutable::~VolumeExecutable() {} | |
1131 | |||
1132 | 744 | void VolumeExecutable::execute(openvdb::GridPtrVec& grids) const | |
1133 | { | ||
1134 | Logger* logger; | ||
1135 | 742 | std::unique_ptr<Logger> log; | |
1136 | if (true) { | ||
1137 | /// @note This branch exists for forwards compatibility with upcoming | ||
1138 | /// changes to allow a logger to be provided to the executables | ||
1139 |
4/8✓ Branch 3 taken 744 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 742 times.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 12 taken 2 times.
✗ Branch 13 not taken.
|
2978 | log.reset(new Logger([](const std::string& error) { |
1140 |
1/4✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
|
8 | OPENVDB_THROW(AXExecutionError, error); |
1141 |
2/4✓ Branch 1 taken 744 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 744 times.
✗ Branch 5 not taken.
|
744 | })); |
1142 | logger = log.get(); | ||
1143 | } | ||
1144 | |||
1145 | std::unique_ptr<GridCache> cache = | ||
1146 |
2/2✓ Branch 1 taken 742 times.
✓ Branch 2 taken 2 times.
|
1486 | registerVolumes(grids, *mAttributeRegistry, mSettings->mBindings, mSettings->mCreateMissing, *logger); |
1147 | |||
1148 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 742 times.
|
742 | if (logger->hasError()) return; |
1149 | |||
1150 |
2/2✓ Branch 0 taken 740 times.
✓ Branch 1 taken 2 times.
|
742 | if (mSettings->mValueIterator == IterType::ON) { |
1151 |
1/2✓ Branch 1 taken 740 times.
✗ Branch 2 not taken.
|
740 | run<ValueOnIter>(*cache, mFunctionAddresses, *mAttributeRegistry, mCustomData.get(), *mSettings, *this, *logger); |
1152 | } | ||
1153 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
|
2 | else if (mSettings->mValueIterator == IterType::OFF) { |
1154 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | run<ValueOffIter>(*cache, mFunctionAddresses, *mAttributeRegistry, mCustomData.get(), *mSettings, *this, *logger); |
1155 | } | ||
1156 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | else if (mSettings->mValueIterator == IterType::ALL) { |
1157 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | run<ValueAllIter>(*cache, mFunctionAddresses, *mAttributeRegistry, mCustomData.get(), *mSettings, *this, *logger); |
1158 | } | ||
1159 | else { | ||
1160 | ✗ | assert(false && "Unrecognised voxel iterator."); | |
1161 | } | ||
1162 | } | ||
1163 | |||
1164 | 19 | void VolumeExecutable::execute(openvdb::GridBase& grid) const | |
1165 | { | ||
1166 | // wrap the input with a no delete shared pointer so we can call the main | ||
1167 | // invocation. execute is guaranteed to not take ownership of the inputs | ||
1168 | // (ideally GridPtrVec would not be a vector of shared pointers) | ||
1169 | GridBase::Ptr gridptr(&grid, [](GridBase*){}); | ||
1170 |
1/6✗ Branch 1 not taken.
✓ Branch 2 taken 19 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
38 | std::vector<GridBase::Ptr> grids { gridptr }; |
1171 |
1/2✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
|
19 | this->execute(grids); |
1172 | 19 | } | |
1173 | |||
1174 | |||
1175 | ///////////////////////////////////////////// | ||
1176 | ///////////////////////////////////////////// | ||
1177 | |||
1178 | |||
1179 | 718 | void VolumeExecutable::setCreateMissing(const bool flag) | |
1180 | { | ||
1181 | 718 | mSettings->mCreateMissing = flag; | |
1182 | 718 | } | |
1183 | |||
1184 | ✗ | bool VolumeExecutable::getCreateMissing() const | |
1185 | { | ||
1186 | ✗ | return mSettings->mCreateMissing; | |
1187 | } | ||
1188 | |||
1189 | 5 | void VolumeExecutable::setTreeExecutionLevel(const Index level) | |
1190 | { | ||
1191 | 5 | this->setTreeExecutionLevel(level, level); | |
1192 | 4 | } | |
1193 | |||
1194 | 9 | void VolumeExecutable::setTreeExecutionLevel(const Index min, const Index max) | |
1195 | { | ||
1196 | // use the default implementation of FloatTree for reference | ||
1197 |
3/4✓ Branch 0 taken 8 times.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 8 times.
|
9 | if (min >= FloatTree::DEPTH || max >= FloatTree::DEPTH || min > max) { |
1198 |
2/6✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
|
4 | OPENVDB_THROW(RuntimeError, |
1199 | "Invalid tree execution level in VolumeExecutable."); | ||
1200 | } | ||
1201 | 8 | mSettings->mTreeExecutionLevelMin = min; | |
1202 | 8 | mSettings->mTreeExecutionLevelMax = max; | |
1203 | 8 | } | |
1204 | |||
1205 | ✗ | Index VolumeExecutable::getTreeExecutionLevel() const | |
1206 | { | ||
1207 | ✗ | return mSettings->mTreeExecutionLevelMin; | |
1208 | } | ||
1209 | |||
1210 | 17 | void VolumeExecutable::getTreeExecutionLevel(Index& min, Index& max) const | |
1211 | { | ||
1212 | 17 | min = mSettings->mTreeExecutionLevelMin; | |
1213 | 17 | max = mSettings->mTreeExecutionLevelMax; | |
1214 | 17 | } | |
1215 | |||
1216 | 1 | void VolumeExecutable::setActiveTileStreaming(const Streaming& s) | |
1217 | { | ||
1218 | 1 | mSettings->mActiveTileStreaming = s; | |
1219 | 1 | } | |
1220 | |||
1221 | 3529 | VolumeExecutable::Streaming VolumeExecutable::getActiveTileStreaming() const | |
1222 | { | ||
1223 | 3529 | return mSettings->mActiveTileStreaming; | |
1224 | } | ||
1225 | |||
1226 | VolumeExecutable::Streaming | ||
1227 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4938 times.
|
4938 | VolumeExecutable::getActiveTileStreaming(const std::string& name, |
1228 | const ast::tokens::CoreType& type) const | ||
1229 | { | ||
1230 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4938 times.
|
4938 | assert(mAttributeRegistry); |
1231 |
2/2✓ Branch 0 taken 1428 times.
✓ Branch 1 taken 3510 times.
|
4938 | if (mSettings->mActiveTileStreaming == VolumeExecutable::Streaming::AUTO) { |
1232 | const ax::AttributeRegistry::AccessData* accessData = | ||
1233 | 1428 | mAttributeRegistry->get(name, type); | |
1234 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1425 times.
|
1428 | if (!accessData) return this->getActiveTileStreaming(); |
1235 | // If this grids access depends on other grids, we must stream it. | ||
1236 | // if it only has one access and this is its own access, streaming | ||
1237 | // is off. | ||
1238 |
2/2✓ Branch 0 taken 1116 times.
✓ Branch 1 taken 309 times.
|
1425 | if (accessData->deps().size() == 0) return Streaming::OFF; |
1239 |
2/2✓ Branch 0 taken 862 times.
✓ Branch 1 taken 254 times.
|
1116 | if (accessData->deps().size() == 1) { |
1240 |
2/2✓ Branch 1 taken 202 times.
✓ Branch 2 taken 660 times.
|
862 | if (accessData->dependson(accessData)) return Streaming::OFF; |
1241 | 202 | else return Streaming::ON; | |
1242 | } | ||
1243 | else { | ||
1244 | return Streaming::ON; | ||
1245 | } | ||
1246 | } | ||
1247 | else { | ||
1248 | 3510 | return this->getActiveTileStreaming(); | |
1249 | } | ||
1250 | } | ||
1251 | |||
1252 | 717 | void VolumeExecutable::setValueIterator(const VolumeExecutable::IterType& iter) | |
1253 | { | ||
1254 | 717 | mSettings->mValueIterator = iter; | |
1255 | 717 | } | |
1256 | |||
1257 | ✗ | VolumeExecutable::IterType VolumeExecutable::getValueIterator() const | |
1258 | { | ||
1259 | ✗ | return mSettings->mValueIterator; | |
1260 | } | ||
1261 | |||
1262 | ✗ | void VolumeExecutable::setGrainSize(const size_t grain) | |
1263 | { | ||
1264 | ✗ | mSettings->mGrainSize = grain; | |
1265 | } | ||
1266 | |||
1267 | 4915 | size_t VolumeExecutable::getGrainSize() const | |
1268 | { | ||
1269 | 4915 | return mSettings->mGrainSize; | |
1270 | } | ||
1271 | |||
1272 | ✗ | void VolumeExecutable::setActiveTileStreamingGrainSize(const size_t grain) | |
1273 | { | ||
1274 | ✗ | mSettings->mTileGrainSize = grain; | |
1275 | } | ||
1276 | |||
1277 | 4915 | size_t VolumeExecutable::getActiveTileStreamingGrainSize() const | |
1278 | { | ||
1279 | 4915 | return mSettings->mTileGrainSize; | |
1280 | } | ||
1281 | |||
1282 | 13 | void VolumeExecutable::setAttributeBindings(const AttributeBindings& bindings) | |
1283 | { | ||
1284 |
2/2✓ Branch 0 taken 15 times.
✓ Branch 1 taken 13 times.
|
28 | for (const auto& binding : bindings.axToDataMap()) { |
1285 | 15 | mSettings->mBindings.set(binding.first, binding.second); | |
1286 | } | ||
1287 | // check the registry to make sure everything is bound | ||
1288 |
2/2✓ Branch 0 taken 26 times.
✓ Branch 1 taken 12 times.
|
38 | for (const auto& access : mAttributeRegistry->data()) { |
1289 | if (!mSettings->mBindings.isBoundAXName(access.name())) { | ||
1290 | if (bindings.isBoundDataName(access.name())) { | ||
1291 |
6/14✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 21 taken 1 times.
✗ Branch 22 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
|
8 | OPENVDB_THROW(AXExecutionError, "AX attribute \"@" |
1292 | + access.name() + "\" not bound to any volume." | ||
1293 | " Volume \"" + access.name() + "\" bound to \"@" | ||
1294 | + *bindings.axNameBoundTo(access.name()) + "\"."); | ||
1295 | } | ||
1296 | else { | ||
1297 | // rebind to itself as it may have been unbound | ||
1298 | // by a previous set call | ||
1299 | 1 | mSettings->mBindings.set(access.name(), access.name()); | |
1300 | } | ||
1301 | } | ||
1302 | } | ||
1303 | 12 | } | |
1304 | |||
1305 | 1 | const AttributeBindings& VolumeExecutable::getAttributeBindings() const | |
1306 | { | ||
1307 | 1 | return mSettings->mBindings; | |
1308 | } | ||
1309 | |||
1310 | } // namespace ax | ||
1311 | } // namespace OPENVDB_VERSION_NAME | ||
1312 | } // namespace openvdb | ||
1313 | |||
1314 |