vtkMathConfigure.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3 // SPDX-License-Identifier: BSD-3-Clause
4 
5 #ifndef vtkMathConfigure_h
6 #define vtkMathConfigure_h
7 
8 #include <cmath>
9 #include <float.h> // for _isnan, _finite on Win32
10 
11 #define VTK_HAS_ISNAN
12 #define VTK_HAS_STD_ISNAN
13 /* #undef VTK_HAS__ISNAN */
14 #define VTK_HAS_ISINF
15 #define VTK_HAS_STD_ISINF
16 #define VTK_HAS_ISFINITE
17 #define VTK_HAS_STD_ISFINITE
18 #define VTK_HAS_FINITE
19 /* #undef VTK_HAS__FINITE */
20 
21 // Check for undetected macro versions of isnan(), isinf(), isfinite()
22 #if !defined(VTK_HAS_ISNAN) && defined(isnan)
23 # define VTK_HAS_ISNAN 1
24 #endif
25 #if !defined(VTK_HAS_ISINF) && defined(isinf)
26 # define VTK_HAS_ISINF 1
27 #endif
28 #if !defined(VTK_HAS_ISFINITE) && defined(isfinite)
29 # define VTK_HAS_ISFINITE 1
30 #endif
31 #if !defined(VTK_HAS_FINITE) && defined(finite)
32 # define VTK_HAS_FINITE 1
33 #endif
34 
35 // Make macros from _isnan(), _finite() if they exist (there is no _isinf)
36 #if !defined(VTK_HAS_ISNAN) && (defined(VTK_HAS__ISNAN) || defined(_isnan))
37 # define isnan(x) _isnan(x)
38 # define VTK_HAS_ISNAN 1
39 #endif
40 #if !defined(VTK_HAS_FINITE) && (defined(VTK_HAS__FINITE) || defined(_finite))
41 # define finite(x) _finite(x)
42 # define VTK_HAS_FINITE 1
43 #endif
44 
45 // The CUDA compiler(nvcc) is a secondary compiler that is used beside
46 // your host compiler. While your host compiler can support std::isnan and
47 // other functions, the CUDA compiler doesn't. Because the CUDA compiler is
48 // given both host and device code to parse it will then fail when it sees
49 // std::isnan because it is in the vtkMath header and not the
50 // implementation file. To get around this issue we check __CUDACC__ which
51 // is only set when we are compiling with the CUDA compiler
52 #ifdef __CUDACC__
53 
54 #if defined(VTK_HAS_STD_ISINF)
55 #undef VTK_HAS_STD_ISINF
56 #endif
57 
58 #if defined(VTK_HAS_STD_ISNAN)
59 #undef VTK_HAS_STD_ISNAN
60 #endif
61 
62 #if defined(VTK_HAS_STD_ISFINITE)
63 #undef VTK_HAS_STD_ISFINITE
64 #endif
65 
66 #endif
67 
68 #endif //vtkMathConfigure_h