GCC Code Coverage Report


Directory: ./
File: openvdb/openvdb/unittest/TestPointAdvect.cc
Date: 2022-07-25 17:40:05
Exec Total Coverage
Lines: 192 192 100.0%
Functions: 4 4 100.0%
Branches: 330 804 41.0%

Line Branch Exec Source
1 // Copyright Contributors to the OpenVDB Project
2 // SPDX-License-Identifier: MPL-2.0
3
4 #include <openvdb/points/PointAttribute.h>
5 #include <openvdb/points/PointDataGrid.h>
6 #include <openvdb/points/PointConversion.h>
7 #include <openvdb/points/PointScatter.h>
8 #include <openvdb/points/PointAdvect.h>
9 #include <openvdb/tools/LevelSetSphere.h>
10 #include <openvdb/tools/Composite.h> // csgDifference
11 #include <openvdb/tools/MeshToVolume.h> // createLevelSetBox
12 #include <openvdb/openvdb.h>
13 #include <openvdb/Types.h>
14
15 #include <gtest/gtest.h>
16 #include "util.h"
17 #include <string>
18 #include <vector>
19
20 using namespace openvdb;
21 using namespace openvdb::points;
22
23 2 class TestPointAdvect: public ::testing::Test
24 {
25 public:
26
27 2 void SetUp() override { openvdb::initialize(); }
28 2 void TearDown() override { openvdb::uninitialize(); }
29 }; // class TestPointAdvect
30
31
32 ////////////////////////////////////////
33
34
35
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestPointAdvect, testAdvect)
36 {
37 // generate four points
38
39 const float voxelSize = 1.0f;
40 std::vector<Vec3s> positions = {
41 {5, 2, 3},
42 {2, 4, 1},
43 {50, 5, 1},
44 {3, 20, 1},
45
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 };
46
47 const PointAttributeVector<Vec3s> pointList(positions);
48
49
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 math::Transform::Ptr pointTransform(math::Transform::createLinearTransform(voxelSize));
50
51 auto pointIndexGrid = tools::createPointIndexGrid<tools::PointIndexGrid>(
52
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 pointList, *pointTransform);
53
54 auto points = createPointDataGrid<NullCodec, PointDataGrid>(
55
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 *pointIndexGrid, pointList, *pointTransform);
56
57 std::vector<int> id;
58
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 id.push_back(0);
59
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 id.push_back(1);
60
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 id.push_back(2);
61
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 id.push_back(3);
62
63
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 auto idAttributeType = TypedAttributeArray<int>::attributeType();
64
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.
2 appendAttribute(points->tree(), "id", idAttributeType);
65
66 // create a wrapper around the id vector
67 PointAttributeVector<int> idWrapper(id);
68
69
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 populateAttribute<PointDataTree, tools::PointIndexTree, PointAttributeVector<int>>(
70 points->tree(), pointIndexGrid->tree(), "id", idWrapper);
71
72 // create "test" group which only contains third point
73
74
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 appendGroup(points->tree(), "test");
75
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 std::vector<short> groups(positions.size(), 0);
76 1 groups[2] = 1;
77
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 setGroup(points->tree(), pointIndexGrid->tree(), groups, "test");
78
79 // create "test2" group which contains second and third point
80
81
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.
2 appendGroup(points->tree(), "test2");
82 1 groups[1] = 1;
83
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 setGroup(points->tree(), pointIndexGrid->tree(), groups, "test2");
84
85 const Vec3s tolerance(1e-3f);
86
87 // advect by velocity using all integration orders
88
89
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1 times.
6 for (Index integrationOrder = 0; integrationOrder < 5; integrationOrder++) {
90 Vec3s velocityBackground(1.0, 2.0, 3.0);
91 double timeStep = 1.0;
92 int steps = 1;
93
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 auto velocity = Vec3SGrid::create(velocityBackground); // grid with background value only
94
95
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 auto pointsToAdvect = points->deepCopy();
96 const auto& transform = pointsToAdvect->transform();
97
98
2/6
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
5 advectPoints(*pointsToAdvect, *velocity, integrationOrder, timeStep, steps);
99
100
2/2
✓ Branch 0 taken 15 times.
✓ Branch 1 taken 5 times.
20 for (auto leaf = pointsToAdvect->tree().beginLeaf(); leaf; ++leaf) {
101
3/6
✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 15 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 15 times.
✗ Branch 8 not taken.
60 AttributeHandle<Vec3s> positionHandle(leaf->constAttributeArray("P"));
102
3/6
✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 15 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 15 times.
✗ Branch 8 not taken.
60 AttributeHandle<int> idHandle(leaf->constAttributeArray("id"));
103
4/6
✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 20 times.
✓ Branch 4 taken 15 times.
✓ Branch 6 taken 20 times.
✗ Branch 7 not taken.
70 for (auto iter = leaf->beginIndexOn(); iter; ++iter) {
104
1/2
✓ Branch 2 taken 20 times.
✗ Branch 3 not taken.
20 int theId = idHandle.get(*iter);
105 20 Vec3s position = transform.indexToWorld(
106
2/4
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 20 times.
✗ Branch 6 not taken.
20 positionHandle.get(*iter) + iter.getCoord().asVec3d());
107
2/2
✓ Branch 0 taken 16 times.
✓ Branch 1 taken 4 times.
20 Vec3s expectedPosition(positions[theId]);
108
2/2
✓ Branch 0 taken 16 times.
✓ Branch 1 taken 4 times.
20 if (integrationOrder > 0) expectedPosition += velocityBackground;
109
2/18
✓ Branch 0 taken 20 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 20 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
40 EXPECT_TRUE(math::isApproxEqual(position, expectedPosition, tolerance));
110 }
111 }
112 }
113
114 // invalid advection scheme
115
116
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 auto zeroVelocityGrid = Vec3SGrid::create(Vec3s(0));
117
5/24
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✓ Branch 20 taken 1 times.
✗ Branch 21 not taken.
✓ Branch 24 taken 1 times.
✗ Branch 25 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
1 EXPECT_THROW(advectPoints(*points, *zeroVelocityGrid, 5, 1.0, 1), ValueError);
118
119 { // advect varying dt and steps
120 Vec3s velocityBackground(1.0, 2.0, 3.0);
121 Index integrationOrder = 4;
122 double timeStep = 0.1;
123 int steps = 100;
124
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto velocity = Vec3SGrid::create(velocityBackground); // grid with background value only
125
126
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto pointsToAdvect = points->deepCopy();
127 const auto& transform = pointsToAdvect->transform();
128
129
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 advectPoints(*pointsToAdvect, *velocity, integrationOrder, timeStep, steps);
130
131
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 times.
5 for (auto leaf = pointsToAdvect->tree().beginLeaf(); leaf; ++leaf) {
132
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 AttributeHandle<Vec3s> positionHandle(leaf->constAttributeArray("P"));
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.
16 AttributeHandle<int> idHandle(leaf->constAttributeArray("id"));
134
4/6
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
16 for (auto iter = leaf->beginIndexOn(); iter; ++iter) {
135
1/2
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 int theId = idHandle.get(*iter);
136 4 Vec3s position = transform.indexToWorld(
137
3/6
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
8 positionHandle.get(*iter) + iter.getCoord().asVec3d());
138
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 Vec3s expectedPosition(positions[theId] + velocityBackground * 10.0f);
139
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.
4 EXPECT_TRUE(math::isApproxEqual(position, expectedPosition, tolerance));
140 }
141 }
142 }
143
144 { // perform filtered advection
145 Vec3s velocityBackground(1.0, 2.0, 3.0);
146 Index integrationOrder = 4;
147 double timeStep = 1.0;
148 int steps = 1;
149
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto velocity = Vec3SGrid::create(velocityBackground); // grid with background value only
150
151 1 std::vector<std::string> advectIncludeGroups;
152 1 std::vector<std::string> advectExcludeGroups;
153 1 std::vector<std::string> includeGroups;
154 1 std::vector<std::string> excludeGroups;
155
156 { // only advect points in "test" group
157
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 advectIncludeGroups.push_back("test");
158
159 auto leaf = points->tree().cbeginLeaf();
160 MultiGroupFilter advectFilter(
161
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 advectIncludeGroups, advectExcludeGroups, leaf->attributeSet());
162
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 MultiGroupFilter filter(includeGroups, excludeGroups, leaf->attributeSet());
163
164
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto pointsToAdvect = points->deepCopy();
165 const auto& transform = pointsToAdvect->transform();
166
167
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 advectPoints(*pointsToAdvect, *velocity, integrationOrder, timeStep, steps,
168 advectFilter, filter);
169
170
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(Index64(4), pointCount(pointsToAdvect->tree()));
171
172
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1 times.
4 for (auto leafIter = pointsToAdvect->tree().beginLeaf(); leafIter; ++leafIter) {
173
3/6
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
12 AttributeHandle<Vec3s> positionHandle(leafIter->constAttributeArray("P"));
174
3/6
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
12 AttributeHandle<int> idHandle(leafIter->constAttributeArray("id"));
175
4/6
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 3 times.
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
14 for (auto iter = leafIter->beginIndexOn(); iter; ++iter) {
176
1/2
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 int theId = idHandle.get(*iter);
177 4 Vec3s position = transform.indexToWorld(
178
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
4 positionHandle.get(*iter) + iter.getCoord().asVec3d());
179
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
4 Vec3s expectedPosition(positions[theId]);
180
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
4 if (theId == 2) expectedPosition += velocityBackground;
181
2/18
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
8 EXPECT_TRUE(math::isApproxEqual(position, expectedPosition, tolerance));
182 }
183 }
184
185 advectIncludeGroups.clear();
186 }
187
188 { // only keep points in "test" group
189
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 includeGroups.push_back("test");
190
191 auto leaf = points->tree().cbeginLeaf();
192 MultiGroupFilter advectFilter(
193
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 advectIncludeGroups, advectExcludeGroups, leaf->attributeSet());
194
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 MultiGroupFilter filter(includeGroups, excludeGroups, leaf->attributeSet());
195
196
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto pointsToAdvect = points->deepCopy();
197 const auto& transform = pointsToAdvect->transform();
198
199
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 advectPoints(*pointsToAdvect, *velocity, integrationOrder, timeStep, steps,
200 advectFilter, filter);
201
202
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(Index64(1), pointCount(pointsToAdvect->tree()));
203
204
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
2 for (auto leafIter = pointsToAdvect->tree().beginLeaf(); leafIter; ++leafIter) {
205
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.
4 AttributeHandle<Vec3s> positionHandle(leafIter->constAttributeArray("P"));
206
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.
4 AttributeHandle<int> idHandle(leafIter->constAttributeArray("id"));
207
4/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
4 for (auto iter = leafIter->beginIndexOn(); iter; ++iter) {
208
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 int theId = idHandle.get(*iter);
209 1 Vec3s position = transform.indexToWorld(
210
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 positionHandle.get(*iter) + iter.getCoord().asVec3d());
211
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 Vec3s expectedPosition(positions[theId]);
212 expectedPosition += velocityBackground;
213
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(math::isApproxEqual(position, expectedPosition, tolerance));
214 }
215 }
216
217 includeGroups.clear();
218 }
219
220 { // only advect points in "test2" group, delete points in "test" group
221
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 advectIncludeGroups.push_back("test2");
222
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 excludeGroups.push_back("test");
223
224 auto leaf = points->tree().cbeginLeaf();
225 MultiGroupFilter advectFilter(
226
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 advectIncludeGroups, advectExcludeGroups, leaf->attributeSet());
227
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 MultiGroupFilter filter(includeGroups, excludeGroups, leaf->attributeSet());
228
229
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto pointsToAdvect = points->deepCopy();
230 const auto& transform = pointsToAdvect->transform();
231
232
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 advectPoints(*pointsToAdvect, *velocity, integrationOrder, timeStep, steps,
233 advectFilter, filter);
234
235
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(Index64(3), pointCount(pointsToAdvect->tree()));
236
237
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
3 for (auto leafIter = pointsToAdvect->tree().beginLeaf(); leafIter; ++leafIter) {
238
3/6
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
8 AttributeHandle<Vec3s> positionHandle(leafIter->constAttributeArray("P"));
239
3/6
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
8 AttributeHandle<int> idHandle(leafIter->constAttributeArray("id"));
240
4/6
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3 times.
✓ Branch 4 taken 2 times.
✓ Branch 6 taken 3 times.
✗ Branch 7 not taken.
10 for (auto iter = leafIter->beginIndexOn(); iter; ++iter) {
241
1/2
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
3 int theId = idHandle.get(*iter);
242 3 Vec3s position = transform.indexToWorld(
243
2/4
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 3 times.
✗ Branch 6 not taken.
3 positionHandle.get(*iter) + iter.getCoord().asVec3d());
244
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2 times.
3 Vec3s expectedPosition(positions[theId]);
245
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2 times.
3 if (theId == 1) expectedPosition += velocityBackground;
246
2/18
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 3 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
6 EXPECT_TRUE(math::isApproxEqual(position, expectedPosition, tolerance));
247 }
248 }
249
250 advectIncludeGroups.clear();
251 excludeGroups.clear();
252 }
253
254 { // advect all points, caching disabled
255
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto pointsToAdvect = points->deepCopy();
256 const auto& transform = pointsToAdvect->transform();
257
258 auto leaf = points->tree().cbeginLeaf();
259 MultiGroupFilter advectFilter(
260
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 advectIncludeGroups, advectExcludeGroups, leaf->attributeSet());
261
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 MultiGroupFilter filter(includeGroups, excludeGroups, leaf->attributeSet());
262
263
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 advectPoints(*pointsToAdvect, *velocity, integrationOrder, timeStep, steps,
264 advectFilter, filter, false);
265
266
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(Index64(4), pointCount(pointsToAdvect->tree()));
267
268
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1 times.
4 for (auto leafIter = pointsToAdvect->tree().beginLeaf(); leafIter; ++leafIter) {
269
3/6
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
12 AttributeHandle<Vec3s> positionHandle(leafIter->constAttributeArray("P"));
270
3/6
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
12 AttributeHandle<int> idHandle(leafIter->constAttributeArray("id"));
271
4/6
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 3 times.
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
14 for (auto iter = leafIter->beginIndexOn(); iter; ++iter) {
272
1/2
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 int theId = idHandle.get(*iter);
273 4 Vec3s position = transform.indexToWorld(
274
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
4 positionHandle.get(*iter) + iter.getCoord().asVec3d());
275
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 Vec3s expectedPosition(positions[theId]);
276 expectedPosition += velocityBackground;
277
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.
4 EXPECT_TRUE(math::isApproxEqual(position, expectedPosition, tolerance));
278 }
279 }
280 }
281
282 { // only advect points in "test2" group, delete points in "test" group, caching disabled
283
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 advectIncludeGroups.push_back("test2");
284
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 excludeGroups.push_back("test");
285
286 auto leaf = points->tree().cbeginLeaf();
287 MultiGroupFilter advectFilter(
288
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 advectIncludeGroups, advectExcludeGroups, leaf->attributeSet());
289
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 MultiGroupFilter filter(includeGroups, excludeGroups, leaf->attributeSet());
290
291
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto pointsToAdvect = points->deepCopy();
292 const auto& transform = pointsToAdvect->transform();
293
294
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 advectPoints(*pointsToAdvect, *velocity, integrationOrder, timeStep, steps,
295 advectFilter, filter, false);
296
297
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(Index64(3), pointCount(pointsToAdvect->tree()));
298
299
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
3 for (auto leafIter = pointsToAdvect->tree().beginLeaf(); leafIter; ++leafIter) {
300
3/6
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
8 AttributeHandle<Vec3s> positionHandle(leafIter->constAttributeArray("P"));
301
3/6
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
8 AttributeHandle<int> idHandle(leafIter->constAttributeArray("id"));
302
4/6
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3 times.
✓ Branch 4 taken 2 times.
✓ Branch 6 taken 3 times.
✗ Branch 7 not taken.
10 for (auto iter = leafIter->beginIndexOn(); iter; ++iter) {
303
1/2
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
3 int theId = idHandle.get(*iter);
304 3 Vec3s position = transform.indexToWorld(
305
2/4
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 3 times.
✗ Branch 6 not taken.
3 positionHandle.get(*iter) + iter.getCoord().asVec3d());
306
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2 times.
3 Vec3s expectedPosition(positions[theId]);
307
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2 times.
3 if (theId == 1) expectedPosition += velocityBackground;
308
2/18
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 3 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
6 EXPECT_TRUE(math::isApproxEqual(position, expectedPosition, tolerance));
309 }
310 }
311
312 advectIncludeGroups.clear();
313 excludeGroups.clear();
314 }
315 }
316 1 }
317
318
319
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestPointAdvect, testZalesaksDisk)
320 {
321 // advect a notched sphere known as Zalesak's disk in a rotational velocity field
322
323 // build the level set sphere
324
325 Vec3s center(0, 0, 0);
326 float radius = 10;
327 float voxelSize = 0.2f;
328
329 1 auto zalesak = tools::createLevelSetSphere<FloatGrid>(radius, center, voxelSize);
330
331 // create box for notch using width and depth relative to radius
332
333
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 const math::Transform::Ptr xform = math::Transform::createLinearTransform(voxelSize);
334
335 1 Vec3f min(center);
336 1 Vec3f max(center);
337 float notchWidth = 0.5f;
338 float notchDepth = 1.5f;
339
340 1 min.x() -= (radius * notchWidth) / 2;
341 1 min.y() -= (radius * (notchDepth - 1));
342 1 min.z() -= radius * 1.1f;
343
344 1 max.x() += (radius * notchWidth) / 2;
345 1 max.y() += radius * 1.1f;
346
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 max.z() += radius * 1.1f;
347
348 math::BBox<Vec3f> bbox(min, max);
349
350
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto notch = tools::createLevelSetBox<FloatGrid>(bbox, *xform);
351
352 // subtract notch from the sphere
353
354
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::csgDifference(*zalesak, *notch);
355
356 // scatter points inside the sphere
357
358
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto points = points::denseUniformPointScatter(*zalesak, /*pointsPerVoxel=*/8);
359
360 // append an integer "id" attribute
361
362
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 auto idAttributeType = TypedAttributeArray<int>::attributeType();
363
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.
2 appendAttribute(points->tree(), "id", idAttributeType);
364
365 // populate it in serial based on iteration order
366
367 int id = 0;
368
2/2
✓ Branch 0 taken 1127 times.
✓ Branch 1 taken 1 times.
1128 for (auto leaf = points->tree().beginLeaf(); leaf; ++leaf) {
369
4/8
✓ Branch 1 taken 1127 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1127 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1127 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1127 times.
✗ Branch 11 not taken.
2254 AttributeWriteHandle<int> handle(leaf->attributeArray("id"));
370
3/4
✓ Branch 1 taken 1127 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1913536 times.
✓ Branch 4 taken 1127 times.
1915790 for (auto iter = leaf->beginIndexOn(); iter; ++iter) {
371
2/4
✓ Branch 2 taken 1913536 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1913536 times.
✗ Branch 6 not taken.
1913536 handle.set(*iter, id++);
372 }
373 }
374
375 // copy grid into new grid for advecting
376
377
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto pointsToAdvect = points->deepCopy();
378
379 // populate a velocity grid that rotates in X
380
381
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
1 auto velocity = Vec3SGrid::create(Vec3s(0));
382
2/4
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
2 velocity->setTransform(xform);
383
384
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 CoordBBox activeBbox(zalesak->evalActiveVoxelBoundingBox());
385 activeBbox.expand(5);
386
387
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 velocity->denseFill(activeBbox, Vec3s(0));
388
389
2/2
✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 1 times.
4097 for (auto leaf = velocity->tree().beginLeaf(); leaf; ++leaf) {
390
2/2
✓ Branch 0 taken 1520875 times.
✓ Branch 1 taken 4096 times.
1524971 for (auto iter = leaf->beginValueOn(); iter; ++iter) {
391
2/4
✓ Branch 1 taken 1520875 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1520875 times.
✗ Branch 5 not taken.
3041750 Vec3s position = xform->indexToWorld(iter.getCoord().asVec3d());
392 Vec3s vel = (position.cross(Vec3s(0, 0, 1)) * 2.0f * M_PI) / 10.0f;
393
1/2
✓ Branch 1 taken 1520875 times.
✗ Branch 2 not taken.
1520875 iter.setValue(vel);
394 }
395 }
396
397 // extract original positions
398
399
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 const Index count = Index(pointCount(points->constTree()));
400
401
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 std::vector<Vec3f> preAdvectPositions(count, Vec3f(0));
402
403
2/2
✓ Branch 0 taken 1127 times.
✓ Branch 1 taken 1 times.
1128 for (auto leaf = points->constTree().cbeginLeaf(); leaf; ++leaf) {
404
3/6
✓ Branch 1 taken 1127 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1127 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1127 times.
✗ Branch 8 not taken.
4508 AttributeHandle<int> idHandle(leaf->constAttributeArray("id"));
405
3/6
✓ Branch 1 taken 1127 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1127 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1127 times.
✗ Branch 8 not taken.
4508 AttributeHandle<Vec3f> posHandle(leaf->constAttributeArray("P"));
406
4/6
✓ Branch 1 taken 1127 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1913536 times.
✓ Branch 4 taken 1127 times.
✓ Branch 6 taken 1913536 times.
✗ Branch 7 not taken.
3829326 for (auto iter = leaf->beginIndexOn(); iter; ++iter) {
407
3/6
✓ Branch 1 taken 1913536 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1913536 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1913536 times.
✗ Branch 9 not taken.
1913536 Vec3f position = posHandle.get(*iter) + iter.getCoord().asVec3d();
408
2/4
✓ Branch 2 taken 1913536 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1913536 times.
✗ Branch 6 not taken.
1913536 preAdvectPositions[idHandle.get(*iter)] = Vec3f(xform->indexToWorld(position));
409 }
410 }
411
412 // advect points a half revolution
413
414
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 points::advectPoints(*pointsToAdvect, *velocity, Index(4), 1.0, 5);
415
416 // extract new positions
417
418
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 std::vector<Vec3f> postAdvectPositions(count, Vec3f(0));
419
420
2/2
✓ Branch 0 taken 1170 times.
✓ Branch 1 taken 1 times.
1171 for (auto leaf = pointsToAdvect->constTree().cbeginLeaf(); leaf; ++leaf) {
421
3/6
✓ Branch 1 taken 1170 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1170 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1170 times.
✗ Branch 8 not taken.
4680 AttributeHandle<int> idHandle(leaf->constAttributeArray("id"));
422
3/6
✓ Branch 1 taken 1170 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1170 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1170 times.
✗ Branch 8 not taken.
4680 AttributeHandle<Vec3f> posHandle(leaf->constAttributeArray("P"));
423
4/6
✓ Branch 1 taken 1170 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1913536 times.
✓ Branch 4 taken 1170 times.
✓ Branch 6 taken 1913536 times.
✗ Branch 7 not taken.
3829412 for (auto iter = leaf->beginIndexOn(); iter; ++iter) {
424
3/6
✓ Branch 1 taken 1913536 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1913536 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1913536 times.
✗ Branch 9 not taken.
1913536 Vec3f position = posHandle.get(*iter) + iter.getCoord().asVec3d();
425
2/4
✓ Branch 2 taken 1913536 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1913536 times.
✗ Branch 6 not taken.
1913536 postAdvectPositions[idHandle.get(*iter)] = Vec3f(xform->indexToWorld(position));
426 }
427 }
428
429
2/2
✓ Branch 0 taken 1913536 times.
✓ Branch 1 taken 1 times.
1913537 for (Index i = 0; i < count; i++) {
430
3/18
✓ Branch 0 taken 4276 times.
✓ Branch 1 taken 1909260 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1913536 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
1917812 EXPECT_TRUE(!math::isApproxEqual(
431 preAdvectPositions[i], postAdvectPositions[i], Vec3f(0.1)));
432 }
433
434 // advect points another half revolution
435
436
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 points::advectPoints(*pointsToAdvect, *velocity, Index(4), 1.0, 5);
437
438
2/2
✓ Branch 0 taken 1178 times.
✓ Branch 1 taken 1 times.
1179 for (auto leaf = pointsToAdvect->constTree().cbeginLeaf(); leaf; ++leaf) {
439
3/6
✓ Branch 1 taken 1178 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1178 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1178 times.
✗ Branch 8 not taken.
4712 AttributeHandle<int> idHandle(leaf->constAttributeArray("id"));
440
3/6
✓ Branch 1 taken 1178 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1178 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1178 times.
✗ Branch 8 not taken.
4712 AttributeHandle<Vec3f> posHandle(leaf->constAttributeArray("P"));
441
4/6
✓ Branch 1 taken 1178 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1913536 times.
✓ Branch 4 taken 1178 times.
✓ Branch 6 taken 1913536 times.
✗ Branch 7 not taken.
3829428 for (auto iter = leaf->beginIndexOn(); iter; ++iter) {
442
3/6
✓ Branch 1 taken 1913536 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1913536 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1913536 times.
✗ Branch 9 not taken.
1913536 Vec3f position = posHandle.get(*iter) + iter.getCoord().asVec3d();
443
2/4
✓ Branch 2 taken 1913536 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1913536 times.
✗ Branch 6 not taken.
1913536 postAdvectPositions[idHandle.get(*iter)] = Vec3f(xform->indexToWorld(position));
444 }
445 }
446
447
2/2
✓ Branch 0 taken 1913536 times.
✓ Branch 1 taken 1 times.
1913537 for (Index i = 0; i < count; i++) {
448
2/18
✓ Branch 0 taken 1913536 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1913536 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
3827072 EXPECT_TRUE(math::isApproxEqual(
449 preAdvectPositions[i], postAdvectPositions[i], Vec3f(0.1)));
450 }
451 1 }
452