VTK-m  2.0
CombinedVectorDifferentFromNext.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 // This software is distributed WITHOUT ANY WARRANTY; without even
6 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
7 // PURPOSE. See the above copyright notice for more information.
8 //
9 // Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
10 // Copyright 2014 UT-Battelle, LLC.
11 // Copyright 2014 Los Alamos National Security.
12 //
13 // Under the terms of Contract DE-NA0003525 with NTESS,
14 // the U.S. Government retains certain rights in this software.
15 //
16 // Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
17 // Laboratory (LANL), the U.S. Government retains certain rights in
18 // this software.
19 //============================================================================
20 // Copyright (c) 2018, The Regents of the University of California, through
21 // Lawrence Berkeley National Laboratory (subject to receipt of any required approvals
22 // from the U.S. Dept. of Energy). All rights reserved.
23 //
24 // Redistribution and use in source and binary forms, with or without modification,
25 // are permitted provided that the following conditions are met:
26 //
27 // (1) Redistributions of source code must retain the above copyright notice, this
28 // list of conditions and the following disclaimer.
29 //
30 // (2) Redistributions in binary form must reproduce the above copyright notice,
31 // this list of conditions and the following disclaimer in the documentation
32 // and/or other materials provided with the distribution.
33 //
34 // (3) Neither the name of the University of California, Lawrence Berkeley National
35 // Laboratory, U.S. Dept. of Energy nor the names of its contributors may be
36 // used to endorse or promote products derived from this software without
37 // specific prior written permission.
38 //
39 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
40 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
41 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
42 // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
43 // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
44 // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
45 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
46 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
47 // OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
48 // OF THE POSSIBILITY OF SUCH DAMAGE.
49 //
50 //=============================================================================
51 //
52 // This code is an extension of the algorithm presented in the paper:
53 // Parallel Peak Pruning for Scalable SMP Contour Tree Computation.
54 // Hamish Carr, Gunther Weber, Christopher Sewell, and James Ahrens.
55 // Proceedings of the IEEE Symposium on Large Data Analysis and Visualization
56 // (LDAV), October 2016, Baltimore, Maryland.
57 //
58 // The PPP2 algorithm and software were jointly developed by
59 // Hamish Carr (University of Leeds), Gunther H. Weber (LBNL), and
60 // Oliver Ruebel (LBNL)
61 //==============================================================================
62 
63 #ifndef vtk_m_worklet_contourtree_augmented_contourtree_mesh_inc_combined_vector_different_from_next_h
64 #define vtk_m_worklet_contourtree_augmented_contourtree_mesh_inc_combined_vector_different_from_next_h
65 
66 #include <vtkm/cont/ArrayHandle.h>
69 
70 namespace vtkm
71 {
72 namespace worklet
73 {
74 namespace contourtree_augmented
75 {
76 namespace mesh_dem_contourtree_mesh_inc
77 {
78 
82 {
83 public:
84  template <typename Portal1Type, typename Portal2Type, typename Portal3Type>
85  struct Functor
86  {
88  Portal2Type ThisGlobalMeshIndex;
89  Portal3Type OtherGlobalMeshIndex;
90 
92  {
94  ? this->ThisGlobalMeshIndex.Get(MaskedIndex(idx))
95  : this->OtherGlobalMeshIndex.Get(MaskedIndex(idx));
96  }
97 
99  {
100  vtkm::Id currGlobalIdx = this->GetGlobalMeshIndex(this->OverallSortOrderPortal.Get(i));
101  vtkm::Id nextGlobalIdx = this->GetGlobalMeshIndex(this->OverallSortOrderPortal.Get(i + 1));
102  return (currGlobalIdx != nextGlobalIdx) ? 1 : 0;
103  }
104  };
105 
106  template <typename PT1, typename PT2, typename PT3>
107  Functor<PT1, PT2, PT3> CreateFunctor(PT1 OverallSortOrderPortal,
108  PT2 ThisGlobalMeshIndex,
109  PT3 OtherGlobalMeshIndex) const
110  {
111  return { OverallSortOrderPortal, ThisGlobalMeshIndex, OtherGlobalMeshIndex };
112  }
113 };
114 
115 } // namespace mesh_dem_contourtree_mesh_inc
116 } // namespace contourtree_augmented
117 } // namespace worklet
118 } // namespace vtkm
119 
120 #endif
ArrayHandle.h
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
VTKM_EXEC_CONT
#define VTKM_EXEC_CONT
Definition: ExportMacros.h:52
vtkm::worklet::contourtree_augmented::mesh_dem_contourtree_mesh_inc::CombinedVectorDifferentFromNextDecoratorImpl::Functor
Definition: CombinedVectorDifferentFromNext.h:85
vtkm::worklet::contourtree_augmented::mesh_dem_contourtree_mesh_inc::CombinedVectorDifferentFromNextDecoratorImpl::Functor::ThisGlobalMeshIndex
Portal2Type ThisGlobalMeshIndex
Definition: CombinedVectorDifferentFromNext.h:88
vtkm::worklet::contourtree_augmented::MaskedIndex
VTKM_EXEC_CONT vtkm::Id MaskedIndex(vtkm::Id flaggedIndex)
Definition: filter/scalar_topology/worklet/contourtree_augmented/Types.h:127
vtkm::Id
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
vtkm::worklet::contourtree_augmented::mesh_dem_contourtree_mesh_inc::CombinedVectorDifferentFromNextDecoratorImpl::Functor::GetGlobalMeshIndex
VTKM_EXEC_CONT vtkm::Id GetGlobalMeshIndex(vtkm::Id idx) const
Definition: CombinedVectorDifferentFromNext.h:91
vtkm::worklet::contourtree_augmented::mesh_dem_contourtree_mesh_inc::CombinedVectorDifferentFromNextDecoratorImpl::Functor::operator()
VTKM_EXEC_CONT vtkm::Id operator()(vtkm::Id i) const
Definition: CombinedVectorDifferentFromNext.h:98
ExecutionAndControlObjectBase.h
Types.h
vtkm::worklet::contourtree_augmented::mesh_dem_contourtree_mesh_inc::CombinedVectorDifferentFromNextDecoratorImpl::Functor::OtherGlobalMeshIndex
Portal3Type OtherGlobalMeshIndex
Definition: CombinedVectorDifferentFromNext.h:89
vtkm::worklet::contourtree_augmented::IsThis
VTKM_EXEC_CONT bool IsThis(vtkm::Id flaggedIndex)
Used in the context of CombinedVector class used in ContourTreeMesh to merge the mesh of contour tree...
Definition: filter/scalar_topology/worklet/contourtree_augmented/Types.h:134
vtkm::worklet::contourtree_augmented::mesh_dem_contourtree_mesh_inc::CombinedVectorDifferentFromNextDecoratorImpl
Decorator to compute if element i is different from element i+1 in an arrays.
Definition: CombinedVectorDifferentFromNext.h:81
vtkm::worklet::contourtree_augmented::mesh_dem_contourtree_mesh_inc::CombinedVectorDifferentFromNextDecoratorImpl::Functor::OverallSortOrderPortal
Portal1Type OverallSortOrderPortal
Definition: CombinedVectorDifferentFromNext.h:87
vtkm::worklet::contourtree_augmented::mesh_dem_contourtree_mesh_inc::CombinedVectorDifferentFromNextDecoratorImpl::CreateFunctor
Functor< PT1, PT2, PT3 > CreateFunctor(PT1 OverallSortOrderPortal, PT2 ThisGlobalMeshIndex, PT3 OtherGlobalMeshIndex) const
Definition: CombinedVectorDifferentFromNext.h:107