MOAB: Mesh Oriented datABase  (version 5.2.1)
MBMesquite::Exponent Class Reference

#include <Exponent.hpp>

Public Types

typedef double(Exponent::* constMemberPtr )(double) const

Public Member Functions

 Exponent ()
 Exponent (double exponent)
double raise (double p_value) const
void set_exponent (double exponent)
Exponentoperator= (double d)
double value () const
double pow0 (double x) const
double pow1 (double x) const
double squareRoot (double x) const
double cubeRoot (double x) const
double invCubeRoot (double x) const
double powTwoThirds (double x) const
double invTwoThirds (double x) const
double pow2 (double x) const
double powPositiveInt (double x) const
double std_pow (double x) const
double inverse (double x) const
double invSquareRoot (double x) const
double powThreeHalves (double x) const
double invSquare (double x) const
double powNegativeInt (double x) const

Static Public Member Functions

static constMemberPtr get_func_ptr (double exponent)

Private Attributes

double mExponent
constMemberPtr funcPointer

Detailed Description

Definition at line 44 of file Exponent.hpp.


Member Typedef Documentation

typedef double( Exponent::* MBMesquite::Exponent::constMemberPtr)(double) const

Definition at line 47 of file Exponent.hpp.


Constructor & Destructor Documentation

Definition at line 50 of file Exponent.hpp.

: funcPointer( 0 ) {}
MBMesquite::Exponent::Exponent ( double  exponent) [inline, explicit]

Definition at line 52 of file Exponent.hpp.

: mExponent( exponent ), funcPointer( get_func_ptr( exponent ) ) {}

Member Function Documentation

double MBMesquite::Exponent::cubeRoot ( double  x) const

Definition at line 100 of file Exponent.cpp.

References MBMesquite::cbrt().

Referenced by get_func_ptr().

{
    return MBMesquite::cbrt( x );
}

Definition at line 41 of file Exponent.cpp.

References cubeRoot(), invCubeRoot(), inverse(), invSquare(), invSquareRoot(), invTwoThirds(), pow0(), pow1(), pow2(), powNegativeInt(), powPositiveInt(), powThreeHalves(), powTwoThirds(), squareRoot(), and std_pow().

Referenced by set_exponent().

{
    if( exponent == 0.0 )
        return &Exponent::pow0;
    else if( exponent == 1.0 )
        return &Exponent::pow1;
    else if( exponent == 0.5 )
        return &Exponent::squareRoot;
    else if( exponent == 1. / 3. )
        return &Exponent::cubeRoot;
    else if( exponent == -1. / 3. )
        return &Exponent::invCubeRoot;
    else if( exponent == 2. / 3. )
        return &Exponent::powTwoThirds;
    else if( exponent == -2. / 3. )
        return &Exponent::invTwoThirds;
    else if( exponent == 2.0 )
        return &Exponent::pow2;
    else if( exponent == -1.0 )
        return &Exponent::inverse;
    else if( exponent == -0.5 )
        return &Exponent::invSquareRoot;
    else if( exponent == 1.5 )
        return &Exponent::powThreeHalves;
    else if( exponent == -2.0 )
        return &Exponent::invSquare;
    else if( std::floor( exponent ) == exponent )
    {
        if( exponent > 0.0 )
            return &Exponent::powPositiveInt;
        else
            return &Exponent::powNegativeInt;
    }
    else
        return &Exponent::std_pow;
}
double MBMesquite::Exponent::invCubeRoot ( double  x) const

Definition at line 104 of file Exponent.cpp.

References MBMesquite::cbrt().

Referenced by get_func_ptr().

{
    return 1.0 / MBMesquite::cbrt( x );
}
double MBMesquite::Exponent::inverse ( double  x) const

Definition at line 120 of file Exponent.cpp.

Referenced by get_func_ptr().

{
    return 1.0 / x;
}
double MBMesquite::Exponent::invSquare ( double  x) const

Definition at line 132 of file Exponent.cpp.

Referenced by get_func_ptr().

{
    return 1.0 / ( x * x );
}
double MBMesquite::Exponent::invSquareRoot ( double  x) const

Definition at line 124 of file Exponent.cpp.

Referenced by get_func_ptr().

{
    return 1.0 / std::sqrt( x );
}
double MBMesquite::Exponent::invTwoThirds ( double  x) const

Definition at line 112 of file Exponent.cpp.

References MBMesquite::cbrt_sqr().

Referenced by get_func_ptr().

{
    return 1.0 / MBMesquite::cbrt_sqr( x );
}
Exponent& MBMesquite::Exponent::operator= ( double  d) [inline]

Definition at line 61 of file Exponent.hpp.

References set_exponent().

    {
        set_exponent( d );
        return *this;
    }
double MBMesquite::Exponent::pow0 ( double  x) const

Definition at line 84 of file Exponent.cpp.

Referenced by get_func_ptr().

{
    return 1.0;
}
double MBMesquite::Exponent::pow1 ( double  x) const

Definition at line 88 of file Exponent.cpp.

Referenced by get_func_ptr().

{
    return x;
}
double MBMesquite::Exponent::pow2 ( double  x) const

Definition at line 92 of file Exponent.cpp.

Referenced by get_func_ptr().

{
    return x * x;
}
double MBMesquite::Exponent::powNegativeInt ( double  x) const

Definition at line 145 of file Exponent.cpp.

References mExponent.

Referenced by get_func_ptr().

{
    double result = x;
    for( int i = ( -(int)mExponent ) - 1; i > 0; --i )
        result *= x;
    return 1.0 / result;
}
double MBMesquite::Exponent::powPositiveInt ( double  x) const

Definition at line 137 of file Exponent.cpp.

References mExponent.

Referenced by get_func_ptr().

{
    double result = x;
    for( int i = (int)mExponent - 1; i > 0; --i )
        result *= x;
    return result;
}
double MBMesquite::Exponent::powThreeHalves ( double  x) const

Definition at line 128 of file Exponent.cpp.

Referenced by get_func_ptr().

{
    return x * x * x / std::sqrt( x );
}
double MBMesquite::Exponent::powTwoThirds ( double  x) const

Definition at line 108 of file Exponent.cpp.

References MBMesquite::cbrt_sqr().

Referenced by get_func_ptr().

{
    return MBMesquite::cbrt_sqr( x );
}
double MBMesquite::Exponent::raise ( double  p_value) const [inline]
void MBMesquite::Exponent::set_exponent ( double  exponent)

Definition at line 78 of file Exponent.cpp.

References funcPointer, get_func_ptr(), and mExponent.

Referenced by operator=().

{
    mExponent   = exponent;
    funcPointer = get_func_ptr( exponent );
}
double MBMesquite::Exponent::squareRoot ( double  x) const

Definition at line 96 of file Exponent.cpp.

Referenced by get_func_ptr().

{
    return std::sqrt( x );
}
double MBMesquite::Exponent::std_pow ( double  x) const

Definition at line 116 of file Exponent.cpp.

References mExponent.

Referenced by get_func_ptr().

{
    return std::pow( x, mExponent );
}

Member Data Documentation

Definition at line 92 of file Exponent.hpp.

Referenced by raise(), and set_exponent().

Definition at line 91 of file Exponent.hpp.

Referenced by powNegativeInt(), powPositiveInt(), set_exponent(), std_pow(), and value().

List of all members.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines