Skip to content

Commit 89be525

Browse files
committed
Merge branch 'master' into fix_IteratorRange
2 parents ffdf697 + 7edd8cd commit 89be525

File tree

10 files changed

+94
-8
lines changed

10 files changed

+94
-8
lines changed

cmake/FindBlosc.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,12 @@ list(APPEND _BLOSC_LIBRARYDIR_SEARCH_DIRS
191191
# Library suffix handling
192192

193193
set(_BLOSC_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
194+
set(_BLOSC_ORIG_CMAKE_FIND_LIBRARY_PREFIXES ${CMAKE_FIND_LIBRARY_PREFIXES})
194195

195196
if(MSVC)
196197
if(BLOSC_USE_STATIC_LIBS)
197198
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
199+
set(CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES};lib")
198200
endif()
199201
else()
200202
if(BLOSC_USE_STATIC_LIBS)
@@ -247,7 +249,9 @@ endforeach()
247249
# Reset library suffix
248250

249251
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_BLOSC_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
252+
set(CMAKE_FIND_LIBRARY_PREFIXES ${_BLOSC_ORIG_CMAKE_FIND_LIBRARY_PREFIXES})
250253
unset(_BLOSC_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
254+
unset(_BLOSC_ORIG_CMAKE_FIND_LIBRARY_PREFIXES)
251255

252256
if(Blosc_LIBRARY_DEBUG AND Blosc_LIBRARY_RELEASE)
253257
# if the generator is multi-config or if CMAKE_BUILD_TYPE is set for

openvdb/openvdb/tree/LeafManager.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,12 @@ class LeafManager
586586
using LeafParentT = typename CopyConstness<TreeType, NonConstLeafParentT>::Type;
587587

588588
std::deque<LeafParentT*> leafParents;
589-
mTree->getNodes(leafParents);
589+
if constexpr(std::is_same<NonConstLeafParentT, RootNodeType>::value) {
590+
leafParents.emplace_back(&mTree->root());
591+
}
592+
else {
593+
mTree->getNodes(leafParents);
594+
}
590595

591596
// Compute the leaf counts for each node
592597

openvdb/openvdb/tree/Tree.h

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,8 @@ class Tree: public TreeBase
576576
/// array.reserve(tree.leafCount());//this is a fast preallocation.
577577
/// tree.getNodes(array);
578578
/// @endcode
579-
template<typename ArrayT> void getNodes(ArrayT& array) { mRoot.getNodes(array); }
580-
template<typename ArrayT> void getNodes(ArrayT& array) const { mRoot.getNodes(array); }
579+
template<typename ArrayT> void getNodes(ArrayT& array);
580+
template<typename ArrayT> void getNodes(ArrayT& array) const;
581581
//@}
582582

583583
/// @brief Steals all nodes of a certain type from the tree and
@@ -1273,6 +1273,30 @@ Tree<RootNodeType>::writeBuffers(std::ostream &os, bool saveFloatAsHalf) const
12731273
}
12741274

12751275

1276+
template<typename RootNodeType>
1277+
template<typename ArrayT>
1278+
inline void
1279+
Tree<RootNodeType>::getNodes(ArrayT& array)
1280+
{
1281+
using NodeT = typename std::remove_pointer<typename ArrayT::value_type>::type;
1282+
static_assert(!std::is_same<NodeT, RootNodeType>::value,
1283+
"getNodes() does not work for the RootNode. Use Tree::root()");
1284+
mRoot.getNodes(array);
1285+
}
1286+
1287+
1288+
template<typename RootNodeType>
1289+
template<typename ArrayT>
1290+
inline void
1291+
Tree<RootNodeType>::getNodes(ArrayT& array) const
1292+
{
1293+
using NodeT = typename std::remove_pointer<typename ArrayT::value_type>::type;
1294+
static_assert(!std::is_same<NodeT, const RootNodeType>::value,
1295+
"getNodes() does not work for the RootNode. Use Tree::root()");
1296+
mRoot.getNodes(array);
1297+
}
1298+
1299+
12761300
template<typename RootNodeType>
12771301
inline void
12781302
Tree<RootNodeType>::clear()

openvdb/openvdb/unittest/TestLeafManager.cc

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// SPDX-License-Identifier: MPL-2.0
33

44
#include <openvdb/Types.h>
5+
#include <openvdb/TypeList.h>
56
#include <openvdb/tree/LeafManager.h>
67
#include <openvdb/util/CpuTimer.h>
78
#include "util.h" // for unittest_util::makeSphere()
@@ -304,3 +305,39 @@ TEST_F(TestLeafManager, testReduce)
304305
}
305306
EXPECT_EQ(FloatTree::LeafNodeType::numValues(), n);
306307
}
308+
309+
TEST_F(TestLeafManager, testTreeConfigurations)
310+
{
311+
using Tree2Type = openvdb::tree::Tree<
312+
openvdb::tree::RootNode<
313+
openvdb::tree::LeafNode<float, 3> > >;
314+
using Tree3Type = openvdb::tree::Tree3<float, 4, 3>::Type;
315+
using Tree4Type = openvdb::tree::Tree4<float, 5, 4, 3>::Type;
316+
using Tree5Type = openvdb::tree::Tree5<float, 5, 5, 4, 3>::Type;
317+
318+
using TestConfigurations = openvdb::TypeList<
319+
Tree2Type, Tree3Type, Tree4Type, Tree5Type
320+
>;
321+
322+
TestConfigurations::foreach([](auto tree) {
323+
using TreeType = typename std::decay<decltype(tree)>::type;
324+
using LeafNodeType = typename TreeType::LeafNodeType;
325+
using LeafManagerT = openvdb::tree::LeafManager<TreeType>;
326+
using ConstLeafManagerT = openvdb::tree::LeafManager<const TreeType>;
327+
328+
// Add 20 leaf nodes and make sure they are constructed correctly
329+
constexpr openvdb::Int32 Count = 20;
330+
331+
const openvdb::Int32 start = -(Count/2)*openvdb::Int32(LeafNodeType::DIM);
332+
const openvdb::Int32 end = (Count/2)*openvdb::Int32(LeafNodeType::DIM);
333+
for (openvdb::Int32 idx = start; idx < end; idx+=openvdb::Int32(LeafNodeType::DIM)) {
334+
tree.touchLeaf(openvdb::math::Coord(idx));
335+
}
336+
337+
EXPECT_EQ(tree.leafCount(), Count);
338+
LeafManagerT manager(tree);
339+
EXPECT_EQ(manager.leafCount(), Count);
340+
ConstLeafManagerT cmanager(tree);
341+
EXPECT_EQ(cmanager.leafCount(), Count);
342+
});
343+
}

openvdb_ax/openvdb_ax/test/cmd/vdb_ax_test_fail_1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
usage: vdb_ax [command] [--help|-h] [-v] [<args>]
22

33
CLI utility for processing OpenVDB data using AX.
4-
-h, --help, -help print help and exit
4+
Available [command] modes are: [execute|analyze|functions] (Default: execute).
5+
-h, --help, -help print help and exit (use [command] --help for more information)
56
-v, --verbose verbose (print timing and diagnostics)
67

78
[execute] read/process/write VDB file/streams (default command):

openvdb_ax/openvdb_ax/test/cmd/vdb_ax_test_fail_3

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ FATAL: "--invalid-option" is not a valid option
22
usage: vdb_ax [command] [--help|-h] [-v] [<args>]
33

44
CLI utility for processing OpenVDB data using AX.
5-
-h, --help, -help print help and exit
5+
Available [command] modes are: [execute|analyze|functions] (Default: execute).
6+
-h, --help, -help print help and exit (use [command] --help for more information)
67
-v, --verbose verbose (print timing and diagnostics)
78

89
[execute] read/process/write VDB file/streams (default command):

openvdb_ax/openvdb_ax/test/cmd/vdb_ax_test_pass_1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
usage: vdb_ax [command] [--help|-h] [-v] [<args>]
22

33
CLI utility for processing OpenVDB data using AX.
4-
-h, --help, -help print help and exit
4+
Available [command] modes are: [execute|analyze|functions] (Default: execute).
5+
-h, --help, -help print help and exit (use [command] --help for more information)
56
-v, --verbose verbose (print timing and diagnostics)
67

78
[execute] read/process/write VDB file/streams (default command):

openvdb_cmd/vdb_ax/main.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ struct ProgOptions
224224
.addOpt("-h")
225225
.addOpt("--help")
226226
.addOpt("-help")
227-
.setDoc("print help and exit. [command] -h prints extra information.")
227+
.setDoc("print help and exit (use [command] --help for more information).")
228228
.get();
229229

230230
// Execute options
@@ -287,6 +287,7 @@ struct ProgOptions
287287
fatal("invalid option given for --opt level");
288288
}
289289
})
290+
.setDefault(openvdb::ax::CompilerOptions::OptLevel::O3)
290291
.get();
291292

292293
openvdb::ax::cli::Param<size_t> mThreads =
@@ -463,7 +464,8 @@ void shortManPage [[noreturn]] (const ProgOptions& opts, int exitStatus = EXIT_F
463464
std::cerr <<
464465
"usage: " << gProgName << " [command] [--help|-h] [-v] [<args>]\n" <<
465466
'\n' <<
466-
"CLI utility for processing OpenVDB data using AX.\n";
467+
"CLI utility for processing OpenVDB data using AX.\n" <<
468+
"Available [command] modes are: [execute|analyze|functions] (Default: execute).\n";
467469
openvdb::ax::cli::usage(std::cerr, opts.mHelp.opts(), opts.mHelp.doc(), false);
468470
openvdb::ax::cli::usage(std::cerr, opts.mVerbose.opts(), opts.mVerbose.doc(), false);
469471
std::cerr << '\n';
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
OpenVDB:
2+
- Bug Fixes:
3+
- Fixed a bug with LeafManager which wouldn't correctly
4+
initialize its LeafNode array for single level Tree configurations
5+
i.e. RootNode<LeafNode> (bug introduced in 7.2.0)
6+
[Reported by @lanwatch]
7+

pendingchanges/vdb_ax.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
AX:
2+
- Bug Fix:
3+
Fixed an incorrect option in the `vdb_ax` command line tool where the default
4+
optimization level was set to NONE instead of O3 (issue introduced in 10.0.0).

0 commit comments

Comments
 (0)