25 #ifndef OPENVDB_TOOLS_PARTICLE_ATLAS_HAS_BEEN_INCLUDED 26 #define OPENVDB_TOOLS_PARTICLE_ATLAS_HAS_BEEN_INCLUDED 36 #include <tbb/blocked_range.h> 37 #include <tbb/parallel_for.h> 38 #include <tbb/parallel_reduce.h> 82 template<
typename Po
intIndexGr
idType = Po
intIndexGr
id>
89 using IndexType =
typename PointIndexGridType::ValueType;
95 ParticleAtlas() : mIndexGridArray(), mMinRadiusArray(), mMaxRadiusArray() {}
102 template<
typename ParticleArrayType>
103 void construct(
const ParticleArrayType& particles,
double minVoxelSize,
size_t maxLevels = 50);
110 template<
typename ParticleArrayType>
111 static Ptr create(
const ParticleArrayType& particles,
112 double minVoxelSize,
size_t maxLevels = 50);
115 size_t levels()
const {
return mIndexGridArray.size(); }
117 bool empty()
const {
return mIndexGridArray.empty(); }
120 double minRadius(
size_t n)
const {
return mMinRadiusArray[n]; }
122 double maxRadius(
size_t n)
const {
return mMaxRadiusArray[n]; }
127 const PointIndexGridType&
pointIndexGrid(
size_t n)
const {
return *mIndexGridArray[n]; }
134 std::vector<PointIndexGridPtr> mIndexGridArray;
135 std::vector<double> mMinRadiusArray, mMaxRadiusArray;
150 template<
typename Po
intIndexGr
idType>
153 using TreeType =
typename PointIndexGridType::TreeType;
167 template<
typename ParticleArrayType>
168 void worldSpaceSearchAndUpdate(
const Vec3d& center,
double radius,
169 const ParticleArrayType& particles);
175 template<
typename ParticleArrayType>
176 void worldSpaceSearchAndUpdate(
const BBoxd& bbox,
const ParticleArrayType& particles);
179 size_t levels()
const {
return mAtlas->levels(); }
183 void updateFromLevel(
size_t level);
193 bool test()
const {
return mRange.first < mRange.second || mIter != mRangeList.end(); }
194 operator bool()
const {
return this->test(); }
220 using Range = std::pair<const IndexType*, const IndexType*>;
221 using RangeDeque = std::deque<Range>;
222 using RangeDequeCIter =
typename RangeDeque::const_iterator;
223 using IndexArray = std::unique_ptr<IndexType[]>;
226 std::unique_ptr<ConstAccessorPtr[]> mAccessorList;
230 RangeDeque mRangeList;
231 RangeDequeCIter mIter;
233 IndexArray mIndexArray;
234 size_t mIndexArraySize, mAccessorListSize;
243 namespace particle_atlas_internal {
246 template<
typename ParticleArrayT>
249 using PosType =
typename ParticleArrayT::PosType;
253 : particleArray(&particles)
260 : particleArray(rhs.particleArray)
268 ScalarType radius, tmpMin = minRadius, tmpMax = maxRadius;
270 for (
size_t n = range.begin(), N = range.end(); n != N; ++n) {
271 particleArray->getRadius(n, radius);
276 minRadius =
std::min(minRadius, tmpMin);
277 maxRadius =
std::max(maxRadius, tmpMax);
290 template<
typename ParticleArrayT,
typename Po
intIndex>
297 using PosType =
typename ParticleArray::PosType;
301 : mIndexMap(), mParticleArray(&particles), mSize(particles.size())
307 : mIndexMap(), mParticleArray(&particles), mSize(particles.size())
315 size_t size()
const {
return mSize; }
318 {
return mParticleArray->getPos(getGlobalIndex(n), xyz); }
320 {
return mParticleArray->getRadius(getGlobalIndex(n), radius); }
325 size_t getGlobalIndex(
size_t n)
const {
return mIndexMap ? size_t(mIndexMap[n]) : n; }
331 if (mMaxRadius < maxRadiusLimit)
return Ptr();
333 std::unique_ptr<bool[]> mask{
new bool[mSize]};
335 tbb::parallel_for(tbb::blocked_range<size_t>(0, mSize),
336 MaskParticles(*
this, mask, maxRadiusLimit));
339 if (output->size() == 0)
return Ptr();
342 for (
size_t n = 0, N = mSize; n < N; ++n) {
343 newSize += size_t(!mask[n]);
346 std::unique_ptr<PointIndex[]> newIndexMap{
new PointIndex[newSize]};
348 setIndexMap(newIndexMap, mask,
false);
351 mIndexMap.swap(newIndexMap);
365 const std::unique_ptr<
bool[]>& mask)
366 : mIndexMap(), mParticleArray(&other.
particleArray()), mSize(0)
368 for (
size_t n = 0, N = other.
size(); n < N; ++n) {
369 mSize += size_t(mask[n]);
374 other.setIndexMap(mIndexMap, mask,
true);
380 struct MaskParticles {
382 const std::unique_ptr<
bool[]>& mask,
ScalarType radius)
383 : particleArray(&particles)
384 , particleMask(mask.get())
385 , radiusLimit(radius)
389 void operator()(
const tbb::blocked_range<size_t>& range)
const {
392 for (
size_t n = range.begin(), N = range.end(); n != N; ++n) {
393 particleArray->getRadius(n, radius);
394 particleMask[n] = !(radius < maxRadius);
399 bool *
const particleMask;
403 inline void updateExtremas() {
405 tbb::parallel_reduce(tbb::blocked_range<size_t>(0, mSize), op);
410 void setIndexMap(std::unique_ptr<
PointIndex[]>& newIndexMap,
411 const std::unique_ptr<
bool[]>& mask,
bool maskValue)
const 413 if (mIndexMap.get() !=
nullptr) {
415 for (
size_t idx = 0, n = 0, N = mSize; n < N; ++n) {
416 if (mask[n] == maskValue) newIndexMap[idx++] = indices[n];
419 for (
size_t idx = 0, n = 0, N = mSize; n < N; ++n) {
420 if (mask[n] == maskValue) {
421 newIndexMap[idx++] =
PointIndex(static_cast<typename PointIndex::IntType>(n));
430 std::unique_ptr<PointIndex[]> mIndexMap;
431 ParticleArrayT
const *
const mParticleArray;
437 template<
typename ParticleArrayType,
typename Po
intIndexLeafNodeType>
440 RemapIndices(
const ParticleArrayType& particles, std::vector<PointIndexLeafNodeType*>& nodes)
441 : mParticles(&particles)
442 , mNodes(nodes.empty() ? nullptr : &nodes.front())
446 void operator()(
const tbb::blocked_range<size_t>& range)
const 448 using PointIndexType =
typename PointIndexLeafNodeType::ValueType;
449 for (
size_t n = range.begin(), N = range.end(); n != N; ++n) {
451 PointIndexLeafNodeType& node = *mNodes[n];
452 const size_t numIndices = node.indices().size();
454 if (numIndices > 0) {
455 PointIndexType* begin = &node.indices().front();
456 const PointIndexType* end = begin + numIndices;
458 while (begin < end) {
459 *begin = PointIndexType(static_cast<typename PointIndexType::IntType>(
460 mParticles->getGlobalIndex(*begin)));
468 PointIndexLeafNodeType *
const *
const mNodes;
472 template<
typename ParticleArrayType,
typename IndexT>
475 using PosType =
typename ParticleArrayType::PosType;
478 using Range = std::pair<const IndexT*, const IndexT*>;
483 ScalarType radius,
const ParticleArrayType& particles,
bool hasUniformRadius =
false)
488 , mParticles(&particles)
489 , mHasUniformRadius(hasUniformRadius)
491 if (mHasUniformRadius) {
493 mParticles->getRadius(0, uniformRadius);
494 mRadius = mRadius + uniformRadius;
499 template <
typename LeafNodeType>
502 const size_t numIndices = leaf.indices().size();
503 if (numIndices > 0) {
504 const IndexT* begin = &leaf.indices().front();
505 filterVoxel(leaf.origin(), begin, begin + numIndices);
509 void filterVoxel(
const Coord&,
const IndexT* begin,
const IndexT* end)
513 if (mHasUniformRadius) {
517 while (begin < end) {
518 mParticles->getPos(
size_t(*begin), pos);
519 const ScalarType distSqr = (mCenter - pos).lengthSqr();
520 if (distSqr < searchRadiusSqr) {
521 mIndices.push_back(*begin);
526 while (begin < end) {
527 const size_t idx = size_t(*begin);
528 mParticles->getPos(idx, pos);
531 mParticles->getRadius(idx, radius);
533 ScalarType searchRadiusSqr = mRadius + radius;
534 searchRadiusSqr *= searchRadiusSqr;
536 const ScalarType distSqr = (mCenter - pos).lengthSqr();
538 if (distSqr < searchRadiusSqr) {
539 mIndices.push_back(*begin);
555 ParticleArrayType
const *
const mParticles;
556 bool const mHasUniformRadius;
560 template<
typename ParticleArrayType,
typename IndexT>
563 using PosType =
typename ParticleArrayType::PosType;
566 using Range = std::pair<const IndexT*, const IndexT*>;
571 const BBoxd& bbox,
const ParticleArrayType& particles,
bool hasUniformRadius =
false)
575 , mCenter(mBBox.getCenter())
576 , mParticles(&particles)
577 , mHasUniformRadius(hasUniformRadius)
580 if (mHasUniformRadius) {
581 mParticles->getRadius(0, mUniformRadiusSqr);
582 mUniformRadiusSqr *= mUniformRadiusSqr;
586 template <
typename LeafNodeType>
589 const size_t numIndices = leaf.indices().size();
590 if (numIndices > 0) {
591 const IndexT* begin = &leaf.indices().front();
592 filterVoxel(leaf.origin(), begin, begin + numIndices);
596 void filterVoxel(
const Coord&,
const IndexT* begin,
const IndexT* end)
600 if (mHasUniformRadius) {
601 const ScalarType radiusSqr = mUniformRadiusSqr;
603 while (begin < end) {
605 mParticles->getPos(
size_t(*begin), pos);
606 if (mBBox.isInside(pos)) {
607 mIndices.push_back(*begin++);
611 const ScalarType distSqr = pointToBBoxDistSqr(pos);
612 if (!(distSqr > radiusSqr)) {
613 mIndices.push_back(*begin);
620 while (begin < end) {
622 const size_t idx = size_t(*begin);
623 mParticles->getPos(idx, pos);
624 if (mBBox.isInside(pos)) {
625 mIndices.push_back(*begin++);
630 mParticles->getRadius(idx, radius);
631 const ScalarType distSqr = pointToBBoxDistSqr(pos);
632 if (!(distSqr > (radius * radius))) {
633 mIndices.push_back(*begin);
649 for (
int i = 0; i < 3; ++i) {
656 distSqr += delta * delta;
662 distSqr += delta * delta;
673 ParticleArrayType
const *
const mParticles;
674 bool const mHasUniformRadius;
685 template<
typename Po
intIndexGr
idType>
686 template<
typename ParticleArrayType>
689 const ParticleArrayType& particles,
double minVoxelSize,
size_t maxLevels)
691 using SplittableParticleArray =
693 using SplittableParticleArrayPtr =
typename SplittableParticleArray::Ptr;
694 using ScalarType =
typename ParticleArrayType::ScalarType;
699 tbb::parallel_reduce(tbb::blocked_range<size_t>(0, particles.size()), extremas);
700 const double firstMin = extremas.
minRadius;
701 const double firstMax = extremas.
maxRadius;
702 const double firstVoxelSize =
std::max(minVoxelSize, firstMin);
704 if (!(firstMax < (firstVoxelSize *
double(2.0))) && maxLevels > 1) {
706 std::vector<SplittableParticleArrayPtr> levels;
707 levels.push_back(SplittableParticleArrayPtr(
708 new SplittableParticleArray(particles, firstMin, firstMax)));
710 std::vector<double> voxelSizeArray;
711 voxelSizeArray.push_back(firstVoxelSize);
713 for (
size_t n = 0; n < maxLevels; ++n) {
715 const double maxParticleRadius = double(levels.back()->maxRadius());
716 const double particleRadiusLimit = voxelSizeArray.back() * double(2.0);
717 if (maxParticleRadius < particleRadiusLimit)
break;
719 SplittableParticleArrayPtr newLevel =
720 levels.back()->split(ScalarType(particleRadiusLimit));
721 if (!newLevel)
break;
723 levels.push_back(newLevel);
724 voxelSizeArray.push_back(
double(newLevel->minRadius()));
727 size_t numPoints = 0;
729 using PointIndexTreeType =
typename PointIndexGridType::TreeType;
730 using PointIndexLeafNodeType =
typename PointIndexTreeType::LeafNodeType;
732 std::vector<PointIndexLeafNodeType*> nodes;
734 for (
size_t n = 0, N = levels.size(); n < N; ++n) {
736 const SplittableParticleArray& particleArray = *levels[n];
738 numPoints += particleArray.size();
740 mMinRadiusArray.push_back(
double(particleArray.minRadius()));
741 mMaxRadiusArray.push_back(
double(particleArray.maxRadius()));
744 createPointIndexGrid<PointIndexGridType>(particleArray, voxelSizeArray[n]);
747 grid->tree().getNodes(nodes);
749 tbb::parallel_for(tbb::blocked_range<size_t>(0, nodes.size()),
751 PointIndexLeafNodeType>(particleArray, nodes));
753 mIndexGridArray.push_back(grid);
757 mMinRadiusArray.push_back(firstMin);
758 mMaxRadiusArray.push_back(firstMax);
759 mIndexGridArray.push_back(
760 createPointIndexGrid<PointIndexGridType>(particles, firstVoxelSize));
765 template<
typename Po
intIndexGr
idType>
766 template<
typename ParticleArrayType>
769 const ParticleArrayType& particles,
double minVoxelSize,
size_t maxLevels)
772 ret->construct(particles, minVoxelSize, maxLevels);
781 template<
typename Po
intIndexGr
idType>
788 , mIter(mRangeList.begin())
791 , mAccessorListSize(atlas.levels())
793 if (mAccessorListSize > 0) {
795 for (
size_t n = 0, N = mAccessorListSize; n < N; ++n) {
802 template<
typename Po
intIndexGr
idType>
806 mIter = mRangeList.begin();
807 if (!mRangeList.empty()) {
808 mRange = mRangeList.front();
809 }
else if (mIndexArray) {
810 mRange.first = mIndexArray.get();
811 mRange.second = mRange.first + mIndexArraySize;
813 mRange.first =
static_cast<IndexType*
>(
nullptr);
814 mRange.second =
static_cast<IndexType*
>(
nullptr);
819 template<
typename Po
intIndexGr
idType>
824 if (mRange.first >= mRange.second && mIter != mRangeList.end()) {
826 if (mIter != mRangeList.end()) {
828 }
else if (mIndexArray) {
829 mRange.first = mIndexArray.get();
830 mRange.second = mRange.first + mIndexArraySize;
836 template<
typename Po
intIndexGr
idType>
840 if (!this->
test())
return false;
846 template<
typename Po
intIndexGr
idType>
851 typename RangeDeque::const_iterator it =
852 mRangeList.begin(), end = mRangeList.end();
854 for ( ; it != end; ++it) {
855 count += it->second - it->first;
858 return count + mIndexArraySize;
862 template<
typename Po
intIndexGr
idType>
866 mRange.first =
static_cast<IndexType*
>(
nullptr);
867 mRange.second =
static_cast<IndexType*
>(
nullptr);
869 mIter = mRangeList.end();
875 template<
typename Po
intIndexGr
idType>
879 using TreeT =
typename PointIndexGridType::TreeType;
880 using LeafNodeType =
typename TreeType::LeafNodeType;
884 if (mAccessorListSize > 0) {
885 const size_t levelIdx =
std::min(mAccessorListSize - 1, level);
889 std::vector<const LeafNodeType*> nodes;
890 tree.getNodes(nodes);
892 for (
size_t n = 0, N = nodes.size(); n < N; ++n) {
894 const LeafNodeType& node = *nodes[n];
895 const size_t numIndices = node.indices().size();
897 if (numIndices > 0) {
898 const IndexType* begin = &node.indices().front();
899 mRangeList.push_back(Range(begin, (begin + numIndices)));
908 template<
typename Po
intIndexGr
idType>
909 template<
typename ParticleArrayType>
912 const Vec3d& center,
double radius,
const ParticleArrayType& particles)
914 using PosType =
typename ParticleArrayType::PosType;
915 using ScalarType =
typename ParticleArrayType::ScalarType;
921 std::deque<IndexType> filteredIndices;
922 std::vector<CoordBBox> searchRegions;
924 const double iRadius = radius * double(1.0 / std::sqrt(3.0));
926 const Vec3d ibMin(center[0] - iRadius, center[1] - iRadius, center[2] - iRadius);
927 const Vec3d ibMax(center[0] + iRadius, center[1] + iRadius, center[2] + iRadius);
929 const Vec3d bMin(center[0] - radius, center[1] - radius, center[2] - radius);
930 const Vec3d bMax(center[0] + radius, center[1] + radius, center[2] + radius);
932 const PosType pos = PosType(center);
933 const ScalarType dist = ScalarType(radius);
935 for (
size_t n = 0, N = mAccessorListSize; n < N; ++n) {
940 const openvdb::math::Transform& xform = mAtlas->
pointIndexGrid(n).transform();
944 openvdb::CoordBBox inscribedRegion(
945 xform.worldToIndexCellCentered(ibMin),
946 xform.worldToIndexCellCentered(ibMax));
948 inscribedRegion.expand(-1);
953 searchRegions.clear();
955 const openvdb::CoordBBox region(
956 xform.worldToIndexCellCentered(bMin - maxRadius),
957 xform.worldToIndexCellCentered(bMax + maxRadius));
959 inscribedRegion.expand(1);
961 searchRegions, region, inscribedRegion);
964 FilterType filter(mRangeList, filteredIndices, pos, dist, particles, uniformRadius);
966 for (
size_t i = 0, I = searchRegions.size(); i < I; ++i) {
977 template<
typename Po
intIndexGr
idType>
978 template<
typename ParticleArrayType>
981 const BBoxd& bbox,
const ParticleArrayType& particles)
985 std::deque<IndexType> filteredIndices;
986 std::vector<CoordBBox> searchRegions;
988 for (
size_t n = 0, N = mAccessorListSize; n < N; ++n) {
992 const openvdb::math::Transform& xform = mAtlas->
pointIndexGrid(n).transform();
996 openvdb::CoordBBox inscribedRegion(
997 xform.worldToIndexCellCentered(bbox.
min()),
998 xform.worldToIndexCellCentered(bbox.
max()));
1000 inscribedRegion.expand(-1);
1005 searchRegions.clear();
1007 const openvdb::CoordBBox region(
1008 xform.worldToIndexCellCentered(bbox.
min() -
maxRadius),
1009 xform.worldToIndexCellCentered(bbox.
max() +
maxRadius));
1011 inscribedRegion.expand(1);
1013 searchRegions, region, inscribedRegion);
1016 FilterType filter(mRangeList, filteredIndices, bbox, particles, uniformRadius);
1018 for (
size_t i = 0, I = searchRegions.size(); i < I; ++i) {
1033 #endif // OPENVDB_TOOLS_PARTICLE_ATLAS_HAS_BEEN_INCLUDED Definition: ParticleAtlas.h:561
std::pair< const IndexT *, const IndexT * > Range
Definition: ParticleAtlas.h:478
Integer wrapper, required to distinguish PointIndexGrid and PointDataGrid from Int32Grid and Int64Gri...
Definition: openvdb/Types.h:134
size_t levels() const
Returns the total number of resolution levels.
Definition: ParticleAtlas.h:179
PointIndexLeafNodeType *const *const mNodes
Definition: ParticleAtlas.h:468
size_t getGlobalIndex(size_t n) const
Definition: ParticleAtlas.h:325
void increment()
Advance iterator to next item.
Definition: ParticleAtlas.h:821
void operator()(const tbb::blocked_range< size_t > &range) const
Definition: ParticleAtlas.h:446
SharedPtr< const SplittableParticleArray > ConstPtr
Definition: ParticleAtlas.h:294
Space-partitioning acceleration structure for points. Partitions the points into voxels to accelerate...
Definition: ParticleAtlas.h:291
void getPos(size_t n, PosType &xyz) const
Definition: ParticleAtlas.h:317
void filterVoxel(const Coord &, const IndexT *begin, const IndexT *end)
Definition: ParticleAtlas.h:509
Definition: ParticleAtlas.h:247
bool empty() const
true if the container size is 0, false otherwise.
Definition: ParticleAtlas.h:117
const IndexType & operator*() const
Return a const reference to the item to which this iterator is pointing.
Definition: ParticleAtlas.h:189
PointIndexGridType & pointIndexGrid(size_t n)
Returns the PointIndexGrid that represents the given level n.
Definition: ParticleAtlas.h:125
ComputeExtremas(const ParticleArrayT &particles)
Definition: ParticleAtlas.h:252
tree::ValueAccessor< const TreeType > ConstAccessor
Definition: ParticleAtlas.h:154
bool operator!=(const Iterator &p) const
Definition: ParticleAtlas.h:212
const Vec3T & min() const
Return a const reference to the minimum point of this bounding box.
Definition: BBox.h:62
Vec3< double > Vec3d
Definition: Vec3.h:662
void operator()(const tbb::blocked_range< size_t > &range)
Definition: ParticleAtlas.h:266
size_t size() const
Definition: ParticleAtlas.h:315
void operator++()
Advance iterator to next item.
Definition: ParticleAtlas.h:201
typename PosType::value_type ScalarType
Definition: ParticleAtlas.h:476
typename ParticleArray::PosType PosType
Definition: ParticleAtlas.h:297
typename ParticleArrayType::PosType PosType
Definition: ParticleAtlas.h:475
ScalarType maxRadius
Definition: ParticleAtlas.h:286
BBoxFilter(RangeDeque &ranges, IndexDeque &indices, const BBoxd &bbox, const ParticleArrayType &particles, bool hasUniformRadius=false)
Definition: ParticleAtlas.h:570
SplittableParticleArray(const ParticleArrayT &particles)
Definition: ParticleAtlas.h:300
void getRadius(size_t n, ScalarType &radius) const
Definition: ParticleAtlas.h:319
typename ParticleArrayType::PosType PosType
Definition: ParticleAtlas.h:563
ScalarType minRadius() const
Definition: ParticleAtlas.h:322
Selectively extract and filter point data using a custom filter operator.
ScalarType minRadius
Definition: ParticleAtlas.h:286
void filterLeafNode(const LeafNodeType &leaf)
Definition: ParticleAtlas.h:587
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:94
ParticleArrayT const *const particleArray
Definition: ParticleAtlas.h:285
bool operator==(const Iterator &p) const
Return true if both iterators point to the same element.
Definition: ParticleAtlas.h:211
Ptr split(ScalarType maxRadiusLimit)
Definition: ParticleAtlas.h:329
RadialRangeFilter(RangeDeque &ranges, IndexDeque &indices, const PosType &xyz, ScalarType radius, const ParticleArrayType &particles, bool hasUniformRadius=false)
Definition: ParticleAtlas.h:482
SharedPtr< ParticleAtlas > Ptr
Definition: ParticleAtlas.h:85
typename PosType::value_type ScalarType
Definition: ParticleAtlas.h:564
SharedPtr< SplittableParticleArray > Ptr
Definition: ParticleAtlas.h:293
size_t size() const
Return the number of point indices in the iterator range.
Definition: ParticleAtlas.h:848
Definition: ParticleAtlas.h:83
const PointIndexGridType & pointIndexGrid(size_t n) const
Returns the PointIndexGrid that represents the given level n.
Definition: ParticleAtlas.h:127
bool operator==(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Equality operator, does exact floating point comparisons.
Definition: Vec3.h:471
typename PosType::value_type ScalarType
Definition: ParticleAtlas.h:298
typename PointIndexGridType::ValueType IndexType
Definition: ParticleAtlas.h:89
Definition: openvdb/Exceptions.h:13
const Vec3T & max() const
Return a const reference to the maximum point of this bounding box.
Definition: BBox.h:64
void reset()
Reset the iterator to point to the first item.
Definition: ParticleAtlas.h:804
RemapIndices(const ParticleArrayType &particles, std::vector< PointIndexLeafNodeType * > &nodes)
Definition: ParticleAtlas.h:440
bool test() const
Return true if this iterator is not yet exhausted.
Definition: ParticleAtlas.h:193
void updateFromLevel(size_t level)
Clear the iterator and update it with all particles that reside at the given resolution level...
Definition: ParticleAtlas.h:877
void join(const ComputeExtremas &rhs)
Definition: ParticleAtlas.h:280
SplittableParticleArray(const ParticleArrayT &particles, double minR, double maxR)
Definition: ParticleAtlas.h:306
Partition particles and performs range and nearest-neighbor searches.
ParticleArrayType const *const mParticles
Definition: ParticleAtlas.h:467
typename ParticleArrayT::PosType PosType
Definition: ParticleAtlas.h:249
std::deque< IndexT > IndexDeque
Definition: ParticleAtlas.h:568
typename PosType::value_type ScalarType
Definition: ParticleAtlas.h:250
std::shared_ptr< T > SharedPtr
Definition: openvdb/Types.h:92
void worldSpaceSearchAndUpdate(const Vec3d ¢er, double radius, const ParticleArrayType &particles)
Clear the iterator and update it with the result of the given world-space radial query.
Definition: ParticleAtlas.h:911
ParticleAtlas()
Definition: ParticleAtlas.h:95
Definition: ParticleAtlas.h:473
SharedPtr< const ParticleAtlas > ConstPtr
Definition: ParticleAtlas.h:86
double minRadius(size_t n) const
Returns minimum particle radius for level n.
Definition: ParticleAtlas.h:120
ComputeExtremas(ComputeExtremas &rhs, tbb::split)
Definition: ParticleAtlas.h:259
const ParticleArrayT & particleArray() const
Definition: ParticleAtlas.h:313
Definition: ParticleAtlas.h:438
void filterLeafNode(const LeafNodeType &leaf)
Definition: ParticleAtlas.h:500
std::unique_ptr< ConstAccessor > ConstAccessorPtr
Definition: ParticleAtlas.h:155
void filterVoxel(const Coord &, const IndexT *begin, const IndexT *end)
Definition: ParticleAtlas.h:596
bool next()
Advance iterator to next item.
Definition: ParticleAtlas.h:838
std::pair< const IndexT *, const IndexT * > Range
Definition: ParticleAtlas.h:566
typename PointIndexGridType::TreeType TreeType
Definition: ParticleAtlas.h:153
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:146
std::deque< IndexT > IndexDeque
Definition: ParticleAtlas.h:480
Provides accelerated range and nearest-neighbor searches for particles that are partitioned using the...
Definition: ParticleAtlas.h:151
typename PointIndexGridType::Ptr PointIndexGridPtr
Definition: ParticleAtlas.h:88
bool isApproxEqual(const Type &a, const Type &b, const Type &tolerance)
Return true if a is equal to b to within the given tolerance.
Definition: Math.h:397
std::deque< Range > RangeDeque
Definition: ParticleAtlas.h:567
std::deque< Range > RangeDeque
Definition: ParticleAtlas.h:479
size_t levels() const
Returns the number of resolution levels.
Definition: ParticleAtlas.h:115
double maxRadius(size_t n) const
Returns maximum particle radius for level n.
Definition: ParticleAtlas.h:122
ScalarType maxRadius() const
Definition: ParticleAtlas.h:323