Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Todd Kordenbrock
VTK-m
Commits
26f9dc3c
Commit
26f9dc3c
authored
Apr 06, 2018
by
James Kress
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master'
parents
fef41372
bc695f2a
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
1217 additions
and
350 deletions
+1217
-350
vtkm/cont/BoundsCompute.cxx
vtkm/cont/BoundsCompute.cxx
+88
-0
vtkm/cont/BoundsCompute.h
vtkm/cont/BoundsCompute.h
+68
-0
vtkm/cont/BoundsGlobalCompute.cxx
vtkm/cont/BoundsGlobalCompute.cxx
+83
-0
vtkm/cont/BoundsGlobalCompute.h
vtkm/cont/BoundsGlobalCompute.h
+67
-0
vtkm/cont/CMakeLists.txt
vtkm/cont/CMakeLists.txt
+11
-0
vtkm/cont/FieldRangeCompute.cxx
vtkm/cont/FieldRangeCompute.cxx
+74
-0
vtkm/cont/FieldRangeCompute.h
vtkm/cont/FieldRangeCompute.h
+121
-0
vtkm/cont/FieldRangeCompute.hxx
vtkm/cont/FieldRangeCompute.hxx
+80
-0
vtkm/cont/FieldRangeGlobalCompute.cxx
vtkm/cont/FieldRangeGlobalCompute.cxx
+124
-0
vtkm/cont/FieldRangeGlobalCompute.h
vtkm/cont/FieldRangeGlobalCompute.h
+118
-0
vtkm/cont/FieldRangeGlobalCompute.hxx
vtkm/cont/FieldRangeGlobalCompute.hxx
+62
-0
vtkm/cont/MultiBlock.cxx
vtkm/cont/MultiBlock.cxx
+0
-295
vtkm/cont/MultiBlock.h
vtkm/cont/MultiBlock.h
+0
-26
vtkm/cont/diy/CMakeLists.txt
vtkm/cont/diy/CMakeLists.txt
+27
-0
vtkm/cont/diy/Serialization.h
vtkm/cont/diy/Serialization.h
+51
-0
vtkm/cont/diy/Serialization.hxx
vtkm/cont/diy/Serialization.hxx
+59
-0
vtkm/cont/testing/CMakeLists.txt
vtkm/cont/testing/CMakeLists.txt
+2
-1
vtkm/cont/testing/UnitTestFieldRangeCompute.cxx
vtkm/cont/testing/UnitTestFieldRangeCompute.cxx
+170
-0
vtkm/cont/testing/UnitTestMultiBlock.cxx
vtkm/cont/testing/UnitTestMultiBlock.cxx
+12
-28
No files found.
vtkm/cont/BoundsCompute.cxx
0 → 100644
View file @
26f9dc3c
//============================================================================
// 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 2015 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
// Copyright 2015 UT-Battelle, LLC.
// Copyright 2015 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.
//============================================================================
#include <vtkm/cont/BoundsCompute.h>
#include <vtkm/cont/CoordinateSystem.h>
#include <vtkm/cont/DataSet.h>
#include <vtkm/cont/MultiBlock.h>
#include <numeric> // for std::accumulate
namespace
vtkm
{
namespace
cont
{
//-----------------------------------------------------------------------------
VTKM_CONT
vtkm
::
Bounds
BoundsCompute
(
const
vtkm
::
cont
::
DataSet
&
dataset
,
vtkm
::
Id
coordinate_system_index
)
{
try
{
return
dataset
.
GetCoordinateSystem
(
coordinate_system_index
).
GetBounds
();
}
catch
(
vtkm
::
cont
::
ErrorBadValue
&
)
{
// missing coordinate_system_index, return empty bounds.
return
vtkm
::
Bounds
();
}
}
//-----------------------------------------------------------------------------
VTKM_CONT
vtkm
::
Bounds
BoundsCompute
(
const
vtkm
::
cont
::
MultiBlock
&
multiblock
,
vtkm
::
Id
coordinate_system_index
)
{
return
std
::
accumulate
(
multiblock
.
begin
(),
multiblock
.
end
(),
vtkm
::
Bounds
(),
[
=
](
const
vtkm
::
Bounds
&
val
,
const
vtkm
::
cont
::
DataSet
&
block
)
{
return
val
+
vtkm
::
cont
::
BoundsCompute
(
block
,
coordinate_system_index
);
});
}
//-----------------------------------------------------------------------------
VTKM_CONT
vtkm
::
Bounds
BoundsCompute
(
const
vtkm
::
cont
::
DataSet
&
dataset
,
const
std
::
string
&
name
)
{
try
{
return
dataset
.
GetCoordinateSystem
(
name
).
GetBounds
();
}
catch
(
vtkm
::
cont
::
ErrorBadValue
&
)
{
// missing coordinate_system_index, return empty bounds.
return
vtkm
::
Bounds
();
}
}
//-----------------------------------------------------------------------------
VTKM_CONT
vtkm
::
Bounds
BoundsCompute
(
const
vtkm
::
cont
::
MultiBlock
&
multiblock
,
const
std
::
string
&
name
)
{
return
std
::
accumulate
(
multiblock
.
begin
(),
multiblock
.
end
(),
vtkm
::
Bounds
(),
[
=
](
const
vtkm
::
Bounds
&
val
,
const
vtkm
::
cont
::
DataSet
&
block
)
{
return
val
+
vtkm
::
cont
::
BoundsCompute
(
block
,
name
);
});
}
}
}
vtkm/cont/BoundsCompute.h
0 → 100644
View file @
26f9dc3c
//============================================================================
// 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 2015 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
// Copyright 2015 UT-Battelle, LLC.
// Copyright 2015 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.
//============================================================================
#ifndef vtk_m_cont_BoundsCompute_h
#define vtk_m_cont_BoundsCompute_h
#include <vtkm/Bounds.h>
#include <vtkm/cont/vtkm_cont_export.h>
namespace
vtkm
{
namespace
cont
{
class
DataSet
;
class
MultiBlock
;
//@{
/// \brief Functions to compute bounds for a dataset or multiblock
///
/// These are utility functions that compute bounds for the dataset or
/// multiblock. When VTK-m is operating in an distributed environment, these
/// are bounds on the local process. To get global bounds across all ranks,
/// use `vtkm::cont::BoundsGlobalCompute` instead.
///
/// Note that if the provided CoordinateSystem does not exists, empty bounds
/// are returned. Likewise, for MultiBlock, blocks without the chosen CoordinateSystem
/// are skipped.
VTKM_CONT_EXPORT
VTKM_CONT
vtkm
::
Bounds
BoundsCompute
(
const
vtkm
::
cont
::
DataSet
&
dataset
,
vtkm
::
Id
coordinate_system_index
=
0
);
VTKM_CONT_EXPORT
VTKM_CONT
vtkm
::
Bounds
BoundsCompute
(
const
vtkm
::
cont
::
MultiBlock
&
multiblock
,
vtkm
::
Id
coordinate_system_index
=
0
);
VTKM_CONT_EXPORT
VTKM_CONT
vtkm
::
Bounds
BoundsCompute
(
const
vtkm
::
cont
::
DataSet
&
dataset
,
const
std
::
string
&
coordinate_system_name
);
VTKM_CONT_EXPORT
VTKM_CONT
vtkm
::
Bounds
BoundsCompute
(
const
vtkm
::
cont
::
MultiBlock
&
multiblock
,
const
std
::
string
&
coordinate_system_name
);
//@}
}
}
#endif
vtkm/cont/BoundsGlobalCompute.cxx
0 → 100644
View file @
26f9dc3c
//============================================================================
// 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 2015 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
// Copyright 2015 UT-Battelle, LLC.
// Copyright 2015 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.
//============================================================================
#include <vtkm/cont/BoundsGlobalCompute.h>
#include <vtkm/cont/BoundsCompute.h>
#include <vtkm/cont/CoordinateSystem.h>
#include <vtkm/cont/DataSet.h>
#include <vtkm/cont/FieldRangeGlobalCompute.h>
#include <vtkm/cont/MultiBlock.h>
#include <numeric> // for std::accumulate
namespace
vtkm
{
namespace
cont
{
namespace
detail
{
VTKM_CONT
vtkm
::
Bounds
MergeBoundsGlobal
(
const
vtkm
::
Bounds
&
local
)
{
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Range
>
ranges
;
ranges
.
Allocate
(
3
);
ranges
.
GetPortalControl
().
Set
(
0
,
local
.
X
);
ranges
.
GetPortalControl
().
Set
(
1
,
local
.
Y
);
ranges
.
GetPortalControl
().
Set
(
2
,
local
.
Z
);
ranges
=
vtkm
::
cont
::
detail
::
MergeRangesGlobal
(
ranges
);
auto
portal
=
ranges
.
GetPortalConstControl
();
return
vtkm
::
Bounds
(
portal
.
Get
(
0
),
portal
.
Get
(
1
),
portal
.
Get
(
2
));
}
}
//-----------------------------------------------------------------------------
VTKM_CONT
vtkm
::
Bounds
BoundsGlobalCompute
(
const
vtkm
::
cont
::
DataSet
&
dataset
,
vtkm
::
Id
coordinate_system_index
)
{
return
detail
::
MergeBoundsGlobal
(
vtkm
::
cont
::
BoundsCompute
(
dataset
,
coordinate_system_index
));
}
//-----------------------------------------------------------------------------
VTKM_CONT
vtkm
::
Bounds
BoundsGlobalCompute
(
const
vtkm
::
cont
::
MultiBlock
&
multiblock
,
vtkm
::
Id
coordinate_system_index
)
{
return
detail
::
MergeBoundsGlobal
(
vtkm
::
cont
::
BoundsCompute
(
multiblock
,
coordinate_system_index
));
}
//-----------------------------------------------------------------------------
VTKM_CONT
vtkm
::
Bounds
BoundsGlobalCompute
(
const
vtkm
::
cont
::
DataSet
&
dataset
,
const
std
::
string
&
name
)
{
return
detail
::
MergeBoundsGlobal
(
vtkm
::
cont
::
BoundsCompute
(
dataset
,
name
));
}
//-----------------------------------------------------------------------------
VTKM_CONT
vtkm
::
Bounds
BoundsGlobalCompute
(
const
vtkm
::
cont
::
MultiBlock
&
multiblock
,
const
std
::
string
&
name
)
{
return
detail
::
MergeBoundsGlobal
(
vtkm
::
cont
::
BoundsCompute
(
multiblock
,
name
));
}
}
}
vtkm/cont/BoundsGlobalCompute.h
0 → 100644
View file @
26f9dc3c
//============================================================================
// 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 2015 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
// Copyright 2015 UT-Battelle, LLC.
// Copyright 2015 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.
//============================================================================
#ifndef vtk_m_cont_BoundsGlobalCompute_h
#define vtk_m_cont_BoundsGlobalCompute_h
#include <vtkm/Bounds.h>
#include <vtkm/cont/vtkm_cont_export.h>
namespace
vtkm
{
namespace
cont
{
class
DataSet
;
class
MultiBlock
;
//@{
/// \brief Functions to compute bounds for a dataset or multiblock globally
///
/// These are utility functions that compute bounds for the dataset or
/// multiblock globally i.e. across all ranks when operating in a distributed
/// environment. When VTK-m not operating in an distributed environment, these
/// behave same as `vtkm::cont::BoundsCompute`.
///
/// Note that if the provided CoordinateSystem does not exists, empty bounds
/// are returned. Likewise, for MultiBlock, blocks without the chosen CoordinateSystem
/// are skipped.
VTKM_CONT_EXPORT
VTKM_CONT
vtkm
::
Bounds
BoundsGlobalCompute
(
const
vtkm
::
cont
::
DataSet
&
dataset
,
vtkm
::
Id
coordinate_system_index
=
0
);
VTKM_CONT_EXPORT
VTKM_CONT
vtkm
::
Bounds
BoundsGlobalCompute
(
const
vtkm
::
cont
::
MultiBlock
&
multiblock
,
vtkm
::
Id
coordinate_system_index
=
0
);
VTKM_CONT_EXPORT
VTKM_CONT
vtkm
::
Bounds
BoundsGlobalCompute
(
const
vtkm
::
cont
::
DataSet
&
dataset
,
const
std
::
string
&
coordinate_system_name
);
VTKM_CONT_EXPORT
VTKM_CONT
vtkm
::
Bounds
BoundsGlobalCompute
(
const
vtkm
::
cont
::
MultiBlock
&
multiblock
,
const
std
::
string
&
coordinate_system_name
);
//@}
}
}
#endif
vtkm/cont/CMakeLists.txt
View file @
26f9dc3c
...
...
@@ -46,6 +46,8 @@ set(headers
ArrayHandleConcatenate.h
ArrayRangeCompute.h
AssignerMultiBlock.h
BoundsCompute.h
BoundsGlobalCompute.h
CellLocator.h
CellLocatorTwoLevelUniformGrid.h
CellSet.h
...
...
@@ -77,6 +79,8 @@ set(headers
ErrorExecution.h
ErrorInternal.h
Field.h
FieldRangeCompute.h
FieldRangeGlobalCompute.h
ImplicitFunctionHandle.h
MultiBlock.h
PointLocatorUniformGrid.h
...
...
@@ -97,17 +101,23 @@ set(template_sources
CellSetExplicit.hxx
CellSetStructured.hxx
CoordinateSystem.hxx
FieldRangeCompute.hxx
FieldRangeGlobalCompute.hxx
StorageBasic.hxx
)
set
(
sources
ArrayHandle.cxx
AssignerMultiBlock.cxx
BoundsCompute.cxx
BoundsGlobalCompute.cxx
CellSet.cxx
CellSetStructured.cxx
DynamicArrayHandle.cxx
EnvironmentTracker.cxx
Field.cxx
FieldRangeCompute.cxx
FieldRangeGlobalCompute.cxx
internal/SimplePolymorphicContainer.cxx
internal/ArrayManagerExecutionShareWithControl.cxx
internal/ArrayHandleBasicImpl.cxx
...
...
@@ -137,6 +147,7 @@ vtkm_library( NAME vtkm_cont
)
add_subdirectory
(
internal
)
add_subdirectory
(
arg
)
add_subdirectory
(
diy
)
add_subdirectory
(
serial
)
add_subdirectory
(
tbb
)
add_subdirectory
(
cuda
)
...
...
vtkm/cont/FieldRangeCompute.cxx
0 → 100644
View file @
26f9dc3c
//============================================================================
// 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.
//============================================================================
#include <vtkm/cont/FieldRangeCompute.h>
#include <vtkm/cont/FieldRangeCompute.hxx>
#include <vtkm/cont/Algorithm.h>
namespace
vtkm
{
namespace
cont
{
//-----------------------------------------------------------------------------
VTKM_CONT
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Range
>
FieldRangeCompute
(
const
vtkm
::
cont
::
DataSet
&
dataset
,
const
std
::
string
&
name
,
vtkm
::
cont
::
Field
::
AssociationEnum
assoc
)
{
return
vtkm
::
cont
::
detail
::
FieldRangeComputeImpl
(
dataset
,
name
,
assoc
,
VTKM_DEFAULT_TYPE_LIST_TAG
(),
VTKM_DEFAULT_STORAGE_LIST_TAG
());
}
//-----------------------------------------------------------------------------
VTKM_CONT
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Range
>
FieldRangeCompute
(
const
vtkm
::
cont
::
MultiBlock
&
multiblock
,
const
std
::
string
&
name
,
vtkm
::
cont
::
Field
::
AssociationEnum
assoc
)
{
return
vtkm
::
cont
::
detail
::
FieldRangeComputeImpl
(
multiblock
,
name
,
assoc
,
VTKM_DEFAULT_TYPE_LIST_TAG
(),
VTKM_DEFAULT_STORAGE_LIST_TAG
());
}
//-----------------------------------------------------------------------------
namespace
detail
{
VTKM_CONT
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Range
>
MergeRanges
(
const
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Range
>&
a
,
const
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Range
>&
b
)
{
const
auto
num_vals_a
=
a
.
GetNumberOfValues
();
const
auto
num_vals_b
=
b
.
GetNumberOfValues
();
if
(
num_vals_b
==
0
)
{
return
a
;
}
if
(
num_vals_a
==
0
)
{
return
b
;
}
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Range
>
result
;
vtkm
::
cont
::
Algorithm
::
Transform
(
a
,
b
,
result
,
vtkm
::
Add
());
return
result
;
}
}
// namespace detail
}
}
// namespace vtkm::cont
vtkm/cont/FieldRangeCompute.h
0 → 100644
View file @
26f9dc3c
//============================================================================
// 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.
//============================================================================
#ifndef vtk_m_cont_FieldRangeCompute_h
#define vtk_m_cont_FieldRangeCompute_h
#include <vtkm/cont/DataSet.h>
#include <vtkm/cont/Field.h>
#include <vtkm/cont/MultiBlock.h>
#include <vtkm/cont/FieldRangeCompute.hxx>
namespace
vtkm
{
namespace
cont
{
/// \brief Compute ranges for fields in a DataSet or MultiBlock.
///
/// These methods to compute ranges for fields in a dataset or a multiblock.
/// When using VTK-m in a hybrid-parallel environment with distributed processing,
/// this class uses ranges for locally available data alone. Use FieldRangeGlobalCompute
/// to compute ranges globally across all ranks even in distributed mode.
//{@
/// Returns the range for a field from a dataset. If the field is not present, an empty
/// ArrayHandle will be returned.
VTKM_CONT_EXPORT
VTKM_CONT
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Range
>
FieldRangeCompute
(
const
vtkm
::
cont
::
DataSet
&
dataset
,
const
std
::
string
&
name
,
vtkm
::
cont
::
Field
::
AssociationEnum
assoc
=
vtkm
::
cont
::
Field
::
ASSOC_ANY
);
template
<
typename
TypeList
,
typename
StorageList
>
VTKM_CONT
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Range
>
FieldRangeCompute
(
const
vtkm
::
cont
::
DataSet
&
dataset
,
const
std
::
string
&
name
,
vtkm
::
cont
::
Field
::
AssociationEnum
assoc
,
TypeList
,
StorageList
)
{
VTKM_IS_LIST_TAG
(
TypeList
);
VTKM_IS_LIST_TAG
(
StorageList
);
return
vtkm
::
cont
::
detail
::
FieldRangeComputeImpl
(
dataset
,
name
,
assoc
,
TypeList
(),
StorageList
());
}
template
<
typename
TypeList
>
VTKM_CONT
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Range
>
FieldRangeCompute
(
const
vtkm
::
cont
::
DataSet
&
dataset
,
const
std
::
string
&
name
,
vtkm
::
cont
::
Field
::
AssociationEnum
assoc
,
TypeList
)
{
VTKM_IS_LIST_TAG
(
TypeList
);
return
vtkm
::
cont
::
detail
::
FieldRangeComputeImpl
(
dataset
,
name
,
assoc
,
TypeList
(),
VTKM_DEFAULT_STORAGE_LIST_TAG
());
}
//@}
//{@
/// Returns the range for a field from a multiblock. If the field is not present on any
/// of the blocks, an empty ArrayHandle will be returned. If the field is present on some blocks,
/// but not all, those blocks without the field are skipped.
///
/// The returned array handle will have as many values as the maximum number of components for
/// the selected field across all blocks.
VTKM_CONT_EXPORT
VTKM_CONT
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Range
>
FieldRangeCompute
(
const
vtkm
::
cont
::
MultiBlock
&
multiblock
,
const
std
::
string
&
name
,
vtkm
::
cont
::
Field
::
AssociationEnum
assoc
=
vtkm
::
cont
::
Field
::
ASSOC_ANY
);
template
<
typename
TypeList
,
typename
StorageList
>
VTKM_CONT
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Range
>
FieldRangeCompute
(
const
vtkm
::
cont
::
MultiBlock
&
multiblock
,
const
std
::
string
&
name
,
vtkm
::
cont
::
Field
::
AssociationEnum
assoc
,
TypeList
,
StorageList
)
{
VTKM_IS_LIST_TAG
(
TypeList
);
VTKM_IS_LIST_TAG
(
StorageList
);
return
vtkm
::
cont
::
detail
::
FieldRangeComputeImpl
(
multiblock
,
name
,
assoc
,
TypeList
(),
StorageList
());
}
template
<
typename
TypeList
>
VTKM_CONT
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Range
>
FieldRangeCompute
(
const
vtkm
::
cont
::
MultiBlock
&
multiblock
,
const
std
::
string
&
name
,
vtkm
::
cont
::
Field
::
AssociationEnum
assoc
,
TypeList
)
{
VTKM_IS_LIST_TAG
(
TypeList
);
return
vtkm
::
cont
::
detail
::
FieldRangeComputeImpl
(
multiblock
,
name
,
assoc
,
TypeList
(),
VTKM_DEFAULT_STORAGE_LIST_TAG
());
}
//@}
}
}
// namespace vtkm::cont
#endif
vtkm/cont/FieldRangeCompute.hxx
0 → 100644
View file @
26f9dc3c
//============================================================================
// 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.
//============================================================================
#ifndef vtk_m_cont_FieldRangeCompute_hxx
#define vtk_m_cont_FieldRangeCompute_hxx
#include <numeric> // for std::accumulate
namespace
vtkm
{
namespace
cont
{
namespace
detail
{
VTKM_CONT
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Range
>
MergeRanges
(
const
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Range
>&
a
,
const
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Range
>&
b
);
template
<
typename
TypeList
,
typename
StorageList
>
VTKM_CONT
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Range
>
FieldRangeComputeImpl
(
const
vtkm
::
cont
::
DataSet
&
dataset
,
const
std
::
string
&
name
,
vtkm
::
cont
::
Field
::
AssociationEnum
assoc
,
TypeList
,
StorageList
)
{
vtkm
::
cont
::
Field
field
;
try
{
field
=
dataset
.
GetField
(
name
,
assoc
);
}
catch
(
vtkm
::
cont
::
ErrorBadValue
&
)
{
// field missing, return empty range.
return
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Range
>
();
}
return
field
.
GetRange
(
TypeList
(),
StorageList
());
}
template
<
typename
TypeList
,
typename
StorageList
>
VTKM_CONT
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Range
>
FieldRangeComputeImpl
(
const
vtkm
::
cont
::
MultiBlock
&
multiblock
,
const
std
::
string
&
name
,
vtkm
::
cont
::
Field
::
AssociationEnum
assoc
,