9#ifndef OPENVDB_POINTS_POINT_COUNT_IMPL_HAS_BEEN_INCLUDED 
   10#define OPENVDB_POINTS_POINT_COUNT_IMPL_HAS_BEEN_INCLUDED 
   17template <
typename Po
intDataTreeT, 
typename FilterT>
 
   19                   const FilterT& filter,
 
   20                   const bool inCoreOnly,
 
   24    using LeafRangeT = 
typename LeafManagerT::LeafRange;
 
   27        [&filter, &inCoreOnly] (
const LeafRangeT& range, 
Index64 sum) -> 
Index64 {
 
   28            for (
const auto& leaf : range) {
 
   29                if (inCoreOnly && leaf.buffer().isOutOfCore())  
continue;
 
   30                auto state = filter.state(leaf);
 
   32                    sum += leaf.pointCount();
 
   34                    sum += 
iterCount(leaf.beginIndexAll(filter));
 
   40    LeafManagerT leafManager(
tree);
 
   42        return tbb::parallel_reduce(leafManager.leafRange(), 
Index64(0), countLambda,
 
   46        return countLambda(leafManager.leafRange(), 
Index64(0));
 
 
   51template <
typename Po
intDataTreeT, 
typename FilterT>
 
   53                        const PointDataTreeT& 
tree,
 
   54                        const FilterT& filter,
 
   55                        const bool inCoreOnly,
 
   58    using LeafT = 
typename PointDataTreeT::LeafNodeType;
 
   68    LeafManagerT leafManager(
tree);
 
   70        [&
pointOffsets, &filter, &inCoreOnly](
const LeafT& leaf, 
size_t pos) {
 
   71            if (inCoreOnly && leaf.buffer().isOutOfCore())  
return;
 
   72            auto state = filter.state(leaf);
 
 
   93template <
typename Po
intDataGr
idT, 
typename Gr
idT, 
typename FilterT>
 
   96                const FilterT& filter)
 
   98    static_assert(std::is_integral<typename GridT::ValueType>::value ||
 
   99                  std::is_floating_point<typename GridT::ValueType>::value,
 
  100        "openvdb::points::pointCountGrid must return an integer or floating-point scalar grid");
 
  102    using PointDataTreeT = 
typename PointDataGridT::TreeType;
 
  103    using TreeT = 
typename GridT::TreeType;
 
  105    typename TreeT::Ptr 
tree =
 
  106        point_mask_internal::convertPointsToScalar<TreeT, PointDataTreeT, FilterT>
 
  109    typename GridT::Ptr grid(
new GridT(
tree));
 
  110    grid->setTransform(
points.transform().copy());
 
 
  115template <
typename Po
intDataGr
idT, 
typename Gr
idT, 
typename FilterT>
 
  118                const openvdb::math::Transform& transform,
 
  119                const FilterT& filter)
 
  121    static_assert(  std::is_integral<typename GridT::ValueType>::value ||
 
  122                    std::is_floating_point<typename GridT::ValueType>::value,
 
  123        "openvdb::points::pointCountGrid must return an integer or floating-point scalar grid");
 
  127    auto& nonConstPoints = 
const_cast<typename AdapterT::NonConstGridType&
>(
points);
 
  130    return point_mask_internal::convertPointsToScalar<GridT>(
 
  131        nonConstPoints, transform, filter, deformer);
 
 
This class manages a linear array of pointers to a given tree's leaf nodes, as well as optional auxil...
Definition LeafManager.h:86
@ ALL
Definition IndexIterator.h:44
@ NONE
Definition IndexIterator.h:43
Definition AttributeArray.h:42
Index64 pointOffsets(std::vector< Index64 > &pointOffsets, const PointDataTreeT &tree, const FilterT &filter=NullFilter(), const bool inCoreOnly=false, const bool threaded=true)
Populate an array of cumulative point offsets per leaf node.
Definition PointCountImpl.h:52
Index64 pointCount(const PointDataTreeT &tree, const FilterT &filter=NullFilter(), const bool inCoreOnly=false, const bool threaded=true)
Count the total number of points in a PointDataTree.
Definition PointCountImpl.h:18
GridT::Ptr pointCountGrid(const PointDataGridT &grid, const FilterT &filter=NullFilter())
Generate a new grid with voxel values to store the number of points per voxel.
Definition PointCountImpl.h:95
Index64 iterCount(const IterT &iter)
Count up the number of times the iterator can iterate.
Definition IndexIterator.h:315
Definition PointDataGrid.h:170
uint64_t Index64
Definition Types.h:53
Definition Exceptions.h:13
This adapter allows code that is templated on a Tree type to accept either a Tree type or a Grid type...
Definition Grid.h:1060
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition version.h.in:121
#define OPENVDB_USE_VERSION_NAMESPACE
Definition version.h.in:218