Teuchos_ScalarTraitsDecl.hpp

Go to the documentation of this file.
00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 //                    Teuchos: Common Tools Package
00005 //                 Copyright (2004) Sandia Corporation
00006 // 
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 // 
00010 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //  
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //  
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00025 // 
00026 // ***********************************************************************
00027 // @HEADER
00028 
00029 #ifndef _TEUCHOS_SCALARTRAITS_DECL_HPP_
00030 #define _TEUCHOS_SCALARTRAITS_DECL_HPP_
00031 
00036 #include "Teuchos_ConfigDefs.hpp"
00037 
00038 
00039 namespace Teuchos {
00040 
00041 
00042 template <typename T>
00043 struct UndefinedScalarTraits
00044 {
00046   static inline T notDefined() { return T::this_type_is_missing_a_specialization(); }
00047 };
00048 
00049 
00050 /* This is the default structure used by ScalarTraits<T> to produce a compile time
00051   error when the specialization does not exist for type <tt>T</tt>.
00052 */
00053 
00054 
00075 template <typename T>
00076 struct ScalarTraits
00077 {
00079   typedef T magnitudeType;
00081   typedef T halfPrecision;
00083   typedef T doublePrecision;
00085   static const bool isComplex = false;
00087   static const bool isOrdinal = false;
00089   static const bool isComparable = false;
00094   static const bool hasMachineParameters = false;
00096   static inline magnitudeType eps()   { return UndefinedScalarTraits<T>::notDefined(); }
00098   static inline magnitudeType sfmin() { return UndefinedScalarTraits<T>::notDefined(); }
00100   static inline magnitudeType base()  { return UndefinedScalarTraits<T>::notDefined(); }
00102   static inline magnitudeType prec()  { return UndefinedScalarTraits<T>::notDefined(); }
00104   static inline magnitudeType t()     { return UndefinedScalarTraits<T>::notDefined(); }
00106   static inline magnitudeType rnd()   { return UndefinedScalarTraits<T>::notDefined(); }
00108   static inline magnitudeType emin()  { return UndefinedScalarTraits<T>::notDefined(); }
00110   static inline magnitudeType rmin()  { return UndefinedScalarTraits<T>::notDefined(); }
00112   static inline magnitudeType emax()  { return UndefinedScalarTraits<T>::notDefined(); }
00114   static inline magnitudeType rmax()  { return UndefinedScalarTraits<T>::notDefined(); }
00116   static inline magnitudeType magnitude(T a) { return UndefinedScalarTraits<T>::notDefined(); }
00118   static inline T zero()                     { return UndefinedScalarTraits<T>::notDefined(); }
00120   static inline T one()                      { return UndefinedScalarTraits<T>::notDefined(); }
00122   static inline magnitudeType real(T a) { return UndefinedScalarTraits<T>::notDefined(); }
00124   static inline magnitudeType imag(T a) { return UndefinedScalarTraits<T>::notDefined(); }
00126   static inline T conjugate(T a) { return UndefinedScalarTraits<T>::notDefined(); }
00128   static inline T nan()                      { return UndefinedScalarTraits<T>::notDefined(); }
00130   static inline bool isnaninf(const T& x)     { return UndefinedScalarTraits<T>::notDefined(); }
00132   static inline void seedrandom(unsigned int s) { int i; T t = &i; }
00134   static inline T random()                   { return UndefinedScalarTraits<T>::notDefined(); }
00136   static inline std::string name()           { (void)UndefinedScalarTraits<T>::notDefined(); return 0; }
00138   static inline T squareroot(T x) { return UndefinedScalarTraits<T>::notDefined(); }
00140   static inline T pow(T x, T y) { return UndefinedScalarTraits<T>::notDefined(); }
00141 };
00142 
00143   
00144 } // Teuchos namespace
00145 
00146 
00147 #endif // _TEUCHOS_SCALARTRAITS_DECL_HPP_

Generated on Tue Jul 13 09:23:00 2010 for Teuchos - Trilinos Tools Package by  doxygen 1.4.7