Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

SAMRAI::tbox::MathUtilities< TYPE > Class Template Reference

#include <source/toolbox/base/MathUtilities.h>

List of all members.

Public Member Functions

template<>
bool isNaN (const float &value)
template<>
bool isNaN (const double &value)
template<>
bool Rand (bool low, bool width)
template<>
char Rand (char low, char width)
template<>
int Rand (int low, int width)
template<>
float Rand (float low, float width)
template<>
double Rand (double low, double width)
template<>
dcomplex Rand (dcomplex low, dcomplex width)
template<>
dcomplex Min (dcomplex a, dcomplex b)
template<>
dcomplex Max (dcomplex a, dcomplex b)

Static Public Member Functions

static TYPE getZero ()
 Get the value 0.
static TYPE getOne ()
 Get the value 1.
static TYPE getSignalingNaN ()
 Get the IEEE signaling NaN on architectures that support it.
static bool isNaN (const TYPE &value)
 Indicates whether the supplied value is NaN.
static TYPE getMax ()
 Get max for the templated type.
static TYPE getMin ()
 Get min for the templated type.
static TYPE getEpsilon ()
 Get epsilon for the templated type.
static TYPE getUndefined ()
 Get value to set for undefined data.
static TYPE Min (TYPE a, TYPE b)
 Compute the minimum of a and b.
static TYPE Max (TYPE a, TYPE b)
 Compute the maximum of a and b.
static TYPE Rand (TYPE low, TYPE width)
 Generate a random value from low to low+width.


Detailed Description

template<class TYPE>
class SAMRAI::tbox::MathUtilities< TYPE >

Class MathUtilities is a utility for managing basic math functions and the initialization of data to signaling NaNs, and for managing Posix constants like INT_MAX, FLT_MAX, DBL_MAX, etc. Signaling NaNs force a trap if they are used in a numerical operation, so they are a useful way to track uninitialized floating point data. Setting integer values to INT_MAX is a useful way to track uninitialized integer values.

The implementation of this class depends heavily on the particular computer architecture and how it implements floating point arithmetic and hardware traps.

This class has a similiar purpose to

See also:
tbox::IEEE. The primary purpose for replication is due to the use of variable type names in the method names in the IEEE class. This prevents templating based on type. This class is templated on type so it can be used by templated classes.


Member Function Documentation

template<class TYPE>
TYPE SAMRAI::tbox::MathUtilities< TYPE >::getZero  )  [inline, static]
 

Get the value 0.

template<class TYPE>
TYPE SAMRAI::tbox::MathUtilities< TYPE >::getOne  )  [inline, static]
 

Get the value 1.

template<class TYPE>
TYPE SAMRAI::tbox::MathUtilities< TYPE >::getSignalingNaN  )  [inline, static]
 

Get the IEEE signaling NaN on architectures that support it.

Using this value in a numerical expression will cause a program abort.

Valid for float/double only. For non float/double will return false.

template<class TYPE>
bool SAMRAI::tbox::MathUtilities< TYPE >::isNaN const TYPE &  value  )  [inline, static]
 

Indicates whether the supplied value is NaN.

Valid for float/double only. For non float/double will return false.

Parameters:
value Value to test

template<class TYPE>
TYPE SAMRAI::tbox::MathUtilities< TYPE >::getMax  )  [inline, static]
 

Get max for the templated type.

template<class TYPE>
TYPE SAMRAI::tbox::MathUtilities< TYPE >::getMin  )  [inline, static]
 

Get min for the templated type.

template<class TYPE>
TYPE SAMRAI::tbox::MathUtilities< TYPE >::getEpsilon  )  [inline, static]
 

Get epsilon for the templated type.

template<class TYPE>
TYPE SAMRAI::tbox::MathUtilities< TYPE >::getUndefined  )  [inline, static]
 

Get value to set for undefined data.

Typicaly used for initialziation during debugging.

template<class TYPE>
TYPE SAMRAI::tbox::MathUtilities< TYPE >::Min TYPE  a,
TYPE  b
[inline, static]
 

Compute the minimum of a and b.

Parameters:
a 
b 

template<class TYPE>
TYPE SAMRAI::tbox::MathUtilities< TYPE >::Max TYPE  a,
TYPE  b
[inline, static]
 

Compute the maximum of a and b.

Parameters:
a 
b 

template<class TYPE>
static TYPE SAMRAI::tbox::MathUtilities< TYPE >::Rand TYPE  low,
TYPE  width
[static]
 

Generate a random value from low to low+width.

Parameters:
low Starting value for range
width Width of the range.

template<>
bool SAMRAI::tbox::MathUtilities< float >::isNaN const float &  value  ) 
 

template<>
bool SAMRAI::tbox::MathUtilities< double >::isNaN const double &  value  ) 
 

template<>
bool SAMRAI::tbox::MathUtilities< bool >::Rand bool  low,
bool  width
 

template<>
char SAMRAI::tbox::MathUtilities< char >::Rand char  low,
char  width
 

template<>
int SAMRAI::tbox::MathUtilities< int >::Rand int  low,
int  width
 

template<>
float SAMRAI::tbox::MathUtilities< float >::Rand float  low,
float  width
 

template<>
double SAMRAI::tbox::MathUtilities< double >::Rand double  low,
double  width
 

template<>
dcomplex SAMRAI::tbox::MathUtilities< dcomplex >::Rand dcomplex  low,
dcomplex  width
 

template<>
dcomplex SAMRAI::tbox::MathUtilities< dcomplex >::Min dcomplex  a,
dcomplex  b
 

template<>
dcomplex SAMRAI::tbox::MathUtilities< dcomplex >::Max dcomplex  a,
dcomplex  b
 


The documentation for this class was generated from the following files:
Generated on Fri Dec 2 11:33:18 2005 for SAMRAI by  doxygen 1.4.2