VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Volumes/BIGMAC1/Dashboards/MyTests/VTK_BLD_Release_docs/Common/Core/vtkMathConfigure.h
Go to the documentation of this file.
00001 // -*- c++ -*-
00002 /*=========================================================================
00003 
00004   Program:   Visualization Toolkit
00005   Module:    vtkMathConfigure.h.in
00006 
00007   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00016 /*----------------------------------------------------------------------------
00017  Copyright (c) Sandia Corporation
00018  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
00019 ----------------------------------------------------------------------------*/
00020 
00021 #ifndef vtkMathConfigure_h
00022 #define vtkMathConfigure_h
00023 
00024 #include <cmath>
00025 #include <float.h> // for _isnan, _finite on Win32
00026 
00027 #define VTK_HAS_ISNAN
00028 #define VTK_HAS_STD_ISNAN
00029 /* #undef VTK_HAS__ISNAN */
00030 #define VTK_HAS_ISINF
00031 #define VTK_HAS_STD_ISINF
00032 #define VTK_HAS_ISFINITE
00033 #define VTK_HAS_STD_ISFINITE
00034 #define VTK_HAS_FINITE
00035 /* #undef VTK_HAS__FINITE */
00036 
00037 // Check for undetected macro versions of isnan(), isinf(), isfinite()
00038 #if !defined(VTK_HAS_ISNAN) && defined(isnan)
00039 # define VTK_HAS_ISNAN 1
00040 #endif
00041 #if !defined(VTK_HAS_ISINF) && defined(isinf)
00042 # define VTK_HAS_ISINF 1
00043 #endif
00044 #if !defined(VTK_HAS_ISFINITE) && defined(isfinite)
00045 # define VTK_HAS_ISFINITE 1
00046 #endif
00047 #if !defined(VTK_HAS_FINITE) && defined(finite)
00048 # define VTK_HAS_FINITE 1
00049 #endif
00050 
00051 // Make macros from _isnan(), _finite() if they exist (there is no _isinf)
00052 #if !defined(VTK_HAS_ISNAN) && (defined(VTK_HAS__ISNAN) || defined(_isnan))
00053 # define isnan(x) _isnan(x)
00054 # define VTK_HAS_ISNAN 1
00055 #endif
00056 #if !defined(VTK_HAS_FINITE) && (defined(VTK_HAS__FINITE) || defined(_finite))
00057 # define finite(x) _finite(x)
00058 # define VTK_HAS_FINITE 1
00059 #endif
00060 
00061 // The CUDA compiler(nvcc) is a secondary compiler that is used beside
00062 // your host compiler. While your host compiler can support std::isnan and
00063 // other functions, the CUDA compiler doesn't. Because the CUDA compiler is
00064 // given both host and device code to parse it will then fail when it sees
00065 // std::isnan because it is in the vtkMath header and not the
00066 // implementation file. To get around this issue we check __CUDACC__ which
00067 // is only set when we are compiling with the CUDA compiler
00068 #ifdef __CUDACC__
00069 
00070 #if defined(VTK_HAS_STD_ISINF)
00071 #undef VTK_HAS_STD_ISINF
00072 #endif
00073 
00074 #if defined(VTK_HAS_STD_ISNAN)
00075 #undef VTK_HAS_STD_ISNAN
00076 #endif
00077 
00078 #if defined(VTK_HAS_STD_ISFINITE)
00079 #undef VTK_HAS_STD_ISFINITE
00080 #endif
00081 
00082 #endif
00083 
00084 // We pretty much assume that all compilers are going to provide
00085 // std::numeric_limits methods in the limits header.  On of the Borland
00086 // dashboard compilers failed to link in the methods, so we have a special
00087 // case here.  If we find more platforms that do not support it correctly,
00088 // then we should probably implement a TRY_COMPILE in the CMakeLists.txt.
00089 #ifndef __BORLANDC__
00090 # define VTK_HAS_STD_NUMERIC_LIMITS
00091 #endif
00092 
00093 // If the isnan or isinf function does not exist, then our next attempt is to
00094 // use comparisons to determine if the number is not finite.  Although these
00095 // comparisons should be valid, some systems raise execeptions anyway (possibly
00096 // because exceptions for really bad operations like division by 0 are on).
00097 // This flag will instruct vtkMath not to make these comparisons.  (The next
00098 // fallback is to do IEEE-754 bit comparisons.)
00099 #ifdef __BORLANDC__
00100 # define VTK_NON_FINITE_CAUSES_EXCEPTIONS
00101 #endif
00102 
00103 #endif //vtkMathConfigure_h