40#ifndef GEOGRAM_VORONOI_GENERIC_RVD_UTILS
41#define GEOGRAM_VORONOI_GENERIC_RVD_UTILS
91 const T&
top()
const {
92 return *rep_.rbegin();
99 return rep_.size() == 0;
145 return seed < rhs.seed;
254 insert(fs.seed, fs.f, conn_comp);
261 for(index_t i = 0; i <
nb_arrays(); ++i) {
264 for(index_t i = 0; i <
nb_arrays(); ++i) {
274 return index_t(keys_.size());
312 for(index_t i = 0; i < 32; i++) {
314 if((size & mask) != 0) {
320 result = result << 1;
331 signed_index_t
find_index(index_t array, index_t key)
const {
332 index_t* K = keys_[array];
333 for(index_t i = 0; i <
array_size(array); ++i) {
335 return signed_index_t(i);
349 signed_index_t
find_value(index_t array, index_t key)
const {
354 return signed_index_t(values_[array][i]);
363 void insert(index_t array, index_t key, index_t value) {
367 index_t i = size_[array];
370 index_t new_nb = index_t(2*i);
374 keys_[array] =
reinterpret_cast<index_t*
>(
375 realloc(keys_[array],
sizeof(index_t) * new_nb)
377 values_[array] =
reinterpret_cast<index_t*
>(
378 realloc(values_[array],
sizeof(index_t) * new_nb)
381 size_[array] = i + 1;
382 si = signed_index_t(i);
384 keys_[array][si] = key;
385 values_[array][si] = value;
389 std::vector<index_t*> keys_;
390 std::vector<index_t*> values_;
391 std::vector<index_t> size_;
Common include file, providing basic definitions. Should be included before anything else by all head...
Stores associations between (facet,seed) pairs and the index of a connected component.
void insert(index_t array, index_t key, index_t value)
Inserts a (key,value) pair into one of the arrays.
index_t array_size(index_t array) const
Gets the size of one of the arrays.
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.
signed_index_t find_value(index_t array, index_t key) const
Finds the value associated with a key in one of the arrays.
bool is_marked(const FacetSeed &fs) const
Tests whether a fiven FacetSeed is marked.
FacetSeedMarking(index_t, index_t nb_seeds)
Creates a new FacetSeedMarking.
signed_index_t get_connected_component(const FacetSeed &fs) const
Gets the index of the connected component associated with a given FacetSeed.
index_t array_capacity(index_t array) const
Gets the capacity of one of the arrays.
void mark(const FacetSeed &fs, index_t conn_comp)
Marks a FacetSeed and sets the associated connected component index.
index_t nb_arrays() const
Gets the number of arrays used internally.
~FacetSeedMarking()
FacetSeedMarking destructor.
bool is_marked(index_t facet, index_t seed) const
Tests whether a given facet,seed couple is marked.
void set_size(index_t nb_arrays)
Sets the number of arrays to be used.
A stack implemented in a GEO::vector.
const T & top() const
Gets the item on the top.
void pop()
Pops the top of the stack.
void push(const T &x)
Pushes a new item onto the stack.
bool empty() const
Tests whether the stack is empty.
Vector with aligned memory allocation.
Internal representation of polyhedra for GEO::GenericVoronoiDiagram.
Internal representation of polygons for GenericVoronoiDiagram.
std::stack< TetSeed > TetSeedStack
A stack of TetSeed.
std::stack< FacetSeed > FacetSeedStack
A stack of FacetSeed.
std::stack< index_t > SeedStack
A stack of seed indices (index_t).
Types and utilities for manipulating vertices in geometric and symbolic forms in restricted Voronoi d...
Types and functions for memory manipulation.
FacetSeed()
Creates a new uninitialized FacetSeed.
bool operator<(const FacetSeed &rhs) const
Compares two facet seeds using lexicographic order.
FacetSeed(index_t f_in, index_t seed_in)
Creates a new FacetSeed.