HDK
openvdb::OPENVDB_VERSION_NAME::tools::poisson Namespace Reference

internal

## Classes

struct  DirichletBoundaryOp
Dirichlet boundary condition functor. More...

## Typedefs

using VIndex = Int32

using LaplacianMatrix = math::pcg::SparseStencilMatrix< double, 7 >
The type of a matrix used to represent a three-dimensional Laplacian operator. More...

## Functions

template<typename TreeType >
TreeType::Ptr solve (const TreeType &, math::pcg::State &, bool staggered=false)
Solve ∇2x = b for x, where b is a vector comprising the values of all of the active voxels in the input tree. More...

template<typename TreeType , typename Interrupter >
TreeType::Ptr solve (const TreeType &, math::pcg::State &, Interrupter &, bool staggered=false)
Solve ∇2x = b for x, where b is a vector comprising the values of all of the active voxels in the input tree. More...

template<typename TreeType , typename BoundaryOp , typename Interrupter >
TreeType::Ptr solveWithBoundaryConditions (const TreeType &, const BoundaryOp &, math::pcg::State &, Interrupter &, bool staggered=false)
Solve ∇2x = b for x with user-specified boundary conditions, where b is a vector comprising the values of all of the active voxels in the input tree or domain mask if provided. More...

template<typename PreconditionerType , typename TreeType , typename BoundaryOp , typename Interrupter >
TreeType::Ptr solveWithBoundaryConditionsAndPreconditioner (const TreeType &, const BoundaryOp &, math::pcg::State &, Interrupter &, bool staggered=false)
Solve ∇2x = b for x with user-specified boundary conditions, where b is a vector comprising the values of all of the active voxels in the input tree or domain mask if provided. More...

template<typename PreconditionerType , typename TreeType , typename DomainTreeType , typename BoundaryOp , typename Interrupter >
TreeType::Ptr solveWithBoundaryConditionsAndPreconditioner (const TreeType &, const DomainTreeType &, const BoundaryOp &, math::pcg::State &, Interrupter &, bool staggered=false)

Low-level functions
template<typename VIndexTreeType >
void populateIndexTree (VIndexTreeType &)
Overwrite each active voxel in the given scalar tree with a sequential index, starting from zero. More...

template<typename TreeType >
TreeType::template
ValueConverter< VIndex >
::Type::Ptr
createIndexTree (const TreeType &)
Iterate over the active voxels of the input tree and for each one assign its index in the iteration sequence to the corresponding voxel of an integer-valued output tree. More...

template<typename VectorValueType , typename SourceTreeType >
math::pcg::Vector
< VectorValueType >::Ptr
createVectorFromTree (const SourceTreeType &source, const typename SourceTreeType::template ValueConverter< VIndex >::Type &index)
Return a vector of the active voxel values of the scalar-valued source tree. More...

template<typename TreeValueType , typename VIndexTreeType , typename VectorValueType >
VIndexTreeType::template
ValueConverter< TreeValueType >
::Type::Ptr
createTreeFromVector (const math::pcg::Vector< VectorValueType > &values, const VIndexTreeType &index, const TreeValueType &background)
Return a tree with the same active voxel topology as the index tree but whose voxel values are taken from the the given vector. More...

template<typename BoolTreeType >
LaplacianMatrix::Ptr createISLaplacian (const typename BoolTreeType::template ValueConverter< VIndex >::Type &vectorIndexTree, const BoolTreeType &interiorMask, bool staggered=false)
Generate a sparse matrix of the index-space (Δx = 1) Laplacian operator using second-order finite differences. More...

template<typename BoolTreeType , typename BoundaryOp >
LaplacianMatrix::Ptr createISLaplacianWithBoundaryConditions (const typename BoolTreeType::template ValueConverter< VIndex >::Type &vectorIndexTree, const BoolTreeType &interiorMask, const BoundaryOp &boundaryOp, typename math::pcg::Vector< LaplacianMatrix::ValueType > &source, bool staggered=false)
Generate a sparse matrix of the index-space (Δx = 1) Laplacian operator with user-specified boundary conditions using second-order finite differences. More...

## Typedef Documentation

 using openvdb::OPENVDB_VERSION_NAME::tools::poisson::LaplacianMatrix = typedef math::pcg::SparseStencilMatrix

The type of a matrix used to represent a three-dimensional Laplacian operator.

Definition at line 82 of file PoissonSolver.h.

 using openvdb::OPENVDB_VERSION_NAME::tools::poisson::VIndex = typedef Int32

Definition at line 79 of file PoissonSolver.h.

## Function Documentation

template<typename TreeType >
 TreeType::template ValueConverter< VIndex >::Type::Ptr openvdb::OPENVDB_VERSION_NAME::tools::poisson::createIndexTree ( const TreeType & tree )
inline

Iterate over the active voxels of the input tree and for each one assign its index in the iteration sequence to the corresponding voxel of an integer-valued output tree.

Definition at line 350 of file PoissonSolver.h.

template<typename BoolTreeType >
 LaplacianMatrix::Ptr openvdb::OPENVDB_VERSION_NAME::tools::poisson::createISLaplacian ( const typename BoolTreeType::template ValueConverter< VIndex >::Type & vectorIndexTree, const BoolTreeType & interiorMask, bool staggered = `false` )
inline

Generate a sparse matrix of the index-space (Δx = 1) Laplacian operator using second-order finite differences.

This construction assumes homogeneous Dirichlet boundary conditions (exterior grid points are zero).

Definition at line 689 of file PoissonSolver.h.

template<typename BoolTreeType , typename BoundaryOp >
 LaplacianMatrix::Ptr openvdb::OPENVDB_VERSION_NAME::tools::poisson::createISLaplacianWithBoundaryConditions ( const typename BoolTreeType::template ValueConverter< VIndex >::Type & vectorIndexTree, const BoolTreeType & interiorMask, const BoundaryOp & boundaryOp, typename math::pcg::Vector< LaplacianMatrix::ValueType > & source, bool staggered = `false` )
inline

Generate a sparse matrix of the index-space (Δx = 1) Laplacian operator with user-specified boundary conditions using second-order finite differences.

Each thread gets its own copy of boundaryOp, which should be a functor of the form

struct BoundaryOp {
using ValueType = LaplacianMatrix::ValueType;
void operator()(
const Coord& ijk, // coordinates of a boundary voxel
const Coord& ijkNeighbor, // coordinates of an exterior neighbor of ijk
ValueType& source, // element of source vector corresponding to ijk
ValueType& diagonal // element of Laplacian matrix corresponding to ijk
) const;
};

The functor is called for each of the exterior neighbors of each boundary voxel , and it must specify a boundary condition for by modifying one or both of two provided values: an entry in the given source vector corresponding to and the weighting coefficient for in the Laplacian matrix.

Definition at line 702 of file PoissonSolver.h.

template<typename TreeValueType , typename VIndexTreeType , typename VectorValueType >
 VIndexTreeType::template ValueConverter< TreeValueType >::Type::Ptr openvdb::OPENVDB_VERSION_NAME::tools::poisson::createTreeFromVector ( const math::pcg::Vector< VectorValueType > & values, const VIndexTreeType & index, const TreeValueType & background )
inline

Return a tree with the same active voxel topology as the index tree but whose voxel values are taken from the the given vector.

The voxel whose value in the index tree is n gets assigned the nth element of the vector.

Parameters
 index a tree with value type VIndex that maps voxels to elements of values values a vector of values with which to populate the active voxels of the output tree background the value for the inactive voxels of the output tree

Definition at line 470 of file PoissonSolver.h.

template<typename VectorValueType , typename SourceTreeType >
 math::pcg::Vector< VectorValueType >::Ptr openvdb::OPENVDB_VERSION_NAME::tools::poisson::createVectorFromTree ( const SourceTreeType & source, const typename SourceTreeType::template ValueConverter< VIndex >::Type & index )
inline

Return a vector of the active voxel values of the scalar-valued source tree.

The nth element of the vector corresponds to the voxel whose value in the index tree is n.

Parameters
 source a tree with a scalar value type index a tree of the same configuration as source but with value type VIndex that maps voxels to elements of the output vector

Definition at line 414 of file PoissonSolver.h.

template<typename VIndexTreeType >
 void openvdb::OPENVDB_VERSION_NAME::tools::poisson::populateIndexTree ( VIndexTreeType & result )
inline

Overwrite each active voxel in the given scalar tree with a sequential index, starting from zero.

Definition at line 317 of file PoissonSolver.h.

template<typename TreeType >
 TreeType::Ptr openvdb::OPENVDB_VERSION_NAME::tools::poisson::solve ( const TreeType & inTree, math::pcg::State & state, bool staggered = `false` )
inline

Solve ∇2x = b for x, where b is a vector comprising the values of all of the active voxels in the input tree.

Returns
a new tree, with the same active voxel topology as the input tree, whose voxel values are the elements of the solution vector x.

On input, the State object should specify convergence criteria (minimum error and maximum number of iterations); on output, it gives the actual termination conditions.

The solution is computed using the conjugate gradient method with (where possible) incomplete Cholesky preconditioning, falling back to Jacobi preconditioning.

solveWithBoundaryConditions

Definition at line 739 of file PoissonSolver.h.

template<typename TreeType , typename Interrupter >
 TreeType::Ptr openvdb::OPENVDB_VERSION_NAME::tools::poisson::solve ( const TreeType & inTree, math::pcg::State & state, Interrupter & interrupter, bool staggered = `false` )
inline

Solve ∇2x = b for x, where b is a vector comprising the values of all of the active voxels in the input tree.

Returns
a new tree, with the same active voxel topology as the input tree, whose voxel values are the elements of the solution vector x.

On input, the State object should specify convergence criteria (minimum error and maximum number of iterations); on output, it gives the actual termination conditions.

The solution is computed using the conjugate gradient method with (where possible) incomplete Cholesky preconditioning, falling back to Jacobi preconditioning.

solveWithBoundaryConditions

Definition at line 748 of file PoissonSolver.h.

template<typename TreeType , typename BoundaryOp , typename Interrupter >
 TreeType::Ptr openvdb::OPENVDB_VERSION_NAME::tools::poisson::solveWithBoundaryConditions ( const TreeType & inTree, const BoundaryOp & boundaryOp, math::pcg::State & state, Interrupter & interrupter, bool staggered = `false` )
inline

Solve ∇2x = b for x with user-specified boundary conditions, where b is a vector comprising the values of all of the active voxels in the input tree or domain mask if provided.

Returns
a new tree, with the same active voxel topology as the input tree, whose voxel values are the elements of the solution vector x.

On input, the State object should specify convergence criteria (minimum error and maximum number of iterations); on output, it gives the actual termination conditions.

The solution is computed using the conjugate gradient method with the specified type of preconditioner (default: incomplete Cholesky), falling back to Jacobi preconditioning if necessary.

Each thread gets its own copy of the BoundaryOp, which should be a functor of the form

struct BoundaryOp {
using ValueType = LaplacianMatrix::ValueType;
void operator()(
const Coord& ijk, // coordinates of a boundary voxel
const Coord& ijkNeighbor, // coordinates of an exterior neighbor of ijk
ValueType& source, // element of b corresponding to ijk
ValueType& diagonal // element of Laplacian matrix corresponding to ijk
) const;
};

The functor is called for each of the exterior neighbors of each boundary voxel , and it must specify a boundary condition for by modifying one or both of two provided values: the entry in the source vector b corresponding to and the weighting coefficient for in the Laplacian operator matrix.

solve

Definition at line 757 of file PoissonSolver.h.

template<typename PreconditionerType , typename TreeType , typename BoundaryOp , typename Interrupter >
 TreeType::Ptr openvdb::OPENVDB_VERSION_NAME::tools::poisson::solveWithBoundaryConditionsAndPreconditioner ( const TreeType & inTree, const BoundaryOp & boundaryOp, math::pcg::State & state, Interrupter & interrupter, bool staggered = `false` )
inline

Solve ∇2x = b for x with user-specified boundary conditions, where b is a vector comprising the values of all of the active voxels in the input tree or domain mask if provided.

Returns
a new tree, with the same active voxel topology as the input tree, whose voxel values are the elements of the solution vector x.

On input, the State object should specify convergence criteria (minimum error and maximum number of iterations); on output, it gives the actual termination conditions.

The solution is computed using the conjugate gradient method with the specified type of preconditioner (default: incomplete Cholesky), falling back to Jacobi preconditioning if necessary.

Each thread gets its own copy of the BoundaryOp, which should be a functor of the form

struct BoundaryOp {
using ValueType = LaplacianMatrix::ValueType;
void operator()(
const Coord& ijk, // coordinates of a boundary voxel
const Coord& ijkNeighbor, // coordinates of an exterior neighbor of ijk
ValueType& source, // element of b corresponding to ijk
ValueType& diagonal // element of Laplacian matrix corresponding to ijk
) const;
};

The functor is called for each of the exterior neighbors of each boundary voxel , and it must specify a boundary condition for by modifying one or both of two provided values: the entry in the source vector b corresponding to and the weighting coefficient for in the Laplacian operator matrix.

solve

Definition at line 772 of file PoissonSolver.h.

template<typename PreconditionerType , typename TreeType , typename DomainTreeType , typename BoundaryOp , typename Interrupter >
 TreeType::Ptr openvdb::OPENVDB_VERSION_NAME::tools::poisson::solveWithBoundaryConditionsAndPreconditioner ( const TreeType & inTree, const DomainTreeType & domainMask, const BoundaryOp & boundaryOp, math::pcg::State & state, Interrupter & interrupter, bool staggered = `false` )
inline
Todo:
Is this really needed?
Todo:
if (state.success) ... ?
Todo:
Is this really needed?
Todo:
if (state.success) ... ?

Definition at line 790 of file PoissonSolver.h.