Line | Branch | Exec | Source |
---|---|---|---|
1 | // Copyright Contributors to the OpenVDB Project | ||
2 | // SPDX-License-Identifier: MPL-2.0 | ||
3 | |||
4 | #include "gtest/gtest.h" | ||
5 | #include <openvdb/Types.h> | ||
6 | #include <openvdb/openvdb.h> | ||
7 | #include <openvdb/tools/GridOperators.h> | ||
8 | |||
9 | #define ASSERT_DOUBLES_EXACTLY_EQUAL(expected, actual) \ | ||
10 | EXPECT_NEAR((expected), (actual), /*tolerance=*/0.0); | ||
11 | |||
12 | namespace { | ||
13 | const int GRID_DIM = 10; | ||
14 | } | ||
15 | |||
16 | |||
17 | 7 | class TestDivergence: public ::testing::Test | |
18 | { | ||
19 | public: | ||
20 | 7 | void SetUp() override { openvdb::initialize(); } | |
21 | 7 | void TearDown() override { openvdb::uninitialize(); } | |
22 | }; | ||
23 | |||
24 | |||
25 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | TEST_F(TestDivergence, testDivergenceTool) |
26 | { | ||
27 | using namespace openvdb; | ||
28 | |||
29 | 1 | VectorGrid::Ptr inGrid = VectorGrid::create(); | |
30 | VectorTree& inTree = inGrid->tree(); | ||
31 |
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(inTree.empty()); |
32 | |||
33 | int dim = GRID_DIM; | ||
34 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 1 times.
|
21 | for (int x = -dim; x<dim; ++x) { |
35 |
2/2✓ Branch 0 taken 400 times.
✓ Branch 1 taken 20 times.
|
420 | for (int y = -dim; y<dim; ++y) { |
36 |
2/2✓ Branch 0 taken 8000 times.
✓ Branch 1 taken 400 times.
|
8400 | for (int z = -dim; z<dim; ++z) { |
37 | 8000 | inTree.setValue(Coord(x,y,z), | |
38 |
1/2✓ Branch 1 taken 8000 times.
✗ Branch 2 not taken.
|
16000 | VectorTree::ValueType(float(x), float(y), 0.f)); |
39 | } | ||
40 | } | ||
41 | } | ||
42 | |||
43 |
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(!inTree.empty()); |
44 |
3/20✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 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 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
|
1 | EXPECT_EQ(math::Pow3(2*dim), int(inTree.activeVoxelCount())); |
45 | |||
46 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | FloatGrid::Ptr divGrid = tools::divergence(*inGrid); |
47 |
3/20✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 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 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
|
1 | EXPECT_EQ(math::Pow3(2*dim), int(divGrid->activeVoxelCount())); |
48 | |||
49 | FloatGrid::ConstAccessor accessor = divGrid->getConstAccessor(); | ||
50 | --dim;//ignore boundary divergence | ||
51 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 1 times.
|
19 | for (int x = -dim; x<dim; ++x) { |
52 |
2/2✓ Branch 0 taken 324 times.
✓ Branch 1 taken 18 times.
|
342 | for (int y = -dim; y<dim; ++y) { |
53 |
2/2✓ Branch 0 taken 5832 times.
✓ Branch 1 taken 324 times.
|
6156 | for (int z = -dim; z<dim; ++z) { |
54 | Coord xyz(x,y,z); | ||
55 | 5832 | VectorTree::ValueType v = inTree.getValue(xyz); | |
56 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(x, v[0]); |
57 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(y, v[1]); |
58 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(0, v[2]); |
59 | |||
60 |
1/2✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
|
5832 | const float d = accessor.getValue(xyz); |
61 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
62 | } | ||
63 | } | ||
64 | } | ||
65 | 1 | } | |
66 | |||
67 | |||
68 | |||
69 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | TEST_F(TestDivergence, testDivergenceMaskedTool) |
70 | { | ||
71 | using namespace openvdb; | ||
72 | |||
73 | 1 | VectorGrid::Ptr inGrid = VectorGrid::create(); | |
74 | VectorTree& inTree = inGrid->tree(); | ||
75 |
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(inTree.empty()); |
76 | |||
77 | int dim = GRID_DIM; | ||
78 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 1 times.
|
21 | for (int x = -dim; x<dim; ++x) { |
79 |
2/2✓ Branch 0 taken 400 times.
✓ Branch 1 taken 20 times.
|
420 | for (int y = -dim; y<dim; ++y) { |
80 |
2/2✓ Branch 0 taken 8000 times.
✓ Branch 1 taken 400 times.
|
8400 | for (int z = -dim; z<dim; ++z) { |
81 | 8000 | inTree.setValue(Coord(x,y,z), | |
82 |
1/2✓ Branch 1 taken 8000 times.
✗ Branch 2 not taken.
|
16000 | VectorTree::ValueType(float(x), float(y), 0.f)); |
83 | } | ||
84 | } | ||
85 | } | ||
86 | |||
87 |
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(!inTree.empty()); |
88 |
3/18✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 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 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
|
1 | EXPECT_EQ(math::Pow3(2*dim), int(inTree.activeVoxelCount())); |
89 | |||
90 | /// maked region | ||
91 | 1 | openvdb::CoordBBox maskBBox(openvdb::Coord(0), openvdb::Coord(dim)); | |
92 |
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 | BoolGrid::Ptr maskGrid = BoolGrid::create(false); |
93 |
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.
|
2 | maskGrid->fill(maskBBox, true /*value*/, true /*activate*/); |
94 | |||
95 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | FloatGrid::Ptr divGrid = tools::divergence(*inGrid, *maskGrid); |
96 |
3/20✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 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 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
|
1 | EXPECT_EQ(math::Pow3(dim), int(divGrid->activeVoxelCount())); |
97 | |||
98 | FloatGrid::ConstAccessor accessor = divGrid->getConstAccessor(); | ||
99 | --dim;//ignore boundary divergence | ||
100 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 1 times.
|
19 | for (int x = -dim; x<dim; ++x) { |
101 |
2/2✓ Branch 0 taken 324 times.
✓ Branch 1 taken 18 times.
|
342 | for (int y = -dim; y<dim; ++y) { |
102 |
2/2✓ Branch 0 taken 5832 times.
✓ Branch 1 taken 324 times.
|
6156 | for (int z = -dim; z<dim; ++z) { |
103 | Coord xyz(x,y,z); | ||
104 | |||
105 | 5832 | VectorTree::ValueType v = inTree.getValue(xyz); | |
106 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(x, v[0]); |
107 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(y, v[1]); |
108 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(0, v[2]); |
109 | |||
110 |
3/4✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2916 times.
✓ Branch 4 taken 2916 times.
|
5832 | const float d = accessor.getValue(xyz); |
111 | if (maskBBox.isInside(xyz)) { | ||
112 |
2/16✓ Branch 1 taken 729 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 729 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.
|
729 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
113 | } else { | ||
114 |
2/16✓ Branch 1 taken 5103 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5103 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.
|
5103 | ASSERT_DOUBLES_EXACTLY_EQUAL(0, d); |
115 | } | ||
116 | } | ||
117 | } | ||
118 | } | ||
119 | 1 | } | |
120 | |||
121 | |||
122 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | TEST_F(TestDivergence, testStaggeredDivergence) |
123 | { | ||
124 | // This test is slightly different than the one above for sanity | ||
125 | // checking purposes. | ||
126 | |||
127 | using namespace openvdb; | ||
128 | |||
129 | 1 | VectorGrid::Ptr inGrid = VectorGrid::create(); | |
130 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | inGrid->setGridClass( GRID_STAGGERED ); |
131 | VectorTree& inTree = inGrid->tree(); | ||
132 |
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(inTree.empty()); |
133 | |||
134 | int dim = GRID_DIM; | ||
135 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 1 times.
|
21 | for (int x = -dim; x<dim; ++x) { |
136 |
2/2✓ Branch 0 taken 400 times.
✓ Branch 1 taken 20 times.
|
420 | for (int y = -dim; y<dim; ++y) { |
137 |
2/2✓ Branch 0 taken 8000 times.
✓ Branch 1 taken 400 times.
|
8400 | for (int z = -dim; z<dim; ++z) { |
138 | 8000 | inTree.setValue(Coord(x,y,z), | |
139 |
1/2✓ Branch 1 taken 8000 times.
✗ Branch 2 not taken.
|
16000 | VectorTree::ValueType(float(x), float(y), float(z))); |
140 | } | ||
141 | } | ||
142 | } | ||
143 | |||
144 |
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(!inTree.empty()); |
145 |
3/20✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 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 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
|
1 | EXPECT_EQ(math::Pow3(2*dim), int(inTree.activeVoxelCount())); |
146 | |||
147 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | FloatGrid::Ptr divGrid = tools::divergence(*inGrid); |
148 |
3/20✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 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 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
|
1 | EXPECT_EQ(math::Pow3(2*dim), int(divGrid->activeVoxelCount())); |
149 | |||
150 | FloatGrid::ConstAccessor accessor = divGrid->getConstAccessor(); | ||
151 | --dim;//ignore boundary divergence | ||
152 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 1 times.
|
19 | for (int x = -dim; x<dim; ++x) { |
153 |
2/2✓ Branch 0 taken 324 times.
✓ Branch 1 taken 18 times.
|
342 | for (int y = -dim; y<dim; ++y) { |
154 |
2/2✓ Branch 0 taken 5832 times.
✓ Branch 1 taken 324 times.
|
6156 | for (int z = -dim; z<dim; ++z) { |
155 | Coord xyz(x,y,z); | ||
156 | 5832 | VectorTree::ValueType v = inTree.getValue(xyz); | |
157 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(x, v[0]); |
158 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(y, v[1]); |
159 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(z, v[2]); |
160 | |||
161 |
1/2✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
|
5832 | const float d = accessor.getValue(xyz); |
162 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(3, d); |
163 | } | ||
164 | } | ||
165 | } | ||
166 | 1 | } | |
167 | |||
168 | |||
169 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | TEST_F(TestDivergence, testISDivergence) |
170 | { | ||
171 | using namespace openvdb; | ||
172 | |||
173 | typedef VectorGrid::ConstAccessor Accessor; | ||
174 | |||
175 | 1 | VectorGrid::Ptr inGrid = VectorGrid::create(); | |
176 | VectorTree& inTree = inGrid->tree(); | ||
177 |
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(inTree.empty()); |
178 | |||
179 | int dim = GRID_DIM; | ||
180 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 1 times.
|
21 | for (int x = -dim; x<dim; ++x) { |
181 |
2/2✓ Branch 0 taken 400 times.
✓ Branch 1 taken 20 times.
|
420 | for (int y = -dim; y<dim; ++y) { |
182 |
2/2✓ Branch 0 taken 8000 times.
✓ Branch 1 taken 400 times.
|
8400 | for (int z = -dim; z<dim; ++z) { |
183 | 8000 | inTree.setValue(Coord(x,y,z), | |
184 |
1/4✓ Branch 1 taken 8000 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
16000 | VectorTree::ValueType(float(x), float(y), 0.f)); |
185 | } | ||
186 | } | ||
187 | } | ||
188 | |||
189 | Accessor inAccessor = inGrid->getConstAccessor(); | ||
190 |
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(!inTree.empty()); |
191 |
3/20✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 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 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
|
1 | EXPECT_EQ(math::Pow3(2*dim), int(inTree.activeVoxelCount())); |
192 | |||
193 | --dim;//ignore boundary divergence | ||
194 | // test index space divergence | ||
195 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 1 times.
|
19 | for (int x = -dim; x<dim; ++x) { |
196 |
2/2✓ Branch 0 taken 324 times.
✓ Branch 1 taken 18 times.
|
342 | for (int y = -dim; y<dim; ++y) { |
197 |
2/2✓ Branch 0 taken 5832 times.
✓ Branch 1 taken 324 times.
|
6156 | for (int z = -dim; z<dim; ++z) { |
198 | Coord xyz(x,y,z); | ||
199 | 5832 | VectorTree::ValueType v = inTree.getValue(xyz); | |
200 | |||
201 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(x, v[0]); |
202 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(y, v[1]); |
203 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(0, v[2]); |
204 | float d; | ||
205 |
1/2✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
|
5832 | d = math::ISDivergence<math::CD_2ND>::result(inAccessor, xyz); |
206 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
207 | |||
208 |
1/2✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
|
5832 | d = math::ISDivergence<math::BD_1ST>::result(inAccessor, xyz); |
209 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
210 | |||
211 |
1/2✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
|
5832 | d = math::ISDivergence<math::FD_1ST>::result(inAccessor, xyz); |
212 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
213 | } | ||
214 | } | ||
215 | } | ||
216 | |||
217 | --dim;//ignore boundary divergence | ||
218 | // test index space divergence | ||
219 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 1 times.
|
17 | for (int x = -dim; x<dim; ++x) { |
220 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 16 times.
|
272 | for (int y = -dim; y<dim; ++y) { |
221 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 256 times.
|
4352 | for (int z = -dim; z<dim; ++z) { |
222 | Coord xyz(x,y,z); | ||
223 | 4096 | VectorTree::ValueType v = inTree.getValue(xyz); | |
224 | |||
225 |
2/16✓ Branch 1 taken 4096 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 4096 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.
|
4096 | ASSERT_DOUBLES_EXACTLY_EQUAL(x, v[0]); |
226 |
2/16✓ Branch 1 taken 4096 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 4096 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.
|
4096 | ASSERT_DOUBLES_EXACTLY_EQUAL(y, v[1]); |
227 |
2/16✓ Branch 1 taken 4096 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 4096 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.
|
4096 | ASSERT_DOUBLES_EXACTLY_EQUAL(0, v[2]); |
228 | float d; | ||
229 |
1/2✓ Branch 1 taken 4096 times.
✗ Branch 2 not taken.
|
4096 | d = math::ISDivergence<math::CD_4TH>::result(inAccessor, xyz); |
230 | |||
231 |
2/16✓ Branch 1 taken 4096 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 4096 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.
|
4096 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
232 |
1/2✓ Branch 1 taken 4096 times.
✗ Branch 2 not taken.
|
4096 | d = math::ISDivergence<math::FD_2ND>::result(inAccessor, xyz); |
233 | |||
234 |
2/16✓ Branch 1 taken 4096 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 4096 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.
|
4096 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
235 |
1/2✓ Branch 1 taken 4096 times.
✗ Branch 2 not taken.
|
4096 | d = math::ISDivergence<math::BD_2ND>::result(inAccessor, xyz); |
236 | |||
237 |
2/16✓ Branch 1 taken 4096 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 4096 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.
|
4096 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
238 | } | ||
239 | } | ||
240 | } | ||
241 | |||
242 | --dim;//ignore boundary divergence | ||
243 | // test index space divergence | ||
244 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 1 times.
|
15 | for (int x = -dim; x<dim; ++x) { |
245 |
2/2✓ Branch 0 taken 196 times.
✓ Branch 1 taken 14 times.
|
210 | for (int y = -dim; y<dim; ++y) { |
246 |
2/2✓ Branch 0 taken 2744 times.
✓ Branch 1 taken 196 times.
|
2940 | for (int z = -dim; z<dim; ++z) { |
247 | Coord xyz(x,y,z); | ||
248 | 2744 | VectorTree::ValueType v = inTree.getValue(xyz); | |
249 | |||
250 |
2/16✓ Branch 1 taken 2744 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2744 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.
|
2744 | ASSERT_DOUBLES_EXACTLY_EQUAL(x, v[0]); |
251 |
2/16✓ Branch 1 taken 2744 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2744 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.
|
2744 | ASSERT_DOUBLES_EXACTLY_EQUAL(y, v[1]); |
252 |
2/16✓ Branch 1 taken 2744 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2744 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.
|
2744 | ASSERT_DOUBLES_EXACTLY_EQUAL(0, v[2]); |
253 | float d; | ||
254 |
1/2✓ Branch 1 taken 2744 times.
✗ Branch 2 not taken.
|
2744 | d = math::ISDivergence<math::CD_6TH>::result(inAccessor, xyz); |
255 |
2/16✓ Branch 1 taken 2744 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2744 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.
|
2744 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
256 | |||
257 |
1/2✓ Branch 1 taken 2744 times.
✗ Branch 2 not taken.
|
2744 | d = math::ISDivergence<math::FD_3RD>::result(inAccessor, xyz); |
258 |
2/16✓ Branch 1 taken 2744 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2744 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.
|
2744 | EXPECT_NEAR(2, d, /*tolerance=*/0.00001); |
259 | |||
260 |
1/2✓ Branch 1 taken 2744 times.
✗ Branch 2 not taken.
|
2744 | d = math::ISDivergence<math::BD_3RD>::result(inAccessor, xyz); |
261 |
2/16✓ Branch 1 taken 2744 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2744 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.
|
2744 | EXPECT_NEAR(2, d, /*tolerance=*/0.00001); |
262 | } | ||
263 | } | ||
264 | } | ||
265 | 1 | } | |
266 | |||
267 | |||
268 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | TEST_F(TestDivergence, testISDivergenceStencil) |
269 | { | ||
270 | using namespace openvdb; | ||
271 | |||
272 | 1 | VectorGrid::Ptr inGrid = VectorGrid::create(); | |
273 | VectorTree& inTree = inGrid->tree(); | ||
274 |
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(inTree.empty()); |
275 | |||
276 | int dim = GRID_DIM; | ||
277 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 1 times.
|
21 | for (int x = -dim; x<dim; ++x) { |
278 |
2/2✓ Branch 0 taken 400 times.
✓ Branch 1 taken 20 times.
|
420 | for (int y = -dim; y<dim; ++y) { |
279 |
2/2✓ Branch 0 taken 8000 times.
✓ Branch 1 taken 400 times.
|
8400 | for (int z = -dim; z<dim; ++z) { |
280 | 8000 | inTree.setValue(Coord(x,y,z), | |
281 |
1/2✓ Branch 1 taken 8000 times.
✗ Branch 2 not taken.
|
16000 | VectorTree::ValueType(float(x), float(y), 0.f)); |
282 | } | ||
283 | } | ||
284 | } | ||
285 | |||
286 |
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(!inTree.empty()); |
287 |
3/20✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 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 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
|
1 | EXPECT_EQ(math::Pow3(2*dim), int(inTree.activeVoxelCount())); |
288 | math::SevenPointStencil<VectorGrid> sevenpt(*inGrid); | ||
289 | math::ThirteenPointStencil<VectorGrid> thirteenpt(*inGrid); | ||
290 | math::NineteenPointStencil<VectorGrid> nineteenpt(*inGrid); | ||
291 | |||
292 | --dim;//ignore boundary divergence | ||
293 | // test index space divergence | ||
294 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 1 times.
|
19 | for (int x = -dim; x<dim; ++x) { |
295 |
2/2✓ Branch 0 taken 324 times.
✓ Branch 1 taken 18 times.
|
342 | for (int y = -dim; y<dim; ++y) { |
296 |
2/2✓ Branch 0 taken 5832 times.
✓ Branch 1 taken 324 times.
|
6156 | for (int z = -dim; z<dim; ++z) { |
297 | Coord xyz(x,y,z); | ||
298 | 5832 | VectorTree::ValueType v = inTree.getValue(xyz); | |
299 | |||
300 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(x, v[0]); |
301 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(y, v[1]); |
302 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(0, v[2]); |
303 |
1/2✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
|
5832 | sevenpt.moveTo(xyz); |
304 | float d; | ||
305 | d = math::ISDivergence<math::CD_2ND>::result(sevenpt); | ||
306 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
307 | |||
308 | 5832 | d = math::ISDivergence<math::BD_1ST>::result(sevenpt); | |
309 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
310 | |||
311 | 5832 | d = math::ISDivergence<math::FD_1ST>::result(sevenpt); | |
312 |
1/14✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
313 | } | ||
314 | } | ||
315 | } | ||
316 | |||
317 | --dim;//ignore boundary divergence | ||
318 | // test index space divergence | ||
319 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 1 times.
|
17 | for (int x = -dim; x<dim; ++x) { |
320 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 16 times.
|
272 | for (int y = -dim; y<dim; ++y) { |
321 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 256 times.
|
4352 | for (int z = -dim; z<dim; ++z) { |
322 | Coord xyz(x,y,z); | ||
323 | 4096 | VectorTree::ValueType v = inTree.getValue(xyz); | |
324 | |||
325 |
2/16✓ Branch 1 taken 4096 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 4096 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.
|
4096 | ASSERT_DOUBLES_EXACTLY_EQUAL(x, v[0]); |
326 |
2/16✓ Branch 1 taken 4096 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 4096 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.
|
4096 | ASSERT_DOUBLES_EXACTLY_EQUAL(y, v[1]); |
327 |
2/16✓ Branch 1 taken 4096 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 4096 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.
|
4096 | ASSERT_DOUBLES_EXACTLY_EQUAL(0, v[2]); |
328 |
1/2✓ Branch 1 taken 4096 times.
✗ Branch 2 not taken.
|
4096 | thirteenpt.moveTo(xyz); |
329 | float d; | ||
330 | 4096 | d = math::ISDivergence<math::CD_4TH>::result(thirteenpt); | |
331 |
2/16✓ Branch 1 taken 4096 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 4096 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.
|
4096 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
332 | |||
333 | 4096 | d = math::ISDivergence<math::FD_2ND>::result(thirteenpt); | |
334 |
2/16✓ Branch 1 taken 4096 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 4096 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.
|
4096 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
335 | |||
336 | 4096 | d = math::ISDivergence<math::BD_2ND>::result(thirteenpt); | |
337 |
2/16✓ Branch 1 taken 4096 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 4096 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.
|
4096 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
338 | } | ||
339 | } | ||
340 | } | ||
341 | |||
342 | --dim;//ignore boundary divergence | ||
343 | // test index space divergence | ||
344 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 1 times.
|
15 | for (int x = -dim; x<dim; ++x) { |
345 |
2/2✓ Branch 0 taken 196 times.
✓ Branch 1 taken 14 times.
|
210 | for (int y = -dim; y<dim; ++y) { |
346 |
2/2✓ Branch 0 taken 2744 times.
✓ Branch 1 taken 196 times.
|
2940 | for (int z = -dim; z<dim; ++z) { |
347 | Coord xyz(x,y,z); | ||
348 | 2744 | VectorTree::ValueType v = inTree.getValue(xyz); | |
349 | |||
350 |
2/16✓ Branch 1 taken 2744 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2744 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.
|
2744 | ASSERT_DOUBLES_EXACTLY_EQUAL(x, v[0]); |
351 |
2/16✓ Branch 1 taken 2744 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2744 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.
|
2744 | ASSERT_DOUBLES_EXACTLY_EQUAL(y, v[1]); |
352 |
2/16✓ Branch 1 taken 2744 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2744 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.
|
2744 | ASSERT_DOUBLES_EXACTLY_EQUAL(0, v[2]); |
353 |
1/2✓ Branch 1 taken 2744 times.
✗ Branch 2 not taken.
|
2744 | nineteenpt.moveTo(xyz); |
354 | float d; | ||
355 | 2744 | d = math::ISDivergence<math::CD_6TH>::result(nineteenpt); | |
356 |
2/16✓ Branch 1 taken 2744 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2744 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.
|
2744 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
357 | |||
358 | 2744 | d = math::ISDivergence<math::FD_3RD>::result(nineteenpt); | |
359 |
2/16✓ Branch 1 taken 2744 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2744 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.
|
2744 | EXPECT_NEAR(2, d, /*tolerance=*/0.00001); |
360 | |||
361 | 2744 | d = math::ISDivergence<math::BD_3RD>::result(nineteenpt); | |
362 |
2/16✓ Branch 1 taken 2744 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2744 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.
|
2744 | EXPECT_NEAR(2, d, /*tolerance=*/0.00001); |
363 | } | ||
364 | } | ||
365 | } | ||
366 | 1 | } | |
367 | |||
368 | |||
369 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | TEST_F(TestDivergence, testWSDivergence) |
370 | { | ||
371 | using namespace openvdb; | ||
372 | |||
373 | typedef VectorGrid::ConstAccessor Accessor; | ||
374 | |||
375 | { // non-unit voxel size | ||
376 | double voxel_size = 0.5; | ||
377 | 1 | VectorGrid::Ptr inGrid = VectorGrid::create(); | |
378 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
2 | inGrid->setTransform(math::Transform::createLinearTransform(voxel_size)); |
379 | |||
380 | VectorTree& inTree = inGrid->tree(); | ||
381 |
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(inTree.empty()); |
382 | |||
383 | int dim = GRID_DIM; | ||
384 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 1 times.
|
21 | for (int x = -dim; x<dim; ++x) { |
385 |
2/2✓ Branch 0 taken 400 times.
✓ Branch 1 taken 20 times.
|
420 | for (int y = -dim; y<dim; ++y) { |
386 |
2/2✓ Branch 0 taken 8000 times.
✓ Branch 1 taken 400 times.
|
8400 | for (int z = -dim; z<dim; ++z) { |
387 |
1/2✓ Branch 1 taken 8000 times.
✗ Branch 2 not taken.
|
8000 | Vec3d location = inGrid->indexToWorld(Vec3d(x,y,z)); |
388 | 8000 | inTree.setValue(Coord(x,y,z), | |
389 |
1/4✓ Branch 1 taken 8000 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
16000 | VectorTree::ValueType(float(location.x()), float(location.y()), 0.f)); |
390 | } | ||
391 | } | ||
392 | } | ||
393 | |||
394 | Accessor inAccessor = inGrid->getConstAccessor(); | ||
395 |
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(!inTree.empty()); |
396 |
3/18✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 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 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
|
1 | EXPECT_EQ(math::Pow3(2*dim), int(inTree.activeVoxelCount())); |
397 | |||
398 | --dim;//ignore boundary divergence | ||
399 | |||
400 | // test with a map | ||
401 | // test with a map | ||
402 |
2/6✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
1 | math::AffineMap map(voxel_size*math::Mat3d::identity()); |
403 | math::UniformScaleMap uniform_map(voxel_size); | ||
404 |
0/2✗ Branch 0 not taken.
✗ Branch 1 not taken.
|
1 | math::UniformScaleTranslateMap uniform_translate_map(voxel_size, Vec3d(0,0,0)); |
405 | |||
406 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 1 times.
|
19 | for (int x = -dim; x<dim; ++x) { |
407 |
2/2✓ Branch 0 taken 324 times.
✓ Branch 1 taken 18 times.
|
342 | for (int y = -dim; y<dim; ++y) { |
408 |
2/2✓ Branch 0 taken 5832 times.
✓ Branch 1 taken 324 times.
|
6156 | for (int z = -dim; z<dim; ++z) { |
409 | openvdb::Coord xyz(x,y,z); | ||
410 | //openvdb::VectorTree::ValueType v = inTree.getValue(xyz); | ||
411 | //std::cout << "vec(" << xyz << ")=" << v << std::endl; | ||
412 | |||
413 | float d; | ||
414 |
1/2✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
|
5832 | d = math::Divergence<math::AffineMap, math::CD_2ND>::result( |
415 | map, inAccessor, xyz); | ||
416 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
417 | |||
418 |
1/2✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
|
5832 | d = math::Divergence<math::AffineMap, math::BD_1ST>::result( |
419 | map, inAccessor, xyz); | ||
420 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
421 | |||
422 |
1/2✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
|
5832 | d = math::Divergence<math::AffineMap, math::FD_1ST>::result( |
423 | map, inAccessor, xyz); | ||
424 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
425 | |||
426 | d = math::Divergence<math::UniformScaleMap, math::CD_2ND>::result( | ||
427 | uniform_map, inAccessor, xyz); | ||
428 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
429 | |||
430 | d = math::Divergence<math::UniformScaleMap, math::BD_1ST>::result( | ||
431 | uniform_map, inAccessor, xyz); | ||
432 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
433 | |||
434 | d = math::Divergence<math::UniformScaleMap, math::FD_1ST>::result( | ||
435 | uniform_map, inAccessor, xyz); | ||
436 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
437 | |||
438 | d = math::Divergence<math::UniformScaleTranslateMap, math::CD_2ND>::result( | ||
439 | uniform_translate_map, inAccessor, xyz); | ||
440 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
441 | |||
442 | d = math::Divergence<math::UniformScaleTranslateMap, math::BD_1ST>::result( | ||
443 | uniform_translate_map, inAccessor, xyz); | ||
444 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
445 | |||
446 | d = math::Divergence<math::UniformScaleTranslateMap, math::FD_1ST>::result( | ||
447 | uniform_translate_map, inAccessor, xyz); | ||
448 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
449 | } | ||
450 | } | ||
451 | } | ||
452 | } | ||
453 | |||
454 | { // non-uniform scaling and rotation | ||
455 | Vec3d voxel_sizes(0.25, 0.45, 0.75); | ||
456 | 1 | VectorGrid::Ptr inGrid = VectorGrid::create(); | |
457 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | math::MapBase::Ptr base_map( new math::ScaleMap(voxel_sizes)); |
458 | // apply rotation | ||
459 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | math::MapBase::Ptr rotated_map = base_map->preRotate(1.5, math::X_AXIS); |
460 |
3/6✓ 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.
|
3 | inGrid->setTransform(math::Transform::Ptr(new math::Transform(rotated_map))); |
461 | |||
462 | VectorTree& inTree = inGrid->tree(); | ||
463 |
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(inTree.empty()); |
464 | |||
465 | int dim = GRID_DIM; | ||
466 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 1 times.
|
21 | for (int x = -dim; x<dim; ++x) { |
467 |
2/2✓ Branch 0 taken 400 times.
✓ Branch 1 taken 20 times.
|
420 | for (int y = -dim; y<dim; ++y) { |
468 |
2/2✓ Branch 0 taken 8000 times.
✓ Branch 1 taken 400 times.
|
8400 | for (int z = -dim; z<dim; ++z) { |
469 |
1/2✓ Branch 1 taken 8000 times.
✗ Branch 2 not taken.
|
8000 | Vec3d location = inGrid->indexToWorld(Vec3d(x,y,z)); |
470 | 8000 | inTree.setValue(Coord(x,y,z), | |
471 |
1/4✓ Branch 1 taken 8000 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
16000 | VectorTree::ValueType(float(location.x()), float(location.y()), 0.f)); |
472 | } | ||
473 | } | ||
474 | } | ||
475 | |||
476 | Accessor inAccessor = inGrid->getConstAccessor(); | ||
477 |
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(!inTree.empty()); |
478 |
3/20✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 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 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
|
1 | EXPECT_EQ(math::Pow3(2*dim), int(inTree.activeVoxelCount())); |
479 | |||
480 | --dim;//ignore boundary divergence | ||
481 | |||
482 | // test with a map | ||
483 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | math::AffineMap::ConstPtr map = inGrid->transform().map<math::AffineMap>(); |
484 | |||
485 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 1 times.
|
19 | for (int x = -dim; x<dim; ++x) { |
486 |
2/2✓ Branch 0 taken 324 times.
✓ Branch 1 taken 18 times.
|
342 | for (int y = -dim; y<dim; ++y) { |
487 |
2/2✓ Branch 0 taken 5832 times.
✓ Branch 1 taken 324 times.
|
6156 | for (int z = -dim; z<dim; ++z) { |
488 | openvdb::Coord xyz(x,y,z); | ||
489 | //openvdb::VectorTree::ValueType v = inTree.getValue(xyz); | ||
490 | //std::cout << "vec(" << xyz << ")=" << v << std::endl; | ||
491 | |||
492 | float d; | ||
493 |
1/2✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
|
5832 | d = math::Divergence<math::AffineMap, math::CD_2ND>::result( |
494 | *map, inAccessor, xyz); | ||
495 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | EXPECT_NEAR(2.0, d, 0.01); |
496 | |||
497 |
1/2✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
|
5832 | d = math::Divergence<math::AffineMap, math::BD_1ST>::result( |
498 | *map, inAccessor, xyz); | ||
499 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | EXPECT_NEAR(2.0, d, 0.01); |
500 | |||
501 |
1/2✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
|
5832 | d = math::Divergence<math::AffineMap, math::FD_1ST>::result( |
502 | *map, inAccessor, xyz); | ||
503 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | EXPECT_NEAR(2.0, d, 0.01); |
504 | } | ||
505 | } | ||
506 | } | ||
507 | } | ||
508 | 1 | } | |
509 | |||
510 | |||
511 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | TEST_F(TestDivergence, testWSDivergenceStencil) |
512 | { | ||
513 | using namespace openvdb; | ||
514 | |||
515 | { // non-unit voxel size | ||
516 | double voxel_size = 0.5; | ||
517 | 1 | VectorGrid::Ptr inGrid = VectorGrid::create(); | |
518 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
2 | inGrid->setTransform(math::Transform::createLinearTransform(voxel_size)); |
519 | |||
520 | VectorTree& inTree = inGrid->tree(); | ||
521 |
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(inTree.empty()); |
522 | |||
523 | int dim = GRID_DIM; | ||
524 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 1 times.
|
21 | for (int x = -dim; x<dim; ++x) { |
525 |
2/2✓ Branch 0 taken 400 times.
✓ Branch 1 taken 20 times.
|
420 | for (int y = -dim; y<dim; ++y) { |
526 |
2/2✓ Branch 0 taken 8000 times.
✓ Branch 1 taken 400 times.
|
8400 | for (int z = -dim; z<dim; ++z) { |
527 |
1/2✓ Branch 1 taken 8000 times.
✗ Branch 2 not taken.
|
8000 | Vec3d location = inGrid->indexToWorld(Vec3d(x,y,z)); |
528 | 8000 | inTree.setValue(Coord(x,y,z), | |
529 |
1/2✓ Branch 1 taken 8000 times.
✗ Branch 2 not taken.
|
16000 | VectorTree::ValueType(float(location.x()), float(location.y()), 0.f)); |
530 | } | ||
531 | } | ||
532 | } | ||
533 | |||
534 |
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(!inTree.empty()); |
535 |
3/18✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 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 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
|
1 | EXPECT_EQ(math::Pow3(2*dim), int(inTree.activeVoxelCount())); |
536 | |||
537 | --dim;//ignore boundary divergence | ||
538 | |||
539 | // test with a map | ||
540 |
2/6✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
1 | math::AffineMap map(voxel_size*math::Mat3d::identity()); |
541 | math::UniformScaleMap uniform_map(voxel_size); | ||
542 |
1/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
1 | math::UniformScaleTranslateMap uniform_translate_map(voxel_size, Vec3d(0,0,0)); |
543 | |||
544 | math::SevenPointStencil<VectorGrid> sevenpt(*inGrid); | ||
545 | math::SecondOrderDenseStencil<VectorGrid> dense_2ndOrder(*inGrid); | ||
546 | |||
547 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 1 times.
|
19 | for (int x = -dim; x<dim; ++x) { |
548 |
2/2✓ Branch 0 taken 324 times.
✓ Branch 1 taken 18 times.
|
342 | for (int y = -dim; y<dim; ++y) { |
549 |
2/2✓ Branch 0 taken 5832 times.
✓ Branch 1 taken 324 times.
|
6156 | for (int z = -dim; z<dim; ++z) { |
550 | openvdb::Coord xyz(x,y,z); | ||
551 | //openvdb::VectorTree::ValueType v = inTree.getValue(xyz); | ||
552 | //std::cout << "vec(" << xyz << ")=" << v << std::endl; | ||
553 | float d; | ||
554 | |||
555 |
1/2✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
|
5832 | sevenpt.moveTo(xyz); |
556 |
1/2✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
|
5832 | dense_2ndOrder.moveTo(xyz); |
557 | |||
558 | 5832 | d = math::Divergence<math::AffineMap, math::CD_2ND>::result( | |
559 | map, dense_2ndOrder); | ||
560 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
561 | |||
562 | 5832 | d = math::Divergence<math::AffineMap, math::BD_1ST>::result( | |
563 | map, dense_2ndOrder); | ||
564 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
565 | |||
566 | 5832 | d = math::Divergence<math::AffineMap, math::FD_1ST>::result( | |
567 | map, dense_2ndOrder); | ||
568 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
569 | |||
570 | d = math::Divergence<math::UniformScaleMap, math::CD_2ND>::result( | ||
571 | uniform_map, sevenpt); | ||
572 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
573 | |||
574 | d = math::Divergence<math::UniformScaleMap, math::BD_1ST>::result( | ||
575 | uniform_map, sevenpt); | ||
576 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
577 | |||
578 | d = math::Divergence<math::UniformScaleMap, math::FD_1ST>::result( | ||
579 | uniform_map, sevenpt); | ||
580 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
581 | |||
582 | d = math::Divergence<math::UniformScaleTranslateMap, math::CD_2ND>::result( | ||
583 | uniform_translate_map, sevenpt); | ||
584 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
585 | |||
586 | d = math::Divergence<math::UniformScaleTranslateMap, math::BD_1ST>::result( | ||
587 | uniform_translate_map, sevenpt); | ||
588 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
589 | |||
590 | d = math::Divergence<math::UniformScaleTranslateMap, math::FD_1ST>::result( | ||
591 | uniform_translate_map, sevenpt); | ||
592 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | ASSERT_DOUBLES_EXACTLY_EQUAL(2, d); |
593 | } | ||
594 | } | ||
595 | } | ||
596 | } | ||
597 | |||
598 | { // non-uniform scaling and rotation | ||
599 | Vec3d voxel_sizes(0.25, 0.45, 0.75); | ||
600 | 1 | VectorGrid::Ptr inGrid = VectorGrid::create(); | |
601 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | math::MapBase::Ptr base_map( new math::ScaleMap(voxel_sizes)); |
602 | // apply rotation | ||
603 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | math::MapBase::Ptr rotated_map = base_map->preRotate(1.5, math::X_AXIS); |
604 |
3/6✓ 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.
|
3 | inGrid->setTransform(math::Transform::Ptr(new math::Transform(rotated_map))); |
605 | |||
606 | VectorTree& inTree = inGrid->tree(); | ||
607 |
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(inTree.empty()); |
608 | |||
609 | int dim = GRID_DIM; | ||
610 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 1 times.
|
21 | for (int x = -dim; x<dim; ++x) { |
611 |
2/2✓ Branch 0 taken 400 times.
✓ Branch 1 taken 20 times.
|
420 | for (int y = -dim; y<dim; ++y) { |
612 |
2/2✓ Branch 0 taken 8000 times.
✓ Branch 1 taken 400 times.
|
8400 | for (int z = -dim; z<dim; ++z) { |
613 |
1/2✓ Branch 1 taken 8000 times.
✗ Branch 2 not taken.
|
8000 | Vec3d location = inGrid->indexToWorld(Vec3d(x,y,z)); |
614 | 8000 | inTree.setValue(Coord(x,y,z), | |
615 |
1/2✓ Branch 1 taken 8000 times.
✗ Branch 2 not taken.
|
16000 | VectorTree::ValueType(float(location.x()), float(location.y()), 0.f)); |
616 | } | ||
617 | } | ||
618 | } | ||
619 | |||
620 | //Accessor inAccessor = inGrid->getConstAccessor(); | ||
621 |
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(!inTree.empty()); |
622 |
3/20✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 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 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
|
1 | EXPECT_EQ(math::Pow3(2*dim), int(inTree.activeVoxelCount())); |
623 | |||
624 | --dim;//ignore boundary divergence | ||
625 | |||
626 | // test with a map | ||
627 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | math::AffineMap::ConstPtr map = inGrid->transform().map<math::AffineMap>(); |
628 | math::SecondOrderDenseStencil<VectorGrid> dense_2ndOrder(*inGrid); | ||
629 | |||
630 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 1 times.
|
19 | for (int x = -dim; x<dim; ++x) { |
631 |
2/2✓ Branch 0 taken 324 times.
✓ Branch 1 taken 18 times.
|
342 | for (int y = -dim; y<dim; ++y) { |
632 |
2/2✓ Branch 0 taken 5832 times.
✓ Branch 1 taken 324 times.
|
6156 | for (int z = -dim; z<dim; ++z) { |
633 | openvdb::Coord xyz(x,y,z); | ||
634 |
1/2✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
|
5832 | dense_2ndOrder.moveTo(xyz); |
635 | |||
636 | float d; | ||
637 | 5832 | d = math::Divergence<math::AffineMap, math::CD_2ND>::result( | |
638 | *map, dense_2ndOrder); | ||
639 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | EXPECT_NEAR(2.0, d, 0.01); |
640 | |||
641 | 5832 | d = math::Divergence<math::AffineMap, math::BD_1ST>::result( | |
642 | *map, dense_2ndOrder); | ||
643 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | EXPECT_NEAR(2.0, d, 0.01); |
644 | |||
645 | 5832 | d = math::Divergence<math::AffineMap, math::FD_1ST>::result( | |
646 | *map, dense_2ndOrder); | ||
647 |
2/16✓ Branch 1 taken 5832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5832 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.
|
5832 | EXPECT_NEAR(2.0, d, 0.01); |
648 | } | ||
649 | } | ||
650 | } | ||
651 | } | ||
652 | 1 | } | |
653 |