ViennaLS
Loading...
Searching...
No Matches
viennals::CalculateNormalVectors< T, D > Class Template Reference

This algorithm is used to compute the normal vectors for all points with level set values <= maxValue (default 0.5). The result is saved in the lsPointData of the lsDomain and can be retrieved with lsDomain.getPointData().getVectorData("Normals"). More...

#include <lsCalculateNormalVectors.hpp>

Public Member Functions

 CalculateNormalVectors ()=default
 CalculateNormalVectors (SmartPointer< Domain< T, D > > passedLevelSet, T passedMaxValue=DEFAULT_MAX_VALUE)
void setLevelSet (SmartPointer< Domain< T, D > > passedLevelSet)
void setMaxValue (const T passedMaxValue)
SmartPointer< Domain< T, D > > getLevelSet () const
T getMaxValue () const
bool hasNormalVectors () const
 Check if normal vectors are already calculated for the level set.
void apply ()

Static Public Attributes

static constexpr char normalVectorsLabel [] = "Normals"

Detailed Description

template<class T, int D>
class viennals::CalculateNormalVectors< T, D >

This algorithm is used to compute the normal vectors for all points with level set values <= maxValue (default 0.5). The result is saved in the lsPointData of the lsDomain and can be retrieved with lsDomain.getPointData().getVectorData("Normals").

The algorithm uses central differences to compute gradients and normalizes them to unit vectors. Since neighbors in each cartesian direction are necessary for the calculation, the level set width must be >= (maxValue * 4)

  • 1. If the level set width is insufficient, it will be automatically expanded.

The calculation is parallelized using OpenMP across level set segments. Normal vectors are computed using finite differences and normalized to unit length. Points with zero gradient magnitude are assigned zero normal vectors.

Constructor & Destructor Documentation

◆ CalculateNormalVectors() [1/2]

template<class T, int D>
viennals::CalculateNormalVectors< T, D >::CalculateNormalVectors ( )
default

◆ CalculateNormalVectors() [2/2]

template<class T, int D>
viennals::CalculateNormalVectors< T, D >::CalculateNormalVectors ( SmartPointer< Domain< T, D > > passedLevelSet,
T passedMaxValue = DEFAULT_MAX_VALUE )
inline

Member Function Documentation

◆ apply()

template<class T, int D>
void viennals::CalculateNormalVectors< T, D >::apply ( )
inline

◆ getLevelSet()

template<class T, int D>
SmartPointer< Domain< T, D > > viennals::CalculateNormalVectors< T, D >::getLevelSet ( ) const
inline

◆ getMaxValue()

template<class T, int D>
T viennals::CalculateNormalVectors< T, D >::getMaxValue ( ) const
inline

◆ hasNormalVectors()

template<class T, int D>
bool viennals::CalculateNormalVectors< T, D >::hasNormalVectors ( ) const
inline

Check if normal vectors are already calculated for the level set.

◆ setLevelSet()

template<class T, int D>
void viennals::CalculateNormalVectors< T, D >::setLevelSet ( SmartPointer< Domain< T, D > > passedLevelSet)
inline

◆ setMaxValue()

template<class T, int D>
void viennals::CalculateNormalVectors< T, D >::setMaxValue ( const T passedMaxValue)
inline

Member Data Documentation

◆ normalVectorsLabel

template<class T, int D>
char viennals::CalculateNormalVectors< T, D >::normalVectorsLabel[] = "Normals"
staticconstexpr

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