Viskores  1.0
ContourTreeUniformAugmented.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 // Copyright (c) 2018, The Regents of the University of California, through
19 // Lawrence Berkeley National Laboratory (subject to receipt of any required approvals
20 // from the U.S. Dept. of Energy). All rights reserved.
21 //
22 // Redistribution and use in source and binary forms, with or without modification,
23 // are permitted provided that the following conditions are met:
24 //
25 // (1) Redistributions of source code must retain the above copyright notice, this
26 // list of conditions and the following disclaimer.
27 //
28 // (2) Redistributions in binary form must reproduce the above copyright notice,
29 // this list of conditions and the following disclaimer in the documentation
30 // and/or other materials provided with the distribution.
31 //
32 // (3) Neither the name of the University of California, Lawrence Berkeley National
33 // Laboratory, U.S. Dept. of Energy nor the names of its contributors may be
34 // used to endorse or promote products derived from this software without
35 // specific prior written permission.
36 //
37 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
38 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
39 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
40 // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
41 // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
42 // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
43 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
44 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
45 // OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
46 // OF THE POSSIBILITY OF SUCH DAMAGE.
47 //
48 //=============================================================================
49 //
50 // This code is an extension of the algorithm presented in the paper:
51 // Parallel Peak Pruning for Scalable SMP Contour Tree Computation.
52 // Hamish Carr, Gunther Weber, Christopher Sewell, and James Ahrens.
53 // Proceedings of the IEEE Symposium on Large Data Analysis and Visualization
54 // (LDAV), October 2016, Baltimore, Maryland.
55 //
56 // The PPP2 algorithm and software were jointly developed by
57 // Hamish Carr (University of Leeds), Gunther H. Weber (LBNL), and
58 // Oliver Ruebel (LBNL)
59 //==============================================================================
60 
61 #ifndef viskores_filter_scalar_topology_ContourTreeUniformAugmented_h
62 #define viskores_filter_scalar_topology_ContourTreeUniformAugmented_h
63 
64 #include <viskores/Types.h>
66 
67 #include <viskores/filter/Filter.h>
69 
70 #include <viskores/filter/scalar_topology/worklet/contourtree_augmented/ContourTree.h>
71 #include <viskores/filter/scalar_topology/worklet/contourtree_distributed/MultiBlockContourTreeHelper.h>
72 
73 #include <memory>
74 
75 namespace viskores
76 {
77 namespace filter
78 {
79 namespace scalar_topology
80 {
96 class VISKORES_FILTER_SCALAR_TOPOLOGY_EXPORT ContourTreeAugmented : public viskores::filter::Filter
97 {
98 public:
99  VISKORES_CONT bool CanThread() const override
100  {
101  // shared helper object MultiBlockTreeHelper.
102  // TODO: need further investigation.
103  return false;
104  }
105 
117  explicit ContourTreeAugmented(bool useMarchingCubes = false,
118  unsigned int computeRegularStructure = 1);
119 
128  void SetBlockIndices(viskores::Id3 blocksPerDim,
129  const viskores::cont::ArrayHandle<viskores::Id3>& localBlockIndices);
130 
133  const viskores::worklet::contourtree_augmented::ContourTree& GetContourTree() const;
135  const viskores::worklet::contourtree_augmented::IdArrayType& GetSortOrder() const;
137  viskores::Id GetNumIterations() const;
139 
140 private:
142  VISKORES_CONT viskores::cont::DataSet DoExecute(const viskores::cont::DataSet& input) override;
144  const viskores::cont::PartitionedDataSet& inData) override;
145 
150  VISKORES_CONT void PreExecute(const viskores::cont::PartitionedDataSet& input);
151 
152  VISKORES_CONT void PostExecute(const viskores::cont::PartitionedDataSet& input,
159  template <typename T>
160  VISKORES_CONT void DoPostExecute(const viskores::cont::PartitionedDataSet& input,
163 
166  // 0=no augmentation, 1=full augmentation, 2=boundary augmentation
168 
169  // TODO Should the additional fields below be add to the viskores::filter::ResultField and what is the best way to represent them
170  // Additional result fields not included in the viskores::filter::ResultField returned by DoExecute
171 
173  viskores::worklet::contourtree_augmented::ContourTree ContourTreeData;
175  viskores::Id NumIterations = 0;
177  viskores::worklet::contourtree_augmented::IdArrayType MeshSortOrder;
179  std::unique_ptr<viskores::worklet::contourtree_distributed::MultiBlockContourTreeHelper>
181 };
182 } // namespace scalar_topology
183 } // namespace filter
184 } // namespace viskores
185 
186 #endif // viskores_filter_scalar_topology_ContourTreeUniformAugmented_h
viskores::filter::scalar_topology::ContourTreeAugmented::MeshSortOrder
viskores::worklet::contourtree_augmented::IdArrayType MeshSortOrder
Array with the sorted order of the mesh vertices.
Definition: ContourTreeUniformAugmented.h:177
ArrayHandle.h
viskores::cont::DataSet
Contains and manages the geometric data structures that Viskores operates on.
Definition: DataSet.h:66
viskores::filter::scalar_topology::ContourTreeAugmented
Construct the Contour Tree for a 2D or 3D regular mesh.
Definition: ContourTreeUniformAugmented.h:96
viskores::filter::scalar_topology::ContourTreeAugmented::MultiBlockTreeHelper
std::unique_ptr< viskores::worklet::contourtree_distributed::MultiBlockContourTreeHelper > MultiBlockTreeHelper
Helper object to help with the parallel merge when running with DIY in parallel with MulitBlock data.
Definition: ContourTreeUniformAugmented.h:180
Types.h
viskores::filter::scalar_topology::ContourTreeAugmented::ContourTreeData
viskores::worklet::contourtree_augmented::ContourTree ContourTreeData
The contour tree computed by the filter.
Definition: ContourTreeUniformAugmented.h:173
viskores::filter::scalar_topology::ContourTreeAugmented::ComputeRegularStructure
unsigned int ComputeRegularStructure
Definition: ContourTreeUniformAugmented.h:167
viskores::filter::Filter
Base class for all filters.
Definition: Filter.h:171
viskores::cont::ArrayHandle
Manages an array-worth of data.
Definition: ArrayHandle.h:313
viskores::Id
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::cont::PartitionedDataSet
Comprises a set of viskores::cont::DataSet objects.
Definition: PartitionedDataSet.h:34
viskores::filter::scalar_topology::ContourTreeAugmented::UseMarchingCubes
bool UseMarchingCubes
Use marching cubes connectivity for computing the contour tree.
Definition: ContourTreeUniformAugmented.h:165
viskores_filter_scalar_topology_export.h
viskores::Vec< viskores::Id, 3 >
viskores::filter::scalar_topology::ContourTreeAugmented::CanThread
bool CanThread() const override
Returns whether the filter can execute on partitions in concurrent threads.
Definition: ContourTreeUniformAugmented.h:99
Filter.h