Geogram  Version 1.9.1-rc
A programming library of geometric algorithms
GEOGen::FacetSeedMarking Class Reference

Stores associations between (facet,seed) pairs and the index of a connected component. More...

#include <geogram/voronoi/generic_RVD_utils.h>

Public Member Functions

 FacetSeedMarking (index_t, index_t nb_seeds)
 Creates a new FacetSeedMarking. More...
 
bool is_marked (index_t facet, index_t seed) const
 Tests whether a given facet,seed couple is marked.
 
bool is_marked (const FacetSeed &fs) const
 Tests whether a fiven FacetSeed is marked.
 
signed_index_t get_connected_component (const FacetSeed &fs) const
 Gets the index of the connected component associated with a given FacetSeed.
 
void mark (const FacetSeed &fs, index_t conn_comp)
 Marks a FacetSeed and sets the associated connected component index.
 
 ~FacetSeedMarking ()
 FacetSeedMarking destructor.
 

Protected Member Functions

index_t nb_arrays () const
 Gets the number of arrays used internally.
 
void set_size (index_t nb_arrays)
 Sets the number of arrays to be used. More...
 
index_t array_size (index_t array) const
 Gets the size of one of the arrays. More...
 
index_t array_capacity (index_t array) const
 Gets the capacity of one of the arrays. More...
 
signed_index_t find_index (index_t array, index_t key) const
 Finds the index of one of the keys in one of the arrays. More...
 
signed_index_t find_value (index_t array, index_t key) const
 Finds the value associated with a key in one of the arrays. More...
 
void insert (index_t array, index_t key, index_t value)
 Inserts a (key,value) pair into one of the arrays. More...
 

Detailed Description

Stores associations between (facet,seed) pairs and the index of a connected component.

Used by GEOGen::RestrictedVoronoiDiagram. The implementation uses an array of (key,value) vectors, with dynamic reallocation and linear search. Experimentally, this significantly reduces the memory footprint and execution time as compared to std::table<FacetSeed,index_t>.

Definition at line 217 of file generic_RVD_utils.h.

Constructor & Destructor Documentation

◆ FacetSeedMarking()

GEOGen::FacetSeedMarking::FacetSeedMarking ( index_t  ,
index_t  nb_seeds 
)
inline

Creates a new FacetSeedMarking.

Parameters
[in]nb_seedstotal number of seeds

Definition at line 223 of file generic_RVD_utils.h.

Member Function Documentation

◆ array_capacity()

index_t GEOGen::FacetSeedMarking::array_capacity ( index_t  array) const
inlineprotected

Gets the capacity of one of the arrays.

It corresponds with the power of two immediately greater than size. Unlike in std::vector, capacity is implicitly retrieved from size (this saves one integer per seed).

Parameters
[in]arrayindex of the array
Precondition
array < nb_arrays()

Definition at line 305 of file generic_RVD_utils.h.

◆ array_size()

index_t GEOGen::FacetSeedMarking::array_size ( index_t  array) const
inlineprotected

Gets the size of one of the arrays.

Parameters
[in]arrayindex of the array
Precondition
array < nb_arrays()

Definition at line 292 of file generic_RVD_utils.h.

◆ find_index()

signed_index_t GEOGen::FacetSeedMarking::find_index ( index_t  array,
index_t  key 
) const
inlineprotected

Finds the index of one of the keys in one of the arrays.

Parameters
[in]arrayindex of the array
[in]keythe query key
Returns
the index of key in array or -1 if not found

Definition at line 331 of file generic_RVD_utils.h.

◆ find_value()

signed_index_t GEOGen::FacetSeedMarking::find_value ( index_t  array,
index_t  key 
) const
inlineprotected

Finds the value associated with a key in one of the arrays.

Parameters
[in]arrayindex of the array
[in]keythe query key
Returns
the value associated with key in array or -1 if not found.

Definition at line 349 of file generic_RVD_utils.h.

◆ insert()

void GEOGen::FacetSeedMarking::insert ( index_t  array,
index_t  key,
index_t  value 
)
inlineprotected

Inserts a (key,value) pair into one of the arrays.

Parameters
[in]arrayindex of the array
[in]keythe key
[in]valuethe value to be associated with key

Definition at line 363 of file generic_RVD_utils.h.

◆ set_size()

void GEOGen::FacetSeedMarking::set_size ( index_t  nb_arrays)
inlineprotected

Sets the number of arrays to be used.

Parameters
[in]nb_arraysnumber of arrays

Definition at line 281 of file generic_RVD_utils.h.


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