Sparse::CheckMaxAbs< Data_T > Struct Template Reference

Checks if all the absolute values in the SparseBlock are greater than some number. Useful for making narrow band levelsets Used by SparseField::releaseBlocks(). More...

`#include <SparseField.h>`

## Public Member Functions

bool | check (const SparseBlock< Data_T > &block, Data_T &retEmptyValue, const V3i &validSize, const V3i &blockSize)
| Checks whether a given block can be released. It's safe to assume that the block is allocated if this functor is called.
| CheckMaxAbs (Data_T maxValue)
| Constructor. Takes max value.

## Private Attributes

Data_T | m_maxValue

## Detailed Description

template<typename Data_T>
struct Sparse::CheckMaxAbs< Data_T >

Checks if all the absolute values in the SparseBlock are greater than some number. Useful for making narrow band levelsets Used by SparseField::releaseBlocks().

Definition at line 811 of file SparseField.h.

## Constructor & Destructor Documentation

## CheckMaxAbs()

template<typename Data_T>

Sparse::CheckMaxAbs< Data_T >::CheckMaxAbs | ( | Data_T | maxValue | ) |

inline

Constructor. Takes max value.

Definition at line 814 of file SparseField.h.

: m_maxValue(maxValue)
{ }
Sparse::CheckMaxAbs
Checks if all the absolute values in the SparseBlock are greater than some number....
Definition SparseField.h:812
Sparse::CheckMaxAbs::m_maxValue
Data_T m_maxValue
Definition SparseField.h:872

References m_maxValue.

## Member Function Documentation

## check()

template<typename Data_T>

bool Sparse::CheckMaxAbs< Data_T >::check | ( | const SparseBlock< Data_T > & | block,
|  | Data_T & | retEmptyValue,
|  | const V3i & | validSize,
|  | const V3i & | blockSize )

inline

Checks whether a given block can be released. It's safe to assume that the block is allocated if this functor is called.

Parameters

  block | Reference to the block to check
  retEmptyValue | If the block is to be removed, store the "empty value" that replaces it in this variable
  validSize | Number of voxels per dim within field data window
  blockSize | Number of voxels actually allocated per dim

Returns
  Whether or not the supplied block can be released.

Definition at line 825 of file SparseField.h.

{
// Store first value
Data_T first = block.data[0];
// Iterate over rest
bool allGreater = true;
size_t len = blockSize.x * blockSize.y * blockSize.z;
if (validSize == blockSize) {
// interior block so look at all voxels
for (size_t i = 0; i < len; i++) {
if (isAnyLess<Data_T>(block.data[i], m_maxValue)) {
allGreater = false;
break;
}
}
} else {
// only look at valid voxels
int x=0, y=0, z=0;
for (size_t i = 0; i < len; i++, x++) {
if (x >= blockSize.x) {
x = 0;
++y;
if (y >= blockSize.y) {
y = 0;
++z;
}
}
if (x >= validSize.x || y >= validSize.y || z >= validSize.z) {
continue;
}
if (isAnyLess<Data_T>(block.data[i], m_maxValue)) {
allGreater = false;
break;
}
}
} // end of interior block test
if (allGreater) {
retEmptyValue = first;
return true;
} else {
return false;
}
}

References Sparse::SparseBlock< Data_T >::data, Sparse::isAnyLess(), and m_maxValue.

## Member Data Documentation

## m_maxValue

template<typename Data_T>

Data_T Sparse::CheckMaxAbs< Data_T >::m_maxValue

private

Definition at line 872 of file SparseField.h.

Referenced by check(), and CheckMaxAbs().

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

- export/SparseField.h