QuOc

 

Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes

aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType > Class Template Reference

A helper class for Chan Vese with multiple levelset functions. More...

#include <ChanVese.h>

List of all members.

Public Types

typedef ConfiguratorType::RealType RealType

Public Member Functions

void initValues (const typename ConfiguratorType::ElementType &El, const int QuadPoint)
 HeavisideFunctionProduct (const typename ConfiguratorType::InitType &Initializer, const HeavisideFunctionType &HeavisideFunction, const aol::MultiVector< RealType > &LevelsetFunctions)
 ~HeavisideFunctionProduct ()
 HeavisideFunctionProduct (const typename ConfiguratorType::InitType &Initializer, const HeavisideFunctionType &HeavisideFunction, const aol::MultiVector< RealType > &LevelsetFunctions, const typename ConfiguratorType::ElementType &El, const int QuadPoint)
 Note: Calling this constructor on every quad point will be slow!
 HeavisideFunctionProduct (const typename ConfiguratorType::InitType &Initializer, const HeavisideFunctionType &HeavisideFunction, const aol::MultiVector< RealType > &LevelsetFunctions, const typename ConfiguratorType::ElementType &El, const typename ConfiguratorType::VecType &RefCoord)
 Note: Calling this constructor on every quad point will be slow!
RealType f (const RealType x, const int b) const
RealType g (const RealType x, const int b) const
RealType evaluate (const aol::PowerSetIterator &Iterator) const
RealType evaluateSkippingOneComponent (const int ComponentToSkip, const aol::PowerSetIterator &Iterator) const
RealType evaluateSkippingOneComponentWithSign (const int ComponentToSkip, const aol::PowerSetIterator &Iterator) const
RealType evaluateSkippingTwoComponents (const int ComponentToSkipOne, const int ComponentToSkipTwo, const aol::PowerSetIterator &Iterator) const
RealType evaluateMixedSecondDerivativeForCEMModel (const int ComponentOne, const int ComponentTwo, const aol::PowerSetIterator &Iterator) const

Protected Types

typedef
HeavisideFunctionType::ScalingFunctionType 
ScalingFunctionType

Protected Member Functions

void initDiscrLevesetFunctionsVec (const typename ConfiguratorType::InitType &Initializer, const aol::MultiVector< RealType > &LevelsetFunctions)
 May only be called once! Calling it more than once will lead to memory leaks.

Protected Attributes

const HeavisideFunctionType & _heavisideFunction
const int _numLevelsetFunctions
aol::Vector< RealType_hOfPhiValues
vector
< aol::DiscreteFunctionDefault
< ConfiguratorType > * > 
_discrLevesetFunctionsVec

Detailed Description

template<typename ConfiguratorType, typename HeavisideFunctionType>
class aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType >

A helper class for Chan Vese with multiple levelset functions.

Has to be constructed (or initialized with initValues) for each point where you want to evaluate the product of the Heaviside funtions of the levelset functions.

Note: In a proper Chan Vese model evaluateDerivative is not necessary, but caching the necessary values for this function causes a noticeably performance hit. Terefore all code for this is commented out at the moment.

If HeavisideFunctionType::ScalingFunctionType is equal to IdentityFunction, this class fits to the classical Chan Vese model.

Author:
Berkels

Definition at line 1101 of file ChanVese.h.


Member Typedef Documentation

template<typename ConfiguratorType, typename HeavisideFunctionType>
typedef ConfiguratorType::RealType aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType >::RealType

Definition at line 1103 of file ChanVese.h.

template<typename ConfiguratorType, typename HeavisideFunctionType>
typedef HeavisideFunctionType::ScalingFunctionType aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType >::ScalingFunctionType [protected]

Definition at line 1105 of file ChanVese.h.


Constructor & Destructor Documentation

template<typename ConfiguratorType, typename HeavisideFunctionType>
aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType >::HeavisideFunctionProduct ( const typename ConfiguratorType::InitType &  Initializer,
const HeavisideFunctionType &  HeavisideFunction,
const aol::MultiVector< RealType > &  LevelsetFunctions 
) [inline]

Definition at line 1129 of file ChanVese.h.

References aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType >::initDiscrLevesetFunctionsVec().

  : _heavisideFunction( HeavisideFunction ),
    _numLevelsetFunctions( LevelsetFunctions.numComponents() ),
    _hOfPhiValues( _numLevelsetFunctions )//,
    //_hPrimeOfPhiValues( _numLevelsetFunctions )
  {
    initDiscrLevesetFunctionsVec ( Initializer, LevelsetFunctions );
  }

template<typename ConfiguratorType, typename HeavisideFunctionType>
aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType >::~HeavisideFunctionProduct (  )  [inline]
template<typename ConfiguratorType, typename HeavisideFunctionType>
aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType >::HeavisideFunctionProduct ( const typename ConfiguratorType::InitType &  Initializer,
const HeavisideFunctionType &  HeavisideFunction,
const aol::MultiVector< RealType > &  LevelsetFunctions,
const typename ConfiguratorType::ElementType &  El,
const int  QuadPoint 
) [inline]

Note: Calling this constructor on every quad point will be slow!

Definition at line 1145 of file ChanVese.h.

References aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType >::initDiscrLevesetFunctionsVec(), and aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType >::initValues().

  : _heavisideFunction( HeavisideFunction ),
    _numLevelsetFunctions( LevelsetFunctions.numComponents() ),
    _hOfPhiValues( _numLevelsetFunctions )//,
    //_hPrimeOfPhiValues( _numLevelsetFunctions )
  {
    initDiscrLevesetFunctionsVec ( Initializer, LevelsetFunctions );
    initValues ( El, QuadPoint );
  }

template<typename ConfiguratorType, typename HeavisideFunctionType>
aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType >::HeavisideFunctionProduct ( const typename ConfiguratorType::InitType &  Initializer,
const HeavisideFunctionType &  HeavisideFunction,
const aol::MultiVector< RealType > &  LevelsetFunctions,
const typename ConfiguratorType::ElementType &  El,
const typename ConfiguratorType::VecType &  RefCoord 
) [inline]

Note: Calling this constructor on every quad point will be slow!

Definition at line 1159 of file ChanVese.h.

References aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType >::_heavisideFunction, aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType >::_hOfPhiValues, aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType >::_numLevelsetFunctions, and aol::DiscreteFunctionDefault< ConfiguratorType >::evaluate().

  : _heavisideFunction( HeavisideFunction ),
    _numLevelsetFunctions( LevelsetFunctions.numComponents() ),
    _hOfPhiValues( _numLevelsetFunctions )//,
    //_hPrimeOfPhiValues( _numLevelsetFunctions )
  {
    for( int i = 0; i < _numLevelsetFunctions; i++ ){
      aol::DiscreteFunctionDefault<ConfiguratorType> discrFunc( Initializer, LevelsetFunctions[i] );
      const RealType phiValue = discrFunc.evaluate( El, RefCoord );
      _hOfPhiValues[i] = _heavisideFunction.evaluate( phiValue );
      //_hPrimeOfPhiValues[i] = _heavisideFunction.evaluateDerivative( phiValue );
    }
  }


Member Function Documentation

template<typename ConfiguratorType, typename HeavisideFunctionType>
RealType aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType >::evaluate ( const aol::PowerSetIterator Iterator  )  const [inline]
template<typename ConfiguratorType, typename HeavisideFunctionType>
RealType aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType >::evaluateMixedSecondDerivativeForCEMModel ( const int  ComponentOne,
const int  ComponentTwo,
const aol::PowerSetIterator Iterator 
) const [inline]

Definition at line 1227 of file ChanVese.h.

References aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType >::_hOfPhiValues, aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType >::evaluateSkippingTwoComponents(), aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType >::f(), and aol::PowerSetIterator::getComponent().

                                                                                                                                                 {
    const RealType sign1 = 2*(Iterator.getComponent(ComponentOne)-0.5f);
    const RealType sign2 = 2*(Iterator.getComponent(ComponentTwo)-0.5f);
    return ( sign1 * ScalingFunctionType::evaluateDerivative ( f( _hOfPhiValues[ComponentOne], Iterator.getComponent(ComponentOne) ) )
             * sign2 * ScalingFunctionType::evaluateDerivative ( f( _hOfPhiValues[ComponentTwo], Iterator.getComponent(ComponentTwo) ) )
             * evaluateSkippingTwoComponents( ComponentOne, ComponentTwo, Iterator ));
  }

template<typename ConfiguratorType, typename HeavisideFunctionType>
RealType aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType >::evaluateSkippingOneComponent ( const int  ComponentToSkip,
const aol::PowerSetIterator Iterator 
) const [inline]
template<typename ConfiguratorType, typename HeavisideFunctionType>
RealType aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType >::evaluateSkippingOneComponentWithSign ( const int  ComponentToSkip,
const aol::PowerSetIterator Iterator 
) const [inline]

ATTENTION: If ScalingFunctionType::evaluateDerivative doesn't always return one, evaluateSkippingOneComponentWithSign doesn't exactly do what the name suggests.

Definition at line 1214 of file ChanVese.h.

References aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType >::_hOfPhiValues, aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType >::evaluateSkippingOneComponent(), aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType >::f(), and aol::PowerSetIterator::getComponent().

                                                                                                                        {
    const RealType sign = 2*(Iterator.getComponent(ComponentToSkip)-0.5f);
    return (sign * ScalingFunctionType::evaluateDerivative ( f( _hOfPhiValues[ComponentToSkip], Iterator.getComponent(ComponentToSkip) ) ) * evaluateSkippingOneComponent( ComponentToSkip, Iterator ));
  }

template<typename ConfiguratorType, typename HeavisideFunctionType>
RealType aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType >::evaluateSkippingTwoComponents ( const int  ComponentToSkipOne,
const int  ComponentToSkipTwo,
const aol::PowerSetIterator Iterator 
) const [inline]
template<typename ConfiguratorType, typename HeavisideFunctionType>
RealType aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType >::f ( const RealType  x,
const int  b 
) const [inline]
template<typename ConfiguratorType, typename HeavisideFunctionType>
RealType aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType >::g ( const RealType  x,
const int  b 
) const [inline]

Helper function to decide whether to use "x" or "-x" without using an if statement. g(x,1) = x g(x,0) = -x

Definition at line 1189 of file ChanVese.h.

References aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType >::f().

                                                           { 
    return ( 2*(b-0.5f)*x );
  }

template<typename ConfiguratorType, typename HeavisideFunctionType>
void aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType >::initDiscrLevesetFunctionsVec ( const typename ConfiguratorType::InitType &  Initializer,
const aol::MultiVector< RealType > &  LevelsetFunctions 
) [inline, protected]
template<typename ConfiguratorType, typename HeavisideFunctionType>
void aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType >::initValues ( const typename ConfiguratorType::ElementType &  El,
const int  QuadPoint 
) [inline]

Member Data Documentation

template<typename ConfiguratorType, typename HeavisideFunctionType>
vector< aol::DiscreteFunctionDefault<ConfiguratorType>* > aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType >::_discrLevesetFunctionsVec [protected]
template<typename ConfiguratorType, typename HeavisideFunctionType>
const HeavisideFunctionType& aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType >::_heavisideFunction [protected]
template<typename ConfiguratorType, typename HeavisideFunctionType>
aol::Vector<RealType> aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType >::_hOfPhiValues [protected]
template<typename ConfiguratorType, typename HeavisideFunctionType>
const int aol::HeavisideFunctionProduct< ConfiguratorType, HeavisideFunctionType >::_numLevelsetFunctions [protected]

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

Generated on Fri Sep 9 2011 21:08:51 for QuocMesh by doxygen 1.7.1