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

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

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

Type of vectors.

Public Functions Documentation

function New

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

Factory method for creating instances.

function evaluate

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

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

function EnergyB

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

function energy

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

Reimplements: shapeworks::VectorFunction::energy

function evaluate

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

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

inline virtual void after_iteration() override

This method is called by a solver after each iteration.

Reimplements: shapeworks::VectorFunction::after_iteration

function before_iteration

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

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

inline virtual void set_domain_number(
    unsigned int i
) override

Reimplements: shapeworks::VectorFunction::set_domain_number

function set_function_a

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

function get_function_a

inline std::shared_ptr< VectorFunction > get_function_a()

function get_function_b

inline std::shared_ptr< VectorFunction > get_function_b()

function set_function_b

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

function set_a_on

inline void set_a_on()

Turn each term on and off.

function set_a_off

inline void set_a_off()

function set_a_on

inline void set_a_on(
    bool s
)

function get_a_on

inline bool get_a_on() const

function set_b_on

inline void set_b_on()

function set_b_off

inline void set_b_off()

function set_b_on

inline void set_b_on(
    bool s
)

function get_b_on

inline bool get_b_on() const

function set_relative_energy_scaling

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

inline virtual double get_relative_energy_scaling() const override

Reimplements: shapeworks::VectorFunction::get_relative_energy_scaling

function set_relative_gradient_scaling

inline void set_relative_gradient_scaling(
    double r
)

function get_relative_gradient_scaling

inline double get_relative_gradient_scaling() const

function get_average_grad_mag_a

inline double get_average_grad_mag_a() const

function get_average_grad_mag_b

inline double get_average_grad_mag_b() const

function get_average_energy_a

inline double get_average_energy_a() const

function get_average_energy_b

inline double get_average_energy_b() const

function clone

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

Reimplements: shapeworks::VectorFunction::clone

function DualVectorFunction

inline DualVectorFunction()

function ~DualVectorFunction

~DualVectorFunction() override =default

Protected Functions Documentation

function DualVectorFunction

DualVectorFunction(
    const DualVectorFunction & 
) =delete

function operator=

DualVectorFunction & operator=(
    const DualVectorFunction & 
) =delete

Public Attributes Documentation

variable VDimension

static constexpr static int VDimension = 3;

variable Dimension

static constexpr static unsigned int Dimension = VDimension;

Protected Attributes Documentation

variable a_on_

bool a_on_;

variable b_on_

bool b_on_;

variable relative_gradient_scaling_

double relative_gradient_scaling_;

variable relative_energy_scaling_

double relative_energy_scaling_;

variable average_grad_mag_a_

double average_grad_mag_a_;

variable average_grad_mag_b_

double average_grad_mag_b_;

variable average_energy_a_

double average_energy_a_;

variable average_energy_b_

double average_energy_b_;

variable counter_

double counter_;

variable function_a_

std::shared_ptr< VectorFunction > function_a_;

variable function_b_

std::shared_ptr< VectorFunction > function_b_;

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