MOAB: Mesh Oriented datABase  (version 5.4.1)
Exponent.hpp
Go to the documentation of this file.
00001 /* *****************************************************************
00002     MESQUITE -- The Mesh Quality Improvement Toolkit
00003 
00004     Copyright 2004 Sandia Corporation and Argonne National
00005     Laboratory.  Under the terms of Contract DE-AC04-94AL85000
00006     with Sandia Corporation, the U.S. Government retains certain
00007     rights in this software.
00008 
00009     This library is free software; you can redistribute it and/or
00010     modify it under the terms of the GNU Lesser General Public
00011     License as published by the Free Software Foundation; either
00012     version 2.1 of the License, or (at your option) any later version.
00013 
00014     This library is distributed in the hope that it will be useful,
00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017     Lesser General Public License for more details.
00018 
00019     You should have received a copy of the GNU Lesser General Public License
00020     (lgpl.txt) along with this library; if not, write to the Free Software
00021     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 
00023     [email protected], [email protected], [email protected],
00024     [email protected], [email protected], [email protected],
00025     [email protected]
00026 
00027   ***************************************************************** */
00028 /*!
00029   \file   Exponent.hpp
00030   \brief
00031 
00032   \author Jason Kraftcheck
00033   \date   2005-5-2
00034 */
00035 
00036 #ifndef MESQUITE_POWER_HPP
00037 #define MESQUITE_POWER_HPP
00038 
00039 #include "Mesquite.hpp"
00040 
00041 namespace MBMesquite
00042 {
00043 
00044 class Exponent
00045 {
00046   public:
00047     typedef double ( Exponent::*constMemberPtr )( double ) const;
00048     static constMemberPtr get_func_ptr( double exponent );
00049 
00050     Exponent() : funcPointer( 0 ) {}
00051 
00052     explicit Exponent( double exponent ) : mExponent( exponent ), funcPointer( get_func_ptr( exponent ) ) {}
00053 
00054     inline double raise( double p_value ) const
00055     {
00056         return ( this->*funcPointer )( p_value );
00057     }
00058 
00059     void set_exponent( double exponent );
00060 
00061     inline Exponent& operator=( double d )
00062     {
00063         set_exponent( d );
00064         return *this;
00065     }
00066 
00067     // inline operator double () const
00068     //  { return mExponent; }
00069     inline double value() const
00070     {
00071         return mExponent;
00072     }
00073 
00074     double pow0( double x ) const;
00075     double pow1( double x ) const;
00076     double squareRoot( double x ) const;
00077     double cubeRoot( double x ) const;
00078     double invCubeRoot( double x ) const;
00079     double powTwoThirds( double x ) const;
00080     double invTwoThirds( double x ) const;
00081     double pow2( double x ) const;
00082     double powPositiveInt( double x ) const;
00083     double std_pow( double x ) const;
00084     double inverse( double x ) const;
00085     double invSquareRoot( double x ) const;
00086     double powThreeHalves( double x ) const;
00087     double invSquare( double x ) const;
00088     double powNegativeInt( double x ) const;
00089 
00090   private:
00091     double mExponent;
00092     constMemberPtr funcPointer;
00093 };
00094 
00095 }  // namespace MBMesquite
00096 
00097 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines