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 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

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

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

using PointType

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

using GradientVectorType

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

using SigmaCacheType

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

Public Functions Documentation

function New

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

Factory method for creating instances.

function evaluate

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

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

Reimplements: shapeworks::VectorFunction::evaluate

function before_evaluate

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

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

Reimplements: shapeworks::VectorFunction::energy

function EstimateSigma

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

inline void SetSharedBoundaryWeight(
    double w
)

function GetSharedBoundaryWeight

inline double GetSharedBoundaryWeight() const

function SetSharedBoundaryEnabled

inline void SetSharedBoundaryEnabled(
    bool enabled
)

function GetSharedBoundaryEnabled

inline bool GetSharedBoundaryEnabled() const

function SetSpatialSigmaCache

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

inline SigmaCacheType * GetSpatialSigmaCache()

function GetSpatialSigmaCache

inline const SigmaCacheType * GetSpatialSigmaCache() const

function SetMinimumNeighborhoodRadius

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

inline double GetMinimumNeighborhoodRadius() const

function SetMaximumNeighborhoodRadius

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

inline double GetMaximumNeighborhoodRadius() const

function SetFlatCutoff

inline void SetFlatCutoff(
    double s
)

Numerical parameters

function GetFlatCutoff

inline double GetFlatCutoff() const

function SetNeighborhoodToSigmaRatio

inline void SetNeighborhoodToSigmaRatio(
    double s
)

function GetNeighborhoodToSigmaRatio

inline double GetNeighborhoodToSigmaRatio() const

function reset_buffers

inline virtual void reset_buffers() override

May be called by the solver class.

Reimplements: shapeworks::VectorFunction::reset_buffers

function clone

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

Reimplements: shapeworks::VectorFunction::clone

function SamplingFunction

inline SamplingFunction()

function ~SamplingFunction

~SamplingFunction() override =default

Public Attributes Documentation

variable VDimension

static constexpr static int VDimension = 3;

Updated on 2025-12-17 at 23:05:25 +0000