Field3D
|
Storage for one individual block of a SparseField. More...
#include <SparseField.h>
Public Member Functions | |
void | clear () |
Remove data. | |
Data_T & | dataRef () |
Returns reference to start of memory. | |
void | resize (int n) |
Alloc data. | |
SparseBlock () | |
Ctor. | |
const Data_T & | value (int i, int j, int k, int blockOrder) const |
Gets the const value of a given voxel. | |
Data_T & | value (int i, int j, int k, int blockOrder) |
Gets the value of a given voxel. | |
Public Attributes | |
std::vector< Data_T > | data |
Container for this block's data. It's either size 0 or size m_blockSize^3. | |
Data_T | emptyValue |
The value to use if the block isn't allocated. We allow setting this per block so that we for example can have different inside/outside values when storing narrow-band levelsets. | |
bool | isAllocated |
Whether the block is allocated or not. |
Storage for one individual block of a SparseField.
Definition at line 85 of file SparseField.h.
Sparse::SparseBlock< Data_T >::SparseBlock | ( | ) | [inline] |
Ctor.
Definition at line 90 of file SparseField.h.
: isAllocated(false), emptyValue(static_cast<Data_T>(0)) { /* Empty */ }
Data_T& Sparse::SparseBlock< Data_T >::value | ( | int | i, |
int | j, | ||
int | k, | ||
int | blockOrder | ||
) | [inline] |
Gets the value of a given voxel.
Definition at line 98 of file SparseField.h.
References Sparse::SparseBlock< Data_T >::data.
Referenced by SparseField< Data_T >::fastLValue(), SparseField< Data_T >::fastValue(), SparseField< Data_T >::const_iterator::operator*(), SparseField< Data_T >::const_iterator::operator->(), SparseField< Data_T >::iterator::setupNextBlock(), and SparseField< Data_T >::const_iterator::setupNextBlock().
{ return data[(k << blockOrder << blockOrder) + (j << blockOrder) + i]; }
const Data_T& Sparse::SparseBlock< Data_T >::value | ( | int | i, |
int | j, | ||
int | k, | ||
int | blockOrder | ||
) | const [inline] |
Gets the const value of a given voxel.
Definition at line 104 of file SparseField.h.
References Sparse::SparseBlock< Data_T >::data.
{ return data[(k << blockOrder << blockOrder) + (j << blockOrder) + i]; }
void Sparse::SparseBlock< Data_T >::resize | ( | int | n | ) | [inline] |
Alloc data.
Definition at line 108 of file SparseField.h.
References Sparse::SparseBlock< Data_T >::data.
{ this->data.resize(n); }
void Sparse::SparseBlock< Data_T >::clear | ( | ) | [inline] |
Remove data.
Definition at line 112 of file SparseField.h.
References Sparse::SparseBlock< Data_T >::data.
Referenced by SparseField< Data_T >::deallocBlock().
{ std::vector<Data_T>().swap(data); }
Data_T& Sparse::SparseBlock< Data_T >::dataRef | ( | ) | [inline] |
Returns reference to start of memory.
Definition at line 116 of file SparseField.h.
References Sparse::SparseBlock< Data_T >::data.
{ return data[0]; }
bool Sparse::SparseBlock< Data_T >::isAllocated |
Whether the block is allocated or not.
Definition at line 122 of file SparseField.h.
Referenced by SparseField< Data_T >::blockIsAllocated(), SparseField< Data_T >::deallocBlock(), SparseField< Data_T >::fastLValue(), SparseField< Data_T >::fastValue(), SparseField< Data_T >::setBlockEmptyValue(), SparseField< Data_T >::iterator::setupNextBlock(), and SparseField< Data_T >::const_iterator::setupNextBlock().
Data_T Sparse::SparseBlock< Data_T >::emptyValue |
The value to use if the block isn't allocated. We allow setting this per block so that we for example can have different inside/outside values when storing narrow-band levelsets.
Definition at line 127 of file SparseField.h.
Referenced by SparseField< Data_T >::deallocBlock(), SparseField< Data_T >::fastLValue(), SparseField< Data_T >::fastValue(), SparseField< Data_T >::setBlockEmptyValue(), SparseField< Data_T >::iterator::setupNextBlock(), and SparseField< Data_T >::const_iterator::setupNextBlock().
std::vector<Data_T> Sparse::SparseBlock< Data_T >::data |
Container for this block's data. It's either size 0 or size m_blockSize^3.
Definition at line 130 of file SparseField.h.
Referenced by Sparse::CheckMaxAbs< Data_T >::check(), Sparse::CheckAllEqual< Data_T >::check(), Sparse::SparseBlock< Data_T >::clear(), Sparse::SparseBlock< Data_T >::dataRef(), SparseField< Data_T >::fastLValue(), Sparse::SparseBlock< Data_T >::resize(), and Sparse::SparseBlock< Data_T >::value().