Line | Branch | Exec | Source |
---|---|---|---|
1 | // Copyright Contributors to the OpenVDB Project | ||
2 | // SPDX-License-Identifier: MPL-2.0 | ||
3 | |||
4 | #include <openvdb/Exceptions.h> | ||
5 | #include <openvdb/openvdb.h> | ||
6 | #include <gtest/gtest.h> | ||
7 | |||
8 | #include <cstdio> // for remove() | ||
9 | |||
10 | |||
11 | 4 | class TestGridIO: public ::testing::Test | |
12 | { | ||
13 | public: | ||
14 | typedef openvdb::tree::Tree< | ||
15 | openvdb::tree::RootNode< | ||
16 | openvdb::tree::InternalNode< | ||
17 | openvdb::tree::InternalNode< | ||
18 | openvdb::tree::InternalNode< | ||
19 | openvdb::tree::LeafNode<float, 2>, 3>, 4>, 5> > > | ||
20 | Float5432Tree; | ||
21 | typedef openvdb::Grid<Float5432Tree> Float5432Grid; | ||
22 | |||
23 | 4 | void SetUp() override { openvdb::initialize(); } | |
24 | 4 | void TearDown() override { openvdb::uninitialize(); } | |
25 | |||
26 | protected: | ||
27 | template<typename GridType> void readAllTest(); | ||
28 | }; | ||
29 | |||
30 | |||
31 | //////////////////////////////////////// | ||
32 | |||
33 | |||
34 | template<typename GridType> | ||
35 | void | ||
36 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
8 | TestGridIO::readAllTest() |
37 | { | ||
38 | using namespace openvdb; | ||
39 | |||
40 | typedef typename GridType::TreeType TreeType; | ||
41 | typedef typename TreeType::Ptr TreePtr; | ||
42 | typedef typename TreeType::ValueType ValueT; | ||
43 | typedef typename TreeType::NodeCIter NodeCIter; | ||
44 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | const ValueT zero = zeroVal<ValueT>(); |
45 | |||
46 | // For each level of the tree, compute a bit mask for use in converting | ||
47 | // global coordinates to node origins for nodes at that level. | ||
48 | // That is, node_origin = global_coordinates & mask[node_level]. | ||
49 | std::vector<Index> mask; | ||
50 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
8 | TreeType::getNodeLog2Dims(mask); |
51 | const size_t height = mask.size(); | ||
52 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 4 times.
|
42 | for (size_t i = 0; i < height; ++i) { |
53 | Index dim = 0; | ||
54 |
2/2✓ Branch 0 taken 45 times.
✓ Branch 1 taken 17 times.
|
124 | for (size_t j = i; j < height; ++j) dim += mask[j]; |
55 | 34 | mask[i] = ~((1 << dim) - 1); | |
56 | } | ||
57 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
8 | const Index childDim = 1 + ~(mask[0]); |
58 | |||
59 | // Choose sample coordinate pairs (coord0, coord1) and (coord0, coord2) | ||
60 | // that are guaranteed to lie in different children of the root node | ||
61 | // (because they are separated by more than the child node dimension). | ||
62 | const Coord | ||
63 | coord0(0, 0, 0), | ||
64 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
8 | coord1(int(1.1 * childDim), 0, 0), |
65 | coord2(0, int(1.1 * childDim), 0); | ||
66 | |||
67 | // Create trees. | ||
68 | TreePtr | ||
69 |
2/7✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
10 | tree1(new TreeType(zero + 1)), |
70 |
2/6✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
16 | tree2(new TreeType(zero + 2)); |
71 | |||
72 | // Set some values. | ||
73 |
2/4✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
|
16 | tree1->setValue(coord0, zero + 5); |
74 |
2/4✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
|
16 | tree1->setValue(coord1, zero + 6); |
75 |
2/4✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
|
16 | tree2->setValue(coord0, zero + 10); |
76 |
1/4✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
8 | tree2->setValue(coord2, zero + 11); |
77 | |||
78 | // Create grids with trees and assign transforms. | ||
79 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
8 | math::Transform::Ptr trans1(math::Transform::createLinearTransform(0.1)), |
80 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
8 | trans2(math::Transform::createLinearTransform(0.1)); |
81 |
4/12✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 4 times.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
24 | GridBase::Ptr grid1 = createGrid(tree1), grid2 = createGrid(tree2); |
82 |
2/4✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
|
16 | grid1->setTransform(trans1); |
83 |
2/4✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
|
16 | grid1->setName("density"); |
84 |
2/4✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
|
16 | grid2->setTransform(trans2); |
85 |
3/6✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
|
16 | grid2->setName("temperature"); |
86 | |||
87 | OPENVDB_NO_FP_EQUALITY_WARNING_BEGIN | ||
88 |
2/16✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 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.
|
8 | EXPECT_EQ(ValueT(zero + 5), tree1->getValue(coord0)); |
89 |
2/16✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 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.
|
8 | EXPECT_EQ(ValueT(zero + 6), tree1->getValue(coord1)); |
90 |
2/16✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 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.
|
8 | EXPECT_EQ(ValueT(zero + 10), tree2->getValue(coord0)); |
91 |
2/16✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 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.
|
8 | EXPECT_EQ(ValueT(zero + 11), tree2->getValue(coord2)); |
92 | OPENVDB_NO_FP_EQUALITY_WARNING_END | ||
93 | |||
94 | // count[d] is the number of nodes already visited at depth d. | ||
95 | // There should be exactly two nodes at each depth (apart from the root). | ||
96 |
1/4✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
8 | std::vector<int> count(height, 0); |
97 | |||
98 | // Verify that tree1 has correct node origins. | ||
99 |
2/2✓ Branch 0 taken 30 times.
✓ Branch 1 taken 4 times.
|
68 | for (NodeCIter iter = tree1->cbeginNode(); iter; ++iter) { |
100 | const Index depth = iter.getDepth(); | ||
101 | const Coord expected[2] = { | ||
102 |
1/2✓ Branch 1 taken 30 times.
✗ Branch 2 not taken.
|
60 | coord0 & mask[depth], // origin of the first node at this depth |
103 | 60 | coord1 & mask[depth] // origin of the second node at this depth | |
104 | }; | ||
105 |
3/18✓ Branch 1 taken 30 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 30 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 30 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.
|
60 | EXPECT_EQ(expected[count[depth]], iter.getCoord()); |
106 |
1/2✓ Branch 1 taken 30 times.
✗ Branch 2 not taken.
|
60 | ++count[depth]; |
107 | } | ||
108 | // Verify that tree2 has correct node origins. | ||
109 |
1/4✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
8 | count.assign(height, 0); // reset node counts |
110 |
2/2✓ Branch 0 taken 30 times.
✓ Branch 1 taken 4 times.
|
68 | for (NodeCIter iter = tree2->cbeginNode(); iter; ++iter) { |
111 | const Index depth = iter.getDepth(); | ||
112 |
1/2✓ Branch 1 taken 30 times.
✗ Branch 2 not taken.
|
60 | const Coord expected[2] = { coord0 & mask[depth], coord2 & mask[depth] }; |
113 |
3/18✓ Branch 1 taken 30 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 30 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 30 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.
|
60 | EXPECT_EQ(expected[count[depth]], iter.getCoord()); |
114 |
1/2✓ Branch 1 taken 30 times.
✗ Branch 2 not taken.
|
60 | ++count[depth]; |
115 | } | ||
116 | |||
117 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
8 | MetaMap::Ptr meta(new MetaMap); |
118 |
4/8✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 12 taken 4 times.
✗ Branch 13 not taken.
|
24 | meta->insertMeta("author", StringMetadata("Einstein")); |
119 |
2/6✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
8 | meta->insertMeta("year", Int32Metadata(2009)); |
120 | |||
121 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
8 | GridPtrVecPtr grids(new GridPtrVec); |
122 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
8 | grids->push_back(grid1); |
123 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
8 | grids->push_back(grid2); |
124 | |||
125 | // Write grids and metadata out to a file. | ||
126 | { | ||
127 |
3/6✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
|
16 | io::File vdbfile("something.vdb2"); |
128 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
8 | vdbfile.write(*grids, *meta); |
129 | } | ||
130 | meta.reset(); | ||
131 | grids.reset(); | ||
132 | |||
133 |
3/6✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
|
24 | io::File vdbfile("something.vdb2"); |
134 |
4/20✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 4 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 4 times.
✗ Branch 23 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
|
16 | EXPECT_THROW(vdbfile.getGrids(), openvdb::IoError); // file has not been opened |
135 | |||
136 | // Read the grids back in. | ||
137 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
8 | vdbfile.open(); |
138 |
2/18✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 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.
|
8 | EXPECT_TRUE(vdbfile.isOpen()); |
139 | |||
140 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
8 | grids = vdbfile.getGrids(); |
141 |
2/4✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
|
16 | meta = vdbfile.getMetadata(); |
142 | |||
143 | // Ensure we have the metadata. | ||
144 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 4 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.
|
8 | EXPECT_TRUE(meta.get() != NULL); |
145 |
2/16✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 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.
|
8 | EXPECT_EQ(2, int(meta->metaCount())); |
146 |
4/20✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 4 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
|
16 | EXPECT_EQ(std::string("Einstein"), meta->metaValue<std::string>("author")); |
147 |
4/20✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 4 times.
✗ 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 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
|
8 | EXPECT_EQ(2009, meta->metaValue<int32_t>("year")); |
148 | |||
149 | // Ensure we got both grids. | ||
150 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 4 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.
|
8 | EXPECT_TRUE(grids.get() != NULL); |
151 |
2/16✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 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.
|
8 | EXPECT_EQ(2, int(grids->size())); |
152 | |||
153 | grid1.reset(); | ||
154 |
3/6✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 4 times.
|
16 | grid1 = findGridByName(*grids, "density"); |
155 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 4 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.
|
8 | EXPECT_TRUE(grid1.get() != NULL); |
156 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
8 | TreePtr density = gridPtrCast<GridType>(grid1)->treePtr(); |
157 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 4 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.
|
8 | EXPECT_TRUE(density.get() != NULL); |
158 | |||
159 | grid2.reset(); | ||
160 |
3/6✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 4 times.
|
16 | grid2 = findGridByName(*grids, "temperature"); |
161 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 4 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.
|
8 | EXPECT_TRUE(grid2.get() != NULL); |
162 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
8 | TreePtr temperature = gridPtrCast<GridType>(grid2)->treePtr(); |
163 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 4 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.
|
8 | EXPECT_TRUE(temperature.get() != NULL); |
164 | |||
165 | OPENVDB_NO_FP_EQUALITY_WARNING_BEGIN | ||
166 |
2/16✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 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.
|
8 | EXPECT_EQ(ValueT(zero + 5), density->getValue(coord0)); |
167 |
2/16✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 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.
|
8 | EXPECT_EQ(ValueT(zero + 6), density->getValue(coord1)); |
168 |
2/16✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 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.
|
8 | EXPECT_EQ(ValueT(zero + 10), temperature->getValue(coord0)); |
169 |
2/16✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 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.
|
8 | EXPECT_EQ(ValueT(zero + 11), temperature->getValue(coord2)); |
170 | OPENVDB_NO_FP_EQUALITY_WARNING_END | ||
171 | |||
172 | // Check if we got the correct node origins. | ||
173 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
8 | count.assign(height, 0); |
174 |
2/2✓ Branch 0 taken 30 times.
✓ Branch 1 taken 4 times.
|
68 | for (NodeCIter iter = density->cbeginNode(); iter; ++iter) { |
175 | const Index depth = iter.getDepth(); | ||
176 |
1/2✓ Branch 1 taken 30 times.
✗ Branch 2 not taken.
|
60 | const Coord expected[2] = { coord0 & mask[depth], coord1 & mask[depth] }; |
177 |
3/18✓ Branch 1 taken 30 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 30 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 30 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.
|
60 | EXPECT_EQ(expected[count[depth]], iter.getCoord()); |
178 |
1/2✓ Branch 1 taken 30 times.
✗ Branch 2 not taken.
|
60 | ++count[depth]; |
179 | } | ||
180 |
1/4✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
8 | count.assign(height, 0); |
181 |
2/2✓ Branch 0 taken 30 times.
✓ Branch 1 taken 4 times.
|
68 | for (NodeCIter iter = temperature->cbeginNode(); iter; ++iter) { |
182 | const Index depth = iter.getDepth(); | ||
183 |
1/2✓ Branch 1 taken 30 times.
✗ Branch 2 not taken.
|
60 | const Coord expected[2] = { coord0 & mask[depth], coord2 & mask[depth] }; |
184 |
3/18✓ Branch 1 taken 30 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 30 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 30 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.
|
60 | EXPECT_EQ(expected[count[depth]], iter.getCoord()); |
185 |
1/2✓ Branch 1 taken 30 times.
✗ Branch 2 not taken.
|
60 | ++count[depth]; |
186 | } | ||
187 | |||
188 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
8 | vdbfile.close(); |
189 | |||
190 | 8 | ::remove("something.vdb2"); | |
191 | 8 | } | |
192 | |||
193 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | TEST_F(TestGridIO, testReadAllBool) { readAllTest<openvdb::BoolGrid>(); } |
194 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | TEST_F(TestGridIO, testReadAllFloat) { readAllTest<openvdb::FloatGrid>(); } |
195 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | TEST_F(TestGridIO, testReadAllVec3S) { readAllTest<openvdb::Vec3SGrid>(); } |
196 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | TEST_F(TestGridIO, testReadAllFloat5432) { Float5432Grid::registerGrid(); readAllTest<Float5432Grid>(); } |
197 |