GCC Code Coverage Report


Directory: ./
File: openvdb/openvdb/unittest/TestDenseSparseTools.cc
Date: 2022-07-25 17:40:05
Exec Total Coverage
Lines: 97 97 100.0%
Functions: 9 9 100.0%
Branches: 86 474 18.1%

Line Branch Exec Source
1 // Copyright Contributors to the OpenVDB Project
2 // SPDX-License-Identifier: MPL-2.0
3
4 #include <openvdb/Exceptions.h>
5 #include <openvdb/openvdb.h>
6 #include <openvdb/tools/Dense.h>
7 #include <openvdb/tools/DenseSparseTools.h>
8 #include <openvdb/Types.h>
9 #include <openvdb/math/Math.h>
10
11 #include <gtest/gtest.h>
12
13 #include "util.h"
14
15 6 class TestDenseSparseTools: public ::testing::Test
16 {
17 public:
18 void SetUp() override;
19
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
12 void TearDown() override { delete mDense; }
20
21 protected:
22 openvdb::tools::Dense<float>* mDense;
23 openvdb::math::Coord mijk;
24 };
25
26
27
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 void TestDenseSparseTools::SetUp()
28 {
29 namespace vdbmath = openvdb::math;
30
31 // Domain for the dense grid
32
33 6 vdbmath::CoordBBox domain(vdbmath::Coord(-100, -16, 12),
34 6 vdbmath::Coord( 90, 103, 100));
35
36 // Create dense grid, filled with 0.f
37
38
2/4
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
6 mDense = new openvdb::tools::Dense<float>(domain, 0.f);
39
40 // Insert non-zero values
41
42 6 mijk[0] = 1; mijk[1] = -2; mijk[2] = 14;
43 6 }
44
45
46 namespace {
47
48 // Simple Rule for extracting data greater than a determined mMaskValue
49 // and producing a tree that holds type ValueType
50 namespace vdbmath = openvdb::math;
51
52 class FloatRule
53 {
54 public:
55 // Standard tree type (e.g. BoolTree or FloatTree in openvdb.h)
56 typedef openvdb::FloatTree ResultTreeType;
57 typedef ResultTreeType::LeafNodeType ResultLeafNodeType;
58
59 typedef float ResultValueType;
60 typedef float DenseValueType;
61
62 2 FloatRule(const DenseValueType& value): mMaskValue(value){}
63
64 template <typename IndexOrCoord>
65 2039880 void operator()(const DenseValueType& a, const IndexOrCoord& offset,
66 ResultLeafNodeType* leaf) const
67 {
68
4/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2039879 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 2039879 times.
4079760 if (a > mMaskValue) {
69 2 leaf->setValueOn(offset, a);
70 }
71 2039880 }
72
73 private:
74 const DenseValueType mMaskValue;
75 };
76
77 class BoolRule
78 {
79 public:
80 // Standard tree type (e.g. BoolTree or FloatTree in openvdb.h)
81 typedef openvdb::BoolTree ResultTreeType;
82 typedef ResultTreeType::LeafNodeType ResultLeafNodeType;
83
84 typedef bool ResultValueType;
85 typedef float DenseValueType;
86
87 1 BoolRule(const DenseValueType& value): mMaskValue(value){}
88
89 template <typename IndexOrCoord>
90 void operator()(const DenseValueType& a, const IndexOrCoord& offset,
91 ResultLeafNodeType* leaf) const
92 {
93
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2039879 times.
2039880 if (a > mMaskValue) {
94 1 leaf->setValueOn(offset, true);
95 }
96 }
97
98 private:
99 const DenseValueType mMaskValue;
100 };
101
102
103 // Square each value
104 struct SqrOp
105 {
106 float operator()(const float& in) const
107 105 { return in * in; }
108 };
109 }
110
111
112
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 TEST_F(TestDenseSparseTools, testExtractSparseFloatTree)
113 {
114 namespace vdbmath = openvdb::math;
115
116
117 FloatRule rule(0.5f);
118
119 const float testvalue = 1.f;
120 1 mDense->setValue(mijk, testvalue);
121 1 const float background(0.f);
122 openvdb::FloatTree::Ptr result
123 1 = openvdb::tools::extractSparseTree(*mDense, rule, background);
124
125 // The result should have only one active value.
126
127
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_TRUE(result->activeVoxelCount() == 1);
128
129 // The result should have only one leaf
130
131
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_TRUE(result->leafCount() == 1);
132
133 // The background
134
135
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 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.
1 EXPECT_NEAR(background, result->background(), 1.e-6);
136
137 // The stored value
138
139
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 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.
1 EXPECT_NEAR(testvalue, result->getValue(mijk), 1.e-6);
140 1 }
141
142
143
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 TEST_F(TestDenseSparseTools, testExtractSparseBoolTree)
144 {
145
146 const float testvalue = 1.f;
147 1 mDense->setValue(mijk, testvalue);
148
149 const float cutoff(0.5);
150
151 openvdb::BoolTree::Ptr result
152
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 = openvdb::tools::extractSparseTree(*mDense, BoolRule(cutoff), false);
153
154 // The result should have only one active value.
155
156
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_TRUE(result->activeVoxelCount() == 1);
157
158 // The result should have only one leaf
159
160
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_TRUE(result->leafCount() == 1);
161
162 // The background
163
164
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(result->background() == false);
165
166 // The stored value
167
168
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(result->getValue(mijk) == true);
169 1 }
170
171
172
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 TEST_F(TestDenseSparseTools, testExtractSparseAltDenseLayout)
173 {
174 namespace vdbmath = openvdb::math;
175
176 FloatRule rule(0.5f);
177 // Create a dense grid with the alternate data layout
178 // but the same domain as mDense
179 1 openvdb::tools::Dense<float, openvdb::tools::LayoutXYZ> dense(mDense->bbox(), 0.f);
180
181 const float testvalue = 1.f;
182 1 dense.setValue(mijk, testvalue);
183
184 1 const float background(0.f);
185
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::FloatTree::Ptr result = openvdb::tools::extractSparseTree(dense, rule, background);
186
187 // The result should have only one active value.
188
189
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_TRUE(result->activeVoxelCount() == 1);
190
191 // The result should have only one leaf
192
193
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_TRUE(result->leafCount() == 1);
194
195 // The background
196
197
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 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.
1 EXPECT_NEAR(background, result->background(), 1.e-6);
198
199 // The stored value
200
201
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 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.
1 EXPECT_NEAR(testvalue, result->getValue(mijk), 1.e-6);
202 1 }
203
204
205
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 TEST_F(TestDenseSparseTools, testExtractSparseMaskedTree)
206 {
207 namespace vdbmath = openvdb::math;
208
209 const float testvalue = 1.f;
210 1 mDense->setValue(mijk, testvalue);
211
212 // Create a mask with two values. One in the domain of
213 // interest and one outside. The intersection of the active
214 // state topology of the mask and the domain of interest will define
215 // the topology of the extracted result.
216
217 2 openvdb::FloatTree mask(0.f);
218
219 // turn on a point inside the bouding domain of the dense grid
220
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mask.setValue(mijk, 5.f);
221
222 // turn on a point outside the bounding domain of the dense grid
223
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 vdbmath::Coord outsidePoint = mDense->bbox().min() - vdbmath::Coord(3, 3, 3);
224
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mask.setValue(outsidePoint, 1.f);
225
226 1 float background = 10.f;
227
228 openvdb::FloatTree::Ptr result
229
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 = openvdb::tools::extractSparseTreeWithMask(*mDense, mask, background);
230
231 // The result should have only one active value.
232
233
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_TRUE(result->activeVoxelCount() == 1);
234
235 // The result should have only one leaf
236
237
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_TRUE(result->leafCount() == 1);
238
239 // The background
240
241
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 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.
1 EXPECT_NEAR(background, result->background(), 1.e-6);
242
243 // The stored value
244
245
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 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.
1 EXPECT_NEAR(testvalue, result->getValue(mijk), 1.e-6);
246 1 }
247
248
249
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestDenseSparseTools, testDenseTransform)
250 {
251
252 namespace vdbmath = openvdb::math;
253
254 1 vdbmath::CoordBBox domain(vdbmath::Coord(-4, -6, 10),
255 1 vdbmath::Coord( 1, 2, 15));
256
257 // Create dense grid, filled with value
258 1 const float value(2.f); const float valueSqr(value*value);
259
260 1 openvdb::tools::Dense<float> dense(domain, 0.f);
261 1 dense.fill(value);
262
263 SqrOp op;
264
265 1 vdbmath::CoordBBox smallBBox(vdbmath::Coord(-5, -5, 11),
266 1 vdbmath::Coord( 0, 1, 13) );
267
268 // Apply the transformation
269
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::tools::transformDense<float, SqrOp>(dense, smallBBox, op, true);
270
271 vdbmath::Coord ijk;
272 // Test results.
273
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 1 times.
7 for (ijk[0] = domain.min().x(); ijk[0] < domain.max().x() + 1; ++ijk[0]) {
274
2/2
✓ Branch 0 taken 54 times.
✓ Branch 1 taken 6 times.
60 for (ijk[1] = domain.min().y(); ijk[1] < domain.max().y() + 1; ++ijk[1]) {
275
2/2
✓ Branch 0 taken 324 times.
✓ Branch 1 taken 54 times.
378 for (ijk[2] = domain.min().z(); ijk[2] < domain.max().z() + 1; ++ijk[2]) {
276
277 if (smallBBox.isInside(ijk)) {
278 // the functor was applied here
279 // the value should be base * base
280
2/16
✓ Branch 1 taken 105 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 105 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 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.
105 EXPECT_NEAR(dense.getValue(ijk), valueSqr, 1.e-6);
281 } else {
282 // the original value
283
2/16
✓ Branch 1 taken 219 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 219 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 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.
219 EXPECT_NEAR(dense.getValue(ijk), value, 1.e-6);
284 }
285 }
286 }
287 }
288 1 }
289
290
291
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestDenseSparseTools, testOver)
292 {
293 namespace vdbmath = openvdb::math;
294
295 1 const vdbmath::CoordBBox domain(vdbmath::Coord(-10, 0, 5), vdbmath::Coord( 10, 5, 10));
296 1 const openvdb::Coord ijk = domain.min() + openvdb::Coord(1, 1, 1);
297 // Create dense grid, filled with value
298 1 const float value(2.f);
299 const float strength(1.f);
300 const float beta(1.f);
301
302 2 openvdb::FloatTree src(0.f);
303
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 src.setValue(ijk, 1.f);
304 2 openvdb::FloatTree alpha(0.f);
305
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 alpha.setValue(ijk, 1.f);
306
307
308
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 const float expected = openvdb::tools::ds::OpOver<float>::apply(
309 value, alpha.getValue(ijk), src.getValue(ijk), strength, beta, 1.f);
310
311 { // testing composite function
312
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::tools::Dense<float> dense(domain, 0.f);
313 1 dense.fill(value);
314
315
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::tools::compositeToDense<openvdb::tools::DS_OVER>(
316 dense, src, alpha, beta, strength, true /*threaded*/);
317
318 // Check for over value
319
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ 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 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_NEAR(dense.getValue(ijk), expected, 1.e-6);
320 // Check for original value
321
2/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ 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 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_NEAR(dense.getValue(openvdb::Coord(1,1,1) + ijk), value, 1.e-6);
322 }
323
324 { // testing sparse explict sparse composite
325
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::tools::Dense<float> dense(domain, 0.f);
326 1 dense.fill(value);
327
328 typedef openvdb::tools::ds::CompositeFunctorTranslator<openvdb::tools::DS_OVER, float>
329 CompositeTool;
330 typedef CompositeTool::OpT Method;
331 openvdb::tools::SparseToDenseCompositor<Method, openvdb::FloatTree>
332 sparseToDense(dense, src, alpha, beta, strength);
333
334
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 sparseToDense.sparseComposite(true);
335 // Check for over value
336
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ 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 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_NEAR(dense.getValue(ijk), expected, 1.e-6);
337 // Check for original value
338
2/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ 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 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_NEAR(dense.getValue(openvdb::Coord(1,1,1) + ijk), value, 1.e-6);
339 }
340
341 { // testing sparse explict dense composite
342
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::tools::Dense<float> dense(domain, 0.f);
343 1 dense.fill(value);
344
345 typedef openvdb::tools::ds::CompositeFunctorTranslator<openvdb::tools::DS_OVER, float>
346 CompositeTool;
347 typedef CompositeTool::OpT Method;
348 openvdb::tools::SparseToDenseCompositor<Method, openvdb::FloatTree>
349 sparseToDense(dense, src, alpha, beta, strength);
350
351
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 sparseToDense.denseComposite(true);
352 // Check for over value
353
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ 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 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_NEAR(dense.getValue(ijk), expected, 1.e-6);
354 // Check for original value
355
2/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ 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 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_NEAR(dense.getValue(openvdb::Coord(1,1,1) + ijk), value, 1.e-6);
356 }
357 1 }
358