Geogram  Version 1.9.1-rc
A programming library of geometric algorithms
GEO::OptimalTransportMap::Callback Class Reference

Base class for the callbacks executed for each intersection between a Laguerre cell and a simplex of the background mesh. More...

#include <exploragram/optimal_transport/optimal_transport.h>

Public Member Functions

 Callback (OptimalTransportMap *OTM)
 Callback constructor. More...
 
virtual ~Callback ()
 Callback destructor.
 
void set_Laguerre_centroids (double *mg)
 Sets where centroids should be output. More...
 
bool has_Laguerre_centroids () const
 Tests whether Laguerre centroids should be computed. More...
 
double * Laguerre_centroids ()
 Gets a pointer to the Laguerre centroids. More...
 
void set_w (const double *w, index_t n)
 Sets the weight vector. More...
 
void set_Newton_step (bool Newton)
 Specifies whether current step is a Newton step. More...
 
bool is_Newton_step () const
 Tests whether the current step is a Newton step. More...
 
void set_nb_threads (index_t nb)
 Specifies the number of threads. More...
 
void set_g (double *g)
 Specifies where the gradient should be stored. More...
 
void set_eval_F (bool x)
 Specifies whether the objective function should be evaluated. More...
 
double funcval () const
 Gets the computed value of the objective function. More...
 

Protected Attributes

OptimalTransportMapOTM_
 
bool weighted_
 
bool Newton_step_
 
bool eval_F_
 
vector< double > funcval_
 
index_t n_
 
const double * w_
 
double * g_
 
double * mg_
 

Detailed Description

Base class for the callbacks executed for each intersection between a Laguerre cell and a simplex of the background mesh.

Definition at line 612 of file optimal_transport.h.

Constructor & Destructor Documentation

◆ Callback()

GEO::OptimalTransportMap::Callback::Callback ( OptimalTransportMap OTM)
inline

Callback constructor.

Parameters
[in]OTMa pointer to the OptimalTransportMap

Definition at line 618 of file optimal_transport.h.

Member Function Documentation

◆ funcval()

double GEO::OptimalTransportMap::Callback::funcval ( ) const
inline

Gets the computed value of the objective function.

This sums the contributions of all threads.

Return values
thevalue of the objective function.

Definition at line 730 of file optimal_transport.h.

◆ has_Laguerre_centroids()

bool GEO::OptimalTransportMap::Callback::has_Laguerre_centroids ( ) const
inline

Tests whether Laguerre centroids should be computed.

Return values
trueif Laguerre centroids should be computed.
falseotherwise.

Definition at line 652 of file optimal_transport.h.

◆ is_Newton_step()

bool GEO::OptimalTransportMap::Callback::is_Newton_step ( ) const
inline

Tests whether the current step is a Newton step.

Return values
trueif the current step is a Newton step.
falseotherwise.

Definition at line 692 of file optimal_transport.h.

◆ Laguerre_centroids()

double* GEO::OptimalTransportMap::Callback::Laguerre_centroids ( )
inline

Gets a pointer to the Laguerre centroids.

Returns
a pointer to nb vertices * dimension doubles with the centroids of the Laguerre cells times the mass of the Laguerre cells.

Definition at line 662 of file optimal_transport.h.

◆ set_eval_F()

void GEO::OptimalTransportMap::Callback::set_eval_F ( bool  x)
inline

Specifies whether the objective function should be evaluated.

The Newton solver does not need evaluating the objective function, only the BFGS solver needs it.

Parameters
[in]xtrue if the objective function should be evaluated, false otherwise. Default is false.

Definition at line 721 of file optimal_transport.h.

◆ set_g()

void GEO::OptimalTransportMap::Callback::set_g ( double *  g)
inline

Specifies where the gradient should be stored.

Parameters
[in]ga pointer to an array of nb points doubles.

Definition at line 709 of file optimal_transport.h.

◆ set_Laguerre_centroids()

void GEO::OptimalTransportMap::Callback::set_Laguerre_centroids ( double *  mg)
inline

Sets where centroids should be output.

This computes mass times centroid. The mass can be retreived (and used to divide) from the gradient.

Parameters
[in]mga pointer to the dimension()*nb_points coordinates of the centroids times the mass of the Laguerre cells

Definition at line 643 of file optimal_transport.h.

◆ set_nb_threads()

void GEO::OptimalTransportMap::Callback::set_nb_threads ( index_t  nb)
inline

Specifies the number of threads.

This allocates one function value per thread.

Parameters
[in]nbthe number of threads.

Definition at line 701 of file optimal_transport.h.

◆ set_Newton_step()

void GEO::OptimalTransportMap::Callback::set_Newton_step ( bool  Newton)
inline

Specifies whether current step is a Newton step.

If it is a Newton step, then the Hessian is computed.

Parameters
[in]Newtontrue if the current step is a Newton step, false otherwise.

Definition at line 683 of file optimal_transport.h.

◆ set_w()

void GEO::OptimalTransportMap::Callback::set_w ( const double *  w,
index_t  n 
)
inline

Sets the weight vector.

Parameters
[in]wa const pointer to the weight vector.
[in]nthe number of weights in the weight vector.

Definition at line 671 of file optimal_transport.h.


The documentation for this class was generated from the following file: