Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
includeLinks/Exponent.hpp
Go to the documentation of this file.
1 /* *****************************************************************
2  MESQUITE -- The Mesh Quality Improvement Toolkit
3 
4  Copyright 2004 Sandia Corporation and Argonne National
5  Laboratory. Under the terms of Contract DE-AC04-94AL85000
6  with Sandia Corporation, the U.S. Government retains certain
7  rights in this software.
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Lesser General Public
11  License as published by the Free Software Foundation; either
12  version 2.1 of the License, or (at your option) any later version.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public License
20  (lgpl.txt) along with this library; if not, write to the Free Software
21  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 
23  diachin2@llnl.gov, djmelan@sandia.gov, mbrewer@sandia.gov,
24  pknupp@sandia.gov, tleurent@mcs.anl.gov, tmunson@mcs.anl.gov,
25  kraftche@cae.wisc.edu
26 
27  ***************************************************************** */
36 #ifndef MESQUITE_POWER_HPP
37 #define MESQUITE_POWER_HPP
38 
39 #include "Mesquite.hpp"
40 
41 namespace Mesquite {
42 
43 class Exponent
44 {
45  public:
46 
47  typedef double (Exponent::*constMemberPtr)(double) const;
48  static constMemberPtr get_func_ptr( double exponent );
49 
50  Exponent( ) : funcPointer( 0 )
51  {}
52 
53  Exponent( double exponent )
54  : mExponent(exponent),
55  funcPointer( get_func_ptr( exponent ) )
56  {}
57 
58  inline double raise( double value ) const
59  { return (this->*funcPointer)( value ); }
60 
61  void set_exponent( double exponent );
62 
63  inline Exponent& operator=( double d )
64  { set_exponent(d); return *this; }
65 
66  inline operator double () const
67  { return mExponent; }
68 
69  double pow0( double x ) const;
70  double pow1( double x ) const;
71  double squareRoot( double x ) const;
72  double cubeRoot( double x ) const;
73  double powTwoThirds( double x ) const;
74  double pow2( double x ) const;
75  double powPositiveInt( double x ) const;
76  double std_pow( double x ) const;
77  double inverse( double x ) const;
78  double invSquareRoot( double x ) const;
79  double powThreeHalves( double x ) const;
80  double invSquare( double x ) const;
81  double powNegativeInt( double x ) const;
82 
83  private:
84 
85  double mExponent;
87 };
88 
89 inline double pow( double value, const Exponent& exp )
90  { return exp.raise( value ); }
91 
92 } // namespace Mesquite
93 
94 #endif
double pow1(double x) const
double powNegativeInt(double x) const
CImg< _cimg_Tfloat > exp(const CImg< T > &instance)
Definition: CImg.h:6016
const NT & d
double pow0(double x) const
double std_pow(double x) const
void set_exponent(double exponent)
double invSquareRoot(double x) const
double invSquare(double x) const
double powThreeHalves(double x) const
void int int REAL * x
Definition: read.cpp:74
double raise(double value) const
double powTwoThirds(double x) const
double cubeRoot(double x) const
Exponent & operator=(double d)
double powPositiveInt(double x) const
double(Exponent::* constMemberPtr)(double) const
double pow2(double x) const
static constMemberPtr get_func_ptr(double exponent)
double pow(double value, const Exponent &exp)
double squareRoot(double x) const
double inverse(double x) const