Skip to content

shapeworks::DualVectorFunction

More...

#include <DualVectorFunction.h>

Inherits from shapeworks::VectorFunction

Public Types

Name
using VectorFunction::VectorType VectorType
Type of vectors.

Public Functions

Name
std::shared_ptr< DualVectorFunction > New()
Factory method for creating instances.
virtual VectorType evaluate(unsigned int idx, unsigned int d, const ParticleSystem * system, double & maxmove) const override
double EnergyA(unsigned int idx, unsigned int d, const ParticleSystem * system) const
virtual double EnergyB(unsigned int idx, unsigned int d, const ParticleSystem * system) const
virtual double energy(unsigned int idx, unsigned int d, const ParticleSystem * system) const
virtual VectorType evaluate(unsigned int idx, unsigned int d, const ParticleSystem * system, double & maxmove, double & energy) const
virtual void before_evaluate(unsigned int , unsigned int , const ParticleSystem * )
virtual void after_iteration() override
This method is called by a solver after each iteration.
virtual void before_iteration() override
This method is called by a solver before each iteration.
virtual void set_particle_system(ParticleSystem * p) override
Some subclasses may require a pointer to the particle system and its domain number.
virtual void set_domain_number(unsigned int i) override
void set_function_a(std::shared_ptr< VectorFunction > o)
std::shared_ptr< VectorFunction > get_function_a()
std::shared_ptr< VectorFunction > get_function_b()
void set_function_b(std::shared_ptr< VectorFunction > o)
void set_a_on()
Turn each term on and off.
void set_a_off()
void set_a_on(bool s)
bool get_a_on() const
void set_b_on()
void set_b_off()
void set_b_on(bool s)
bool get_b_on() const
virtual void set_relative_energy_scaling(double r) override
The relative scaling scales the gradient B relative to A. By default this value is 1.0.
virtual double get_relative_energy_scaling() const override
void set_relative_gradient_scaling(double r)
double get_relative_gradient_scaling() const
double get_average_grad_mag_a() const
double get_average_grad_mag_b() const
double get_average_energy_a() const
double get_average_energy_b() const
virtual std::shared_ptr< VectorFunction > clone() override
DualVectorFunction()
~DualVectorFunction() override =default

Protected Functions

Name
DualVectorFunction(const DualVectorFunction & ) =delete
DualVectorFunction & operator=(const DualVectorFunction & ) =delete

Public Attributes

Name
constexpr static int VDimension
constexpr static unsigned int Dimension

Protected Attributes

Name
bool a_on_
bool b_on_
double relative_gradient_scaling_
double relative_energy_scaling_
double average_grad_mag_a_
double average_grad_mag_b_
double average_energy_a_
double average_energy_b_
double counter_
std::shared_ptr< VectorFunction > function_a_
std::shared_ptr< VectorFunction > function_b_

Additional inherited members

Public Functions inherited from shapeworks::VectorFunction

Name
virtual void reset_buffers()
May be called by the solver class.
virtual ParticleSystem * get_particle_system() const
virtual int get_domain_number() const
virtual ~VectorFunction() =default
Virtual destructor for proper cleanup of derived classes.

Protected Functions inherited from shapeworks::VectorFunction

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

Protected Attributes inherited from shapeworks::VectorFunction

Name
ParticleSystem * particle_system_
unsigned int domain_number_

Detailed Description

cpp class shapeworks::DualVectorFunction;

This class combines the results of evaluating 2 VectorFunction and presents the interface of a single function evaluation. Optionally, only the first function can be used by calling SetLinkOff().

Public Types Documentation

using VectorType

cpp using shapeworks::DualVectorFunction::VectorType = VectorFunction::VectorType;

Type of vectors.

Public Functions Documentation

function New

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

Factory method for creating instances.

function evaluate

cpp inline virtual VectorType evaluate( unsigned int idx, unsigned int d, const ParticleSystem * system, double & maxmove ) 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 EnergyA

cpp inline double EnergyA( unsigned int idx, unsigned int d, const ParticleSystem * system ) const

function EnergyB

cpp inline virtual double EnergyB( unsigned int idx, unsigned int d, const ParticleSystem * system ) const

function energy

cpp inline virtual double energy( unsigned int idx, unsigned int d, const ParticleSystem * system ) const

Reimplements: shapeworks::VectorFunction::energy

function evaluate

cpp inline virtual VectorType evaluate( unsigned int idx, unsigned int d, const ParticleSystem * system, double & maxmove, double & energy ) const

Reimplements: shapeworks::VectorFunction::evaluate

function before_evaluate

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

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 after_iteration

cpp inline virtual void after_iteration() override

This method is called by a solver after each iteration.

Reimplements: shapeworks::VectorFunction::after_iteration

function before_iteration

cpp inline virtual void before_iteration() override

This method is called by a solver before each iteration.

Reimplements: shapeworks::VectorFunction::before_iteration

function set_particle_system

cpp inline virtual void set_particle_system( ParticleSystem * p ) override

Some subclasses may require a pointer to the particle system and its domain number.

Reimplements: shapeworks::VectorFunction::set_particle_system

function set_domain_number

cpp inline virtual void set_domain_number( unsigned int i ) override

Reimplements: shapeworks::VectorFunction::set_domain_number

function set_function_a

cpp inline void set_function_a( std::shared_ptr< VectorFunction > o )

function get_function_a

cpp inline std::shared_ptr< VectorFunction > get_function_a()

function get_function_b

cpp inline std::shared_ptr< VectorFunction > get_function_b()

function set_function_b

cpp inline void set_function_b( std::shared_ptr< VectorFunction > o )

function set_a_on

cpp inline void set_a_on()

Turn each term on and off.

function set_a_off

cpp inline void set_a_off()

function set_a_on

cpp inline void set_a_on( bool s )

function get_a_on

cpp inline bool get_a_on() const

function set_b_on

cpp inline void set_b_on()

function set_b_off

cpp inline void set_b_off()

function set_b_on

cpp inline void set_b_on( bool s )

function get_b_on

cpp inline bool get_b_on() const

function set_relative_energy_scaling

cpp inline virtual void set_relative_energy_scaling( double r ) override

The relative scaling scales the gradient B relative to A. By default this value is 1.0.

Reimplements: shapeworks::VectorFunction::set_relative_energy_scaling

function get_relative_energy_scaling

cpp inline virtual double get_relative_energy_scaling() const override

Reimplements: shapeworks::VectorFunction::get_relative_energy_scaling

function set_relative_gradient_scaling

cpp inline void set_relative_gradient_scaling( double r )

function get_relative_gradient_scaling

cpp inline double get_relative_gradient_scaling() const

function get_average_grad_mag_a

cpp inline double get_average_grad_mag_a() const

function get_average_grad_mag_b

cpp inline double get_average_grad_mag_b() const

function get_average_energy_a

cpp inline double get_average_energy_a() const

function get_average_energy_b

cpp inline double get_average_energy_b() const

function clone

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

Reimplements: shapeworks::VectorFunction::clone

function DualVectorFunction

cpp inline DualVectorFunction()

function ~DualVectorFunction

cpp ~DualVectorFunction() override =default

Protected Functions Documentation

function DualVectorFunction

cpp DualVectorFunction( const DualVectorFunction & ) =delete

function operator=

cpp DualVectorFunction & operator=( const DualVectorFunction & ) =delete

Public Attributes Documentation

variable VDimension

cpp static constexpr static int VDimension = 3;

variable Dimension

cpp static constexpr static unsigned int Dimension = VDimension;

Protected Attributes Documentation

variable a_on_

cpp bool a_on_;

variable b_on_

cpp bool b_on_;

variable relative_gradient_scaling_

cpp double relative_gradient_scaling_;

variable relative_energy_scaling_

cpp double relative_energy_scaling_;

variable average_grad_mag_a_

cpp double average_grad_mag_a_;

variable average_grad_mag_b_

cpp double average_grad_mag_b_;

variable average_energy_a_

cpp double average_energy_a_;

variable average_energy_b_

cpp double average_energy_b_;

variable counter_

cpp double counter_;

variable function_a_

cpp std::shared_ptr< VectorFunction > function_a_;

variable function_b_

cpp std::shared_ptr< VectorFunction > function_b_;


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