VTK-m
2.3
Main Page
Related Pages
Modules
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Enumerations
Enumerator
Related Functions
Files
File List
File Members
All
a
c
d
e
f
h
i
k
m
o
p
q
r
s
t
u
v
w
x
y
Variables
Typedefs
Macros
e
k
m
q
s
t
u
v
vtkm
cont
internal
CastInvalidValue.h
Go to the documentation of this file.
1
//============================================================================
2
// Copyright (c) Kitware, Inc.
3
// All rights reserved.
4
// See LICENSE.txt for details.
5
//
6
// This software is distributed WITHOUT ANY WARRANTY; without even
7
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8
// PURPOSE. See the above copyright notice for more information.
9
//============================================================================
10
#ifndef vtk_m_cont_internal_CastInvalidValue_h
11
#define vtk_m_cont_internal_CastInvalidValue_h
12
13
#include <
vtkm/Math.h
>
14
#include <
vtkm/Types.h
>
15
#include <
vtkm/VecTraits.h
>
16
17
namespace
vtkm
18
{
19
namespace
cont
20
{
21
namespace
internal
22
{
23
36
template
<
typename
T>
37
T CastInvalidValue(
vtkm::Float64
invalidValue)
38
{
39
using
ComponentType =
typename
vtkm::VecTraits<T>::BaseComponentType
;
40
41
if
(std::is_same<
vtkm::TypeTraitsIntegerTag
,
typename
vtkm::TypeTraits<T>::NumericTag
>::value)
42
{
43
// Casting to integer types
44
if
(vtkm::IsFinite(invalidValue))
45
{
46
return
T(
static_cast<
ComponentType
>
(invalidValue));
47
}
48
else
if
(vtkm::IsInf(invalidValue) && (invalidValue > 0))
49
{
50
return
T(std::numeric_limits<ComponentType>::max());
51
}
52
else
53
{
54
return
T(std::numeric_limits<ComponentType>::min());
55
}
56
}
57
else
58
{
59
// Not an integer type. Assume can be directly cast
60
return
T(
static_cast<
ComponentType
>
(invalidValue));
61
}
62
}
63
}
64
}
65
}
// namespace vtkm::cont::internal
66
67
#endif //vtk_m_cont_internal_CastInvalidValue_h
vtkm::TypeTraitsIntegerTag
Tag used to identify types that store integer numbers.
Definition:
TypeTraits.h:36
vtkm
Groups connected points that have the same field value.
Definition:
Atomic.h:19
Types.h
vtkm::VecTraits::BaseComponentType
T BaseComponentType
Base component type in the vector.
Definition:
VecTraits.h:78
Math.h
vtkm::TypeTraitsUnknownTag
Tag used to identify types that aren't Real, Integer, Scalar or Vector.
Definition:
TypeTraits.h:20
vtkm::Float64
double Float64
Base type to use for 64-bit floating-point numbers.
Definition:
Types.h:161
VecTraits.h
Generated by
1.8.17