Skip to content

shapeworks::SamplingFunction

More...

#include <SamplingFunction.h>

Inherits from shapeworks::VectorFunction

Public Types

Name
using vnl_vector_fixed< double, 3 > VectorType
using ParticleSystem::PointType PointType
using vnl_vector_fixed< float, 3 > GradientVectorType
using GenericContainerArray< double > SigmaCacheType

Public Functions

Name
std::shared_ptr< SamplingFunction > New()
Factory method for creating instances.
virtual VectorType evaluate(unsigned int , unsigned int , const ParticleSystem * , double & maxtimestep) const override
virtual VectorType evaluate(unsigned int , unsigned int , const ParticleSystem * , double & , double & ) const override
virtual void before_evaluate(unsigned int , unsigned int , const ParticleSystem * ) override
virtual double energy(unsigned int a, unsigned int b, const ParticleSystem * c) const override
double EstimateSigma(unsigned int idx, unsigned int dom, const shapeworks::ParticleDomain * domain, const PointType & pos, double initial_sigma, double precision, int & err, double & avg_kappa) const
void SetSharedBoundaryWeight(double w)
double GetSharedBoundaryWeight() const
void SetSharedBoundaryEnabled(bool enabled)
bool GetSharedBoundaryEnabled() const
void SetSamplingScale(bool enabled)
bool GetSamplingScale() const
void SetSamplingAutoScale(bool auto_scale)
bool GetSamplingAutoScale() const
void SetSamplingScaleValue(double scale_value)
double GetSamplingScaleValue() const
void SetSpatialSigmaCache(SigmaCacheType * s)
SigmaCacheType * GetSpatialSigmaCache()
const SigmaCacheType * GetSpatialSigmaCache() const
void SetMinimumNeighborhoodRadius(double s)
double GetMinimumNeighborhoodRadius() const
void SetMaximumNeighborhoodRadius(double s)
double GetMaximumNeighborhoodRadius() const
void SetFlatCutoff(double s)
double GetFlatCutoff() const
void SetNeighborhoodToSigmaRatio(double s)
double GetNeighborhoodToSigmaRatio() const
virtual void reset_buffers() override
May be called by the solver class.
virtual std::shared_ptr< VectorFunction > clone() override
SamplingFunction()
~SamplingFunction() override =default

Public Attributes

Name
constexpr static int VDimension

Additional inherited members

Public Functions inherited from shapeworks::VectorFunction

Name
virtual void after_iteration()
This method is called by a solver after each iteration.
virtual void before_iteration()
This method is called by a solver before each iteration.
virtual void set_particle_system(ParticleSystem * p)
Some subclasses may require a pointer to the particle system and its domain number.
virtual ParticleSystem * get_particle_system() const
virtual void set_domain_number(unsigned int i)
virtual int get_domain_number() const
virtual double get_relative_energy_scaling() const
virtual void set_relative_energy_scaling(double r)
virtual ~VectorFunction() =default
Virtual destructor for proper cleanup of derived classes.

Protected Functions inherited from shapeworks::VectorFunction

Name
VectorFunction()
VectorFunction(const VectorFunction & ) =delete

Public Attributes inherited from shapeworks::VectorFunction

Name
constexpr static unsigned int Dimension

Protected Attributes inherited from shapeworks::VectorFunction

Name
ParticleSystem * particle_system_
unsigned int domain_number_

Detailed Description

cpp class shapeworks::SamplingFunction;

This function is responsible for the sampling term of the optimization. E.g. the repulsion force between particles on a single shape

Public Types Documentation

using VectorType

cpp using shapeworks::SamplingFunction::VectorType = vnl_vector_fixed<double, 3>;

using PointType

cpp using shapeworks::SamplingFunction::PointType = ParticleSystem::PointType;

using GradientVectorType

cpp using shapeworks::SamplingFunction::GradientVectorType = vnl_vector_fixed<float, 3>;

using SigmaCacheType

cpp using shapeworks::SamplingFunction::SigmaCacheType = GenericContainerArray<double>;

Public Functions Documentation

function New

cpp static inline std::shared_ptr< SamplingFunction > New()

Factory method for creating instances.

function evaluate

cpp inline virtual VectorType evaluate( unsigned int , unsigned int , const ParticleSystem * , double & maxtimestep ) const override

Reimplements: shapeworks::VectorFunction::evaluate

The first argument is a pointer to the particle system. The second argument is the index of the domain within that particle system. The third argument is the index of the particle location within the given domain.

function evaluate

cpp virtual VectorType evaluate( unsigned int , unsigned int , const ParticleSystem * , double & , double & ) const override

Reimplements: shapeworks::VectorFunction::evaluate

function before_evaluate

cpp virtual void before_evaluate( unsigned int , unsigned int , const ParticleSystem * ) override

Reimplements: shapeworks::VectorFunction::before_evaluate

This method may be called to set up the state of the function object before a call to evaluate. It is necessary in order to initialize certain constants and variables that may be used for calculating the energy as well as the gradients. Typically this is only necessary for the adaptive gradient descent algorithm.

function energy

cpp inline virtual double energy( unsigned int a, unsigned int b, const ParticleSystem * c ) const override

Reimplements: shapeworks::VectorFunction::energy

function EstimateSigma

cpp double EstimateSigma( unsigned int idx, unsigned int dom, const shapeworks::ParticleDomain * domain, const PointType & pos, double initial_sigma, double precision, int & err, double & avg_kappa ) const

Estimate the best sigma for Parzen windowing in a given neighborhood. The best sigma is the sigma that maximizes probability at the given point

function SetSharedBoundaryWeight

cpp inline void SetSharedBoundaryWeight( double w )

function GetSharedBoundaryWeight

cpp inline double GetSharedBoundaryWeight() const

function SetSharedBoundaryEnabled

cpp inline void SetSharedBoundaryEnabled( bool enabled )

function GetSharedBoundaryEnabled

cpp inline bool GetSharedBoundaryEnabled() const

function SetSamplingScale

cpp inline void SetSamplingScale( bool enabled )

function GetSamplingScale

cpp inline bool GetSamplingScale() const

function SetSamplingAutoScale

cpp inline void SetSamplingAutoScale( bool auto_scale )

function GetSamplingAutoScale

cpp inline bool GetSamplingAutoScale() const

function SetSamplingScaleValue

cpp inline void SetSamplingScaleValue( double scale_value )

function GetSamplingScaleValue

cpp inline double GetSamplingScaleValue() const

function SetSpatialSigmaCache

cpp inline void SetSpatialSigmaCache( SigmaCacheType * s )

Access the cache of sigma values for each particle position. This cache is populated by registering this object as an observer of the correct particle system (see SetParticleSystem).

function GetSpatialSigmaCache

cpp inline SigmaCacheType * GetSpatialSigmaCache()

function GetSpatialSigmaCache

cpp inline const SigmaCacheType * GetSpatialSigmaCache() const

function SetMinimumNeighborhoodRadius

cpp inline void SetMinimumNeighborhoodRadius( double s )

Minimum radius of the neighborhood of points that are considered in the calculation. The neighborhood is a spherical radius in 3D space. The actual radius used in a calculation may exceed this value, but will not exceed the MaximumNeighborhoodRadius.

function GetMinimumNeighborhoodRadius

cpp inline double GetMinimumNeighborhoodRadius() const

function SetMaximumNeighborhoodRadius

cpp inline void SetMaximumNeighborhoodRadius( double s )

Maximum radius of the neighborhood of points that are considered in the calculation. The neighborhood is a spherical radius in 3D space.

function GetMaximumNeighborhoodRadius

cpp inline double GetMaximumNeighborhoodRadius() const

function SetFlatCutoff

cpp inline void SetFlatCutoff( double s )

Numerical parameters

function GetFlatCutoff

cpp inline double GetFlatCutoff() const

function SetNeighborhoodToSigmaRatio

cpp inline void SetNeighborhoodToSigmaRatio( double s )

function GetNeighborhoodToSigmaRatio

cpp inline double GetNeighborhoodToSigmaRatio() const

function reset_buffers

cpp inline virtual void reset_buffers() override

May be called by the solver class.

Reimplements: shapeworks::VectorFunction::reset_buffers

function clone

cpp virtual std::shared_ptr< VectorFunction > clone() override

Reimplements: shapeworks::VectorFunction::clone

function SamplingFunction

cpp inline SamplingFunction()

function ~SamplingFunction

cpp ~SamplingFunction() override =default

Public Attributes Documentation

variable VDimension

cpp static constexpr static int VDimension = 3;


Updated on 2026-03-31 at 16:02:10 +0000