Geogram
Version 1.9.1
A programming library of geometric algorithms
|
An array of cell status codes associates to each tetrahedron in a Delaunay tetrahedralization. More...
#include <geogram/delaunay/delaunay_sync.h>
Public Types | |
typedef uint8_t | thread_index_t |
typedef uint8_t | cell_status_t |
Public Member Functions | |
CellStatusArray () | |
Creates an empty CellStatusArray. | |
CellStatusArray (index_t size_in) | |
Creates a CellStatusArray. More... | |
~CellStatusArray () | |
CellStatusArray destructor. More... | |
CellStatusArray (const CellStatusArray &rhs)=delete | |
Forbids copy. | |
CellStatusArray & | operator= (const CellStatusArray &rhs)=delete |
Forbids copy. | |
cell_status_t | acquire_cell (index_t cell, cell_status_t status) |
Tentatively acquires a cell. More... | |
void | release_cell (index_t cell) |
Releases a cell. More... | |
cell_status_t | cell_thread (index_t cell) const |
Gets the thread that acquired a cell. More... | |
bool | cell_is_marked_as_conflict (index_t cell) const |
Tests whether a cell is marked as conflict. More... | |
void | mark_cell_as_conflict (index_t cell) |
Marks a cell as conflict. More... | |
void | set_cell_status (index_t cell, cell_status_t status) |
Sets the status of a cell. More... | |
void | resize (index_t size_in, index_t capacity_in) |
Resizes this CellStatusArray. More... | |
void | resize (index_t size_in) |
Resizes this CellStatusArray. More... | |
void | reserve (index_t new_capacity) |
Reserves additional space. More... | |
void | grow () |
Increases the size of the array for one additional element. More... | |
index_t | size () const |
Gets the size of this CellStatusArray. More... | |
void | clear () |
Clears this CellStatusArray. More... | |
Static Public Attributes | |
static constexpr cell_status_t | FREE_CELL = 127 |
static constexpr cell_status_t | THREAD_MASK = 127 |
static constexpr cell_status_t | CONFLICT_MASK = 128 |
static constexpr index_t | MAX_THREADS = index_t(THREAD_MASK)-1 |
An array of cell status codes associates to each tetrahedron in a Delaunay tetrahedralization.
Each item can be atomically accessed to implement fine-grained resource control in a multithreaded context. It is used to memorize for each tetrahedron the thread that owns it as well as a couple of flags.
Definition at line 68 of file delaunay_sync.h.
|
inline |
Creates a CellStatusArray.
[in] | size_in | number of cells in the CellStatusArray |
Definition at line 97 of file delaunay_sync.h.
|
inline |
CellStatusArray destructor.
It is illegal to destroy a CellStatusArray if
Definition at line 108 of file delaunay_sync.h.
|
inline |
Tentatively acquires a cell.
[in] | cell | the index of the cell |
[in] | status | the status to be written in the cell if acquisition is successful, that is, if the current status of the cell is FREE_CELL |
cell
otherwise. Definition at line 131 of file delaunay_sync.h.
|
inline |
Tests whether a cell is marked as conflict.
[in] | cell | the cell |
true | if cell is marked as conflict |
false | otherwise |
Definition at line 176 of file delaunay_sync.h.
|
inline |
Gets the thread that acquired a cell.
[in] | cell | the cell |
Definition at line 161 of file delaunay_sync.h.
|
inline |
Clears this CellStatusArray.
Deallocates all memory
Definition at line 287 of file delaunay_sync.h.
|
inline |
Increases the size of the array for one additional element.
capacity is doubled each time additional space is needed
Definition at line 266 of file delaunay_sync.h.
|
inline |
Marks a cell as conflict.
[in] | cell | the cell |
Definition at line 191 of file delaunay_sync.h.
|
inline |
Releases a cell.
[in] | cell | the index of the cell |
Definition at line 150 of file delaunay_sync.h.
|
inline |
Reserves additional space.
[in] | new_capacity | on exit, this CellStatusArray will have at least sufficient space for new_capacity elements without needing to reallocate. Size is not modified. Operates like its std::vector counterpart. |
Definition at line 256 of file delaunay_sync.h.
|
inline |
Resizes this CellStatusArray.
[in] | size_in | number of cells |
Definition at line 245 of file delaunay_sync.h.
Resizes this CellStatusArray.
[in] | size_in | number of cells |
[in] | capacity_in | total number of allocated cells |
capacity_in
>= size_in
and no concurrent thread is currently running Definition at line 217 of file delaunay_sync.h.
|
inline |
Sets the status of a cell.
[in] | cell | the index of the cell |
uses relaxed memory ordering
Definition at line 205 of file delaunay_sync.h.
|
inline |
Gets the size of this CellStatusArray.
Definition at line 278 of file delaunay_sync.h.