GCC Code Coverage Report


Directory: ./
File: openvdb/openvdb/unittest/TestDense.cc
Date: 2022-07-25 17:40:05
Exec Total Coverage
Lines: 287 287 100.0%
Functions: 32 32 100.0%
Branches: 382 1666 22.9%

Line Branch Exec Source
1 // Copyright Contributors to the OpenVDB Project
2 // SPDX-License-Identifier: MPL-2.0
3
4 //#define BENCHMARK_TEST
5
6 #include <openvdb/openvdb.h>
7 #include <openvdb/tools/LevelSetSphere.h>
8 #include <openvdb/tools/Count.h>
9 #include <openvdb/tools/Dense.h>
10 #include <openvdb/Exceptions.h>
11 #ifdef BENCHMARK_TEST
12 #include <openvdb/util/CpuTimer.h>
13 #endif
14
15 #include <gtest/gtest.h>
16
17 #include <sstream>
18
19
20 16 class TestDense: public ::testing::Test
21 {
22 public:
23 template <openvdb::tools::MemoryLayout Layout>
24 void testCopy();
25 template <openvdb::tools::MemoryLayout Layout>
26 void testCopyBool();
27 template <openvdb::tools::MemoryLayout Layout>
28 void testCopyFromDenseWithOffset();
29 template <openvdb::tools::MemoryLayout Layout>
30 void testDense2Sparse();
31 template <openvdb::tools::MemoryLayout Layout>
32 void testDense2Sparse2();
33 template <openvdb::tools::MemoryLayout Layout>
34 void testInvalidBBox();
35 template <openvdb::tools::MemoryLayout Layout>
36 void testDense2Sparse2Dense();
37 };
38
39
40
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestDense, testDenseZYX)
41 {
42 1 const openvdb::CoordBBox bbox(openvdb::Coord(-40,-5, 6),
43 1 openvdb::Coord(-11, 7,22));
44 1 openvdb::tools::Dense<float> dense(bbox);//LayoutZYX is the default
45
46 // Check Desne::origin()
47
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(openvdb::Coord(-40,-5, 6) == dense.origin());
48
49 // Check coordToOffset and offsetToCoord
50 1 size_t offset = 0;
51
2/2
✓ Branch 0 taken 30 times.
✓ Branch 1 taken 1 times.
31 for (openvdb::Coord P(bbox.min()); P[0] <= bbox.max()[0]; ++P[0]) {
52
2/2
✓ Branch 0 taken 390 times.
✓ Branch 1 taken 30 times.
420 for (P[1] = bbox.min()[1]; P[1] <= bbox.max()[1]; ++P[1]) {
53
2/2
✓ Branch 0 taken 6630 times.
✓ Branch 1 taken 390 times.
7020 for (P[2] = bbox.min()[2]; P[2] <= bbox.max()[2]; ++P[2]) {
54 //std::cerr << "offset = " << offset << " P = " << P << std::endl;
55
2/16
✓ Branch 2 taken 6630 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 6630 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
6630 EXPECT_EQ(offset, dense.coordToOffset(P));
56
2/16
✓ Branch 1 taken 6630 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6630 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.
6630 EXPECT_EQ(P - dense.origin(), dense.offsetToLocalCoord(offset));
57
2/16
✓ Branch 1 taken 6630 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6630 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.
6630 EXPECT_EQ(P, dense.offsetToCoord(offset));
58 6630 ++offset;
59 }
60 }
61 }
62
63 // Check Dense::valueCount
64 1 const int size = static_cast<int>(dense.valueCount());
65
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(30*13*17, size);
66
67 // Check Dense::fill(float) and Dense::getValue(size_t)
68 1 const float v = 0.234f;
69 1 dense.fill(v);
70
2/2
✓ Branch 0 taken 6630 times.
✓ Branch 1 taken 1 times.
6631 for (int i=0; i<size; ++i) {
71
2/16
✓ Branch 1 taken 6630 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6630 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.
6630 EXPECT_NEAR(v, dense.getValue(i),/*tolerance=*/0.0001);
72 }
73
74 // Check Dense::data() and Dense::getValue(Coord, float)
75 float* a = dense.data();
76 int s = size;
77
4/18
✓ Branch 0 taken 6630 times.
✓ Branch 1 taken 1 times.
✓ Branch 3 taken 6630 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 6630 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
6631 while(s--) EXPECT_NEAR(v, *a++, /*tolerance=*/0.0001);
78
79
2/2
✓ Branch 0 taken 30 times.
✓ Branch 1 taken 1 times.
31 for (openvdb::Coord P(bbox.min()); P[0] <= bbox.max()[0]; ++P[0]) {
80
2/2
✓ Branch 0 taken 390 times.
✓ Branch 1 taken 30 times.
420 for (P[1] = bbox.min()[1]; P[1] <= bbox.max()[1]; ++P[1]) {
81
2/2
✓ Branch 0 taken 6630 times.
✓ Branch 1 taken 390 times.
7020 for (P[2] = bbox.min()[2]; P[2] <= bbox.max()[2]; ++P[2]) {
82
2/16
✓ Branch 1 taken 6630 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6630 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.
6630 EXPECT_NEAR(v, dense.getValue(P), /*tolerance=*/0.0001);
83 }
84 }
85 }
86
87 // Check Dense::setValue(Coord, float)
88 const openvdb::Coord C(-30, 3,12);
89 const float v1 = 3.45f;
90 dense.setValue(C, v1);
91
2/2
✓ Branch 0 taken 30 times.
✓ Branch 1 taken 1 times.
31 for (openvdb::Coord P(bbox.min()); P[0] <= bbox.max()[0]; ++P[0]) {
92
2/2
✓ Branch 0 taken 390 times.
✓ Branch 1 taken 30 times.
420 for (P[1] = bbox.min()[1]; P[1] <= bbox.max()[1]; ++P[1]) {
93
2/2
✓ Branch 0 taken 6630 times.
✓ Branch 1 taken 390 times.
7020 for (P[2] = bbox.min()[2]; P[2] <= bbox.max()[2]; ++P[2]) {
94
4/18
✓ Branch 0 taken 221 times.
✓ Branch 1 taken 6409 times.
✓ Branch 3 taken 6630 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 6630 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
6851 EXPECT_NEAR(P==C ? v1 : v, dense.getValue(P),
95 /*tolerance=*/0.0001);
96 }
97 }
98 }
99
100 // Check Dense::setValue(size_t, size_t, size_t, float)
101 dense.setValue(C, v);
102 const openvdb::Coord L(1,2,3), C1 = bbox.min() + L;
103 dense.setValue(L[0], L[1], L[2], v1);
104
2/2
✓ Branch 0 taken 30 times.
✓ Branch 1 taken 1 times.
31 for (openvdb::Coord P(bbox.min()); P[0] <= bbox.max()[0]; ++P[0]) {
105
2/2
✓ Branch 0 taken 390 times.
✓ Branch 1 taken 30 times.
420 for (P[1] = bbox.min()[1]; P[1] <= bbox.max()[1]; ++P[1]) {
106
2/2
✓ Branch 0 taken 6630 times.
✓ Branch 1 taken 390 times.
7020 for (P[2] = bbox.min()[2]; P[2] <= bbox.max()[2]; ++P[2]) {
107
4/18
✓ Branch 0 taken 221 times.
✓ Branch 1 taken 6409 times.
✓ Branch 3 taken 6630 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 6630 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
6851 EXPECT_NEAR(P==C1 ? v1 : v, dense.getValue(P),
108 /*tolerance=*/0.0001);
109 }
110 }
111 }
112
113 1 }
114
115
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestDense, testDenseXYZ)
116 {
117 1 const openvdb::CoordBBox bbox(openvdb::Coord(-40,-5, 6),
118 1 openvdb::Coord(-11, 7,22));
119 1 openvdb::tools::Dense<float, openvdb::tools::LayoutXYZ> dense(bbox);
120
121 // Check Desne::origin()
122
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(openvdb::Coord(-40,-5, 6) == dense.origin());
123
124 // Check coordToOffset and offsetToCoord
125 1 size_t offset = 0;
126
2/2
✓ Branch 0 taken 17 times.
✓ Branch 1 taken 1 times.
18 for (openvdb::Coord P(bbox.min()); P[2] <= bbox.max()[2]; ++P[2]) {
127
2/2
✓ Branch 0 taken 221 times.
✓ Branch 1 taken 17 times.
238 for (P[1] = bbox.min()[1]; P[1] <= bbox.max()[1]; ++P[1]) {
128
2/2
✓ Branch 0 taken 6630 times.
✓ Branch 1 taken 221 times.
6851 for (P[0] = bbox.min()[0]; P[0] <= bbox.max()[0]; ++P[0]) {
129 //std::cerr << "offset = " << offset << " P = " << P << std::endl;
130
2/16
✓ Branch 2 taken 6630 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 6630 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
6630 EXPECT_EQ(offset, dense.coordToOffset(P));
131
2/16
✓ Branch 1 taken 6630 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6630 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.
6630 EXPECT_EQ(P - dense.origin(), dense.offsetToLocalCoord(offset));
132
2/16
✓ Branch 1 taken 6630 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6630 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.
6630 EXPECT_EQ(P, dense.offsetToCoord(offset));
133 6630 ++offset;
134 }
135 }
136 }
137
138 // Check Dense::valueCount
139 1 const int size = static_cast<int>(dense.valueCount());
140
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(30*13*17, size);
141
142 // Check Dense::fill(float) and Dense::getValue(size_t)
143 1 const float v = 0.234f;
144 1 dense.fill(v);
145
2/2
✓ Branch 0 taken 6630 times.
✓ Branch 1 taken 1 times.
6631 for (int i=0; i<size; ++i) {
146
2/16
✓ Branch 1 taken 6630 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6630 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.
6630 EXPECT_NEAR(v, dense.getValue(i),/*tolerance=*/0.0001);
147 }
148
149 // Check Dense::data() and Dense::getValue(Coord, float)
150 float* a = dense.data();
151 int s = size;
152
4/18
✓ Branch 0 taken 6630 times.
✓ Branch 1 taken 1 times.
✓ Branch 3 taken 6630 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 6630 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
6631 while(s--) EXPECT_NEAR(v, *a++, /*tolerance=*/0.0001);
153
154
2/2
✓ Branch 0 taken 17 times.
✓ Branch 1 taken 1 times.
18 for (openvdb::Coord P(bbox.min()); P[2] <= bbox.max()[2]; ++P[2]) {
155
2/2
✓ Branch 0 taken 221 times.
✓ Branch 1 taken 17 times.
238 for (P[1] = bbox.min()[1]; P[1] <= bbox.max()[1]; ++P[1]) {
156
2/2
✓ Branch 0 taken 6630 times.
✓ Branch 1 taken 221 times.
6851 for (P[0] = bbox.min()[0]; P[0] <= bbox.max()[0]; ++P[0]) {
157
2/16
✓ Branch 1 taken 6630 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6630 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.
6630 EXPECT_NEAR(v, dense.getValue(P), /*tolerance=*/0.0001);
158 }
159 }
160 }
161
162 // Check Dense::setValue(Coord, float)
163 const openvdb::Coord C(-30, 3,12);
164 const float v1 = 3.45f;
165 dense.setValue(C, v1);
166
2/2
✓ Branch 0 taken 17 times.
✓ Branch 1 taken 1 times.
18 for (openvdb::Coord P(bbox.min()); P[2] <= bbox.max()[2]; ++P[2]) {
167
2/2
✓ Branch 0 taken 221 times.
✓ Branch 1 taken 17 times.
238 for (P[1] = bbox.min()[1]; P[1] <= bbox.max()[1]; ++P[1]) {
168
2/2
✓ Branch 0 taken 6630 times.
✓ Branch 1 taken 221 times.
6851 for (P[0] = bbox.min()[0]; P[0] <= bbox.max()[0]; ++P[0]) {
169
4/18
✓ Branch 0 taken 221 times.
✓ Branch 1 taken 6409 times.
✓ Branch 3 taken 6630 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 6630 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
6851 EXPECT_NEAR(P==C ? v1 : v, dense.getValue(P),
170 /*tolerance=*/0.0001);
171 }
172 }
173 }
174
175 // Check Dense::setValue(size_t, size_t, size_t, float)
176 dense.setValue(C, v);
177 const openvdb::Coord L(1,2,3), C1 = bbox.min() + L;
178 dense.setValue(L[0], L[1], L[2], v1);
179
2/2
✓ Branch 0 taken 17 times.
✓ Branch 1 taken 1 times.
18 for (openvdb::Coord P(bbox.min()); P[2] <= bbox.max()[2]; ++P[2]) {
180
2/2
✓ Branch 0 taken 221 times.
✓ Branch 1 taken 17 times.
238 for (P[1] = bbox.min()[1]; P[1] <= bbox.max()[1]; ++P[1]) {
181
2/2
✓ Branch 0 taken 6630 times.
✓ Branch 1 taken 221 times.
6851 for (P[0] = bbox.min()[0]; P[0] <= bbox.max()[0]; ++P[0]) {
182
4/18
✓ Branch 0 taken 221 times.
✓ Branch 1 taken 6409 times.
✓ Branch 3 taken 6630 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 6630 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
6851 EXPECT_NEAR(P==C1 ? v1 : v, dense.getValue(P),
183 /*tolerance=*/0.0001);
184 }
185 }
186 }
187
188 1 }
189
190
191 // The check is so slow that we're going to multi-thread it :)
192 template <typename TreeT,
193 typename DenseT = openvdb::tools::Dense<typename TreeT::ValueType,
194 openvdb::tools::LayoutZYX> >
195 class CheckDense
196 {
197 public:
198 typedef typename TreeT::ValueType ValueT;
199
200 2 CheckDense() : mTree(NULL), mDense(NULL)
201 {
202 EXPECT_TRUE(DenseT::memoryLayout() == openvdb::tools::LayoutZYX ||
203 DenseT::memoryLayout() == openvdb::tools::LayoutXYZ );
204 }
205
206 void check(const TreeT& tree, const DenseT& dense)
207 {
208 6 mTree = &tree;
209 6 mDense = &dense;
210
6/12
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
6 tbb::parallel_for(dense.bbox(), *this);
211 6 }
212 2154 void operator()(const openvdb::CoordBBox& bbox) const
213 {
214 2154 openvdb::tree::ValueAccessor<const TreeT> acc(*mTree);
215
216 if (DenseT::memoryLayout() == openvdb::tools::LayoutZYX) {//resolved at compiletime
217
2/2
✓ Branch 0 taken 5167 times.
✓ Branch 1 taken 504 times.
11342 for (openvdb::Coord P(bbox.min()); P[0] <= bbox.max()[0]; ++P[0]) {
218
2/2
✓ Branch 0 taken 49450 times.
✓ Branch 1 taken 5167 times.
109234 for (P[1] = bbox.min()[1]; P[1] <= bbox.max()[1]; ++P[1]) {
219
2/2
✓ Branch 0 taken 352947 times.
✓ Branch 1 taken 49450 times.
804794 for (P[2] = bbox.min()[2]; P[2] <= bbox.max()[2]; ++P[2]) {
220
3/18
✓ Branch 2 taken 352947 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 352947 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 352947 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
705894 EXPECT_NEAR(acc.getValue(P), mDense->getValue(P),
221 /*tolerance=*/0.0001);
222 }
223 }
224 }
225 } else {
226
2/2
✓ Branch 0 taken 3870 times.
✓ Branch 1 taken 573 times.
8886 for (openvdb::Coord P(bbox.min()); P[2] <= bbox.max()[2]; ++P[2]) {
227
2/2
✓ Branch 0 taken 35076 times.
✓ Branch 1 taken 3870 times.
77892 for (P[1] = bbox.min()[1]; P[1] <= bbox.max()[1]; ++P[1]) {
228
2/2
✓ Branch 0 taken 352947 times.
✓ Branch 1 taken 35076 times.
776046 for (P[0] = bbox.min()[0]; P[0] <= bbox.max()[0]; ++P[0]) {
229
3/18
✓ Branch 2 taken 352947 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 352947 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 352947 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
705894 EXPECT_NEAR(acc.getValue(P), mDense->getValue(P),
230 /*tolerance=*/0.0001);
231 }
232 }
233 }
234 }
235 2154 }
236 private:
237 const TreeT* mTree;
238 const DenseT* mDense;
239 };// CheckDense
240
241 template <openvdb::tools::MemoryLayout Layout>
242 void
243 4 TestDense::testCopy()
244 {
245 using namespace openvdb;
246
247 //std::cerr << "\nTesting testCopy with "
248 // << (Layout == tools::LayoutXYZ ? "XYZ" : "ZYX") << " memory layout"
249 // << std::endl;
250
251 typedef tools::Dense<float, Layout> DenseT;
252 CheckDense<FloatTree, DenseT> checkDense;
253 4 const float radius = 10.0f, tolerance = 0.00001f;
254 const Vec3f center(0.0f);
255 // decrease the voxelSize to test larger grids
256 #ifdef BENCHMARK_TEST
257 const float voxelSize = 0.05f, width = 5.0f;
258 #else
259 4 const float voxelSize = 0.5f, width = 5.0f;
260 #endif
261
262 // Create a VDB containing a level set of a sphere
263 4 FloatGrid::Ptr grid =
264 tools::createLevelSetSphere<FloatGrid>(radius, center, voxelSize, width);
265 FloatTree& tree0 = grid->tree();
266
267 // Create an empty dense grid
268
2/6
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
4 DenseT dense(grid->evalActiveVoxelBoundingBox());
269 #ifdef BENCHMARK_TEST
270 std::cerr << "\nBBox = " << grid->evalActiveVoxelBoundingBox() << std::endl;
271 #endif
272
273 {//check Dense::fill
274 4 dense.fill(voxelSize);
275 #ifndef BENCHMARK_TEST
276
1/4
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
8 checkDense.check(FloatTree(voxelSize), dense);
277 #endif
278 }
279
280 {// parallel convert to dense
281 #ifdef BENCHMARK_TEST
282 util::CpuTimer ts;
283 ts.start("CopyToDense");
284 #endif
285
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tools::copyToDense(*grid, dense);
286 #ifdef BENCHMARK_TEST
287 ts.stop();
288 #else
289 checkDense.check(tree0, dense);
290 #endif
291 }
292
293 {// Parallel create from dense
294 #ifdef BENCHMARK_TEST
295 util::CpuTimer ts;
296 ts.start("CopyFromDense");
297 #endif
298 8 FloatTree tree1(tree0.background());
299
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tools::copyFromDense(dense, tree1, tolerance);
300 #ifdef BENCHMARK_TEST
301 ts.stop();
302 #else
303 checkDense.check(tree1, dense);
304 #endif
305 }
306 4 }
307
308 template <openvdb::tools::MemoryLayout Layout>
309 void
310 4 TestDense::testCopyBool()
311 {
312 using namespace openvdb;
313
314 //std::cerr << "\nTesting testCopyBool with "
315 // << (Layout == tools::LayoutXYZ ? "XYZ" : "ZYX") << " memory layout"
316 // << std::endl;
317
318 const Coord bmin(-1), bmax(8);
319 const CoordBBox bbox(bmin, bmax);
320
321
1/2
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
4 BoolGrid::Ptr grid = createGrid<BoolGrid>(false);
322 BoolGrid::ConstAccessor acc = grid->getConstAccessor();
323
324 typedef openvdb::tools::Dense<bool, Layout> DenseT;
325
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 DenseT dense(bbox);
326 4 dense.fill(false);
327
328 // Start with sparse and dense grids both filled with false.
329 Coord xyz;
330 int &x = xyz[0], &y = xyz[1], &z = xyz[2];
331
2/2
✓ Branch 0 taken 20 times.
✓ Branch 1 taken 2 times.
44 for (x = bmin.x(); x <= bmax.x(); ++x) {
332
2/2
✓ Branch 0 taken 200 times.
✓ Branch 1 taken 20 times.
440 for (y = bmin.y(); y <= bmax.y(); ++y) {
333
2/2
✓ Branch 0 taken 2000 times.
✓ Branch 1 taken 200 times.
4400 for (z = bmin.z(); z <= bmax.z(); ++z) {
334
2/16
✓ Branch 1 taken 2000 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2000 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.
4000 EXPECT_EQ(false, dense.getValue(xyz));
335
2/16
✓ Branch 2 taken 2000 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2000 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
4000 EXPECT_EQ(false, acc.getValue(xyz));
336 }
337 }
338 }
339
340 // Fill the dense grid with true.
341 4 dense.fill(true);
342 // Copy the contents of the dense grid to the sparse grid.
343
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tools::copyFromDense(dense, *grid, /*tolerance=*/false);
344
345 // Verify that both sparse and dense grids are now filled with true.
346
2/2
✓ Branch 0 taken 20 times.
✓ Branch 1 taken 2 times.
44 for (x = bmin.x(); x <= bmax.x(); ++x) {
347
2/2
✓ Branch 0 taken 200 times.
✓ Branch 1 taken 20 times.
440 for (y = bmin.y(); y <= bmax.y(); ++y) {
348
2/2
✓ Branch 0 taken 2000 times.
✓ Branch 1 taken 200 times.
4400 for (z = bmin.z(); z <= bmax.z(); ++z) {
349
2/16
✓ Branch 1 taken 2000 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2000 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.
4000 EXPECT_EQ(true, dense.getValue(xyz));
350
2/16
✓ Branch 2 taken 2000 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2000 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
4000 EXPECT_EQ(true, acc.getValue(xyz));
351 }
352 }
353 }
354
355 // Fill the dense grid with false.
356
1/2
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
4 dense.fill(false);
357 // Copy the contents (= true) of the sparse grid to the dense grid.
358
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tools::copyToDense(*grid, dense);
359
360 // Verify that the dense grid is now filled with true.
361
2/2
✓ Branch 0 taken 20 times.
✓ Branch 1 taken 2 times.
44 for (x = bmin.x(); x <= bmax.x(); ++x) {
362
2/2
✓ Branch 0 taken 200 times.
✓ Branch 1 taken 20 times.
440 for (y = bmin.y(); y <= bmax.y(); ++y) {
363
2/2
✓ Branch 0 taken 2000 times.
✓ Branch 1 taken 200 times.
4400 for (z = bmin.z(); z <= bmax.z(); ++z) {
364
2/18
✓ Branch 1 taken 2000 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2000 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.
4000 EXPECT_EQ(true, dense.getValue(xyz));
365 }
366 }
367 }
368 4 }
369
370
371 // Test copying from a dense grid to a sparse grid with various bounding boxes.
372 template <openvdb::tools::MemoryLayout Layout>
373 void
374 4 TestDense::testCopyFromDenseWithOffset()
375 {
376 using namespace openvdb;
377
378 //std::cerr << "\nTesting testCopyFromDenseWithOffset with "
379 // << (Layout == tools::LayoutXYZ ? "XYZ" : "ZYX") << " memory layout"
380 // << std::endl;
381
382 typedef openvdb::tools::Dense<float, Layout> DenseT;
383
384 4 const int DIM = 20, COUNT = DIM * DIM * DIM;
385 4 const float FOREGROUND = 99.0f, BACKGROUND = 5000.0f;
386
387 4 const int OFFSET[] = { 1, -1, 1001, -1001 };
388
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 2 times.
20 for (int offsetIdx = 0; offsetIdx < 4; ++offsetIdx) {
389
390
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
16 const int offset = OFFSET[offsetIdx];
391 16 const CoordBBox bbox = CoordBBox::createCube(Coord(offset), DIM);
392
393
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
16 DenseT dense(bbox, FOREGROUND);
394
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 8 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.
16 EXPECT_EQ(bbox, dense.bbox());
395
396
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
32 FloatGrid grid(BACKGROUND);
397
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
16 tools::copyFromDense(dense, grid, /*tolerance=*/0.0);
398
399 const CoordBBox gridBBox = grid.evalActiveVoxelBoundingBox();
400
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 8 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.
16 EXPECT_EQ(bbox, gridBBox);
401
2/16
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 8 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.
16 EXPECT_EQ(COUNT, int(grid.activeVoxelCount()));
402
403 FloatGrid::ConstAccessor acc = grid.getConstAccessor();
404
2/2
✓ Branch 0 taken 152 times.
✓ Branch 1 taken 8 times.
320 for (int i = gridBBox.min()[0], ie = gridBBox.max()[0]; i < ie; ++i) {
405
2/2
✓ Branch 0 taken 2888 times.
✓ Branch 1 taken 152 times.
6080 for (int j = gridBBox.min()[1], je = gridBBox.max()[1]; j < je; ++j) {
406
2/2
✓ Branch 0 taken 54872 times.
✓ Branch 1 taken 2888 times.
115520 for (int k = gridBBox.min()[2], ke = gridBBox.max()[2]; k < ke; ++k) {
407 const Coord ijk(i, j, k);
408
3/18
✓ Branch 1 taken 54872 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 54872 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 54872 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 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
109744 EXPECT_NEAR(
409 FOREGROUND, acc.getValue(ijk), /*tolerance=*/0.0);
410
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 54872 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
109744 EXPECT_TRUE(acc.isValueOn(ijk));
411 }
412 }
413 }
414 }
415 4 }
416
417 template <openvdb::tools::MemoryLayout Layout>
418 void
419 4 TestDense::testDense2Sparse()
420 {
421 // The following test revealed a bug in v2.0.0b2
422 using namespace openvdb;
423
424 //std::cerr << "\nTesting testDense2Sparse with "
425 // << (Layout == tools::LayoutXYZ ? "XYZ" : "ZYX") << " memory layout"
426 // << std::endl;
427
428 typedef tools::Dense<float, Layout> DenseT;
429
430 // Test Domain Resolution
431 Int32 sizeX = 8, sizeY = 8, sizeZ = 9;
432
433 // Define a dense grid
434 4 DenseT dense(Coord(sizeX, sizeY, sizeZ));
435 4 const CoordBBox bboxD = dense.bbox();
436 // std::cerr << "\nDense bbox" << bboxD << std::endl;
437
438 // Verify that the CoordBBox is truely used as [inclusive, inclusive]
439
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(int(dense.valueCount()) == int(sizeX * sizeY * sizeZ));
440
441 // Fill the dense grid with constant value 1.
442 4 dense.fill(1.0f);
443
444 // Create two empty float grids
445
1/4
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
4 FloatGrid::Ptr gridS = FloatGrid::create(0.0f /*background*/);
446
1/4
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
4 FloatGrid::Ptr gridP = FloatGrid::create(0.0f /*background*/);
447
448 // Convert in serial and parallel modes
449
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tools::copyFromDense(dense, *gridS, /*tolerance*/0.0f, /*serial = */ true);
450
2/4
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
4 tools::copyFromDense(dense, *gridP, /*tolerance*/0.0f, /*serial = */ false);
451
452 float minS, maxS;
453 float minP, maxP;
454
455
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 math::MinMax<float> extrema = tools::minMax(gridS->tree());
456 4 minS = extrema.min();
457
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 maxS = extrema.max();
458
459
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 extrema = tools::minMax(gridP->tree());
460 4 minP = extrema.min();
461 4 maxP = extrema.max();
462
463 const float tolerance = 0.0001f;
464
465
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 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.
4 EXPECT_NEAR(minS, minP, tolerance);
466
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 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.
4 EXPECT_NEAR(maxS, maxP, tolerance);
467
3/18
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 2 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 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
4 EXPECT_EQ(gridP->activeVoxelCount(), Index64(sizeX * sizeY * sizeZ));
468
469 const FloatTree& treeS = gridS->tree();
470 const FloatTree& treeP = gridP->tree();
471
472 // Values in Test Domain are correct
473
2/2
✓ Branch 0 taken 16 times.
✓ Branch 1 taken 2 times.
36 for (Coord ijk(bboxD.min()); ijk[0] <= bboxD.max()[0]; ++ijk[0]) {
474
2/2
✓ Branch 0 taken 128 times.
✓ Branch 1 taken 16 times.
288 for (ijk[1] = bboxD.min()[1]; ijk[1] <= bboxD.max()[1]; ++ijk[1]) {
475
2/2
✓ Branch 0 taken 1152 times.
✓ Branch 1 taken 128 times.
2560 for (ijk[2] = bboxD.min()[2]; ijk[2] <= bboxD.max()[2]; ++ijk[2]) {
476
477 const float expected = bboxD.isInside(ijk) ? 1.f : 0.f;
478
2/16
✓ Branch 1 taken 1152 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1152 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.
2304 EXPECT_NEAR(expected, 1.f, tolerance);
479
480 const float& vS = treeS.getValue(ijk);
481 const float& vP = treeP.getValue(ijk);
482
483
2/16
✓ Branch 1 taken 1152 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1152 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.
2304 EXPECT_NEAR(expected, vS, tolerance);
484
2/16
✓ Branch 1 taken 1152 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1152 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.
2304 EXPECT_NEAR(expected, vP, tolerance);
485 }
486 }
487 }
488
489
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 CoordBBox bboxP = gridP->evalActiveVoxelBoundingBox();
490
2/4
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 const Index64 voxelCountP = gridP->activeVoxelCount();
491 //std::cerr << "\nParallel: bbox=" << bboxP << " voxels=" << voxelCountP << std::endl;
492
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( bboxP == bboxD );
493
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 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.
4 EXPECT_EQ( dense.valueCount(), voxelCountP);
494
495
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 CoordBBox bboxS = gridS->evalActiveVoxelBoundingBox();
496
2/4
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 const Index64 voxelCountS = gridS->activeVoxelCount();
497 //std::cerr << "\nSerial: bbox=" << bboxS << " voxels=" << voxelCountS << std::endl;
498
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( bboxS == bboxD );
499
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 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.
4 EXPECT_EQ( dense.valueCount(), voxelCountS);
500
501 // Topology
502 EXPECT_TRUE( bboxS.isInside(bboxS) );
503 EXPECT_TRUE( bboxP.isInside(bboxP) );
504
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( bboxS.isInside(bboxP) );
505
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( bboxP.isInside(bboxS) );
506
507 /// Check that the two grids agree
508
2/2
✓ Branch 0 taken 16 times.
✓ Branch 1 taken 2 times.
36 for (Coord ijk(bboxS.min()); ijk[0] <= bboxS.max()[0]; ++ijk[0]) {
509
2/2
✓ Branch 0 taken 128 times.
✓ Branch 1 taken 16 times.
288 for (ijk[1] = bboxS.min()[1]; ijk[1] <= bboxS.max()[1]; ++ijk[1]) {
510
2/2
✓ Branch 0 taken 1152 times.
✓ Branch 1 taken 128 times.
2560 for (ijk[2] = bboxS.min()[2]; ijk[2] <= bboxS.max()[2]; ++ijk[2]) {
511
512 const float& vS = treeS.getValue(ijk);
513 const float& vP = treeP.getValue(ijk);
514
515
2/16
✓ Branch 1 taken 1152 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1152 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.
2304 EXPECT_NEAR(vS, vP, tolerance);
516
517 // the value we should get based on the original domain
518 const float expected = bboxD.isInside(ijk) ? 1.f : 0.f;
519
520
2/16
✓ Branch 1 taken 1152 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1152 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.
2304 EXPECT_NEAR(expected, vP, tolerance);
521
2/16
✓ Branch 1 taken 1152 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1152 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.
2304 EXPECT_NEAR(expected, vS, tolerance);
522 }
523 }
524 }
525
526
527 // Verify the tree topology matches.
528
529
4/20
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 2 times.
✗ 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 21 not taken.
✗ Branch 22 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
4 EXPECT_EQ(gridP->activeVoxelCount(), gridS->activeVoxelCount());
530
3/22
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 2 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 not taken.
✗ Branch 23 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
8 EXPECT_TRUE(gridP->evalActiveVoxelBoundingBox() == gridS->evalActiveVoxelBoundingBox());
531
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(treeP.hasSameTopology(treeS) );
532
533 4 }
534
535 template <openvdb::tools::MemoryLayout Layout>
536 void
537 4 TestDense::testDense2Sparse2()
538 {
539 // The following tests copying a dense grid into a VDB tree with
540 // existing values outside the bbox of the dense grid.
541
542 using namespace openvdb;
543
544 //std::cerr << "\nTesting testDense2Sparse2 with "
545 // << (Layout == tools::LayoutXYZ ? "XYZ" : "ZYX") << " memory layout"
546 // << std::endl;
547
548 typedef tools::Dense<float, Layout> DenseT;
549
550 // Test Domain Resolution
551 const int sizeX = 8, sizeY = 8, sizeZ = 9;
552 const Coord magicVoxel(sizeX, sizeY, sizeZ);
553
554 // Define a dense grid
555 4 DenseT dense(Coord(sizeX, sizeY, sizeZ));
556 4 const CoordBBox bboxD = dense.bbox();
557 //std::cerr << "\nDense bbox" << bboxD << std::endl;
558
559 // Verify that the CoordBBox is truely used as [inclusive, inclusive]
560
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 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.
4 EXPECT_EQ(sizeX * sizeY * sizeZ, static_cast<int>(dense.valueCount()));
561
562 // Fill the dense grid with constant value 1.
563 4 dense.fill(1.0f);
564
565 // Create two empty float grids
566
1/4
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
4 FloatGrid::Ptr gridS = FloatGrid::create(0.0f /*background*/);
567
2/6
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
4 FloatGrid::Ptr gridP = FloatGrid::create(0.0f /*background*/);
568
2/4
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
8 gridS->tree().setValue(magicVoxel, 5.0f);
569
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 gridP->tree().setValue(magicVoxel, 5.0f);
570
571 // Convert in serial and parallel modes
572
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tools::copyFromDense(dense, *gridS, /*tolerance*/0.0f, /*serial = */ true);
573
2/4
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
4 tools::copyFromDense(dense, *gridP, /*tolerance*/0.0f, /*serial = */ false);
574
575 float minS, maxS;
576 float minP, maxP;
577
578
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 math::MinMax<float> extrema = tools::minMax(gridS->tree());
579 4 minS = extrema.min();
580
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 maxS = extrema.max();
581
582
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 extrema = tools::minMax(gridP->tree());
583 4 minP = extrema.min();
584 4 maxP = extrema.max();
585
586 const float tolerance = 0.0001f;
587
588
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 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.
4 EXPECT_NEAR(1.0f, minP, tolerance);
589
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 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.
4 EXPECT_NEAR(1.0f, minS, tolerance);
590
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 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.
4 EXPECT_NEAR(5.0f, maxP, tolerance);
591
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 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.
4 EXPECT_NEAR(5.0f, maxS, tolerance);
592
3/18
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 2 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 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
4 EXPECT_EQ(gridP->activeVoxelCount(), Index64(1 + sizeX * sizeY * sizeZ));
593
594 const FloatTree& treeS = gridS->tree();
595 const FloatTree& treeP = gridP->tree();
596
597 // Values in Test Domain are correct
598
2/2
✓ Branch 0 taken 16 times.
✓ Branch 1 taken 2 times.
36 for (Coord ijk(bboxD.min()); ijk[0] <= bboxD.max()[0]; ++ijk[0]) {
599
2/2
✓ Branch 0 taken 128 times.
✓ Branch 1 taken 16 times.
288 for (ijk[1] = bboxD.min()[1]; ijk[1] <= bboxD.max()[1]; ++ijk[1]) {
600
2/2
✓ Branch 0 taken 1152 times.
✓ Branch 1 taken 128 times.
2560 for (ijk[2] = bboxD.min()[2]; ijk[2] <= bboxD.max()[2]; ++ijk[2]) {
601
602 const float expected = bboxD.isInside(ijk) ? 1.0f : 0.0f;
603
2/16
✓ Branch 1 taken 1152 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1152 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.
2304 EXPECT_NEAR(expected, 1.0f, tolerance);
604
605 const float& vS = treeS.getValue(ijk);
606 const float& vP = treeP.getValue(ijk);
607
608
2/16
✓ Branch 1 taken 1152 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1152 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.
2304 EXPECT_NEAR(expected, vS, tolerance);
609
2/16
✓ Branch 1 taken 1152 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1152 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.
2304 EXPECT_NEAR(expected, vP, tolerance);
610 }
611 }
612 }
613
614
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 CoordBBox bboxP = gridP->evalActiveVoxelBoundingBox();
615
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 const Index64 voxelCountP = gridP->activeVoxelCount();
616 //std::cerr << "\nParallel: bbox=" << bboxP << " voxels=" << voxelCountP << std::endl;
617
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( bboxP != bboxD );
618
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( bboxP == CoordBBox(Coord(0,0,0), magicVoxel) );
619
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 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.
4 EXPECT_EQ( dense.valueCount()+1, voxelCountP);
620
621
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 CoordBBox bboxS = gridS->evalActiveVoxelBoundingBox();
622
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 const Index64 voxelCountS = gridS->activeVoxelCount();
623 //std::cerr << "\nSerial: bbox=" << bboxS << " voxels=" << voxelCountS << std::endl;
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( bboxS != bboxD );
625
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( bboxS == CoordBBox(Coord(0,0,0), magicVoxel) );
626
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 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.
4 EXPECT_EQ( dense.valueCount()+1, voxelCountS);
627
628 // Topology
629 EXPECT_TRUE( bboxS.isInside(bboxS) );
630 EXPECT_TRUE( bboxP.isInside(bboxP) );
631
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( bboxS.isInside(bboxP) );
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( bboxP.isInside(bboxS) );
633
634 /// Check that the two grids agree
635
2/2
✓ Branch 0 taken 18 times.
✓ Branch 1 taken 2 times.
40 for (Coord ijk(bboxS.min()); ijk[0] <= bboxS.max()[0]; ++ijk[0]) {
636
2/2
✓ Branch 0 taken 162 times.
✓ Branch 1 taken 18 times.
360 for (ijk[1] = bboxS.min()[1]; ijk[1] <= bboxS.max()[1]; ++ijk[1]) {
637
2/2
✓ Branch 0 taken 1620 times.
✓ Branch 1 taken 162 times.
3564 for (ijk[2] = bboxS.min()[2]; ijk[2] <= bboxS.max()[2]; ++ijk[2]) {
638
639 const float& vS = treeS.getValue(ijk);
640 const float& vP = treeP.getValue(ijk);
641
642
2/16
✓ Branch 1 taken 1620 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1620 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.
3240 EXPECT_NEAR(vS, vP, tolerance);
643
644 // the value we should get based on the original domain
645 const float expected = bboxD.isInside(ijk) ? 1.0f
646 : ijk == magicVoxel ? 5.0f : 0.0f;
647
648
2/16
✓ Branch 1 taken 1620 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1620 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.
3240 EXPECT_NEAR(expected, vP, tolerance);
649
2/16
✓ Branch 1 taken 1620 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1620 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.
3240 EXPECT_NEAR(expected, vS, tolerance);
650 }
651 }
652 }
653
654 // Verify the tree topology matches.
655
656
4/20
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 2 times.
✗ 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 21 not taken.
✗ Branch 22 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
4 EXPECT_EQ(gridP->activeVoxelCount(), gridS->activeVoxelCount());
657
3/22
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 2 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 not taken.
✗ Branch 23 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
8 EXPECT_TRUE(gridP->evalActiveVoxelBoundingBox() == gridS->evalActiveVoxelBoundingBox());
658
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(treeP.hasSameTopology(treeS) );
659
660 4 }
661
662 template <openvdb::tools::MemoryLayout Layout>
663 void
664
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
4 TestDense::testInvalidBBox()
665 {
666 using namespace openvdb;
667
668 //std::cerr << "\nTesting testInvalidBBox with "
669 // << (Layout == tools::LayoutXYZ ? "XYZ" : "ZYX") << " memory layout"
670 // << std::endl;
671
672 typedef tools::Dense<float, Layout> DenseT;
673
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
4 const CoordBBox badBBox(Coord(1, 1, 1), Coord(-1, 2, 2));
674
675
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(badBBox.empty());
676
3/14
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
8 EXPECT_THROW(DenseT dense(badBBox), ValueError);
677 4 }
678
679 template <openvdb::tools::MemoryLayout Layout>
680 void
681 4 TestDense::testDense2Sparse2Dense()
682 {
683 using namespace openvdb;
684
685 //std::cerr << "\nTesting testDense2Sparse2Dense with "
686 // << (Layout == tools::LayoutXYZ ? "XYZ" : "ZYX") << " memory layout"
687 // << std::endl;
688
689 typedef tools::Dense<float, Layout> DenseT;
690
691 4 const CoordBBox bboxBig(Coord(-12, 7, -32), Coord(12, 14, -15));
692 4 const CoordBBox bboxSmall(Coord(-10, 8, -31), Coord(10, 12, -20));
693
694
695 // A larger bbox
696 4 CoordBBox bboxBigger = bboxBig;
697
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 bboxBigger.expand(Coord(10));
698
699
700 // Small is in big
701
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(bboxBig.isInside(bboxSmall));
702
703 // Big is in Bigger
704
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(bboxBigger.isInside(bboxBig));
705
706 // Construct a small dense grid
707 4 DenseT denseSmall(bboxSmall, 0.f);
708 {
709 // insert non-const values
710 4 const int n = static_cast<int>(denseSmall.valueCount());
711 float* d = denseSmall.data();
712
2/2
✓ Branch 0 taken 2520 times.
✓ Branch 1 taken 2 times.
5044 for (int i = 0; i < n; ++i) { d[i] = static_cast<float>(i); }
713 }
714 // Construct large dense grid
715
1/4
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
4 DenseT denseBig(bboxBig, 0.f);
716 {
717 // insert non-const values
718 4 const int n = static_cast<int>(denseBig.valueCount());
719 float* d = denseBig.data();
720
2/2
✓ Branch 0 taken 7200 times.
✓ Branch 1 taken 2 times.
14404 for (int i = 0; i < n; ++i) { d[i] = static_cast<float>(i); }
721 }
722
723 // Make a sparse grid to copy this data into
724
1/4
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
4 FloatGrid::Ptr grid = FloatGrid::create(3.3f /*background*/);
725
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tools::copyFromDense(denseBig, *grid, /*tolerance*/0.0f, /*serial = */ true);
726
2/4
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
4 tools::copyFromDense(denseSmall, *grid, /*tolerance*/0.0f, /*serial = */ false);
727
728 const FloatTree& tree = grid->tree();
729 //
730
3/20
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
4 EXPECT_EQ(bboxBig.volume(), grid->activeVoxelCount());
731
732 // iterate over the Bigger
733
2/2
✓ Branch 0 taken 50 times.
✓ Branch 1 taken 2 times.
104 for (Coord ijk(bboxBigger.min()); ijk[0] <= bboxBigger.max()[0]; ++ijk[0]) {
734
2/2
✓ Branch 0 taken 400 times.
✓ Branch 1 taken 50 times.
900 for (ijk[1] = bboxBigger.min()[1]; ijk[1] <= bboxBigger.max()[1]; ++ijk[1]) {
735
2/2
✓ Branch 0 taken 17200 times.
✓ Branch 1 taken 400 times.
35200 for (ijk[2] = bboxBigger.min()[2]; ijk[2] <= bboxBigger.max()[2]; ++ijk[2]) {
736
737 float expected = 3.3f;
738 if (bboxSmall.isInside(ijk)) {
739 5040 expected = denseSmall.getValue(ijk);
740 } else if (bboxBig.isInside(ijk)) {
741 9360 expected = denseBig.getValue(ijk);
742 }
743
744 const float& value = tree.getValue(ijk);
745
746
2/16
✓ Branch 1 taken 17200 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 17200 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.
34400 EXPECT_NEAR(expected, value, 0.0001);
747
748 }
749 }
750 }
751
752 // Convert to Dense in small bbox
753 {
754
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 DenseT denseSmall2(bboxSmall);
755
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tools::copyToDense(*grid, denseSmall2, true /* serial */);
756
757 // iterate over the Bigger
758
2/2
✓ Branch 0 taken 42 times.
✓ Branch 1 taken 2 times.
88 for (Coord ijk(bboxSmall.min()); ijk[0] <= bboxSmall.max()[0]; ++ijk[0]) {
759
2/2
✓ Branch 0 taken 210 times.
✓ Branch 1 taken 42 times.
504 for (ijk[1] = bboxSmall.min()[1]; ijk[1] <= bboxSmall.max()[1]; ++ijk[1]) {
760
2/2
✓ Branch 0 taken 2520 times.
✓ Branch 1 taken 210 times.
5460 for (ijk[2] = bboxSmall.min()[2]; ijk[2] <= bboxSmall.max()[2]; ++ijk[2]) {
761
762 const float& expected = denseSmall.getValue(ijk);
763 const float& value = denseSmall2.getValue(ijk);
764
2/16
✓ Branch 1 taken 2520 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2520 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.
5040 EXPECT_NEAR(expected, value, 0.0001);
765 }
766 }
767 }
768 }
769 // Convert to Dense in large bbox
770 {
771
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 DenseT denseBig2(bboxBig);
772
773
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tools::copyToDense(*grid, denseBig2, false /* serial */);
774 // iterate over the Bigger
775
2/2
✓ Branch 0 taken 50 times.
✓ Branch 1 taken 2 times.
104 for (Coord ijk(bboxBig.min()); ijk[0] <= bboxBig.max()[0]; ++ijk[0]) {
776
2/2
✓ Branch 0 taken 400 times.
✓ Branch 1 taken 50 times.
900 for (ijk[1] = bboxBig.min()[1]; ijk[1] <= bboxBig.max()[1]; ++ijk[1]) {
777
2/2
✓ Branch 0 taken 7200 times.
✓ Branch 1 taken 400 times.
15200 for (ijk[2] = bboxBig.min()[2]; ijk[2] <= bboxBig.max()[2]; ++ijk[2]) {
778
779 float expected = -1.f; // should never be this
780 if (bboxSmall.isInside(ijk)) {
781 5040 expected = denseSmall.getValue(ijk);
782 } else if (bboxBig.isInside(ijk)) {
783 9360 expected = denseBig.getValue(ijk);
784 }
785 const float& value = denseBig2.getValue(ijk);
786
2/16
✓ Branch 1 taken 7200 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 7200 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.
14400 EXPECT_NEAR(expected, value, 0.0001);
787 }
788 }
789 }
790 }
791 4 }
792
793
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestDense, testCopyZYX) { this->testCopy<openvdb::tools::LayoutZYX>(); }
794
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestDense, testCopyXYZ) { this->testCopy<openvdb::tools::LayoutXYZ>(); }
795
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestDense, testCopyBoolZYX) { this->testCopyBool<openvdb::tools::LayoutZYX>(); }
796
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestDense, testCopyBoolXYZ) { this->testCopyBool<openvdb::tools::LayoutXYZ>(); }
797
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestDense, testCopyFromDenseWithOffsetZYX) { this->testCopyFromDenseWithOffset<openvdb::tools::LayoutZYX>(); }
798
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestDense, testCopyFromDenseWithOffsetXYZ) { this->testCopyFromDenseWithOffset<openvdb::tools::LayoutXYZ>(); }
799
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestDense, testDense2SparseZYX) { this->testDense2Sparse<openvdb::tools::LayoutZYX>(); }
800
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestDense, testDense2SparseXYZ) { this->testDense2Sparse<openvdb::tools::LayoutXYZ>(); }
801
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestDense, testDense2Sparse2ZYX) { this->testDense2Sparse2<openvdb::tools::LayoutZYX>(); }
802
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestDense, testDense2Sparse2XYZ) { this->testDense2Sparse2<openvdb::tools::LayoutXYZ>(); }
803
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestDense, testInvalidBBoxZYX) { this->testInvalidBBox<openvdb::tools::LayoutZYX>(); }
804
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestDense, testInvalidBBoxXYZ) { this->testInvalidBBox<openvdb::tools::LayoutXYZ>(); }
805
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestDense, testDense2Sparse2DenseZYX) { this->testDense2Sparse2Dense<openvdb::tools::LayoutZYX>(); }
806
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestDense, testDense2Sparse2DenseXYZ) { this->testDense2Sparse2Dense<openvdb::tools::LayoutXYZ>(); }
807
808 #undef BENCHMARK_TEST
809