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_exec_arg_OnBoundary_h
11 #define vtk_m_exec_arg_OnBoundary_h
12 
13 #include <vtkm/exec/arg/ExecutionSignatureTagBase.h>
14 #include <vtkm/exec/arg/Fetch.h>
15 #include <vtkm/exec/arg/ThreadIndicesPointNeighborhood.h>
16 
17 namespace vtkm
18 {
19 namespace exec
20 {
21 namespace arg
22 {
23 
24 /// \brief Aspect tag to use for getting if a point is a boundary point.
25 ///
26 /// The \c AspectTagBoundary aspect tag causes the \c Fetch class to obtain
27 /// if the point is on a boundary.
28 ///
29 struct AspectTagBoundary
30 {
31 };
32 
33 
34 /// \brief The \c ExecutionSignature tag to get if executing on a boundary element
35 ///
36 struct Boundary : vtkm::exec::arg::ExecutionSignatureTagBase
37 {
38   static constexpr vtkm::IdComponent INDEX = 1;
39   using AspectTag = vtkm::exec::arg::AspectTagBoundary;
40 };
41 
42 template <typename FetchTag, typename ExecObjectType>
43 struct Fetch<FetchTag, vtkm::exec::arg::AspectTagBoundary, ExecObjectType>
44 {
45 
46   using ValueType = vtkm::exec::BoundaryState;
47 
48   VTKM_SUPPRESS_EXEC_WARNINGS
49   template <typename ThreadIndicesType>
50   VTKM_EXEC ValueType Load(const ThreadIndicesType& indices, const ExecObjectType&) const
51   {
52     return indices.GetBoundaryState();
53   }
54 
55   template <typename ThreadIndicesType>
56   VTKM_EXEC void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
57   {
58     // Store is a no-op.
59   }
60 };
61 }
62 }
63 } // namespace vtkm::exec::arg
64 
65 #endif //vtk_m_exec_arg_OnBoundary_h
66