Main Page   Namespace List   Class Hierarchy   Compound List   File List   Header Files   Sources   Namespace Members   Compound Members   File Members  

total_energy_function Class Reference

A function giving the total energy of a set of constraints on point positions, as a function of those point positions. More...

#include <total_energy_function.h>

Class diagram for total_energy_function:

func::multi_dimensional_with_derivatives func::multi_dimensional

List of all members.


Public Members

 total_energy_function ( const double t )
The only constructur for a total_energy_function. More...

virtual ~total_energy_function (void)
virtual double operator() ( const vector<double> &x ) const
Calculate the function for a given value. More...

virtual void evaluate ( const vector<double> &x, double &f, vector<double> &gradient ) const
Calculate the function and its gradient for a given value. More...

double tol (void) const
Get the calculation tolerance. More...

unsigned n_vars (void) const
Get the dimensionality of the function. More...

vector<double> current_var (void) const
Convert the current corodinates of the points() to a vector suitable for energy computation by this function. More...

const vector< vector2 * >* points (void) const
The set of points for which this function calculates the energy.

const set< vector2 * >* fixed_points (void) const
Those points() that have fixed positions. More...

const vector< constraint * >* constraints (void) const
The set of constraints that determine the energy computed by this function.

void set_tol ( const double t )
Set the calculation tolerance. More...

void move_points ( const vector<double> & x ) const
Change the point positions, so they correspond to the coordinates stored in a given vector. More...


Friends

void assoc ( total_energy_function &f, const vector< vector2 *> &po, const set< vector2 *> &fp, const vector< constraint *> &co )
Associate a total_energy_function with points and constraints. More...


Detailed Description

A function giving the total energy of a set of constraints on point positions, as a function of those point positions.

The total energy is a measure of how well the constraints are satisifed.

The point positions are represented by a single vector, which contains the x and y coordinates of the points. The class provides member functions for converting the point positions to (the current_var() member function) and from (the move_points(vector<double>) member function) this vector form.

Definition at line 55 of file total_energy_function.h.


Member Function Documentation

total_energy_function::total_energy_function (const double t)

The only constructur for a total_energy_function.

Parameters:
t   the calculation tolerance to use

Preconditions:
 assert( 0 < t && t < 1 );

Postconditions:
 assert( this->tol() == t );
 assert( this->points() == 0 );
 assert( this->fixed_points() == 0 );
 assert( this->constraints() == 0 );

Definition at line 39 of file total_energy_function.cpp.

total_energy_function::~total_energy_function (void) [virtual]

Definition at line 63 of file total_energy_function.cpp.

double total_energy_function::operator() (const vector<double>& x) const [virtual]

Calculate the function for a given value.

Smaller values of the function indicate that the constraints are better met. The value of the function is equal to the sum of the energy contributes of each of the constraints().

Parameters:
x   the value for which the function is to be calculated; this indicates the positions of the constrained points, in the form of a single vector holding the point coordinates
Returns:
The value of the function for argument x, computed to an accuracy determined by tol().

Preconditions:
 assert( this->points() );
 assert( this->fixed_points() );
 assert( this->constraints() );
 assert( x.size() == this->n_vars() );

Reimplemented from func::multi_dimensional.

Definition at line 142 of file total_energy_function.cpp.

void total_energy_function::evaluate (const vector<double>& x, double & e, vector<double>& gradient) const [virtual]

Calculate the function and its gradient for a given value.

Smaller values of the function indicate that the constraints are better met. The value of the function is equal to the sum of the energy contributes of each of the constraints().

Parameters:
x   the value for which the function is to be calculated; this indicates the positions of the constrained points, in the form of a single vector holding the point coordinates
Return values:
f   the value of the function for argument x
gradient   the rate of change of f w.r.t. x

The computation accuracy is determined by tol().

Preconditions:
 assert( this->points() );
 assert( this->fixed_points() );
 assert( this->constraints() );
 assert( x.size() == this->n_vars() );

Reimplemented from func::multi_dimensional_with_derivatives.

Definition at line 162 of file total_energy_function.cpp.

double total_energy_function::tol (void) const [inline]

Get the calculation tolerance.

Returns:
the default calculation tolerance

Definition at line 287 of file total_energy_function.h.

unsigned total_energy_function::n_vars (void) const [inline]

Get the dimensionality of the function.

That is, the number of elements in the vector that this is a function of.

Preconditions:
 assert( this->points() );
 assert( this->fixed_points() );

Definition at line 294 of file total_energy_function.h.

vector<double> total_energy_function::current_var (void) const

Convert the current corodinates of the points() to a vector suitable for energy computation by this function.

Returns:
the vector

Preconditions:
 assert( this->points() );
 assert( this->fixed_points() );

Definition at line 217 of file total_energy_function.cpp.

const vector<vector2 *>* total_energy_function::points (void) const [inline]

The set of points for which this function calculates the energy.

Definition at line 304 of file total_energy_function.h.

const set<vector2 *>* total_energy_function::fixed_points (void) const [inline]

Those points() that have fixed positions.

These points do not have corresponding entries in the current_var() vector.

Definition at line 311 of file total_energy_function.h.

const vector<constraint *>* total_energy_function::constraints (void) const [inline]

The set of constraints that determine the energy computed by this function.

Definition at line 318 of file total_energy_function.h.

void total_energy_function::set_tol (const double t)

Set the calculation tolerance.

Preconditions:
 assert( 0 < t && t < 1 );

Pstonditions:
 assert( this->tol() == t );

Definition at line 70 of file total_energy_function.cpp.

void total_energy_function::move_points (const vector<double>& x) const

Change the point positions, so they correspond to the coordinates stored in a given vector.

Preconditions:
 assert( x.size() == this->n_vars() );

Postconditions:
 assert( this->current_var() == x );

Definition at line 248 of file total_energy_function.cpp.


Friends And Related Function Documentation

void assoc (total_energy_function & f, const vector<vector2 *>& po, const set<vector2 *>& fp, const vector<constraint *>& co) [friend]

Associate a total_energy_function with points and constraints.

Preconditions:
 assert( f.points() == 0 );
 assert( f.fixed_points() == 0 );
 assert( f.constraints() == 0 );
 assert( fp.size() <= po.size() );

Postconditions:
 assert( f.points() == &po );
 assert( f.fixed_points() == &fp );
 assert( f.constraints() == &co );

Definition at line 85 of file total_energy_function.h.


The documentation for this class was generated from the following files:
Generated at Sun Jul 14 20:38:21 2002 for Mapper by doxygen 1.0.0 written by Dimitri van Heesch, © 1997-1999