Geogram  Version 1.9.1-rc
A programming library of geometric algorithms
GEO::IntegrationSimplex Class Referenceabstract

Computes an objective function and its gradient over a restricted Voronoi diagram. More...

#include <geogram/voronoi/integration_simplex.h>

Inheritance diagram for GEO::IntegrationSimplex:
GEO::Counted

Public Member Functions

 ~IntegrationSimplex () override
 IntegrationSimplex destructor.
 
virtual double eval (index_t center_vertex_index, const GEOGen::Vertex &v0, const GEOGen::Vertex &v1, const GEOGen::Vertex &v2, index_t t, index_t t_adj=index_t(-1), index_t v_adj=index_t(-1))=0
 Computes the contribution of a given integration simplex to the function and its gradient. An integration simplex is obtained as the intersection between a Voronoi cell and a triangle or tetrahedron of a background mesh. More...
 
void set_points_and_gradient (coord_index_t dimension, index_t nb_points, const double *points, double *g, Process::SpinLockArray *spinlocks=nullptr)
 Sets the input points and the location where the computed gradient will be stored. More...
 
bool volumetric () const
 Tests whether this IntegrationSimplex is volumetric. More...
 
bool background_mesh_has_varying_attribute () const
 Specifies whether the background mesh has varying attributes used in the computation. More...
 
virtual void reset_thread_local_storage ()
 Before starting computation, resets thread local storage variables. More...
 
- Public Member Functions inherited from GEO::Counted
void ref () const
 Increments the reference count. More...
 
void unref () const
 Decrements the reference count. More...
 
bool is_shared () const
 Check if the object is shared. More...
 
int nb_refs () const
 Gets the number of references that point to this object. More...
 

Protected Member Functions

 IntegrationSimplex (const Mesh &mesh, bool volumetric, index_t nb_frames, index_t nb_comp_per_frame, const double *frames)
 Constructs a new IntegrationSimplex. More...
 
const double * point (index_t i) const
 Gets a point by index. More...
 
const double * frame (index_t i) const
 Gets a frame by index. More...
 
- Protected Member Functions inherited from GEO::Counted
 Counted ()
 Creates a reference counted object. More...
 
virtual ~Counted ()
 Destroys a reference counted object. More...
 

Protected Attributes

const Meshmesh_
 
bool volumetric_
 
index_t nb_points_
 
index_t points_stride_
 
const double * points_
 
double * g_
 
index_t nb_frames_
 
index_t nb_comp_per_frame_
 
const double * frames_
 
Process::SpinLockArrayspinlocks_
 
bool varying_background_
 

Additional Inherited Members

- Static Public Member Functions inherited from GEO::Counted
static void ref (const Counted *counted)
 Increments the reference count. More...
 
static void unref (const Counted *counted)
 Decrements the reference count. More...
 

Detailed Description

Computes an objective function and its gradient over a restricted Voronoi diagram.

This function can be used by CentroidalVoronoiTesselation and its variants to optimize the placement of points by minimizing an objective function. Sub-classing this class makes it possible to define new objective functions.

Definition at line 72 of file integration_simplex.h.

Constructor & Destructor Documentation

◆ IntegrationSimplex()

GEO::IntegrationSimplex::IntegrationSimplex ( const Mesh mesh,
bool  volumetric,
index_t  nb_frames,
index_t  nb_comp_per_frame,
const double *  frames 
)
protected

Constructs a new IntegrationSimplex.

Parameters
[in]meshthe mesh
[in]volumetrictrue if volumetric, false if surfacic
[in]nb_framesnumber of frames, typically number of elements of the background mesh
[in]nb_comp_per_framenumber of components per frame, 3 for 3-axis anisotropy, 1 for vector anisotropy.
[in]framesa const pointer to the array of 3*nb_frames*nb_comp_per_frame of frame coordinates.

Member Function Documentation

◆ background_mesh_has_varying_attribute()

bool GEO::IntegrationSimplex::background_mesh_has_varying_attribute ( ) const
inline

Specifies whether the background mesh has varying attributes used in the computation.

The RestrictedVoronoiDiagram class computes the intersection between a Voronoi diagram and a background mesh. If the triangles or tetrahedra of this background mesh have a property that varies on each triangle / tetrahedron, then the intersection between the Voronoi cells and each individual triangle / tetrahedron is computed. Default mode is constant, subclasses may override.

Return values
trueif the background mesh has varying attributes
falseotherwise

Definition at line 173 of file integration_simplex.h.

◆ eval()

virtual double GEO::IntegrationSimplex::eval ( index_t  center_vertex_index,
const GEOGen::Vertex v0,
const GEOGen::Vertex v1,
const GEOGen::Vertex v2,
index_t  t,
index_t  t_adj = index_t(-1),
index_t  v_adj = index_t(-1) 
)
pure virtual

Computes the contribution of a given integration simplex to the function and its gradient. An integration simplex is obtained as the intersection between a Voronoi cell and a triangle or tetrahedron of a background mesh.

Parameters
[in]center_vertex_indexindex of the first vertex of the integration simplex, that corresponds to one of the vertices of the Delaunay triangulation
[in]v0second vertex of the integration simplex, in both geometric and symbolic forms
[in]v1third vertex of the integration simplex, in both geometric and symbolic forms
[in]v2fourth vertex of the integration simplex, in both geometric and symbolic forms
[in]tthe triangle or tetrahedron of the background mesh
[in]t_adjthe background mesh tetrahedron adjacent to this integration simplex accros (v0, v1, v2) or index_t(-1) if no such tetrahedron exists.
[in]v_adjif (v0, v1, v2) is supported by a bisector, the index of the other extremity of the bisector, else index_t(-1)

◆ frame()

const double* GEO::IntegrationSimplex::frame ( index_t  i) const
inlineprotected

Gets a frame by index.

Parameters
[in]iindex of the frame
Returns
a const pointer to the nb_components_per_frame coordinates of the frame

Definition at line 224 of file integration_simplex.h.

◆ point()

const double* GEO::IntegrationSimplex::point ( index_t  i) const
inlineprotected

Gets a point by index.

Parameters
[in]iindex of the point
Returns
a const pointer to the coordinates of the point

Definition at line 213 of file integration_simplex.h.

◆ reset_thread_local_storage()

virtual void GEO::IntegrationSimplex::reset_thread_local_storage ( )
virtual

Before starting computation, resets thread local storage variables.

RestrictedVoronoiDiagram can operate in multi-threading mode. Some derived classes may need to reset some thread local storage variables before starting each thread.

◆ set_points_and_gradient()

void GEO::IntegrationSimplex::set_points_and_gradient ( coord_index_t  dimension,
index_t  nb_points,
const double *  points,
double *  g,
Process::SpinLockArray spinlocks = nullptr 
)
inline

Sets the input points and the location where the computed gradient will be stored.

This function needs to be called once per evaluation of the objective function, before evaluating the contribution of the simplices with eval().

Parameters
[in]dimensionnumber of coordinates of the points, or number of doubles between two consecutive points
[in]nb_pointsnumber of points
[in]pointsa const pointer to the contiguous array of coordinates of the points
[out]ga pointer to the components of the gradient of the objective function
[in]spinlocksa pointer to the spinlocks array to be used in multithreading mode, or nullptr in single-threaded mode

Definition at line 130 of file integration_simplex.h.

◆ volumetric()

bool GEO::IntegrationSimplex::volumetric ( ) const
inline

Tests whether this IntegrationSimplex is volumetric.

A volumetric IntegrationSimplex is meant to be computed over the Voronoi cells restricted to the tetrahedra of the mesh. A surfacic one is meant to be computed over the Voronoi cells restricted to the facets of the mesh.

Return values
trueif this IntegrationSimplex is volumetric
falseotherwise (surfacic)

Definition at line 153 of file integration_simplex.h.


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