Field3D
Sparse::SparseBlock Class Reference

Storage for one individual block of a SparseField. More...

#include <SparseField.h>

List of all members.

Public Member Functions

void clear ()
 Remove data.
Data_T & dataRef ()
 Returns reference to start of memory.
void resize (int n)
 Alloc data.
 SparseBlock ()
 Ctor.
Data_T & value (int i, int j, int k, int blockOrder)
 Gets the value of a given voxel.
const Data_T & value (int i, int j, int k, int blockOrder) const
 Gets the const 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.

Detailed Description

Storage for one individual block of a SparseField.


Constructor & Destructor Documentation

Sparse::SparseBlock::SparseBlock ( ) [inline]

Ctor.

Definition at line 90 of file SparseField.h.

    : isAllocated(false),
      emptyValue(static_cast<Data_T>(0))
  { /* Empty */ }

Member Function Documentation

Data_T& Sparse::SparseBlock::value ( int  i,
int  j,
int  k,
int  blockOrder 
) [inline]

Gets the value of a given voxel.

Note:
Bit shift should be ok, indices are always positive.

Definition at line 98 of file SparseField.h.

References data.

Referenced by SparseField::const_iterator::operator*(), SparseField::const_iterator::operator->(), SparseField::const_iterator::setupNextBlock(), SparseField::iterator::setupNextBlock(), SparseField::fastValue(), and SparseField::fastLValue().

  { return data[(k << blockOrder << blockOrder) + (j << blockOrder) + i]; }
const Data_T& Sparse::SparseBlock::value ( int  i,
int  j,
int  k,
int  blockOrder 
) const [inline]

Gets the const value of a given voxel.

Note:
Bit shift should be ok, indices are always positive.

Definition at line 104 of file SparseField.h.

References data.

  { return data[(k << blockOrder << blockOrder) + (j << blockOrder) + i]; }
void Sparse::SparseBlock::resize ( int  n) [inline]

Alloc data.

Definition at line 108 of file SparseField.h.

References data.

  { this->data.resize(n); }
void Sparse::SparseBlock::clear ( ) [inline]

Remove data.

Definition at line 112 of file SparseField.h.

References data.

Referenced by SparseField::deallocBlock().

  { std::vector<Data_T>().swap(data); }
Data_T& Sparse::SparseBlock::dataRef ( ) [inline]

Returns reference to start of memory.

Definition at line 116 of file SparseField.h.

References data.

  { return data[0]; }

Member Data Documentation

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::const_iterator::setupNextBlock(), SparseField::iterator::setupNextBlock(), SparseField::setBlockEmptyValue(), SparseField::fastValue(), SparseField::fastLValue(), and SparseField::deallocBlock().

std::vector<Data_T> Sparse::SparseBlock::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 value(), resize(), clear(), dataRef(), Sparse::CheckAllEqual::check(), Sparse::CheckMaxAbs::check(), and SparseField::fastLValue().


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