Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ecpcitest
vtk-m
Commits
10ea36bb
Commit
10ea36bb
authored
Feb 18, 2021
by
Gunther H. Weber
Browse files
Pick one approach of using array handle decorator for contour tree
parent
585f0ccb
Changes
2
Hide whitespace changes
Inline
Side-by-side
vtkm/worklet/contourtree_augmented/meshtypes/ContourTreeMesh.h
View file @
10ea36bb
...
...
@@ -78,7 +78,6 @@
#include
<vtkm/worklet/contourtree_augmented/data_set_mesh/IdRelabeler.h>
// This is needed only as an unused default argument.
#include
<vtkm/worklet/contourtree_augmented/meshtypes/MeshStructureContourTreeMesh.h>
#include
<vtkm/worklet/contourtree_augmented/meshtypes/contourtreemesh/ArcComparator.h>
#include
<vtkm/worklet/contourtree_augmented/meshtypes/contourtreemesh/CombinedArrayHandleDecorator.h>
#include
<vtkm/worklet/contourtree_augmented/meshtypes/contourtreemesh/CombinedOtherStartIndexNNeighboursWorklet.h>
#include
<vtkm/worklet/contourtree_augmented/meshtypes/contourtreemesh/CombinedSimulatedSimplicityIndexComparator.h>
#include
<vtkm/worklet/contourtree_augmented/meshtypes/contourtreemesh/CombinedVectorDifferentFromNext.h>
...
...
@@ -565,37 +564,12 @@ inline void ContourTreeMesh<FieldType>::MergeWith(ContourTreeMesh<FieldType>& ot
{
// Array decorator with functor returning 0, 1 for each element depending
// on whethern the current value is different from the next
#if 1
auto
differentFromNextArr
=
vtkm
::
cont
::
make_ArrayHandleDecorator
(
overallSortIndex
.
GetNumberOfValues
()
-
1
,
mesh_dem_contourtree_mesh_inc
::
CombinedVectorDifferentFromNextDecoratorImpl
{},
overallSortOrder
,
this
->
GlobalMeshIndex
,
other
.
GlobalMeshIndex
);
#else
struct
OneIfDifferentFunctor
{
VTKM_EXEC_CONT
vtkm
::
Id
operator
()(
vtkm
::
Pair
<
vtkm
::
Id
,
vtkm
::
Id
>
x
)
const
{
return
x
.
first
==
x
.
second
?
0
:
1
;
}
};
// Alternate implementation
auto
combinedMeshIndexArray
=
vtkm
::
cont
::
make_ArrayHandleDecorator
(
this
->
GlobalMeshIndex
.
GetNumberOfValues
()
+
other
.
GlobalMeshIndex
.
GetNumberOfValues
(),
mesh_dem_contourtree_mesh_inc
::
CombinedArrayHandleDecoratorImpl
<
vtkm
::
Id
>
{},
this
->
GlobalMeshIndex
,
other
.
GlobalMeshIndex
);
auto
permutedMeshIndexHandle
=
make_ArrayHandlePermutation
(
overallSortOrder
,
combinedMeshIndexArray
);
auto
view0
=
make_ArrayHandleView
(
permutedMeshIndexHandle
,
0
,
permutedMeshIndexHandle
.
GetNumberOfValues
()
-
1
);
auto
view1
=
make_ArrayHandleView
(
permutedMeshIndexHandle
,
1
,
permutedMeshIndexHandle
.
GetNumberOfValues
()
-
1
);
auto
zipped
=
make_ArrayHandleZip
(
view0
,
view1
);
auto
differentFromNextArr
=
make_ArrayHandleTransform
(
zipped
,
OneIfDifferentFunctor
{});
#endif
// Compute the exclusive scan of our transformed combined vector
overallSortIndex
.
WritePortal
().
Set
(
0
,
0
);
...
...
vtkm/worklet/contourtree_augmented/meshtypes/contourtreemesh/CombinedArrayHandleDecorator.h
deleted
100644 → 0
View file @
585f0ccb
//============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//
// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
// Copyright 2014 UT-Battelle, LLC.
// Copyright 2014 Los Alamos National Security.
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// the U.S. Government retains certain rights in this software.
//
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
// Laboratory (LANL), the U.S. Government retains certain rights in
// this software.
//============================================================================
// Copyright (c) 2018, The Regents of the University of California, through
// Lawrence Berkeley National Laboratory (subject to receipt of any required approvals
// from the U.S. Dept. of Energy). All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// (1) Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// (2) Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// (3) Neither the name of the University of California, Lawrence Berkeley National
// Laboratory, U.S. Dept. of Energy nor the names of its contributors may be
// used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
//
//=============================================================================
//
// This code is an extension of the algorithm presented in the paper:
// Parallel Peak Pruning for Scalable SMP Contour Tree Computation.
// Hamish Carr, Gunther Weber, Christopher Sewell, and James Ahrens.
// Proceedings of the IEEE Symposium on Large Data Analysis and Visualization
// (LDAV), October 2016, Baltimore, Maryland.
//
// The PPP2 algorithm and software were jointly developed by
// Hamish Carr (University of Leeds), Gunther H. Weber (LBNL), and
// Oliver Ruebel (LBNL)
//==============================================================================
#ifndef vtk_m_worklet_contourtree_augmented_contourtree_mesh_inc_combined_array_handle_decorator_h
#define vtk_m_worklet_contourtree_augmented_contourtree_mesh_inc_combined_array_handle_decorator_h
#include
<vtkm/cont/ArrayHandle.h>
#include
<vtkm/cont/ExecutionAndControlObjectBase.h>
#include
<vtkm/worklet/contourtree_augmented/Types.h>
namespace
vtkm
{
namespace
worklet
{
namespace
contourtree_augmented
{
namespace
mesh_dem_contourtree_mesh_inc
{
// Decorator implementation that cobmines two arrays. Arrays are
// accessed depending on whether a flag in the index is set.
//
template
<
typename
ValueType
>
struct
CombinedArrayHandleDecoratorImpl
{
// The functor use to read values.
template
<
typename
Portal1Type
,
typename
Portal2Type
>
struct
Functor
{
Portal1Type
ThisGlobalMeshIndex
;
Portal2Type
OtherGlobalMeshIndex
;
VTKM_EXEC_CONT
ValueType
operator
()(
vtkm
::
Id
idx
)
const
{
return
vtkm
::
worklet
::
contourtree_augmented
::
IsThis
(
idx
)
?
this
->
ThisGlobalMeshIndex
.
Get
(
MaskedIndex
(
idx
))
:
this
->
OtherGlobalMeshIndex
.
Get
(
MaskedIndex
(
idx
));
}
};
// Factory function to produce a functor.
template
<
typename
P1T
,
typename
P2T
>
Functor
<
P1T
,
P2T
>
CreateFunctor
(
P1T
p1
,
P2T
p2
)
const
{
return
{
p1
,
p2
};
}
};
}
// namespace mesh_dem_contourtree_mesh_inc
}
// namespace contourtree_augmented
}
// namespace worklet
}
// namespace vtkm
#endif
Atkins, Charles Vernon
@atkins3
mentioned in commit
e3851ce2
·
Feb 22, 2021
mentioned in commit
e3851ce2
mentioned in commit e3851ce2368696f7284cd4f16db4c1ff962256a6
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment