GCC Code Coverage Report


Directory: ./
File: openvdb/openvdb/unittest/TestTreeCombine.cc
Date: 2022-07-25 17:40:05
Exec Total Coverage
Lines: 412 421 97.9%
Functions: 49 49 100.0%
Branches: 433 3438 12.6%

Line Branch Exec Source
1 // Copyright Contributors to the OpenVDB Project
2 // SPDX-License-Identifier: MPL-2.0
3
4 #include <openvdb/Types.h>
5 #include <openvdb/openvdb.h>
6 #include <openvdb/tools/Composite.h>
7 #include <openvdb/tools/LevelSetSphere.h>
8 #include <openvdb/util/CpuTimer.h>
9 #include "util.h" // for unittest_util::makeSphere()
10
11 #include <gtest/gtest.h>
12
13 #include <algorithm> // for std::max() and std::min()
14 #include <cmath> // for std::isnan() and std::isinf()
15 #include <limits> // for std::numeric_limits
16 #include <sstream>
17 #include <string>
18 #include <type_traits>
19
20 #define TEST_CSG_VERBOSE 0
21
22 #if TEST_CSG_VERBOSE
23 #include <openvdb/util/CpuTimer.h>
24 #include <iostream>
25 #endif
26
27 namespace {
28 using Float433Tree = openvdb::tree::Tree4<float, 4, 3, 3>::Type;
29 using Float433Grid = openvdb::Grid<Float433Tree>;
30 }
31
32
33 12 class TestTreeCombine: public ::testing::Test
34 {
35 public:
36 12 void SetUp() override { openvdb::initialize(); Float433Grid::registerGrid(); }
37 12 void TearDown() override { openvdb::uninitialize(); }
38
39 protected:
40 template<class TreeT, typename TreeComp, typename ValueComp>
41 void testComp(const TreeComp&, const ValueComp&);
42
43 template<class TreeT>
44 void testCompRepl();
45
46 template<typename TreeT, typename VisitorT>
47 typename TreeT::Ptr
48 visitCsg(const TreeT& a, const TreeT& b, const TreeT& ref, const VisitorT&);
49 };
50
51
52 ////////////////////////////////////////
53
54
55 namespace {
56 namespace Local {
57
58 template<typename ValueT>
59 struct OrderDependentCombineOp {
60 OrderDependentCombineOp() {}
61 74750 void operator()(const ValueT& a, const ValueT& b, ValueT& result) const {
62
4/18
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 1014 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 8190 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 65534 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
74750 result = a + ValueT(100) * b; // result is order-dependent on A and B
63 74750 }
64 };
65
66 /// Test Tree::combine(), which takes a functor that accepts three arguments
67 /// (the a, b and result values).
68 template<typename TreeT>
69 8 void combine(TreeT& a, TreeT& b)
70 {
71 8 a.combine(b, OrderDependentCombineOp<typename TreeT::ValueType>());
72 8 }
73
74 /// Test Tree::combineExtended(), which takes a functor that accepts a single
75 /// CombineArgs argument, in which the functor can return a computed active state
76 /// for the output value.
77 template<typename TreeT>
78 8 void extendedCombine(TreeT& a, TreeT& b)
79 {
80 using ValueT = typename TreeT::ValueType;
81 struct ArgsOp {
82 149500 static void order(openvdb::CombineArgs<ValueT>& args) {
83 // The result is order-dependent on A and B.
84 149500 args.setResult(args.a() + ValueT(100) * args.b());
85 149500 args.setResultIsActive(args.aIsActive() || args.bIsActive());
86 }
87 };
88 a.combineExtended(b, ArgsOp::order);
89 8 }
90
91 8 template<typename TreeT> void compMax(TreeT& a, TreeT& b) { openvdb::tools::compMax(a, b); }
92 8 template<typename TreeT> void compMin(TreeT& a, TreeT& b) { openvdb::tools::compMin(a, b); }
93 8 template<typename TreeT> void compSum(TreeT& a, TreeT& b) { openvdb::tools::compSum(a, b); }
94 8 template<typename TreeT> void compMul(TreeT& a, TreeT& b) { openvdb::tools::compMul(a, b); }\
95 8 template<typename TreeT> void compDiv(TreeT& a, TreeT& b) { openvdb::tools::compDiv(a, b); }\
96
97 36 inline float orderf(float a, float b) { return a + 100.0f * b; }
98
2/2
✓ Branch 0 taken 9 times.
✓ Branch 1 taken 9 times.
18 inline float maxf(float a, float b) { return std::max(a, b); }
99
2/2
✓ Branch 0 taken 9 times.
✓ Branch 1 taken 9 times.
18 inline float minf(float a, float b) { return std::min(a, b); }
100 18 inline float sumf(float a, float b) { return a + b; }
101 18 inline float mulf(float a, float b) { return a * b; }
102 18 inline float divf(float a, float b) { return a / b; }
103
104 36 inline openvdb::Vec3f orderv(const openvdb::Vec3f& a, const openvdb::Vec3f& b) { return a+100.0f*b; }
105
2/2
✓ Branch 0 taken 9 times.
✓ Branch 1 taken 9 times.
18 inline openvdb::Vec3f maxv(const openvdb::Vec3f& a, const openvdb::Vec3f& b) {
106 const float aMag = a.lengthSqr(), bMag = b.lengthSqr();
107
3/4
✓ Branch 0 taken 9 times.
✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 9 times.
18 return (aMag > bMag ? a : (bMag > aMag ? b : std::max(a, b)));
108 }
109
2/2
✓ Branch 0 taken 9 times.
✓ Branch 1 taken 9 times.
18 inline openvdb::Vec3f minv(const openvdb::Vec3f& a, const openvdb::Vec3f& b) {
110 const float aMag = a.lengthSqr(), bMag = b.lengthSqr();
111
3/4
✓ Branch 0 taken 9 times.
✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 9 times.
18 return (aMag < bMag ? a : (bMag < aMag ? b : std::min(a, b)));
112 }
113 18 inline openvdb::Vec3f sumv(const openvdb::Vec3f& a, const openvdb::Vec3f& b) { return a + b; }
114 18 inline openvdb::Vec3f mulv(const openvdb::Vec3f& a, const openvdb::Vec3f& b) { return a * b; }
115 18 inline openvdb::Vec3f divv(const openvdb::Vec3f& a, const openvdb::Vec3f& b) { return a / b; }
116
117 } // namespace Local
118 } // unnamed namespace
119
120
121
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 TEST_F(TestTreeCombine, testCombine)
122 {
123 1 testComp<openvdb::FloatTree>(Local::combine<openvdb::FloatTree>, Local::orderf);
124 1 testComp<openvdb::VectorTree>(Local::combine<openvdb::VectorTree>, Local::orderv);
125
126 1 testComp<openvdb::FloatTree>(Local::extendedCombine<openvdb::FloatTree>, Local::orderf);
127 1 testComp<openvdb::VectorTree>(Local::extendedCombine<openvdb::VectorTree>, Local::orderv);
128 1 }
129
130
131
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 TEST_F(TestTreeCombine, testCompMax)
132 {
133 1 testComp<openvdb::FloatTree>(Local::compMax<openvdb::FloatTree>, Local::maxf);
134 1 testComp<openvdb::VectorTree>(Local::compMax<openvdb::VectorTree>, Local::maxv);
135 1 }
136
137
138
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 TEST_F(TestTreeCombine, testCompMin)
139 {
140 1 testComp<openvdb::FloatTree>(Local::compMin<openvdb::FloatTree>, Local::minf);
141 1 testComp<openvdb::VectorTree>(Local::compMin<openvdb::VectorTree>, Local::minv);
142 1 }
143
144
145
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 TEST_F(TestTreeCombine, testCompSum)
146 {
147 1 testComp<openvdb::FloatTree>(Local::compSum<openvdb::FloatTree>, Local::sumf);
148 1 testComp<openvdb::VectorTree>(Local::compSum<openvdb::VectorTree>, Local::sumv);
149 1 }
150
151
152
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 TEST_F(TestTreeCombine, testCompProd)
153 {
154 1 testComp<openvdb::FloatTree>(Local::compMul<openvdb::FloatTree>, Local::mulf);
155 1 testComp<openvdb::VectorTree>(Local::compMul<openvdb::VectorTree>, Local::mulv);
156 1 }
157
158
159
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 TEST_F(TestTreeCombine, testCompDiv)
160 {
161 1 testComp<openvdb::FloatTree>(Local::compDiv<openvdb::FloatTree>, Local::divf);
162 1 testComp<openvdb::VectorTree>(Local::compDiv<openvdb::VectorTree>, Local::divv);
163 1 }
164
165
166
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestTreeCombine, testCompDivByZero)
167 {
168 const openvdb::Coord c0(0), c1(1), c2(2), c3(3), c4(4);
169
170 // Verify that integer-valued grids behave well w.r.t. division by zero.
171 {
172 1 const openvdb::Int32 inf = std::numeric_limits<openvdb::Int32>::max();
173
174
1/2
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
2 openvdb::Int32Tree a(/*background=*/1), b(0);
175
176 a.setValueOn(c0);
177 a.setValueOn(c1);
178
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 a.setValueOn(c2, -1);
179
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 a.setValueOn(c3, -1);
180
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 a.setValueOn(c4, 0);
181 b.setValueOn(c1);
182 b.setValueOn(c3);
183
184
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::tools::compDiv(a, b);
185
186
1/14
✗ 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ( inf, a.getValue(c0)); // 1 / 0
187
1/14
✗ 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ( inf, a.getValue(c1)); // 1 / 0
188
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_EQ(-inf, a.getValue(c2)); // -1 / 0
189
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_EQ(-inf, a.getValue(c3)); // -1 / 0
190
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_EQ( 0, a.getValue(c4)); // 0 / 0
191 }
192 {
193 1 const openvdb::Index32 zero(0), inf = std::numeric_limits<openvdb::Index32>::max();
194
195
1/2
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
2 openvdb::UInt32Tree a(/*background=*/1), b(0);
196
197 a.setValueOn(c0);
198 a.setValueOn(c1);
199 a.setValueOn(c2, zero);
200 b.setValueOn(c1);
201
202
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::tools::compDiv(a, b);
203
204
1/14
✗ 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ( inf, a.getValue(c0)); // 1 / 0
205
1/14
✗ 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ( inf, a.getValue(c1)); // 1 / 0
206
1/14
✗ 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(zero, a.getValue(c2)); // 0 / 0
207 }
208
209 // Verify that non-integer-valued grids don't use integer division semantics.
210 {
211
1/2
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
2 openvdb::FloatTree a(/*background=*/1.0), b(0.0);
212
213 a.setValueOn(c0);
214 a.setValueOn(c1);
215
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 a.setValueOn(c2, -1.0);
216
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 a.setValueOn(c3, -1.0);
217
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 a.setValueOn(c4, 0.0);
218 b.setValueOn(c1);
219 b.setValueOn(c3);
220
221
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::tools::compDiv(a, b);
222
223
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(std::isinf(a.getValue(c0))); // 1 / 0
224
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(std::isinf(a.getValue(c1))); // 1 / 0
225
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(std::isinf(a.getValue(c2))); // -1 / 0
226
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(std::isinf(a.getValue(c3))); // -1 / 0
227
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(std::isnan(a.getValue(c4))); // 0 / 0
228 }
229 1 }
230
231
232
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 TEST_F(TestTreeCombine, testCompReplace)
233 {
234 1 testCompRepl<openvdb::FloatTree>();
235 1 testCompRepl<openvdb::VectorTree>();
236 1 }
237
238
239 template<typename TreeT, typename TreeComp, typename ValueComp>
240 void
241 28 TestTreeCombine::testComp(const TreeComp& comp, const ValueComp& op)
242 {
243 using ValueT = typename TreeT::ValueType;
244
245 const ValueT
246 zero = openvdb::zeroVal<ValueT>(),
247 28 minusOne = zero + (-1),
248 28 minusTwo = zero + (-2),
249 28 one = zero + 1,
250 28 three = zero + 3,
251 28 four = zero + 4,
252 28 five = zero + 5;
253
254 {
255 56 TreeT aTree(/*background=*/one);
256
1/2
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
28 aTree.setValueOn(openvdb::Coord(0, 0, 0), three);
257
1/2
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
28 aTree.setValueOn(openvdb::Coord(0, 0, 1), three);
258
1/2
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
28 aTree.setValueOn(openvdb::Coord(0, 0, 2), aTree.background());
259
1/2
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
28 aTree.setValueOn(openvdb::Coord(0, 1, 2), aTree.background());
260
1/2
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
28 aTree.setValueOff(openvdb::Coord(1, 0, 0), three);
261 aTree.setValueOff(openvdb::Coord(1, 0, 1), three);
262
263 56 TreeT bTree(five);
264
1/2
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
28 bTree.setValueOn(openvdb::Coord(0, 0, 0), minusOne);
265
1/2
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
28 bTree.setValueOn(openvdb::Coord(0, 1, 0), four);
266
1/2
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
28 bTree.setValueOn(openvdb::Coord(0, 1, 2), minusTwo);
267
1/2
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
28 bTree.setValueOff(openvdb::Coord(1, 0, 0), minusOne);
268 bTree.setValueOff(openvdb::Coord(1, 1, 0), four);
269
270 // Call aTree.compMax(bTree), aTree.compSum(bTree), etc.
271
1/2
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
28 comp(aTree, bTree);
272
273 // a = 3 (On), b = -1 (On)
274
3/20
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 7 times.
✗ 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.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
42 EXPECT_EQ(op(three, minusOne), aTree.getValue(openvdb::Coord(0, 0, 0)));
275
276 // a = 3 (On), b = 5 (bg)
277
3/20
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 7 times.
✗ 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.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
42 EXPECT_EQ(op(three, five), aTree.getValue(openvdb::Coord(0, 0, 1)));
278
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 14 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.
28 EXPECT_TRUE(aTree.isValueOn(openvdb::Coord(0, 0, 1)));
279
280 // a = 1 (On, = bg), b = 5 (bg)
281
3/20
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 7 times.
✗ 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.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
42 EXPECT_EQ(op(one, five), aTree.getValue(openvdb::Coord(0, 0, 2)));
282
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 14 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.
28 EXPECT_TRUE(aTree.isValueOn(openvdb::Coord(0, 0, 2)));
283
284 // a = 1 (On, = bg), b = -2 (On)
285
3/20
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 7 times.
✗ 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.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
42 EXPECT_EQ(op(one, minusTwo), aTree.getValue(openvdb::Coord(0, 1, 2)));
286
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 14 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.
28 EXPECT_TRUE(aTree.isValueOn(openvdb::Coord(0, 1, 2)));
287
288 // a = 1 (bg), b = 4 (On)
289
3/20
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 7 times.
✗ 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.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
42 EXPECT_EQ(op(one, four), aTree.getValue(openvdb::Coord(0, 1, 0)));
290
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 14 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.
28 EXPECT_TRUE(aTree.isValueOn(openvdb::Coord(0, 1, 0)));
291
292 // a = 3 (Off), b = -1 (Off)
293
3/20
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 7 times.
✗ 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.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
42 EXPECT_EQ(op(three, minusOne), aTree.getValue(openvdb::Coord(1, 0, 0)));
294
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 14 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.
28 EXPECT_TRUE(aTree.isValueOff(openvdb::Coord(1, 0, 0)));
295
296 // a = 3 (Off), b = 5 (bg)
297
3/20
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 7 times.
✗ 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.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
42 EXPECT_EQ(op(three, five), aTree.getValue(openvdb::Coord(1, 0, 1)));
298
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 14 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.
28 EXPECT_TRUE(aTree.isValueOff(openvdb::Coord(1, 0, 1)));
299
300 // a = 1 (bg), b = 4 (Off)
301
3/20
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 7 times.
✗ 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.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
42 EXPECT_EQ(op(one, four), aTree.getValue(openvdb::Coord(1, 1, 0)));
302
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 14 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.
28 EXPECT_TRUE(aTree.isValueOff(openvdb::Coord(1, 1, 0)));
303
304 // a = 1 (bg), b = 5 (bg)
305
3/20
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 7 times.
✗ 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.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
42 EXPECT_EQ(op(one, five), aTree.getValue(openvdb::Coord(1000, 1, 2)));
306
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 14 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.
28 EXPECT_TRUE(aTree.isValueOff(openvdb::Coord(1000, 1, 2)));
307 }
308
309 // As above, but combining the A grid into the B grid
310 {
311 56 TreeT aTree(/*bg=*/one);
312
1/2
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
28 aTree.setValueOn(openvdb::Coord(0, 0, 0), three);
313
1/2
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
28 aTree.setValueOn(openvdb::Coord(0, 0, 1), three);
314
1/2
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
28 aTree.setValueOn(openvdb::Coord(0, 0, 2), aTree.background());
315
1/2
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
28 aTree.setValueOn(openvdb::Coord(0, 1, 2), aTree.background());
316
1/2
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
28 aTree.setValueOff(openvdb::Coord(1, 0, 0), three);
317 aTree.setValueOff(openvdb::Coord(1, 0, 1), three);
318
319 56 TreeT bTree(five);
320
1/2
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
28 bTree.setValueOn(openvdb::Coord(0, 0, 0), minusOne);
321
1/2
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
28 bTree.setValueOn(openvdb::Coord(0, 1, 0), four);
322
1/2
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
28 bTree.setValueOn(openvdb::Coord(0, 1, 2), minusTwo);
323
1/2
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
28 bTree.setValueOff(openvdb::Coord(1, 0, 0), minusOne);
324 bTree.setValueOff(openvdb::Coord(1, 1, 0), four);
325
326 // Call bTree.compMax(aTree), bTree.compSum(aTree), etc.
327
1/2
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
28 comp(bTree, aTree);
328
329 // a = 3 (On), b = -1 (On)
330
3/20
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 7 times.
✗ 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.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
42 EXPECT_EQ(op(minusOne, three), bTree.getValue(openvdb::Coord(0, 0, 0)));
331
332 // a = 3 (On), b = 5 (bg)
333
3/20
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 7 times.
✗ 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.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
42 EXPECT_EQ(op(five, three), bTree.getValue(openvdb::Coord(0, 0, 1)));
334
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 14 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.
28 EXPECT_TRUE(bTree.isValueOn(openvdb::Coord(0, 0, 1)));
335
336 // a = 1 (On, = bg), b = 5 (bg)
337
3/20
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 7 times.
✗ 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.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
42 EXPECT_EQ(op(five, one), bTree.getValue(openvdb::Coord(0, 0, 2)));
338
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 14 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.
28 EXPECT_TRUE(bTree.isValueOn(openvdb::Coord(0, 0, 2)));
339
340 // a = 1 (On, = bg), b = -2 (On)
341
3/20
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 7 times.
✗ 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.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
42 EXPECT_EQ(op(minusTwo, one), bTree.getValue(openvdb::Coord(0, 1, 2)));
342
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 14 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.
28 EXPECT_TRUE(bTree.isValueOn(openvdb::Coord(0, 1, 2)));
343
344 // a = 1 (bg), b = 4 (On)
345
3/20
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 7 times.
✗ 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.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
42 EXPECT_EQ(op(four, one), bTree.getValue(openvdb::Coord(0, 1, 0)));
346
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 14 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.
28 EXPECT_TRUE(bTree.isValueOn(openvdb::Coord(0, 1, 0)));
347
348 // a = 3 (Off), b = -1 (Off)
349
3/20
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 7 times.
✗ 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.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
42 EXPECT_EQ(op(minusOne, three), bTree.getValue(openvdb::Coord(1, 0, 0)));
350
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 14 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.
28 EXPECT_TRUE(bTree.isValueOff(openvdb::Coord(1, 0, 0)));
351
352 // a = 3 (Off), b = 5 (bg)
353
3/20
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 7 times.
✗ 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.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
42 EXPECT_EQ(op(five, three), bTree.getValue(openvdb::Coord(1, 0, 1)));
354
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 14 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.
28 EXPECT_TRUE(bTree.isValueOff(openvdb::Coord(1, 0, 1)));
355
356 // a = 1 (bg), b = 4 (Off)
357
3/20
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 7 times.
✗ 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.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
42 EXPECT_EQ(op(four, one), bTree.getValue(openvdb::Coord(1, 1, 0)));
358
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 14 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.
28 EXPECT_TRUE(bTree.isValueOff(openvdb::Coord(1, 1, 0)));
359
360 // a = 1 (bg), b = 5 (bg)
361
3/20
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 7 times.
✗ 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.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
42 EXPECT_EQ(op(five, one), bTree.getValue(openvdb::Coord(1000, 1, 2)));
362
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 14 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.
28 EXPECT_TRUE(bTree.isValueOff(openvdb::Coord(1000, 1, 2)));
363 }
364 28 }
365
366
367 ////////////////////////////////////////
368
369
370
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestTreeCombine, testCombine2)
371 {
372 using openvdb::Coord;
373 using openvdb::Vec3d;
374
375 struct Local {
376 37375 static void floatAverage(const float& a, const float& b, float& result)
377 37375 { result = 0.5f * (a + b); }
378 37375 static void vec3dAverage(const Vec3d& a, const Vec3d& b, Vec3d& result)
379 37375 { result = 0.5 * (a + b); }
380 37375 static void vec3dFloatMultiply(const Vec3d& a, const float& b, Vec3d& result)
381 37375 { result = a * b; }
382 37375 static void vec3dBoolMultiply(const Vec3d& a, const bool& b, Vec3d& result)
383 37375 { result = a * b; }
384 };
385
386 const Coord c0(0, 0, 0), c1(0, 0, 1), c2(0, 1, 0), c3(1, 0, 0), c4(1000, 1, 2);
387
388 2 openvdb::FloatTree aFloatTree(/*bg=*/1.0), bFloatTree(5.0), outFloatTree(1.0);
389
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 aFloatTree.setValue(c0, 3.0);
390
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 aFloatTree.setValue(c1, 3.0);
391
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 bFloatTree.setValue(c0, -1.0);
392
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 bFloatTree.setValue(c2, 4.0);
393 outFloatTree.combine2(aFloatTree, bFloatTree, Local::floatAverage);
394
395 const float tolerance = 0.0;
396 // Average of set value 3 and set value -1
397
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(1.0, outFloatTree.getValue(c0), tolerance);
398 // Average of set value 3 and bg value 5
399
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(4.0, outFloatTree.getValue(c1), tolerance);
400 // Average of bg value 1 and set value 4
401
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(2.5, outFloatTree.getValue(c2), tolerance);
402 // Average of bg value 1 and bg value 5
403
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(outFloatTree.isValueOff(c3));
404
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(outFloatTree.isValueOff(c4));
405
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(3.0, outFloatTree.getValue(c3), tolerance);
406
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(3.0, outFloatTree.getValue(c4), tolerance);
407
408 // As above, but combining vector grids:
409 const Vec3d zero(0), one(1), two(2), three(3), four(4), five(5);
410 2 openvdb::Vec3DTree aVecTree(/*bg=*/one), bVecTree(five), outVecTree(one);
411 aVecTree.setValue(c0, three);
412 aVecTree.setValue(c1, three);
413
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 bVecTree.setValue(c0, -1.0 * one);
414 bVecTree.setValue(c2, four);
415 outVecTree.combine2(aVecTree, bVecTree, Local::vec3dAverage);
416
417 // Average of set value 3 and set value -1
418
1/14
✗ 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(one, outVecTree.getValue(c0));
419 // Average of set value 3 and bg value 5
420
1/14
✗ 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(four, outVecTree.getValue(c1));
421 // Average of bg value 1 and set value 4
422
1/14
✗ 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(2.5 * one, outVecTree.getValue(c2));
423 // Average of bg value 1 and bg value 5
424
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(outVecTree.isValueOff(c3));
425
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(outVecTree.isValueOff(c4));
426
1/14
✗ 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(three, outVecTree.getValue(c3));
427
1/14
✗ 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(three, outVecTree.getValue(c4));
428
429 // Multiply the vector tree by the scalar tree.
430 {
431 2 openvdb::Vec3DTree vecTree(one);
432 vecTree.combine2(outVecTree, outFloatTree, Local::vec3dFloatMultiply);
433
434 // Product of set value (1, 1, 1) and set value 1
435
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(vecTree.isValueOn(c0));
436
1/14
✗ 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(one, vecTree.getValue(c0));
437 // Product of set value (4, 4, 4) and set value 4
438
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(vecTree.isValueOn(c1));
439
1/14
✗ 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(4 * 4 * one, vecTree.getValue(c1));
440 // Product of set value (2.5, 2.5, 2.5) and set value 2.5
441
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(vecTree.isValueOn(c2));
442
1/14
✗ 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(2.5 * 2.5 * one, vecTree.getValue(c2));
443 // Product of bg value (3, 3, 3) and bg value 3
444
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(vecTree.isValueOff(c3));
445
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(vecTree.isValueOff(c4));
446
1/14
✗ 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(3 * 3 * one, vecTree.getValue(c3));
447
1/14
✗ 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(3 * 3 * one, vecTree.getValue(c4));
448 }
449
450 // Multiply the vector tree by a boolean tree.
451 {
452 2 openvdb::BoolTree boolTree(0);
453
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 boolTree.setValue(c0, true);
454
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 boolTree.setValue(c1, false);
455
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 boolTree.setValue(c2, true);
456
457 2 openvdb::Vec3DTree vecTree(one);
458 vecTree.combine2(outVecTree, boolTree, Local::vec3dBoolMultiply);
459
460 // Product of set value (1, 1, 1) and set value 1
461
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(vecTree.isValueOn(c0));
462
1/14
✗ 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(one, vecTree.getValue(c0));
463 // Product of set value (4, 4, 4) and set value 0
464
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(vecTree.isValueOn(c1));
465
1/14
✗ 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(zero, vecTree.getValue(c1));
466 // Product of set value (2.5, 2.5, 2.5) and set value 1
467
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(vecTree.isValueOn(c2));
468
1/14
✗ 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(2.5 * one, vecTree.getValue(c2));
469 // Product of bg value (3, 3, 3) and bg value 0
470
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(vecTree.isValueOff(c3));
471
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(vecTree.isValueOff(c4));
472
1/14
✗ 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(zero, vecTree.getValue(c3));
473
1/14
✗ 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(zero, vecTree.getValue(c4));
474 }
475
476 // Verify that a vector tree can't be combined into a scalar tree
477 // (although the reverse is allowed).
478 {
479 struct Local2 {
480 static void f(const float& a, const Vec3d&, float& result) { result = a; }
481 };
482 2 openvdb::FloatTree floatTree(5.0), outTree;
483 2 openvdb::Vec3DTree vecTree(one);
484
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ 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 15 not taken.
✗ Branch 16 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
2 EXPECT_THROW(outTree.combine2(floatTree, vecTree, Local2::f), openvdb::TypeError);
485 }
486 1 }
487
488
489 ////////////////////////////////////////
490
491
492
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestTreeCombine, testBoolTree)
493 {
494 openvdb::BoolGrid::Ptr sphere = openvdb::BoolGrid::create();
495
496
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 unittest_util::makeSphere<openvdb::BoolGrid>(/*dim=*/openvdb::Coord(32),
497
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 /*ctr=*/openvdb::Vec3f(0),
498 /*radius=*/20.0, *sphere,
499 unittest_util::SPHERE_SPARSE_NARROW_BAND);
500
501 openvdb::BoolGrid::Ptr
502
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 aGrid = sphere->copy(),
503
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 bGrid = sphere->copy();
504
505 // CSG operations work only on level sets with a nonzero inside and outside values.
506
4/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ 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 22 taken 1 times.
✗ Branch 23 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
2 EXPECT_THROW(openvdb::tools::csgUnion(aGrid->tree(), bGrid->tree()),
507 openvdb::ValueError);
508
4/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ 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 22 taken 1 times.
✗ Branch 23 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
2 EXPECT_THROW(openvdb::tools::csgIntersection(aGrid->tree(), bGrid->tree()),
509 openvdb::ValueError);
510
4/22
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ 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 22 taken 1 times.
✗ Branch 23 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
2 EXPECT_THROW(openvdb::tools::csgDifference(aGrid->tree(), bGrid->tree()),
511 openvdb::ValueError);
512
513
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::tools::compSum(aGrid->tree(), bGrid->tree());
514
515
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 bGrid = sphere->copy();
516
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::tools::compMax(aGrid->tree(), bGrid->tree());
517
518
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 int mismatches = 0;
519 openvdb::BoolGrid::ConstAccessor acc = sphere->getConstAccessor();
520
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 for (openvdb::BoolGrid::ValueAllCIter it = aGrid->cbeginValueAll(); it; ++it) {
521 if (*it != acc.getValue(it.getCoord())) ++mismatches;
522 }
523
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 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_EQ(0, mismatches);
524 1 }
525
526
527 ////////////////////////////////////////
528
529
530 template<typename TreeT>
531 void
532 4 TestTreeCombine::testCompRepl()
533 {
534 using ValueT = typename TreeT::ValueType;
535
536 const ValueT
537 zero = openvdb::zeroVal<ValueT>(),
538 4 minusOne = zero + (-1),
539 4 one = zero + 1,
540 4 three = zero + 3,
541 4 four = zero + 4,
542 4 five = zero + 5;
543
544 {
545 8 TreeT aTree(/*bg=*/one);
546
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 aTree.setValueOn(openvdb::Coord(0, 0, 0), three);
547
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 aTree.setValueOn(openvdb::Coord(0, 0, 1), three);
548
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 aTree.setValueOn(openvdb::Coord(0, 0, 2), aTree.background());
549
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 aTree.setValueOn(openvdb::Coord(0, 1, 2), aTree.background());
550
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 aTree.setValueOff(openvdb::Coord(1, 0, 0), three);
551 aTree.setValueOff(openvdb::Coord(1, 0, 1), three);
552
553 8 TreeT bTree(five);
554
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 bTree.setValueOn(openvdb::Coord(0, 0, 0), minusOne);
555
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 bTree.setValueOn(openvdb::Coord(0, 1, 0), four);
556
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 bTree.setValueOn(openvdb::Coord(0, 1, 2), minusOne);
557
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 bTree.setValueOff(openvdb::Coord(1, 0, 0), minusOne);
558 bTree.setValueOff(openvdb::Coord(1, 1, 0), four);
559
560 // Copy active voxels of bTree into aTree.
561
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 openvdb::tools::compReplace(aTree, bTree);
562
563 // a = 3 (On), b = -1 (On)
564
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
4 EXPECT_EQ(minusOne, aTree.getValue(openvdb::Coord(0, 0, 0)));
565
566 // a = 3 (On), b = 5 (bg)
567
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
4 EXPECT_EQ(three, aTree.getValue(openvdb::Coord(0, 0, 1)));
568
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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.
4 EXPECT_TRUE(aTree.isValueOn(openvdb::Coord(0, 0, 1)));
569
570 // a = 1 (On, = bg), b = 5 (bg)
571
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
4 EXPECT_EQ(one, aTree.getValue(openvdb::Coord(0, 0, 2)));
572
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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.
4 EXPECT_TRUE(aTree.isValueOn(openvdb::Coord(0, 0, 2)));
573
574 // a = 1 (On, = bg), b = -1 (On)
575
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
4 EXPECT_EQ(minusOne, aTree.getValue(openvdb::Coord(0, 1, 2)));
576
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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.
4 EXPECT_TRUE(aTree.isValueOn(openvdb::Coord(0, 1, 2)));
577
578 // a = 1 (bg), b = 4 (On)
579
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
4 EXPECT_EQ(four, aTree.getValue(openvdb::Coord(0, 1, 0)));
580
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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.
4 EXPECT_TRUE(aTree.isValueOn(openvdb::Coord(0, 1, 0)));
581
582 // a = 3 (Off), b = -1 (Off)
583
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
4 EXPECT_EQ(three, aTree.getValue(openvdb::Coord(1, 0, 0)));
584
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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.
4 EXPECT_TRUE(aTree.isValueOff(openvdb::Coord(1, 0, 0)));
585
586 // a = 3 (Off), b = 5 (bg)
587
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
4 EXPECT_EQ(three, aTree.getValue(openvdb::Coord(1, 0, 1)));
588
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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.
4 EXPECT_TRUE(aTree.isValueOff(openvdb::Coord(1, 0, 1)));
589
590 // a = 1 (bg), b = 4 (Off)
591
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
4 EXPECT_EQ(one, aTree.getValue(openvdb::Coord(1, 1, 0)));
592
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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.
4 EXPECT_TRUE(aTree.isValueOff(openvdb::Coord(1, 1, 0)));
593
594 // a = 1 (bg), b = 5 (bg)
595
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
4 EXPECT_EQ(one, aTree.getValue(openvdb::Coord(1000, 1, 2)));
596
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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.
4 EXPECT_TRUE(aTree.isValueOff(openvdb::Coord(1000, 1, 2)));
597 }
598
599 // As above, but combining the A grid into the B grid
600 {
601 8 TreeT aTree(/*background=*/one);
602
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 aTree.setValueOn(openvdb::Coord(0, 0, 0), three);
603
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 aTree.setValueOn(openvdb::Coord(0, 0, 1), three);
604
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 aTree.setValueOn(openvdb::Coord(0, 0, 2), aTree.background());
605
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 aTree.setValueOn(openvdb::Coord(0, 1, 2), aTree.background());
606
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 aTree.setValueOff(openvdb::Coord(1, 0, 0), three);
607 aTree.setValueOff(openvdb::Coord(1, 0, 1), three);
608
609 8 TreeT bTree(five);
610
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 bTree.setValueOn(openvdb::Coord(0, 0, 0), minusOne);
611
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 bTree.setValueOn(openvdb::Coord(0, 1, 0), four);
612
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 bTree.setValueOn(openvdb::Coord(0, 1, 2), minusOne);
613
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 bTree.setValueOff(openvdb::Coord(1, 0, 0), minusOne);
614 bTree.setValueOff(openvdb::Coord(1, 1, 0), four);
615
616 // Copy active voxels of aTree into bTree.
617
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 openvdb::tools::compReplace(bTree, aTree);
618
619 // a = 3 (On), b = -1 (On)
620
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
4 EXPECT_EQ(three, bTree.getValue(openvdb::Coord(0, 0, 0)));
621
622 // a = 3 (On), b = 5 (bg)
623
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
4 EXPECT_EQ(three, bTree.getValue(openvdb::Coord(0, 0, 1)));
624
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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.
4 EXPECT_TRUE(bTree.isValueOn(openvdb::Coord(0, 0, 1)));
625
626 // a = 1 (On, = bg), b = 5 (bg)
627
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
4 EXPECT_EQ(one, bTree.getValue(openvdb::Coord(0, 0, 2)));
628
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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.
4 EXPECT_TRUE(bTree.isValueOn(openvdb::Coord(0, 0, 2)));
629
630 // a = 1 (On, = bg), b = -1 (On)
631
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
4 EXPECT_EQ(one, bTree.getValue(openvdb::Coord(0, 1, 2)));
632
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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.
4 EXPECT_TRUE(bTree.isValueOn(openvdb::Coord(0, 1, 2)));
633
634 // a = 1 (bg), b = 4 (On)
635
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
4 EXPECT_EQ(four, bTree.getValue(openvdb::Coord(0, 1, 0)));
636
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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.
4 EXPECT_TRUE(bTree.isValueOn(openvdb::Coord(0, 1, 0)));
637
638 // a = 3 (Off), b = -1 (Off)
639
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
4 EXPECT_EQ(minusOne, bTree.getValue(openvdb::Coord(1, 0, 0)));
640
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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.
4 EXPECT_TRUE(bTree.isValueOff(openvdb::Coord(1, 0, 0)));
641
642 // a = 3 (Off), b = 5 (bg)
643
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
4 EXPECT_EQ(five, bTree.getValue(openvdb::Coord(1, 0, 1)));
644
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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.
4 EXPECT_TRUE(bTree.isValueOff(openvdb::Coord(1, 0, 1)));
645
646 // a = 1 (bg), b = 4 (Off)
647
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
4 EXPECT_EQ(four, bTree.getValue(openvdb::Coord(1, 1, 0)));
648
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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.
4 EXPECT_TRUE(bTree.isValueOff(openvdb::Coord(1, 1, 0)));
649
650 // a = 1 (bg), b = 5 (bg)
651
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
4 EXPECT_EQ(five, bTree.getValue(openvdb::Coord(1000, 1, 2)));
652
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 2 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.
4 EXPECT_TRUE(bTree.isValueOff(openvdb::Coord(1000, 1, 2)));
653 }
654 4 }
655
656
657 ////////////////////////////////////////
658
659
660 #ifdef DWA_OPENVDB
661 TEST_F(TestTreeCombine, testCsg)
662 {
663 using TreeT = openvdb::FloatTree;
664 using TreePtr = TreeT::Ptr;
665 using GridT = openvdb::Grid<TreeT>;
666
667 struct Local {
668 static TreePtr readFile(const std::string& fname) {
669 std::string filename(fname), gridName("LevelSet");
670 size_t space = filename.find_last_of(' ');
671 if (space != std::string::npos) {
672 gridName = filename.substr(space + 1);
673 filename.erase(space);
674 }
675
676 TreePtr tree;
677 openvdb::io::File file(filename);
678 file.open();
679 if (openvdb::GridBase::Ptr basePtr = file.readGrid(gridName)) {
680 if (GridT::Ptr gridPtr = openvdb::gridPtrCast<GridT>(basePtr)) {
681 tree = gridPtr->treePtr();
682 }
683 }
684 file.close();
685 return tree;
686 }
687
688 //static void writeFile(TreePtr tree, const std::string& filename) {
689 // openvdb::io::File file(filename);
690 // openvdb::GridPtrVec grids;
691 // GridT::Ptr grid = openvdb::createGrid(tree);
692 // grid->setName("LevelSet");
693 // grids.push_back(grid);
694 // file.write(grids);
695 //}
696
697 static void visitorUnion(TreeT& a, TreeT& b) { openvdb::tools::csgUnion(a, b); }
698 static void visitorIntersect(TreeT& a, TreeT& b) { openvdb::tools::csgIntersection(a, b); }
699 static void visitorDiff(TreeT& a, TreeT& b) { openvdb::tools::csgDifference(a, b); }
700 };
701
702 TreePtr smallTree1, smallTree2, largeTree1, largeTree2, refTree, outTree;
703
704 #if TEST_CSG_VERBOSE
705 openvdb::util::CpuTimer timer;
706 timer.start();
707 #endif
708
709 const std::string testDir("/work/rd/fx_tools/vdb_unittest/TestGridCombine::testCsg/");
710 smallTree1 = Local::readFile(testDir + "small1.vdb2 LevelSet");
711 EXPECT_TRUE(smallTree1.get() != nullptr);
712 smallTree2 = Local::readFile(testDir + "small2.vdb2 Cylinder");
713 EXPECT_TRUE(smallTree2.get() != nullptr);
714 largeTree1 = Local::readFile(testDir + "large1.vdb2 LevelSet");
715 EXPECT_TRUE(largeTree1.get() != nullptr);
716 largeTree2 = Local::readFile(testDir + "large2.vdb2 LevelSet");
717 EXPECT_TRUE(largeTree2.get() != nullptr);
718
719 #if TEST_CSG_VERBOSE
720 std::cerr << "file read: " << timer.milliseconds() << " msec\n";
721 #endif
722
723 #if TEST_CSG_VERBOSE
724 std::cerr << "\n<union>\n";
725 #endif
726 refTree = Local::readFile(testDir + "small_union.vdb2");
727 outTree = visitCsg(*smallTree1, *smallTree2, *refTree, Local::visitorUnion);
728 //Local::writeFile(outTree, "small_union_out.vdb2");
729 refTree = Local::readFile(testDir + "large_union.vdb2");
730 outTree = visitCsg(*largeTree1, *largeTree2, *refTree, Local::visitorUnion);
731 //Local::writeFile(outTree, "large_union_out.vdb2");
732
733 #if TEST_CSG_VERBOSE
734 std::cerr << "\n<intersection>\n";
735 #endif
736 refTree = Local::readFile(testDir + "small_intersection.vdb2");
737 outTree = visitCsg(*smallTree1, *smallTree2, *refTree, Local::visitorIntersect);
738 //Local::writeFile(outTree, "small_intersection_out.vdb2");
739 refTree = Local::readFile(testDir + "large_intersection.vdb2");
740 outTree = visitCsg(*largeTree1, *largeTree2, *refTree, Local::visitorIntersect);
741 //Local::writeFile(outTree, "large_intersection_out.vdb2");
742
743 #if TEST_CSG_VERBOSE
744 std::cerr << "\n<difference>\n";
745 #endif
746 refTree = Local::readFile(testDir + "small_difference.vdb2");
747 outTree = visitCsg(*smallTree1, *smallTree2, *refTree, Local::visitorDiff);
748 //Local::writeFile(outTree, "small_difference_out.vdb2");
749 refTree = Local::readFile(testDir + "large_difference.vdb2");
750 outTree = visitCsg(*largeTree1, *largeTree2, *refTree, Local::visitorDiff);
751 //Local::writeFile(outTree, "large_difference_out.vdb2");
752 }
753 #endif
754
755
756 template<typename TreeT, typename VisitorT>
757 typename TreeT::Ptr
758 TestTreeCombine::visitCsg(const TreeT& aInputTree, const TreeT& bInputTree,
759 const TreeT& refTree, const VisitorT& visitor)
760 {
761 using TreePtr = typename TreeT::Ptr;
762
763 #if TEST_CSG_VERBOSE
764 openvdb::util::CpuTimer timer;
765 timer.start();
766 #endif
767 TreePtr aTree(new TreeT(aInputTree));
768 TreeT bTree(bInputTree);
769 #if TEST_CSG_VERBOSE
770 std::cerr << "deep copy: " << timer.milliseconds() << " msec\n";
771 #endif
772
773 #if (TEST_CSG_VERBOSE > 1)
774 std::cerr << "\nA grid:\n";
775 aTree->print(std::cerr, /*verbose=*/3);
776 std::cerr << "\nB grid:\n";
777 bTree.print(std::cerr, /*verbose=*/3);
778 std::cerr << "\nExpected:\n";
779 refTree.print(std::cerr, /*verbose=*/3);
780 std::cerr << "\n";
781 #endif
782
783 // Compute the CSG combination of the two grids.
784 #if TEST_CSG_VERBOSE
785 timer.start();
786 #endif
787 visitor(*aTree, bTree);
788 #if TEST_CSG_VERBOSE
789 std::cerr << "combine: " << timer.milliseconds() << " msec\n";
790 #endif
791 #if (TEST_CSG_VERBOSE > 1)
792 std::cerr << "\nActual:\n";
793 aTree->print(std::cerr, /*verbose=*/3);
794 #endif
795
796 std::ostringstream aInfo, refInfo;
797 aTree->print(aInfo, /*verbose=*/2);
798 refTree.print(refInfo, /*verbose=*/2);
799
800 EXPECT_EQ(refInfo.str(), aInfo.str());
801
802 EXPECT_TRUE(aTree->hasSameTopology(refTree));
803
804 return aTree;
805 }
806
807
808 ////////////////////////////////////////
809
810
811
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestTreeCombine, testCsgCopy)
812 {
813 const float voxelSize = 0.2f;
814 const float radius = 3.0f;
815 openvdb::Vec3f center(0.0f, 0.0f, 0.0f);
816
817 openvdb::FloatGrid::Ptr gridA =
818 1 openvdb::tools::createLevelSetSphere<openvdb::FloatGrid>(radius, center, voxelSize);
819
820
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
1 openvdb::Coord ijkA = gridA->transform().worldToIndexNodeCentered(center);
821
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(gridA->tree().getValue(ijkA) < 0.0f); // center is inside
822
823 1 center.x() += 3.5f;
824
825 openvdb::FloatGrid::Ptr gridB =
826
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::tools::createLevelSetSphere<openvdb::FloatGrid>(radius, center, voxelSize);
827
828
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
1 openvdb::Coord ijkB = gridA->transform().worldToIndexNodeCentered(center);
829
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(gridB->tree().getValue(ijkB) < 0.0f); // center is inside
830
831
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::FloatGrid::Ptr unionGrid = openvdb::tools::csgUnionCopy(*gridA, *gridB);
832
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::FloatGrid::Ptr intersectionGrid = openvdb::tools::csgIntersectionCopy(*gridA, *gridB);
833
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::FloatGrid::Ptr differenceGrid = openvdb::tools::csgDifferenceCopy(*gridA, *gridB);
834
835
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(unionGrid.get() != nullptr);
836
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(intersectionGrid.get() != nullptr);
837
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(differenceGrid.get() != nullptr);
838
839
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(!unionGrid->empty());
840
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(!intersectionGrid->empty());
841
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(!differenceGrid->empty());
842
843 // test inside / outside sign
844
845
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(unionGrid->tree().getValue(ijkA) < 0.0f);
846
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(unionGrid->tree().getValue(ijkB) < 0.0f);
847
848
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(!(intersectionGrid->tree().getValue(ijkA) < 0.0f));
849
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(!(intersectionGrid->tree().getValue(ijkB) < 0.0f));
850
851
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(differenceGrid->tree().getValue(ijkA) < 0.0f);
852
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(!(differenceGrid->tree().getValue(ijkB) < 0.0f));
853 1 }
854
855
856 ////////////////////////////////////////
857
858
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 TEST_F(TestTreeCombine, testCompActiveLeafVoxels)
859 {
860 {//replace float tree (default argument)
861 2 openvdb::FloatTree srcTree(0.0f), dstTree(0.0f);
862
863
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 dstTree.setValue(openvdb::Coord(1,1,1), 1.0f);
864
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 srcTree.setValue(openvdb::Coord(1,1,1), 2.0f);
865
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 srcTree.setValue(openvdb::Coord(8,8,8), 3.0f);
866
867
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_EQ(1, int(dstTree.leafCount()));
868
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_EQ(2, int(srcTree.leafCount()));
869
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_EQ(1.0f, dstTree.getValue(openvdb::Coord(1, 1, 1)));
870
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(dstTree.isValueOn(openvdb::Coord(1, 1, 1)));
871
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_EQ(0.0f, dstTree.getValue(openvdb::Coord(8, 8, 8)));
872
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(!dstTree.isValueOn(openvdb::Coord(8, 8, 8)));
873
874
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::tools::compActiveLeafVoxels(srcTree, dstTree);
875
876
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_EQ(2, int(dstTree.leafCount()));
877
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_EQ(0, int(srcTree.leafCount()));
878
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_EQ(2.0f, dstTree.getValue(openvdb::Coord(1, 1, 1)));
879
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(dstTree.isValueOn(openvdb::Coord(1, 1, 1)));
880
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_EQ(3.0f, dstTree.getValue(openvdb::Coord(8, 8, 8)));
881
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(dstTree.isValueOn(openvdb::Coord(8, 8, 8)));
882 }
883 {//replace float tree (lambda expression)
884 2 openvdb::FloatTree srcTree(0.0f), dstTree(0.0f);
885
886
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 dstTree.setValue(openvdb::Coord(1,1,1), 1.0f);
887
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 srcTree.setValue(openvdb::Coord(1,1,1), 2.0f);
888
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 srcTree.setValue(openvdb::Coord(8,8,8), 3.0f);
889
890
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_EQ(1, int(dstTree.leafCount()));
891
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_EQ(2, int(srcTree.leafCount()));
892
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_EQ(1.0f, dstTree.getValue(openvdb::Coord(1, 1, 1)));
893
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(dstTree.isValueOn(openvdb::Coord(1, 1, 1)));
894
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_EQ(0.0f, dstTree.getValue(openvdb::Coord(8, 8, 8)));
895
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(!dstTree.isValueOn(openvdb::Coord(8, 8, 8)));
896
897
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 openvdb::tools::compActiveLeafVoxels(srcTree, dstTree, [](float &d, float s){d=s;});
898
899
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_EQ(2, int(dstTree.leafCount()));
900
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_EQ(0, int(srcTree.leafCount()));
901
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_EQ(2.0f, dstTree.getValue(openvdb::Coord(1, 1, 1)));
902
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(dstTree.isValueOn(openvdb::Coord(1, 1, 1)));
903
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_EQ(3.0f, dstTree.getValue(openvdb::Coord(8, 8, 8)));
904
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(dstTree.isValueOn(openvdb::Coord(8, 8, 8)));
905 }
906 {//add float tree
907 2 openvdb::FloatTree srcTree(0.0f), dstTree(0.0f);
908
909
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 dstTree.setValue(openvdb::Coord(1,1,1), 1.0f);
910
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 srcTree.setValue(openvdb::Coord(1,1,1), 2.0f);
911
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 srcTree.setValue(openvdb::Coord(8,8,8), 3.0f);
912
913
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_EQ(1, int(dstTree.leafCount()));
914
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_EQ(2, int(srcTree.leafCount()));
915
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_EQ(1.0f, dstTree.getValue(openvdb::Coord(1, 1, 1)));
916
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(dstTree.isValueOn(openvdb::Coord(1, 1, 1)));
917
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_EQ(0.0f, dstTree.getValue(openvdb::Coord(8, 8, 8)));
918
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(!dstTree.isValueOn(openvdb::Coord(8, 8, 8)));
919
920
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 openvdb::tools::compActiveLeafVoxels(srcTree, dstTree, [](float &d, float s){d+=s;});
921
922
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_EQ(2, int(dstTree.leafCount()));
923
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_EQ(0, int(srcTree.leafCount()));
924
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_EQ(3.0f, dstTree.getValue(openvdb::Coord(1, 1, 1)));
925
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(dstTree.isValueOn(openvdb::Coord(1, 1, 1)));
926
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_EQ(3.0f, dstTree.getValue(openvdb::Coord(8, 8, 8)));
927
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(dstTree.isValueOn(openvdb::Coord(8, 8, 8)));
928 }
929 {
930 using BufferT = openvdb::FloatTree::LeafNodeType::Buffer;
931 EXPECT_TRUE((std::is_same<BufferT::ValueType, BufferT::StorageType>::value));
932 }
933 {
934 using BufferT = openvdb::Vec3fTree::LeafNodeType::Buffer;
935 EXPECT_TRUE((std::is_same<BufferT::ValueType, BufferT::StorageType>::value));
936 }
937 {
938 using BufferT = openvdb::BoolTree::LeafNodeType::Buffer;
939 EXPECT_TRUE(!(std::is_same<BufferT::ValueType, BufferT::StorageType>::value));
940 }
941 {
942 using BufferT = openvdb::MaskTree::LeafNodeType::Buffer;
943 EXPECT_TRUE(!(std::is_same<BufferT::ValueType, BufferT::StorageType>::value));
944 }
945 {//replace bool tree
946 2 openvdb::BoolTree srcTree(false), dstTree(false);
947
948
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 dstTree.setValue(openvdb::Coord(1,1,1), true);
949
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 srcTree.setValue(openvdb::Coord(1,1,1), false);
950
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 srcTree.setValue(openvdb::Coord(8,8,8), true);
951 //(9,8,8) is inactive but true so it should have no effect
952
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 srcTree.setValueOnly(openvdb::Coord(9,8,8), true);
953
954
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_EQ(1, int(dstTree.leafCount()));
955
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_EQ(2, int(srcTree.leafCount()));
956
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_EQ(true, dstTree.getValue(openvdb::Coord(1, 1, 1)));
957
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(dstTree.isValueOn(openvdb::Coord(1, 1, 1)));
958
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_EQ(false, dstTree.getValue(openvdb::Coord(8, 8, 8)));
959
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(!dstTree.isValueOn(openvdb::Coord(8, 8, 8)));
960
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_EQ(true, srcTree.getValue(openvdb::Coord(9, 8, 8)));
961
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(!srcTree.isValueOn(openvdb::Coord(9, 8, 8)));
962
963 using Word = openvdb::BoolTree::LeafNodeType::Buffer::WordType;
964
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::tools::compActiveLeafVoxels(srcTree, dstTree, [](Word &d, Word s){d=s;});
965
966
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_EQ(2, int(dstTree.leafCount()));
967
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_EQ(0, int(srcTree.leafCount()));
968
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_EQ(false, dstTree.getValue(openvdb::Coord(1, 1, 1)));
969
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(dstTree.isValueOn(openvdb::Coord(1, 1, 1)));
970
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_EQ(true, dstTree.getValue(openvdb::Coord(8, 8, 8)));
971
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(dstTree.isValueOn(openvdb::Coord(8, 8, 8)));
972 }
973 {// mask tree
974
1/2
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
2 openvdb::MaskTree srcTree(false), dstTree(false);
975
976
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 dstTree.setValueOn(openvdb::Coord(1,1,1));
977
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 srcTree.setValueOn(openvdb::Coord(1,1,1));
978
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 srcTree.setValueOn(openvdb::Coord(8,8,8));
979
980
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_EQ(1, int(dstTree.leafCount()));
981
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_EQ(2, int(srcTree.leafCount()));
982
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_EQ(true, dstTree.getValue(openvdb::Coord(1, 1, 1)));
983
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(dstTree.isValueOn(openvdb::Coord(1, 1, 1)));
984
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_EQ(false, dstTree.getValue(openvdb::Coord(8, 8, 8)));
985
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(!dstTree.isValueOn(openvdb::Coord(8, 8, 8)));
986
987
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::tools::compActiveLeafVoxels(srcTree, dstTree);
988
989
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_EQ(2, int(dstTree.leafCount()));
990
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_EQ(0, int(srcTree.leafCount()));
991
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_EQ(true, dstTree.getValue(openvdb::Coord(1, 1, 1)));
992
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(dstTree.isValueOn(openvdb::Coord(1, 1, 1)));
993
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_EQ(true, dstTree.getValue(openvdb::Coord(8, 8, 8)));
994
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(dstTree.isValueOn(openvdb::Coord(8, 8, 8)));
995 }
996 1 }
997
998
999 ////////////////////////////////////////
1000
1001