62#ifndef OPENVDB_TOOLS_PARTICLES_TO_LEVELSET_HAS_BEEN_INCLUDED 
   63#define OPENVDB_TOOLS_PARTICLES_TO_LEVELSET_HAS_BEEN_INCLUDED 
   73#include <openvdb/thread/Threading.h> 
   80#include <tbb/parallel_reduce.h> 
   81#include <tbb/blocked_range.h> 
   98template<
typename Gr
idT, 
typename ParticleListT, 
typename InterrupterT = util::NullInterrupter>
 
   99inline void particlesToSdf(
const ParticleListT&, GridT&, InterrupterT* = 
nullptr);
 
  105template<
typename Gr
idT, 
typename ParticleListT, 
typename InterrupterT = util::NullInterrupter>
 
  106inline void particlesToSdf(
const ParticleListT&, GridT&, Real radius, InterrupterT* = 
nullptr);
 
  115template<
typename Gr
idT, 
typename ParticleListT, 
typename InterrupterT = util::NullInterrupter>
 
  116inline void particleTrailsToSdf(
const ParticleListT&, GridT&, Real delta=1, InterrupterT* =
nullptr);
 
  122template<
typename Gr
idT, 
typename ParticleListT, 
typename InterrupterT = util::NullInterrupter>
 
  123inline void particlesToMask(
const ParticleListT&, GridT&, InterrupterT* = 
nullptr);
 
  129template<
typename Gr
idT, 
typename ParticleListT, 
typename InterrupterT = util::NullInterrupter>
 
  130inline void particlesToMask(
const ParticleListT&, GridT&, Real radius, InterrupterT* = 
nullptr);
 
  139template<
typename Gr
idT, 
typename ParticleListT, 
typename InterrupterT = util::NullInterrupter>
 
  140inline void particleTrailsToMask(
const ParticleListT&, GridT&,Real delta=1,InterrupterT* =
nullptr);
 
  147namespace p2ls_internal {
 
  152template<
typename VisibleT, 
typename BlindT> 
class BlindData;
 
  157template<
typename SdfGridT,
 
  158         typename AttributeT = void,
 
  159         typename InterrupterT = util::NullInterrupter>
 
  163    using DisableT = 
typename std::is_void<AttributeT>::type;
 
  169    using AttType = 
typename std::conditional<DisableT::value, size_t, AttributeT>::type;
 
  170    using AttGridType = 
typename SdfGridT::template ValueConverter<AttType>::Type;
 
  244    template<
typename ParticleListT>
 
  253    template<
typename ParticleListT>
 
  271    template<
typename ParticleListT>
 
  275    using BlindType = p2ls_internal::BlindData<SdfType, AttType>;
 
  276    using BlindGridType = 
typename SdfGridT::template ValueConverter<BlindType>::Type;
 
  279    template<
typename ParticleListT, 
typename Gr
idT> 
struct Raster;
 
  282    typename AttGridType::Ptr   mAttGrid;
 
  283    BlindGridType* mBlindGrid;
 
  284    InterrupterT*  mInterrupter;
 
  285    Real           mDx, mHalfWidth;
 
  287    size_t         mMinCount, mMaxCount; 
 
 
  292template<
typename SdfGr
idT, 
typename AttributeT, 
typename InterrupterT>
 
  297    mInterrupter(interrupter),
 
  298    mDx(grid.voxelSize()[0]),
 
  299    mHalfWidth(grid.background()/mDx),
 
  306    if (!mSdfGrid->hasUniformVoxels()) {
 
  307        OPENVDB_THROW(RuntimeError, 
"ParticlesToLevelSet only supports uniform voxels!");
 
  309    if (!DisableT::value) {
 
  310        mBlindGrid = 
new BlindGridType(BlindType(grid.background()));
 
  311        mBlindGrid->setTransform(mSdfGrid->transform().copy());
 
 
  315template<
typename SdfGr
idT, 
typename AttributeT, 
typename InterrupterT>
 
  316template<
typename ParticleListT>
 
  320    if (DisableT::value) {
 
  321        Raster<ParticleListT, SdfGridT> r(*
this, mSdfGrid, pa);
 
  322        r.rasterizeSpheres();
 
  324        Raster<ParticleListT, BlindGridType> r(*
this, mBlindGrid, pa);
 
  325        r.rasterizeSpheres();
 
 
  329template<
typename SdfGr
idT, 
typename AttributeT, 
typename InterrupterT>
 
  330template<
typename ParticleListT>
 
  334    if (DisableT::value) {
 
  335        Raster<ParticleListT, SdfGridT> r(*
this, mSdfGrid, pa);
 
  336        r.rasterizeSpheres(radius/mDx);
 
  338        Raster<ParticleListT, BlindGridType> r(*
this, mBlindGrid, pa);
 
  339        r.rasterizeSpheres(radius/mDx);
 
 
  343template<
typename SdfGr
idT, 
typename AttributeT, 
typename InterrupterT>
 
  344template<
typename ParticleListT>
 
  348    if (DisableT::value) {
 
  349        Raster<ParticleListT, SdfGridT> r(*
this, mSdfGrid, pa);
 
  350        r.rasterizeTrails(delta);
 
  352        Raster<ParticleListT, BlindGridType> r(*
this, mBlindGrid, pa);
 
  353        r.rasterizeTrails(delta);
 
 
  358template<
typename SdfGr
idT, 
typename AttributeT, 
typename InterrupterT>
 
  377    using AttTreeT = 
typename AttGridType::TreeType;
 
  378    using AttLeafT = 
typename AttTreeT::LeafNodeType;
 
  379    using BlindTreeT = 
typename BlindGridType::TreeType;
 
  380    using BlindLeafIterT = 
typename BlindTreeT::LeafCIter;
 
  381    using BlindLeafT = 
typename BlindTreeT::LeafNodeType;
 
  382    using SdfTreeT = 
typename SdfGridType::TreeType;
 
  383    using SdfLeafT = 
typename SdfTreeT::LeafNodeType;
 
  386    const BlindTreeT& blindTree = mBlindGrid->tree();
 
  389    typename AttTreeT::Ptr attTree(
new AttTreeT(
 
  392    mAttGrid = 
typename AttGridType::Ptr(
new AttGridType(attTree));
 
  393    mAttGrid->setTransform(mBlindGrid->transform().copy());
 
  395    typename SdfTreeT::Ptr sdfTree; 
 
  399        sdfTree.reset(
new SdfTreeT(blindTree,
 
  404        leafNodes.
foreach([&](AttLeafT& attLeaf, 
size_t ) {
 
  405            if (
const auto* blindLeaf = blindTree.probeConstLeaf(attLeaf.origin())) {
 
  406                for (
auto iter = attLeaf.beginValueOn(); iter; ++iter) {
 
  407                    const auto pos = iter.pos();
 
  408                    attLeaf.setValueOnly(pos, blindLeaf->getValue(pos).blind());
 
  413        const auto blindAcc = mBlindGrid->getConstAccessor();
 
  414        auto iter = attTree->beginValueOn();
 
  415        iter.setMaxDepth(AttTreeT::ValueOnIter::LEAF_DEPTH - 1);
 
  416        for ( ; iter; ++iter) {
 
  417            iter.modifyValue([&](
AttType& v) { v = blindAcc.getValue(iter.getCoord()).blind(); });
 
  422        sdfTree.reset(
new SdfTreeT(blindTree, blindTree.background().visible(), 
TopologyCopy()));
 
  423        for (BlindLeafIterT n = blindTree.cbeginLeaf(); n; ++n) {
 
  424            const BlindLeafT& leaf = *n;
 
  427            SdfLeafT* sdfLeaf = sdfTree->probeLeaf(xyz);
 
  428            AttLeafT* attLeaf = attTree->probeLeaf(xyz);
 
  430            typename BlindLeafT::ValueOnCIter m=leaf.cbeginValueOn();
 
  433                    const BlindType& v = leaf.getValue(k);
 
  434                    sdfLeaf->setValueOnly(k, v.visible());
 
  435                    attLeaf->setValueOnly(k, v.blind());
 
  440                    const BlindType& v = *m;
 
  441                    sdfLeaf->setValueOnly(k, v.visible());
 
  442                    attLeaf->setValueOnly(k, v.blind());
 
  449    if (mSdfGrid->empty()) {
 
  450        mSdfGrid->setTree(sdfTree);
 
  453            mSdfGrid->tree().topologyUnion(*sdfTree);
 
 
  467template<
typename SdfGr
idT, 
typename AttributeT, 
typename InterrupterT>
 
  468template<
typename ParticleListT, 
typename Gr
idT>
 
  471    using DisableT = 
typename std::is_void<AttributeT>::type;
 
  475    using ValueT = 
typename GridT::ValueType;
 
  477    using TreeT = 
typename GridT::TreeType;
 
  486    Raster(ParticlesToLevelSetT& parent, GridT* grid, 
const ParticleListT& particles)
 
  488        , mParticles(particles)
 
  490        , mMap(*(mGrid->transform().baseMap()))
 
  496        mPointPartitioner->construct(particles, mGrid->transform());
 
 
  501        : mParent(other.mParent)
 
  502        , mParticles(other.mParticles)
 
  509        , mPointPartitioner(other.mPointPartitioner)
 
 
  521            delete mPointPartitioner;
 
 
  527        mMinCount = mMaxCount = 0;
 
  528        if (mParent.mInterrupter) {
 
  529            mParent.mInterrupter->start(
"Rasterizing particles to level set using spheres");
 
  531        mTask = std::bind(&Raster::rasterSpheres, std::placeholders::_1, std::placeholders::_2);
 
  533        if (mParent.mInterrupter) mParent.mInterrupter->end();
 
 
  538        mMinCount = radius < mParent.mRmin ? mParticles.size() : 0;
 
  539        mMaxCount = radius > mParent.mRmax ? mParticles.size() : 0;
 
  540        if (mMinCount>0 || mMaxCount>0) {
 
  541            mParent.mMinCount = mMinCount;
 
  542            mParent.mMaxCount = mMaxCount;
 
  544            if (mParent.mInterrupter) {
 
  545                mParent.mInterrupter->start(
 
  546                    "Rasterizing particles to level set using const spheres");
 
  548            mTask = std::bind(&Raster::rasterFixedSpheres,
 
  549                std::placeholders::_1, std::placeholders::_2, radius);
 
  551            if (mParent.mInterrupter) mParent.mInterrupter->end();
 
 
  557        mMinCount = mMaxCount = 0;
 
  558        if (mParent.mInterrupter) {
 
  559            mParent.mInterrupter->start(
"Rasterizing particles to level set using trails");
 
  561        mTask = std::bind(&Raster::rasterTrails,
 
  562            std::placeholders::_1, std::placeholders::_2, delta);
 
  564        if (mParent.mInterrupter) mParent.mInterrupter->end();
 
 
  572        mParent.mMinCount = mMinCount;
 
  573        mParent.mMaxCount = mMaxCount;
 
 
  584                mGrid->topologyUnion(*other.mGrid);
 
  590        mMinCount += other.mMinCount;
 
  591        mMaxCount += other.mMaxCount;
 
 
  599    bool ignoreParticle(
Real R)
 
  601        if (R < mParent.mRmin) {
 
  605        if (R > mParent.mRmax) {
 
  614    void rasterSpheres(
const tbb::blocked_range<size_t>& r)
 
  616        AccessorT acc = mGrid->getAccessor(); 
 
  618        const Real invDx = 1 / mParent.mDx;
 
  624        for (
size_t n = r.begin(), N = r.end(); n < N; ++n) {
 
  626            typename PointPartitionerT::IndexIterator iter = mPointPartitioner->indices(n);
 
  627            for ( ; run && iter; ++iter) {
 
  629                mParticles.getPosRad(
id, pos, rad);
 
  630                const Real R = invDx * rad;
 
  631                if (this->ignoreParticle(R)) 
continue;
 
  632                const Vec3R P = mMap.applyInverseMap(pos);
 
  633                this->getAtt<DisableT>(
id, att);
 
  634                run = this->makeSphere(P, R, att, acc);
 
  642    void rasterFixedSpheres(
const tbb::blocked_range<size_t>& r, 
Real R)
 
  644        AccessorT acc = mGrid->getAccessor(); 
 
  649        for (
size_t n = r.begin(), N = r.end(); n < N; ++n) {
 
  651            for (
auto iter = mPointPartitioner->indices(n); iter; ++iter) {
 
  653                this->getAtt<DisableT>(
id, att);
 
  654                mParticles.getPos(
id, pos);
 
  655                const Vec3R P = mMap.applyInverseMap(pos);
 
  656                this->makeSphere(P, R, att, acc);
 
  664    void rasterTrails(
const tbb::blocked_range<size_t>& r, 
Real delta)
 
  666        AccessorT acc = mGrid->getAccessor(); 
 
  671        const Vec3R origin = mMap.applyInverseMap(
Vec3R(0,0,0));
 
  672        const Real Rmin = mParent.mRmin, invDx = 1 / mParent.mDx;
 
  675        for (
size_t n = r.begin(), N = r.end(); n < N; ++n) {
 
  677            typename PointPartitionerT::IndexIterator iter = mPointPartitioner->indices(n);
 
  678            for ( ; 
run && iter; ++iter) {
 
  680                mParticles.getPosRadVel(
id, pos, rad, vel);
 
  681                const Real R0 = invDx * rad;
 
  682                if (this->ignoreParticle(R0)) 
continue;
 
  683                this->getAtt<DisableT>(
id, att);
 
  684                const Vec3R P0 = mMap.applyInverseMap(pos);
 
  685                const Vec3R V  = mMap.applyInverseMap(vel) - origin; 
 
  686                const Real speed = V.
length(), invSpeed = 1.0 / speed;
 
  687                const Vec3R Nrml = -V * invSpeed; 
 
  690                while (run && d <= speed) {
 
  691                    run = this->makeSphere(P, R, att, acc);
 
  692                    P += 0.5 * delta * R * Nrml; 
 
  693                    d = (P - P0).length(); 
 
  694                    R = R0 - (R0 - Rmin) * d * invSpeed; 
 
  705        if (mParent.mGrainSize>0) {
 
  706            tbb::parallel_reduce(
 
  707              tbb::blocked_range<size_t>(0, bucketCount, mParent.mGrainSize), *
this);
 
  709            (*this)(tbb::blocked_range<size_t>(0, bucketCount));
 
  727    template <
bool IsMaskT = OutputIsMask>
 
  728    typename std::enable_if<!IsMaskT, bool>::type
 
  729    makeSphere(
const Vec3R& P, 
Real R, 
const AttT& att, AccessorT& acc)
 
  733            w = mParent.mHalfWidth,
 
  741        const ValueT inside = -mGrid->background();
 
  745        for (Coord c = lo; c.x() <= hi.x(); ++c.x()) {
 
  748                thread::cancelGroupExecution();
 
  752            for (c.y() = lo.y(); c.y() <= hi.y(); ++c.y()) {
 
  754                for (c.z() = lo.z(); c.z() <= hi.z(); ++c.z()) {
 
  756#if defined __INTEL_COMPILER 
  757    _Pragma(
"warning (push)")
 
  758    _Pragma(
"warning (disable:186)") 
 
  760                    if (x2y2z2 >= max2 || (!acc.probeValue(c, v) && (v < ValueT(0))))
 
  762#if defined __INTEL_COMPILER 
  763    _Pragma(
"warning (pop)")
 
  765                    if (x2y2z2 <= min2) {
 
  766                        acc.setValueOff(c, inside);
 
  771                    const ValueT d = Merge(
static_cast<SdfT
>(dx*(
math::Sqrt(x2y2z2)-R)), att);
 
  772                    if (d < v) acc.setValue(c, d);
 
  781    template <
bool IsMaskT = OutputIsMask>
 
  782    typename std::enable_if<IsMaskT, bool>::type
 
  783    makeSphere(
const Vec3R& p, 
Real r, 
const AttT& att, AccessorT& acc)
 
  797        const std::vector<CoordBBox> padding{
 
  798            CoordBBox(outLo.x(),  outLo.y(),  outLo.z(),  inLo.x()-1, outHi.y(),  outHi.z()),
 
  799            CoordBBox(inHi.x()+1, outLo.y(),  outLo.z(),  outHi.x(),  outHi.y(),  outHi.z()),
 
  800            CoordBBox(outLo.x(),  outLo.y(),  outLo.z(),  outHi.x(),  inLo.y()-1, outHi.z()),
 
  801            CoordBBox(outLo.x(),  inHi.y()+1, outLo.z(),  outHi.x(),  outHi.y(),  outHi.z()),
 
  802            CoordBBox(outLo.x(),  outLo.y(),  outLo.z(),  outHi.x(),  outHi.y(),  inLo.z()-1),
 
  803            CoordBBox(outLo.x(),  outLo.y(),  inHi.z()+1, outHi.x(),  outHi.y(),  outHi.z()),
 
  805        const ValueT onValue = Merge(SdfT(1), att);
 
  809        acc.tree().sparseFill(CoordBBox(inLo, inHi), onValue);
 
  812        for (
const auto& bbox: padding) {
 
  814                thread::cancelGroupExecution();
 
  817            const Coord &bmin = bbox.min(), &bmax = bbox.max();
 
  820            for (c = bmin, cx = c.x(); c.x() <= bmax.x(); ++c.x(), cx += 1) {
 
  822                for (c.y() = bmin.y(), cy = c.y(); c.y() <= bmax.y(); ++c.y(), cy += 1) {
 
  824                    for (c.z() = bmin.z(), cz = c.z(); c.z() <= bmax.z(); ++c.z(), cz += 1) {
 
  826                        if (x2y2z2 < rSquared) {
 
  827                            acc.setValue(c, onValue);
 
  836    using FuncType = 
typename std::function<void (Raster*, 
const tbb::blocked_range<size_t>&)>;
 
  838    template<
typename DisableType>
 
  839    typename std::enable_if<DisableType::value>::type
 
  840    getAtt(
size_t, AttT&)
 const {}
 
  842    template<
typename DisableType>
 
  843    typename std::enable_if<!DisableType::value>::type
 
  844    getAtt(
size_t n, AttT& a)
 const { mParticles.getAtt(n, a); }
 
  847    typename std::enable_if<std::is_same<T, ValueT>::value, ValueT>::type
 
  848    Merge(T s, 
const AttT&)
 const { 
return s; }
 
  851    typename std::enable_if<!std::is_same<T, ValueT>::value, ValueT>::type
 
  852    Merge(T s, 
const AttT& a)
 const { 
return ValueT(s,a); }
 
  854    ParticlesToLevelSetT& mParent;
 
  855    const ParticleListT&  mParticles;
 
  857    const math::MapBase&  mMap;
 
  858    size_t                mMinCount, mMaxCount;
 
  861    PointPartitionerT*    mPointPartitioner;
 
  869namespace p2ls_internal {
 
  875template<
typename VisibleT, 
typename BlindT>
 
  879    using type = VisibleT;
 
  880    using VisibleType = VisibleT;
 
  881    using BlindType = BlindT;
 
  884    explicit BlindData(VisibleT v) : mVisible(v), mBlind(
zeroVal<BlindType>()) {}
 
  885    BlindData(VisibleT v, BlindT b) : mVisible(v), mBlind(b) {}
 
  886    BlindData(
const BlindData&) = 
default;
 
  887    BlindData& operator=(
const BlindData&) = 
default;
 
  888    const VisibleT& visible()
 const { 
return mVisible; }
 
  889    const BlindT&   blind()
   const { 
return mBlind; }
 
  891    bool operator==(
const BlindData& rhs)
     const { 
return mVisible == rhs.mVisible; }
 
  893    bool operator< (
const BlindData& rhs)
     const { 
return mVisible <  rhs.mVisible; }
 
  894    bool operator> (
const BlindData& rhs)
     const { 
return mVisible >  rhs.mVisible; }
 
  895    BlindData 
operator+(
const BlindData& rhs)
 const { 
return BlindData(mVisible + rhs.mVisible); }
 
  896    BlindData 
operator-(
const BlindData& rhs)
 const { 
return BlindData(mVisible - rhs.mVisible); }
 
  897    BlindData 
operator-()
 const { 
return BlindData(-mVisible, mBlind); }
 
  906template<
typename VisibleT, 
typename BlindT>
 
  907inline std::ostream& 
operator<<(std::ostream& ostr, 
const BlindData<VisibleT, BlindT>& rhs)
 
  909    ostr << rhs.visible();
 
  915template<
typename VisibleT, 
typename BlindT>
 
  916inline BlindData<VisibleT, BlindT> 
Abs(
const BlindData<VisibleT, BlindT>& x)
 
  918    return BlindData<VisibleT, BlindT>(math::Abs(x.visible()), x.blind());
 
  923template<
typename VisibleT, 
typename BlindT, 
typename T>
 
  924inline BlindData<VisibleT, BlindT>
 
  925operator+(
const BlindData<VisibleT, BlindT>& x, 
const T& rhs)
 
  927    return BlindData<VisibleT, BlindT>(x.visible() + 
static_cast<VisibleT
>(rhs), x.blind());
 
  939template<
typename Gr
idT, 
typename ParticleListT, 
typename InterrupterT>
 
  943    static_assert(std::is_floating_point<typename GridT::ValueType>::value,
 
  944        "particlesToSdf requires an SDF grid with floating-point values");
 
  948            " try Grid::setGridClass(openvdb::GRID_LEVEL_SET)");
 
 
  956template<
typename Gr
idT, 
typename ParticleListT, 
typename InterrupterT>
 
  960    static_assert(std::is_floating_point<typename GridT::ValueType>::value,
 
  961        "particlesToSdf requires an SDF grid with floating-point values");
 
  965            " try Grid::setGridClass(openvdb::GRID_LEVEL_SET)");
 
 
  973template<
typename Gr
idT, 
typename ParticleListT, 
typename InterrupterT>
 
  977    static_assert(std::is_floating_point<typename GridT::ValueType>::value,
 
  978        "particleTrailsToSdf requires an SDF grid with floating-point values");
 
  982            " try Grid::setGridClass(openvdb::GRID_LEVEL_SET)");
 
 
  990template<
typename Gr
idT, 
typename ParticleListT, 
typename InterrupterT>
 
  994    static_assert(std::is_same<bool, typename GridT::ValueType>::value,
 
  995        "particlesToMask requires a boolean-valued grid");
 
 
 1001template<
typename Gr
idT, 
typename ParticleListT, 
typename InterrupterT>
 
 1005    static_assert(std::is_same<bool, typename GridT::ValueType>::value,
 
 1006        "particlesToMask requires a boolean-valued grid");
 
 
 1012template<
typename Gr
idT, 
typename ParticleListT, 
typename InterrupterT>
 
 1016    static_assert(std::is_same<bool, typename GridT::ValueType>::value,
 
 1017        "particleTrailsToMask requires a boolean-valued grid");
 
 
#define OPENVDB_ASSERT(X)
Definition Assert.h:41
Functions to efficiently perform various compositing operations on grids.
OPENVDB_API std::ostream & operator<<(std::ostream &os, half h)
Output h to os, formatted as a float.
A LeafManager manages a linear array of pointers to a given tree's leaf nodes, as well as optional au...
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
#define OPENVDB_NO_FP_EQUALITY_WARNING_END
Definition Math.h:49
#define OPENVDB_NO_FP_EQUALITY_WARNING_BEGIN
Definition Math.h:48
Spatially partitions points using a parallel radix-based sorting algorithm.
Defined various multi-threaded utility functions for trees.
Propagate the signs of distance values from the active voxels in the narrow band to the inactive valu...
Tag dispatch class that distinguishes shallow copy constructors from deep copy constructors.
Definition Types.h:680
Tag dispatch class that distinguishes topology copy constructors from deep copy constructors.
Definition Types.h:683
Signed (x, y, z) 32-bit integer coordinates.
Definition Coord.h:26
T length() const
Length of the vector.
Definition Vec3.h:201
Raster(ParticlesToLevelSetT &parent, GridT *grid, const ParticleListT &particles)
Main constructor.
Definition ParticlesToLevelSet.h:486
InterrupterT InterrupterType
Definition ParticlesToLevelSet.h:164
void rasterizeTrails(const ParticleListT &pa, Real delta=1.0)
Rasterize each particle as a trail comprising the CSG union of spheres of decreasing radius.
Definition ParticlesToLevelSet.h:346
void setRmax(Real Rmax)
Set the largest radius allowed in voxel units.
Definition ParticlesToLevelSet.h:225
void operator()(const tbb::blocked_range< size_t > &r)
Kick off the optionally multithreaded computation.
Definition ParticlesToLevelSet.h:568
ParticlesToLevelSet(SdfGridT &grid, InterrupterT *interrupt=nullptr)
Constructor using an existing boolean or narrow-band level set grid.
Definition ParticlesToLevelSet.h:294
Real getRmin() const
Return the smallest radius allowed in voxel units.
Definition ParticlesToLevelSet.h:218
PointPartitioner< Index32, LeafNodeT::LOG2DIM > PointPartitionerT
Definition ParticlesToLevelSet.h:479
void finalize(bool prune=false)
This method syncs up the level set and attribute grids and therefore needs to be called before any of...
Definition ParticlesToLevelSet.h:360
void rasterizeSpheres(const ParticleListT &pa, Real radius)
Rasterize each particle as a sphere with the particle's position and a fixed radius.
Definition ParticlesToLevelSet.h:332
void setGrainSize(int grainSize)
Set the grain size used for threading.
Definition ParticlesToLevelSet.h:240
static const bool DoAttrXfer
Definition ParticlesToLevelSet.h:483
Real getRmax() const
Return the largest radius allowed in voxel units.
Definition ParticlesToLevelSet.h:223
Raster(Raster &other, tbb::split)
Copy constructor called by tbb threads.
Definition ParticlesToLevelSet.h:500
Real getVoxelSize() const
Return the size of a voxel in world units.
Definition ParticlesToLevelSet.h:212
~ParticlesToLevelSet()
Definition ParticlesToLevelSet.h:194
Real getHalfWidth() const
Return the half-width of the narrow band in voxel units.
Definition ParticlesToLevelSet.h:215
size_t getMinCount() const
Return the number of particles that were ignored because they were smaller than the minimum radius.
Definition ParticlesToLevelSet.h:231
typename ParticlesToLevelSetT::SdfType SdfT
Definition ParticlesToLevelSet.h:473
typename GridT::TreeType TreeT
Definition ParticlesToLevelSet.h:477
void rasterizeSpheres(Real radius)
Definition ParticlesToLevelSet.h:536
typename SdfGridT::ValueType SdfType
Definition ParticlesToLevelSet.h:167
void rasterizeSpheres(const ParticleListT &pa)
Rasterize each particle as a sphere with the particle's position and radius.
Definition ParticlesToLevelSet.h:318
void join(Raster &other)
Required by tbb::parallel_reduce.
Definition ParticlesToLevelSet.h:577
typename TreeT::LeafNodeType LeafNodeT
Definition ParticlesToLevelSet.h:478
int getGrainSize() const
Return the grain size used for threading.
Definition ParticlesToLevelSet.h:237
AttGridType::Ptr attributeGrid()
Return a pointer to the grid containing the optional user-defined attribute.
Definition ParticlesToLevelSet.h:209
typename GridT::Accessor AccessorT
Definition ParticlesToLevelSet.h:476
bool ignoredParticles() const
Return true if any particles were ignored due to their size.
Definition ParticlesToLevelSet.h:228
void rasterizeTrails(Real delta=1.0)
Definition ParticlesToLevelSet.h:555
typename std::is_void< AttributeT >::type DisableT
Definition ParticlesToLevelSet.h:163
static const bool OutputIsMask
Definition ParticlesToLevelSet.h:172
typename std::conditional< DisableT::value, size_t, AttributeT >::type AttType
Definition ParticlesToLevelSet.h:169
void rasterizeSpheres()
Definition ParticlesToLevelSet.h:525
typename SdfGridT::template ValueConverter< AttType >::Type AttGridType
Definition ParticlesToLevelSet.h:170
virtual ~Raster()
Definition ParticlesToLevelSet.h:514
typename GridT::ValueType ValueT
Definition ParticlesToLevelSet.h:475
void setRmin(Real Rmin)
Set the smallest radius allowed in voxel units.
Definition ParticlesToLevelSet.h:220
typename ParticlesToLevelSetT::AttType AttT
Definition ParticlesToLevelSet.h:474
size_t getMaxCount() const
Return the number of particles that were ignored because they were larger than the maximum radius.
Definition ParticlesToLevelSet.h:234
SdfGridT SdfGridType
Definition ParticlesToLevelSet.h:166
This class manages a linear array of pointers to a given tree's leaf nodes, as well as optional auxil...
Definition LeafManager.h:86
void foreach(const LeafOp &op, bool threaded=true, size_t grainSize=1)
Threaded method that applies a user-supplied functor to each leaf node in the LeafManager.
Definition LeafManager.h:484
#define OPENVDB_LOG_WARN(message)
Log a warning message of the form 'someVar << "some text" << ...'.
Definition logging.h:256
OPENVDB_AX_API void run(const char *ax, openvdb::GridBase &grid, const AttributeBindings &bindings={})
Run a full AX pipeline (parse, compile and execute) on a single OpenVDB Grid.
bool operator==(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Equality operator, does exact floating point comparisons.
Definition Vec3.h:474
int Ceil(float x)
Return the ceiling of x.
Definition Math.h:856
float Sqrt(float x)
Return the square root of a floating-point value.
Definition Math.h:761
const Type & Max(const Type &a, const Type &b)
Return the maximum of two values.
Definition Math.h:595
Vec3< typename promote< T, Coord::ValueType >::type > operator-(const Vec3< T > &v0, const Coord &v1)
Allow a Coord to be subtracted from a Vec3.
Definition Coord.h:554
Vec3< typename promote< T, typename Coord::ValueType >::type > operator+(const Vec3< T > &v0, const Coord &v1)
Allow a Coord to be added to or subtracted from a Vec3.
Definition Coord.h:528
Coord Abs(const Coord &xyz)
Definition Coord.h:518
Type Pow2(Type x)
Return x2.
Definition Math.h:548
int Floor(float x)
Return the floor of x.
Definition Math.h:848
bool wasInterrupted(T *i, int percent=-1)
Definition NullInterrupter.h:49
Index32 Index
Definition Types.h:54
double Real
Definition Types.h:60
@ GRID_LEVEL_SET
Definition Types.h:455
constexpr T zeroVal()
Return the value of type T that corresponds to zero.
Definition Math.h:70
uint32_t Index32
Definition Types.h:52
math::Vec3< Real > Vec3R
Definition Types.h:72
Definition Exceptions.h:13
#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