lib/src/Workshop/NormalDerivative.cpp
// Evaluate derivatives of the normal of an IFSlicer class
Evaluate derivatives of the normal of an IFSlicer class
Evaluate derivatives of the normal of an IFSlicer class
Real NormalDerivative<GLOBALDIM>::evaluate(const IvDim               & a_multiIndex,
                                           const int                 & a_direction,
                                           const RvDim               & a_point,
                                           const IFSlicer<GLOBALDIM> * a_implicitFunction)
{
  DerivativeProduct gradientComponent;
  gradientComponent[BASISV_TM<int,GLOBALDIM>(a_direction)] = 1;
  int magnitudeOfGradientPower = 1;
  PartialDerivativeTerm normalComponent(gradientComponent,
                                        magnitudeOfGradientPower);
  m_magnitudeOfGradient = 0.0;
  for (int idir = 0; idir < GLOBALDIM; idir++)
  {
    Real firstPartial = a_implicitFunction->value(BASISV_TM<int,GLOBALDIM>(idir),a_point);
    m_magnitudeOfGradient += firstPartial*firstPartial;
  }
  m_magnitudeOfGradient = sqrt(m_magnitudeOfGradient);
  Real value = expand(a_multiIndex,
                      normalComponent,
                      a_point,
                      a_implicitFunction);
  return value;
}
Real NormalDerivative < GLOBALDIM > :: evaluate ( const IvDim & a_multiIndex , const int & a_direction , const RvDim & a_point , const IFSlicer < GLOBALDIM > * a_implicitFunction ) { DerivativeProduct gradientComponent ; gradientComponent [ BASISV_TM < int , GLOBALDIM > ( a_direction ) ] = 1 ; int magnitudeOfGradientPower = 1 ; PartialDerivativeTerm normalComponent ( gradientComponent , magnitudeOfGradientPower ) ; m_magnitudeOfGradient = 0.0 ; for ( int idir = 0 ; idir < GLOBALDIM ; idir ++ ) { Real firstPartial = a_implicitFunction -> value ( BASISV_TM < int , GLOBALDIM > ( idir ) , a_point ) ; m_magnitudeOfGradient += firstPartial * firstPartial ; } m_magnitudeOfGradient = sqrt ( m_magnitudeOfGradient ) ; Real value = expand ( a_multiIndex , normalComponent , a_point , a_implicitFunction ) ; return value ; }
Evaluate derivatives of the normal of an IFSlicer class
Evaluate derivatives of the normal of an IFSlicer class
// This is the numerator of the "a_direction" component of the normal, i.e. // the "a_direction" component of the gradient of the function. // Represent the "a_direction" component of the normal as the "a_direction" // component of gradient of the function, "gradientComponent", divided by // the magnitude of the gradient. // Compute and store the magnitude of the gradient of the function.