Viskores
1.0
viskores
exec
CellInside.h
Go to the documentation of this file.
1
//============================================================================
2
// The contents of this file are covered by the Viskores license. See
3
// LICENSE.txt for details.
4
//
5
// By contributing to this file, all contributors agree to the Developer
6
// Certificate of Origin Version 1.1 (DCO 1.1) as stated in DCO.txt.
7
//============================================================================
8
9
//============================================================================
10
// Copyright (c) Kitware, Inc.
11
// All rights reserved.
12
// See LICENSE.txt for details.
13
//
14
// This software is distributed WITHOUT ANY WARRANTY; without even
15
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16
// PURPOSE. See the above copyright notice for more information.
17
//============================================================================
18
#ifndef viskores_exec_CellInside_h
19
#define viskores_exec_CellInside_h
20
21
#include <
viskores/CellShape.h
>
22
#include <
viskores/Types.h
>
23
24
#include <lcl/lcl.h>
25
26
namespace
viskores
27
{
28
namespace
exec
29
{
30
31
template
<
typename
T,
typename
CellShapeTag>
32
static
inline
VISKORES_EXEC
bool
CellInside(
const
viskores::Vec<T, 3>
& pcoords, CellShapeTag)
33
{
34
using
VtkcTagType =
typename
viskores::internal::CellShapeTagViskoresToVtkc<CellShapeTag>::Type;
35
return
lcl::cellInside(VtkcTagType{}, pcoords);
36
}
37
38
template
<
typename
T>
39
static
inline
VISKORES_EXEC
bool
CellInside(
const
viskores::Vec<T, 3>
&,
viskores::CellShapeTagEmpty
)
40
{
41
return
false
;
42
}
43
44
template
<
typename
T>
45
static
inline
VISKORES_EXEC
bool
CellInside(
const
viskores::Vec<T, 3>
& pcoords,
46
viskores::CellShapeTagPolyLine
)
47
{
48
return
pcoords[0] >= T(0) && pcoords[0] <= T(1);
49
}
50
54
template
<
typename
T>
55
static
inline
VISKORES_EXEC
bool
CellInside(
const
viskores::Vec<T, 3>
& pcoords,
56
viskores::CellShapeTagGeneric
shape)
57
{
58
bool
result =
false
;
59
switch
(shape.
Id
)
60
{
61
viskoresGenericCellShapeMacro
(result = CellInside(pcoords, CellShapeTag()));
62
default
:
63
break
;
64
}
65
66
return
result;
67
}
68
}
69
}
// viskores::exec
70
71
#endif // viskores_exec_CellInside_h
viskores::CellShapeTagGeneric::Id
viskores::UInt8 Id
An identifier that corresponds to one of the CELL_SHAPE_* identifiers.
Definition:
CellShape.h:188
Types.h
viskoresGenericCellShapeMacro
#define viskoresGenericCellShapeMacro(call)
A macro used in a switch statement to determine cell shape.
Definition:
CellShape.h:257
CellShape.h
viskores::Vec< T, 3 >
Definition:
Types.h:1025
viskores::CellShapeTagGeneric
A special cell shape tag that holds a cell shape that is not known at compile time.
Definition:
CellShape.h:178
viskores::CellShapeTagEmpty
Definition:
CellShape.h:155
viskores
Groups connected points that have the same field value.
Definition:
Atomic.h:27
viskores::CellShapeTagPolyLine
Definition:
CellShape.h:159
VISKORES_EXEC
#define VISKORES_EXEC
Definition:
ExportMacros.h:59
Generated by
1.8.17