GCC Code Coverage Report


Directory: ./
File: openvdb_ax/openvdb_ax/test/integration/CompareGrids.h
Date: 2022-07-25 17:40:05
Exec Total Coverage
Lines: 3 3 100.0%
Functions: 1 1 100.0%
Branches: 0 0 -%

Line Branch Exec Source
1 // Copyright Contributors to the OpenVDB Project
2 // SPDX-License-Identifier: MPL-2.0
3
4 /// @file test/integration/CompareGrids.h
5 ///
6 /// @authors Francisco Gochez, Nick Avramoussis
7 ///
8 /// @brief Functions for comparing entire VDB grids and generating
9 /// reports on their differences
10 ///
11
12 #ifndef OPENVDB_POINTS_UNITTEST_COMPARE_GRIDS_INCLUDED
13 #define OPENVDB_POINTS_UNITTEST_COMPARE_GRIDS_INCLUDED
14
15 #include <openvdb/openvdb.h>
16 #include <openvdb/points/PointDataGrid.h>
17 #include <openvdb/tree/LeafManager.h>
18 #include <openvdb/tools/Prune.h>
19
20 namespace unittest_util
21 {
22
23
24 struct ComparisonSettings
25 {
26 bool mCheckTransforms = true; // Check grid transforms
27 bool mCheckTopologyStructure = true; // Checks node (voxel/leaf/tile) layout
28 bool mCheckActiveStates = true; // Checks voxel active states match
29 bool mCheckBufferValues = true; // Checks voxel buffer values match
30
31 bool mCheckDescriptors = true; // Check points leaf descriptors
32 bool mCheckArrayValues = true; // Checks attribute array sizes and values
33 bool mCheckArrayFlags = true; // Checks attribute array flags
34 };
35
36 /// @brief The results collected from compareGrids()
37 ///
38 struct ComparisonResult
39 {
40 5383 ComparisonResult(std::ostream& os = std::cout)
41 5383 : mOs(os)
42 , mDifferingTopology(openvdb::MaskGrid::create())
43 10766 , mDifferingValues(openvdb::MaskGrid::create()) {}
44
45 std::ostream& mOs;
46 openvdb::MaskGrid::Ptr mDifferingTopology; // Always empty if mCheckActiveStates is false
47 openvdb::MaskGrid::Ptr mDifferingValues; // Always empty if mCheckBufferValues is false
48 // or if mCheckBufferValues and mCheckArrayValues
49 // is false for point data grids
50 };
51
52 template <typename GridType>
53 bool compareGrids(ComparisonResult& resultData,
54 const GridType& firstGrid,
55 const GridType& secondGrid,
56 const ComparisonSettings& settings,
57 const openvdb::MaskGrid::ConstPtr maskGrid,
58 const typename GridType::ValueType tolerance =
59 openvdb::zeroVal<typename GridType::ValueType>());
60
61 bool compareUntypedGrids(ComparisonResult& resultData,
62 const openvdb::GridBase& firstGrid,
63 const openvdb::GridBase& secondGrid,
64 const ComparisonSettings& settings,
65 const openvdb::MaskGrid::ConstPtr maskGrid);
66
67 } // namespace unittest_util
68
69 #endif // OPENVDB_POINTS_UNITTEST_COMPARE_GRIDS_INCLUDED
70
71