mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Merge branch 'master' into particle_density
This commit is contained in:
commit
148cad2ce5
@ -40,8 +40,8 @@ add_library(vtkm_compiler_flags INTERFACE)
|
||||
target_link_libraries(vtkm_compiler_flags
|
||||
INTERFACE $<BUILD_INTERFACE:vtkm_vectorization_flags>)
|
||||
|
||||
# setup that we need C++11 support
|
||||
target_compile_features(vtkm_compiler_flags INTERFACE cxx_std_11)
|
||||
# setup that we need C++14 support
|
||||
target_compile_features(vtkm_compiler_flags INTERFACE cxx_std_14)
|
||||
|
||||
# setup our static libraries so that a separate ELF section
|
||||
# is generated for each function. This allows for the linker to
|
||||
|
@ -89,6 +89,19 @@ else()
|
||||
set_and_check(VTKm_CMAKE_MODULE_PATH "@PACKAGE_VTKm_INSTALL_CMAKE_MODULE_DIR@")
|
||||
endif()
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
|
||||
set(CMAKE_MODULE_PATH_save_vtkm "${CMAKE_MODULE_PATH}")
|
||||
list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_LIST_DIR}")
|
||||
|
||||
if (VTKm_ENABLE_TBB)
|
||||
find_dependency(TBB)
|
||||
if (NOT TBB_FOUND)
|
||||
set(VTKm_FOUND 0)
|
||||
list(APPEND VTKm_NOT_FOUND_REASON "TBB not found: ${TBB_NOT_FOUND_MESSAGE}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Load the library exports, but only if not compiling VTK-m itself
|
||||
set_and_check(VTKm_CONFIG_DIR "@PACKAGE_VTKm_INSTALL_CONFIG_DIR@")
|
||||
set(VTKM_FROM_INSTALL_DIR FALSE)
|
||||
@ -113,7 +126,8 @@ endif()
|
||||
|
||||
# VTKm requires some CMake Find modules not included with CMake, so
|
||||
# include the CMake modules distributed with VTKm.
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${VTKm_CMAKE_MODULE_PATH})
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH_save_vtkm} ${VTKm_CMAKE_MODULE_PATH})
|
||||
unset(CMAKE_MODULE_PATH_save_vtkm)
|
||||
|
||||
if(VTKm_ENABLE_CUDA)
|
||||
if (CMAKE_VERSION VERSION_LESS 3.13)
|
||||
|
@ -43,38 +43,11 @@ endfunction()
|
||||
|
||||
if(VTKm_ENABLE_TBB AND NOT TARGET vtkm::tbb)
|
||||
find_package(TBB REQUIRED)
|
||||
add_library(vtkm::tbb UNKNOWN IMPORTED GLOBAL)
|
||||
|
||||
set_target_properties(vtkm::tbb PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${TBB_INCLUDE_DIRS}")
|
||||
|
||||
if(EXISTS "${TBB_LIBRARY_RELEASE}")
|
||||
vtkm_extract_real_library("${TBB_LIBRARY_RELEASE}" real_path)
|
||||
set_property(TARGET vtkm::tbb APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
||||
set_target_properties(vtkm::tbb PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
|
||||
IMPORTED_LOCATION_RELEASE "${real_path}"
|
||||
)
|
||||
elseif(EXISTS "${TBB_LIBRARY}")
|
||||
#When VTK-m is mixed with OSPray we could use the OSPray FindTBB file
|
||||
#which doesn't define TBB_LIBRARY_RELEASE but instead defined only
|
||||
#TBB_LIBRARY
|
||||
vtkm_extract_real_library("${TBB_LIBRARY}" real_path)
|
||||
set_property(TARGET vtkm::tbb APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
||||
set_target_properties(vtkm::tbb PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
|
||||
IMPORTED_LOCATION_RELEASE "${real_path}"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(EXISTS "${TBB_LIBRARY_DEBUG}")
|
||||
vtkm_extract_real_library("${TBB_LIBRARY_DEBUG}" real_path)
|
||||
set_property(TARGET vtkm::tbb APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
|
||||
set_target_properties(vtkm::tbb PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
|
||||
IMPORTED_LOCATION_DEBUG "${real_path}"
|
||||
)
|
||||
endif()
|
||||
add_library(vtkmTBB INTERFACE)
|
||||
add_library(vtkm::tbb ALIAS vtkmTBB)
|
||||
target_link_libraries(vtkmTBB INTERFACE TBB::tbb)
|
||||
set_target_properties(vtkmTBB PROPERTIES EXPORT_NAME tbb)
|
||||
install(TARGETS vtkmTBB EXPORT ${VTKm_EXPORT_NAME})
|
||||
endif()
|
||||
|
||||
|
||||
|
47
CMake/VTKmInstallCMakePackage.cmake
Normal file
47
CMake/VTKmInstallCMakePackage.cmake
Normal file
@ -0,0 +1,47 @@
|
||||
##============================================================================
|
||||
## 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.
|
||||
##============================================================================
|
||||
|
||||
if (NOT (DEFINED VTKm_BUILD_CMAKE_BASE_DIR AND
|
||||
DEFINED VTKm_INSTALL_CONFIG_DIR AND
|
||||
DEFINED VTKm_CMAKE_MODULE_PATH))
|
||||
message(FATAL_ERROR
|
||||
"VTKmInstallCMakePackage is missing input variables")
|
||||
endif()
|
||||
|
||||
set(vtkm_cmake_module_files)
|
||||
|
||||
if(VTKm_ENABLE_TBB)
|
||||
list(APPEND vtkm_cmake_module_files FindTBB.cmake)
|
||||
endif()
|
||||
|
||||
set(vtkm_cmake_build_dir ${VTKm_BUILD_CMAKE_BASE_DIR}/${VTKm_INSTALL_CONFIG_DIR})
|
||||
foreach (vtkm_cmake_module_file IN LISTS vtkm_cmake_module_files)
|
||||
configure_file(
|
||||
"${VTKm_CMAKE_MODULE_PATH}/${vtkm_cmake_module_file}"
|
||||
"${vtkm_cmake_build_dir}/${vtkm_cmake_module_file}"
|
||||
COPYONLY)
|
||||
list(APPEND vtkm_cmake_files_to_install
|
||||
"${vtkm_cmake_module_file}")
|
||||
endforeach()
|
||||
|
||||
foreach (vtkm_cmake_file IN LISTS vtkm_cmake_files_to_install)
|
||||
if (IS_ABSOLUTE "${vtkm_cmake_file}")
|
||||
file(RELATIVE_PATH vtkm_cmake_subdir_root "${vtkm_cmake_build_dir}" "${vtkm_cmake_file}")
|
||||
get_filename_component(vtkm_cmake_subdir "${vtkm_cmake_subdir_root}" DIRECTORY)
|
||||
set(vtkm_cmake_original_file "${vtkm_cmake_file}")
|
||||
else ()
|
||||
get_filename_component(vtkm_cmake_subdir "${vtkm_cmake_file}" DIRECTORY)
|
||||
set(vtkm_cmake_original_file "${VTKm_CMAKE_MODULE_PATH}/${vtkm_cmake_file}")
|
||||
endif ()
|
||||
install(
|
||||
FILES "${vtkm_cmake_original_file}"
|
||||
DESTINATION "${VTKm_INSTALL_CONFIG_DIR}/${vtkm_cmake_subdir}"
|
||||
COMPONENT "development")
|
||||
endforeach ()
|
@ -269,6 +269,8 @@ write_basic_package_version_file(
|
||||
VERSION ${VTKm_VERSION}
|
||||
COMPATIBILITY ExactVersion )
|
||||
|
||||
include(VTKmInstallCMakePackage)
|
||||
|
||||
# Install the readme and license files.
|
||||
if (NOT VTKm_NO_INSTALL_README_LICENSE)
|
||||
install(FILES ${VTKm_SOURCE_DIR}/README.md
|
||||
|
@ -604,7 +604,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
// Get the number of components in a VariantArrayHandle, ArrayHandle, or Field's
|
||||
// Get the number of components in a UnknownArrayHandle, ArrayHandle, or Field's
|
||||
// ValueType.
|
||||
struct NumberOfComponents
|
||||
{
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <vtkm/cont/CellSetStructured.h>
|
||||
#include <vtkm/cont/Invoker.h>
|
||||
#include <vtkm/cont/Timer.h>
|
||||
#include <vtkm/cont/UncertainArrayHandle.h>
|
||||
|
||||
#include <vtkm/worklet/WorkletMapField.h>
|
||||
#include <vtkm/worklet/WorkletMapTopology.h>
|
||||
@ -34,7 +35,8 @@ namespace
|
||||
|
||||
using ValueTypes = vtkm::List<vtkm::UInt32, vtkm::Int32, vtkm::Int64, vtkm::Float32, vtkm::Float64>;
|
||||
|
||||
using ValueVariantHandle = vtkm::cont::VariantArrayHandleBase<ValueTypes>;
|
||||
using ValueUncertainHandle =
|
||||
vtkm::cont::UncertainArrayHandle<ValueTypes, vtkm::cont::StorageListBasic>;
|
||||
|
||||
// Hold configuration state (e.g. active device)
|
||||
vtkm::cont::InitializeResult Config;
|
||||
@ -232,7 +234,7 @@ template <typename ValueType>
|
||||
void BenchCellToPointAvgDynamic(::benchmark::State& state)
|
||||
{
|
||||
BenchCellToPointAvgImpl<ValueType> impl{ state };
|
||||
impl.Run(ValueVariantHandle{ impl.Input });
|
||||
impl.Run(ValueUncertainHandle{ impl.Input });
|
||||
};
|
||||
VTKM_BENCHMARK_TEMPLATES(BenchCellToPointAvgDynamic, ValueTypes);
|
||||
|
||||
@ -300,7 +302,7 @@ template <typename ValueType>
|
||||
void BenchPointToCellAvgDynamic(::benchmark::State& state)
|
||||
{
|
||||
BenchPointToCellAvgImpl<ValueType> impl{ state };
|
||||
impl.Run(ValueVariantHandle{ impl.Input });
|
||||
impl.Run(ValueUncertainHandle{ impl.Input });
|
||||
};
|
||||
VTKM_BENCHMARK_TEMPLATES(BenchPointToCellAvgDynamic, ValueTypes);
|
||||
|
||||
@ -371,7 +373,7 @@ template <typename ValueType>
|
||||
void BenchClassificationDynamic(::benchmark::State& state)
|
||||
{
|
||||
BenchClassificationImpl<ValueType> impl{ state };
|
||||
impl.Run(ValueVariantHandle{ impl.Input });
|
||||
impl.Run(ValueUncertainHandle{ impl.Input });
|
||||
};
|
||||
VTKM_BENCHMARK_TEMPLATES(BenchClassificationDynamic, ValueTypes);
|
||||
|
||||
|
5
docs/changelog/deprecate-variant-array-handle.md
Normal file
5
docs/changelog/deprecate-variant-array-handle.md
Normal file
@ -0,0 +1,5 @@
|
||||
# Deprecated `VariantArrayHandle`
|
||||
|
||||
`VaraintArrayHandle` has been replaced by `UnknownArrayHandle` and
|
||||
`UncertainArrayHandle`. Officially made `VariantArrayHandle` deprecated and
|
||||
point users to the new implementations.
|
@ -13,51 +13,110 @@
|
||||
#include <vector>
|
||||
#include <vtkm/cont/DataSetBuilderUniform.h>
|
||||
#include <vtkm/io/ImageWriterPNG.h>
|
||||
#include <vtkm/worklet/WorkletMapField.h>
|
||||
|
||||
|
||||
// The logistic map is xᵢ₊₁ = rxᵢ(1-xᵢ).
|
||||
// If we start this iteration out at (say) x₀ = 0.5, the map has "transients",
|
||||
// which we must iterate away to produce the final image.
|
||||
template <typename T>
|
||||
class LogisticBurnIn : public vtkm::worklet::WorkletMapField
|
||||
{
|
||||
public:
|
||||
LogisticBurnIn(T rmin, vtkm::Id width)
|
||||
: rmin_(rmin)
|
||||
, width_(width)
|
||||
{
|
||||
}
|
||||
|
||||
using ControlSignature = void(FieldOut);
|
||||
using ExecutionSignature = _1(WorkIndex);
|
||||
|
||||
VTKM_EXEC T operator()(vtkm::Id workIndex) const
|
||||
{
|
||||
T r = rmin_ + (4.0 - rmin_) * workIndex / (width_ - 1);
|
||||
T x = 0.5;
|
||||
// 2048 should be enough iterations to get rid of the transients:
|
||||
int n = 0;
|
||||
while (n++ < 2048)
|
||||
{
|
||||
x = r * x * (1 - x);
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
private:
|
||||
T rmin_;
|
||||
vtkm::Id width_;
|
||||
};
|
||||
|
||||
// After burn-in, the iteration is periodic but in general not convergent,
|
||||
// i.e., for large enough i, there exists an integer p > 0 such that
|
||||
// xᵢ₊ₚ = xᵢ for all i.
|
||||
// So color the pixels corresponding to xᵢ, xᵢ₊₁, .. xᵢ₊ₚ.
|
||||
template <typename T>
|
||||
class LogisticLimitPoints : public vtkm::worklet::WorkletMapField
|
||||
{
|
||||
public:
|
||||
LogisticLimitPoints(T rmin, vtkm::Id width, vtkm::Id height)
|
||||
: rmin_(rmin)
|
||||
, width_(width)
|
||||
, height_(height)
|
||||
{
|
||||
orange_ = vtkm::Vec4f(1.0, 0.5, 0.0, 0.0);
|
||||
}
|
||||
|
||||
using ControlSignature = void(FieldIn, WholeArrayOut);
|
||||
using ExecutionSignature = void(_1, _2, WorkIndex);
|
||||
|
||||
template <typename OutputArrayPortalType>
|
||||
VTKM_EXEC void operator()(T x, OutputArrayPortalType& outputArrayPortal, vtkm::Id workIndex) const
|
||||
{
|
||||
T r = rmin_ + (4.0 - rmin_) * workIndex / (width_ - 1);
|
||||
// We can't display need more limit points than pixels of height:
|
||||
vtkm::Id limit_points = 0;
|
||||
while (limit_points++ < height_)
|
||||
{
|
||||
vtkm::Id j = vtkm::Round(x * (height_ - 1));
|
||||
outputArrayPortal.Set(j * width_ + workIndex, orange_);
|
||||
x = r * x * (1 - x);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
T rmin_;
|
||||
vtkm::Id width_;
|
||||
vtkm::Id height_;
|
||||
vtkm::Vec4f orange_;
|
||||
};
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
size_t height = 1800;
|
||||
size_t width = height * 1.618;
|
||||
vtkm::Id height = 1800;
|
||||
vtkm::Id width = height * 1.618;
|
||||
vtkm::cont::DataSetBuilderUniform dsb;
|
||||
vtkm::cont::DataSet ds = dsb.Create(vtkm::Id2(width, height));
|
||||
|
||||
std::vector<double> x(width, 0.5);
|
||||
|
||||
vtkm::cont::ArrayHandle<double> x;
|
||||
x.Allocate(width);
|
||||
vtkm::cont::Invoker invoke;
|
||||
double rmin = 2.9;
|
||||
for (size_t i = 0; i < width; ++i)
|
||||
auto burnIn = LogisticBurnIn<double>(rmin, width);
|
||||
invoke(burnIn, x);
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec4f> pixels;
|
||||
pixels.Allocate(width * height);
|
||||
auto wp = pixels.WritePortal();
|
||||
for (vtkm::Id i = 0; i < pixels.GetNumberOfValues(); ++i)
|
||||
{
|
||||
double r = rmin + (4.0 - rmin) * i / (width - 1);
|
||||
int n = 0;
|
||||
// 2048 should be enough iterations to be "converged";
|
||||
// though of course the iterations actually don't all converge but cycle or are chaotic.
|
||||
while (n++ < 2048)
|
||||
{
|
||||
x[i] = r * x[i] * (1 - x[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
vtkm::Vec4f v(1.0, 0.5, 0.0, 0.0);
|
||||
std::vector<vtkm::Vec4f> pixelValues(width * height, vtkm::Vec4f(0, 0, 0, 0));
|
||||
size_t iterates = 0;
|
||||
// We don't need more iterates than pixels of height,
|
||||
// by the pigeonhole principle.
|
||||
while (iterates++ < height)
|
||||
{
|
||||
for (size_t i = 0; i < width; ++i)
|
||||
{
|
||||
double r = rmin + (4.0 - rmin) * i / (width - 1);
|
||||
double y = x[i];
|
||||
assert(y >= 0 && y <= 1);
|
||||
size_t j = std::round(y * (height - 1));
|
||||
pixelValues[j * width + i] = v;
|
||||
x[i] = r * x[i] * (1 - x[i]);
|
||||
}
|
||||
wp.Set(i, vtkm::Vec4f(0, 0, 0, 0));
|
||||
}
|
||||
auto limitPoints = LogisticLimitPoints<double>(rmin, width, height);
|
||||
|
||||
invoke(limitPoints, x, pixels);
|
||||
std::string colorFieldName = "pixels";
|
||||
ds.AddPointField(colorFieldName, pixelValues);
|
||||
ds.AddPointField(colorFieldName, pixels);
|
||||
std::string filename = "logistic.png";
|
||||
vtkm::io::ImageWriterPNG writer(filename);
|
||||
writer.WriteDataSet(ds, colorFieldName);
|
||||
|
40
vtkm/Math.h
40
vtkm/Math.h
@ -2707,6 +2707,46 @@ inline VTKM_EXEC_CONT T DifferenceOfProducts(T a, T b, T c, T d)
|
||||
return dop + err;
|
||||
}
|
||||
|
||||
// Solves ax² + bx + c = 0.
|
||||
// Only returns the real roots.
|
||||
// If there are real roots, the first element of the pair is <= the second.
|
||||
// If there are no real roots, both elements are NaNs.
|
||||
// The error should be at most 3 ulps.
|
||||
template<typename T>
|
||||
inline VTKM_EXEC_CONT vtkm::Vec<T, 2> QuadraticRoots(T a, T b, T c)
|
||||
{
|
||||
if (a == 0)
|
||||
{
|
||||
if (b == 0)
|
||||
{
|
||||
if (c == 0)
|
||||
{
|
||||
// A degenerate case. All real numbers are roots; hopefully this arbitrary decision interacts gracefully with use.
|
||||
return vtkm::Vec<T,2>(0,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
return vtkm::Vec<T,2>(vtkm::Nan<T>(), vtkm::Nan<T>());
|
||||
}
|
||||
}
|
||||
return vtkm::Vec<T,2>(-c/b, -c/b);
|
||||
}
|
||||
T delta = DifferenceOfProducts(b, b, 4*a, c);
|
||||
if (delta < 0)
|
||||
{
|
||||
return vtkm::Vec<T,2>(vtkm::Nan<T>(), vtkm::Nan<T>());
|
||||
}
|
||||
|
||||
T q = -(b + vtkm::CopySign(vtkm::Sqrt(delta), b)) / 2;
|
||||
T r0 = q / a;
|
||||
T r1 = c / q;
|
||||
if (r0 < r1)
|
||||
{
|
||||
return vtkm::Vec<T,2>(r0, r1);
|
||||
}
|
||||
return vtkm::Vec<T,2>(r1, r0);
|
||||
}
|
||||
|
||||
/// Bitwise operations
|
||||
///
|
||||
|
||||
|
@ -1309,6 +1309,46 @@ inline VTKM_EXEC_CONT T DifferenceOfProducts(T a, T b, T c, T d)
|
||||
return dop + err;
|
||||
}
|
||||
|
||||
// Solves ax² + bx + c = 0.
|
||||
// Only returns the real roots.
|
||||
// If there are real roots, the first element of the pair is <= the second.
|
||||
// If there are no real roots, both elements are NaNs.
|
||||
// The error should be at most 3 ulps.
|
||||
template<typename T>
|
||||
inline VTKM_EXEC_CONT vtkm::Vec<T, 2> QuadraticRoots(T a, T b, T c)
|
||||
{
|
||||
if (a == 0)
|
||||
{
|
||||
if (b == 0)
|
||||
{
|
||||
if (c == 0)
|
||||
{
|
||||
// A degenerate case. All real numbers are roots; hopefully this arbitrary decision interacts gracefully with use.
|
||||
return vtkm::Vec<T,2>(0,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
return vtkm::Vec<T,2>(vtkm::Nan<T>(), vtkm::Nan<T>());
|
||||
}
|
||||
}
|
||||
return vtkm::Vec<T,2>(-c/b, -c/b);
|
||||
}
|
||||
T delta = DifferenceOfProducts(b, b, 4*a, c);
|
||||
if (delta < 0)
|
||||
{
|
||||
return vtkm::Vec<T,2>(vtkm::Nan<T>(), vtkm::Nan<T>());
|
||||
}
|
||||
|
||||
T q = -(b + vtkm::CopySign(vtkm::Sqrt(delta), b)) / 2;
|
||||
T r0 = q / a;
|
||||
T r1 = c / q;
|
||||
if (r0 < r1)
|
||||
{
|
||||
return vtkm::Vec<T,2>(r0, r1);
|
||||
}
|
||||
return vtkm::Vec<T,2>(r1, r0);
|
||||
}
|
||||
|
||||
/// Bitwise operations
|
||||
///
|
||||
|
||||
|
@ -193,7 +193,7 @@ private:
|
||||
if (RangeLoss && PrecLoss)
|
||||
{
|
||||
VTKM_LOG_F(vtkm::cont::LogLevel::Warn,
|
||||
"VariantArrayHandle::AsVirtual: Casting ComponentType of "
|
||||
"ArrayHandleCast: Casting ComponentType of "
|
||||
"%s to %s reduces range and precision.",
|
||||
vtkm::cont::TypeToString<SrcValueType>().c_str(),
|
||||
vtkm::cont::TypeToString<DstValueType>().c_str());
|
||||
@ -201,7 +201,7 @@ private:
|
||||
else if (RangeLoss)
|
||||
{
|
||||
VTKM_LOG_F(vtkm::cont::LogLevel::Warn,
|
||||
"VariantArrayHandle::AsVirtual: Casting ComponentType of "
|
||||
"ArrayHandleCast: Casting ComponentType of "
|
||||
"%s to %s reduces range.",
|
||||
vtkm::cont::TypeToString<SrcValueType>().c_str(),
|
||||
vtkm::cont::TypeToString<DstValueType>().c_str());
|
||||
@ -209,7 +209,7 @@ private:
|
||||
else if (PrecLoss)
|
||||
{
|
||||
VTKM_LOG_F(vtkm::cont::LogLevel::Warn,
|
||||
"VariantArrayHandle::AsVirtual: Casting ComponentType of "
|
||||
"ArrayHandleCast: Casting ComponentType of "
|
||||
"%s to %s reduces precision.",
|
||||
vtkm::cont::TypeToString<SrcValueType>().c_str(),
|
||||
vtkm::cont::TypeToString<DstValueType>().c_str());
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <vtkm/cont/DynamicCellSet.h>
|
||||
#include <vtkm/cont/ErrorBadValue.h>
|
||||
#include <vtkm/cont/Field.h>
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
#include <vtkm/cont/UnknownArrayHandle.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
@ -133,7 +133,7 @@ public:
|
||||
//@}
|
||||
|
||||
VTKM_CONT
|
||||
void AddPointField(const std::string& fieldName, const vtkm::cont::VariantArrayHandle& field)
|
||||
void AddPointField(const std::string& fieldName, const vtkm::cont::UnknownArrayHandle& field)
|
||||
{
|
||||
this->AddField(make_FieldPoint(fieldName, field));
|
||||
}
|
||||
@ -161,7 +161,7 @@ public:
|
||||
|
||||
//Cell centered field
|
||||
VTKM_CONT
|
||||
void AddCellField(const std::string& fieldName, const vtkm::cont::VariantArrayHandle& field)
|
||||
void AddCellField(const std::string& fieldName, const vtkm::cont::UnknownArrayHandle& field)
|
||||
{
|
||||
this->AddField(make_FieldCell(fieldName, field));
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
VTKM_CONT
|
||||
static void AddPointField(vtkm::cont::DataSet& dataSet,
|
||||
const std::string& fieldName,
|
||||
const vtkm::cont::VariantArrayHandle& field)
|
||||
const vtkm::cont::UnknownArrayHandle& field)
|
||||
{
|
||||
dataSet.AddField(make_FieldPoint(fieldName, field));
|
||||
}
|
||||
@ -67,7 +67,7 @@ public:
|
||||
VTKM_CONT
|
||||
static void AddCellField(vtkm::cont::DataSet& dataSet,
|
||||
const std::string& fieldName,
|
||||
const vtkm::cont::VariantArrayHandle& field)
|
||||
const vtkm::cont::UnknownArrayHandle& field)
|
||||
{
|
||||
dataSet.AddField(make_FieldCell(fieldName, field));
|
||||
}
|
||||
|
@ -35,8 +35,8 @@ VTKM_SILENCE_WEAK_VTABLE_WARNING_END
|
||||
|
||||
/// Throws an ErrorBadType exception with the following message:
|
||||
/// Cast failed: \c baseType --> \c derivedType".
|
||||
/// This is generally caused by asking for a casting of a VariantArrayHandle
|
||||
/// with an insufficient type list.
|
||||
/// This is generally caused by asking for a casting of a UnknownArrayHandle
|
||||
/// or UncertainArrayhandle with an insufficient type list.
|
||||
//
|
||||
VTKM_CONT_EXPORT void throwFailedDynamicCast(const std::string& baseType,
|
||||
const std::string& derivedType);
|
||||
|
@ -194,7 +194,7 @@ vtkm::cont::Field make_FieldPoint(std::string name, const vtkm::cont::ArrayHandl
|
||||
return vtkm::cont::Field(name, vtkm::cont::Field::Association::POINTS, data);
|
||||
}
|
||||
|
||||
/// Convenience function to build point fields from vtkm::cont::VariantArrayHandle
|
||||
/// Convenience function to build point fields from vtkm::cont::UnknownArrayHandle
|
||||
inline vtkm::cont::Field make_FieldPoint(std::string name,
|
||||
const vtkm::cont::UnknownArrayHandle& data)
|
||||
{
|
||||
@ -209,7 +209,7 @@ vtkm::cont::Field make_FieldCell(std::string name, const vtkm::cont::ArrayHandle
|
||||
}
|
||||
|
||||
|
||||
/// Convenience function to build cell fields from vtkm::cont::VariantArrayHandle
|
||||
/// Convenience function to build cell fields from vtkm::cont::UnknownArrayHandle
|
||||
inline vtkm::cont::Field make_FieldCell(std::string name,
|
||||
const vtkm::cont::UnknownArrayHandle& data)
|
||||
{
|
||||
|
@ -916,7 +916,7 @@ struct UnknownArrayHandleTry
|
||||
Args&&... args) const
|
||||
{
|
||||
using DerivedArrayType = vtkm::cont::ArrayHandle<T, S>;
|
||||
if (!called && unknownArray.IsType<DerivedArrayType>())
|
||||
if (!called && unknownArray.CanConvert<DerivedArrayType>())
|
||||
{
|
||||
called = true;
|
||||
DerivedArrayType derivedArray;
|
||||
|
@ -31,6 +31,10 @@
|
||||
#include <vtkm/cont/ArrayHandleVirtual.h>
|
||||
#endif //VTKM_NO_DEPRECATED_VIRTUAL
|
||||
|
||||
// This is a deprecated class. Don't warn about deprecation while implementing
|
||||
// deprecated functionality.
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace cont
|
||||
@ -42,7 +46,6 @@ namespace internal
|
||||
namespace variant
|
||||
{
|
||||
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
struct ForceCastToVirtual
|
||||
{
|
||||
template <typename SrcValueType, typename Storage, typename DstValueType>
|
||||
@ -91,7 +94,19 @@ private:
|
||||
throw vtkm::cont::ErrorBadType(str.str());
|
||||
}
|
||||
};
|
||||
VTKM_DEPRECATED_SUPPRESS_END
|
||||
|
||||
template <typename S>
|
||||
struct NoCastStorageTransformImpl
|
||||
{
|
||||
using type = S;
|
||||
};
|
||||
template <typename T, typename S>
|
||||
struct NoCastStorageTransformImpl<vtkm::cont::StorageTagCast<T, S>>
|
||||
{
|
||||
using type = S;
|
||||
};
|
||||
template <typename S>
|
||||
using NoCastStorageTransform = typename NoCastStorageTransformImpl<S>::type;
|
||||
|
||||
}
|
||||
} // namespace internal::variant
|
||||
@ -106,7 +121,10 @@ VTKM_DEPRECATED_SUPPRESS_END
|
||||
///
|
||||
/// See the documentation of `VariantArrayHandleBase` for more information.
|
||||
///
|
||||
class VTKM_ALWAYS_EXPORT VariantArrayHandleCommon : public vtkm::cont::UnknownArrayHandle
|
||||
class VTKM_ALWAYS_EXPORT VTKM_DEPRECATED(
|
||||
1.7,
|
||||
"VariantArrayHandle classes replaced with UnknownArrayHandle and UncertainArrayHandle.")
|
||||
VariantArrayHandleCommon : public vtkm::cont::UnknownArrayHandle
|
||||
{
|
||||
using Superclass = vtkm::cont::UnknownArrayHandle;
|
||||
|
||||
@ -120,14 +138,6 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
// MSVC will issue deprecation warnings here if this template is instantiated with
|
||||
// a deprecated class even if the template is used from a section of code where
|
||||
// deprecation warnings are suppressed. This is annoying behavior since this template
|
||||
// has no control over what class it is used with. To get around it, we have to
|
||||
// suppress all deprecation warnings here.
|
||||
#ifdef VTKM_MSVC
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
#endif
|
||||
/// Returns this array cast to the given \c ArrayHandle type. Throws \c
|
||||
/// ErrorBadType if the cast does not work. Use \c IsType
|
||||
/// to check if the cast can happen.
|
||||
@ -137,9 +147,6 @@ public:
|
||||
{
|
||||
return this->AsArrayHandle<ArrayHandleType>();
|
||||
}
|
||||
#ifdef VTKM_MSVC
|
||||
VTKM_DEPRECATED_SUPPRESS_END
|
||||
#endif
|
||||
|
||||
/// \brief Call a functor using the underlying array type.
|
||||
///
|
||||
@ -165,7 +172,6 @@ public:
|
||||
/// the CastAndCall. You can also specify a list of types to try as the optional
|
||||
/// third template argument.
|
||||
///
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
template <typename T,
|
||||
typename StorageList = VTKM_DEFAULT_STORAGE_LIST,
|
||||
typename TypeList = vtkm::List<T>>
|
||||
@ -174,12 +180,14 @@ public:
|
||||
{
|
||||
VTKM_IS_LIST(StorageList);
|
||||
VTKM_IS_LIST(TypeList);
|
||||
// Remove cast storage from storage list because we take care of casting elsewhere
|
||||
using CleanStorageList =
|
||||
vtkm::ListTransform<StorageList, vtkm::cont::internal::variant::NoCastStorageTransform>;
|
||||
vtkm::cont::internal::variant::ForceCastToVirtual caster;
|
||||
vtkm::cont::ArrayHandleVirtual<T> output;
|
||||
this->CastAndCall<TypeList, StorageList>(caster, output);
|
||||
this->CastAndCall<TypeList, CleanStorageList>(caster, output);
|
||||
return output;
|
||||
}
|
||||
VTKM_DEPRECATED_SUPPRESS_END
|
||||
#endif //VTKM_NO_DEPRECATED_VIRTUAL
|
||||
|
||||
/// Returns this array cast to a `ArrayHandleMultiplexer` of the given type.
|
||||
@ -264,7 +272,10 @@ public:
|
||||
/// component types.
|
||||
///
|
||||
template <typename TypeList>
|
||||
class VTKM_ALWAYS_EXPORT VariantArrayHandleBase : public VariantArrayHandleCommon
|
||||
class VTKM_ALWAYS_EXPORT VTKM_DEPRECATED(
|
||||
1.7,
|
||||
"VariantArrayHandle classes replaced with UnknownArrayHandle and UncertainArrayHandle.")
|
||||
VariantArrayHandleBase : public VariantArrayHandleCommon
|
||||
{
|
||||
VTKM_STATIC_ASSERT_MSG((!std::is_same<TypeList, vtkm::ListUniversal>::value),
|
||||
"Cannot use vtkm::ListUniversal with VariantArrayHandle.");
|
||||
@ -319,14 +330,12 @@ public:
|
||||
/// be specified in the second template parameter, which will be passed to
|
||||
/// the CastAndCall.
|
||||
///
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
template <typename T, typename StorageList = VTKM_DEFAULT_STORAGE_LIST>
|
||||
VTKM_CONT VTKM_DEPRECATED(1.6, "ArrayHandleVirtual is no longer suported.")
|
||||
vtkm::cont::ArrayHandleVirtual<T> AsVirtual() const
|
||||
{
|
||||
return this->Superclass::AsVirtual<T, StorageList, TypeList>();
|
||||
}
|
||||
VTKM_DEPRECATED_SUPPRESS_END
|
||||
#endif //VTKM_NO_DEPRECATED_VIRTUAL
|
||||
|
||||
/// Changes the types to try casting to when resolving this variant array,
|
||||
@ -406,7 +415,10 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
using VariantArrayHandle = vtkm::cont::VariantArrayHandleBase<VTKM_DEFAULT_TYPE_LIST>;
|
||||
using VariantArrayHandle VTKM_DEPRECATED(
|
||||
1.7,
|
||||
"VariantArrayHandle classes replaced with UnknownArrayHandle and UncertainArrayHandle.") =
|
||||
vtkm::cont::VariantArrayHandleBase<VTKM_DEFAULT_TYPE_LIST>;
|
||||
|
||||
|
||||
//=============================================================================
|
||||
@ -473,5 +485,7 @@ public:
|
||||
} // diy
|
||||
/// @endcond SERIALIZATION
|
||||
|
||||
VTKM_DEPRECATED_SUPPRESS_END
|
||||
|
||||
|
||||
#endif //vtk_m_virts_VariantArrayHandle_h
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/cont/DynamicCellSet.h>
|
||||
#include <vtkm/cont/UnknownArrayHandle.h>
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
|
||||
#include <vtkm/cont/testing/vtkm_cont_testing_export.h>
|
||||
|
||||
|
@ -11,7 +11,6 @@
|
||||
#define vtk_m_cont_testing_TestingSerialization_h
|
||||
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
|
||||
#include <vtkm/thirdparty/diy/serialization.h>
|
||||
|
@ -30,7 +30,6 @@
|
||||
|
||||
#include <vtkm/cont/UncertainArrayHandle.h>
|
||||
#include <vtkm/cont/UnknownArrayHandle.h>
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
|
||||
#include <vtkm/cont/testing/TestingSerialization.h>
|
||||
|
||||
@ -87,18 +86,6 @@ inline void RunTest(const T& obj)
|
||||
TestSerialization(obj, TestEqualArrayHandle{});
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline void RunTest(const T& obj, std::true_type)
|
||||
{
|
||||
TestSerialization(obj, TestEqualArrayHandle{});
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline void RunTest(const T&, std::false_type)
|
||||
{
|
||||
// Suppress running the test
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
constexpr vtkm::Id ArraySize = 10;
|
||||
|
||||
@ -107,14 +94,14 @@ using TestTypesListVec = vtkm::List<vtkm::Vec3f_32, vtkm::Vec3f_64>;
|
||||
using TestTypesList = vtkm::ListAppend<TestTypesListScalar, TestTypesListVec>;
|
||||
|
||||
template <typename T, typename S>
|
||||
inline vtkm::cont::VariantArrayHandleBase<vtkm::ListAppend<TestTypesList, vtkm::List<T>>>
|
||||
MakeTestVariantArrayHandle(const vtkm::cont::ArrayHandle<T, S>& array)
|
||||
inline vtkm::cont::UnknownArrayHandle MakeTestUnknownArrayHandle(
|
||||
const vtkm::cont::ArrayHandle<T, S>& array)
|
||||
{
|
||||
return array;
|
||||
}
|
||||
|
||||
template <typename T, typename S>
|
||||
inline vtkm::cont::UnknownArrayHandle MakeTestUnknownArrayHandle(
|
||||
inline vtkm::cont::UncertainArrayHandle<vtkm::List<T>, vtkm::List<S>> MakeTestUncertainArrayHandle(
|
||||
const vtkm::cont::ArrayHandle<T, S>& array)
|
||||
{
|
||||
return array;
|
||||
@ -128,7 +115,7 @@ struct TestArrayHandleBasic
|
||||
auto array = RandomArrayHandle<T>::Make(ArraySize);
|
||||
RunTest(array);
|
||||
RunTest(MakeTestUnknownArrayHandle(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array));
|
||||
RunTest(MakeTestUncertainArrayHandle(array));
|
||||
}
|
||||
};
|
||||
|
||||
@ -141,8 +128,7 @@ struct TestArrayHandleSOA
|
||||
vtkm::cont::ArrayCopy(RandomArrayHandle<T>::Make(ArraySize), array);
|
||||
RunTest(array);
|
||||
RunTest(MakeTestUnknownArrayHandle(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array),
|
||||
vtkm::ListHas<VTKM_DEFAULT_STORAGE_LIST, vtkm::cont::StorageTagSOA>{});
|
||||
RunTest(MakeTestUncertainArrayHandle(array));
|
||||
}
|
||||
};
|
||||
|
||||
@ -157,11 +143,7 @@ struct TestArrayHandleCartesianProduct
|
||||
RandomArrayHandle<T>::Make(ArraySize));
|
||||
RunTest(array);
|
||||
RunTest(MakeTestUnknownArrayHandle(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array),
|
||||
vtkm::ListHas<VTKM_DEFAULT_STORAGE_LIST,
|
||||
vtkm::cont::StorageTagCartesianProduct<vtkm::cont::StorageTagBasic,
|
||||
vtkm::cont::StorageTagBasic,
|
||||
vtkm::cont::StorageTagBasic>>{});
|
||||
RunTest(MakeTestUncertainArrayHandle(array));
|
||||
}
|
||||
};
|
||||
|
||||
@ -174,9 +156,7 @@ struct TestArrayHandleCast
|
||||
vtkm::cont::make_ArrayHandleCast<T>(RandomArrayHandle<vtkm::Int8>::Make(ArraySize));
|
||||
RunTest(array);
|
||||
RunTest(MakeTestUnknownArrayHandle(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array),
|
||||
vtkm::ListHas<VTKM_DEFAULT_STORAGE_LIST,
|
||||
vtkm::cont::StorageTagCast<vtkm::Int8, vtkm::cont::StorageTagBasic>>{});
|
||||
RunTest(MakeTestUncertainArrayHandle(array));
|
||||
}
|
||||
|
||||
template <typename T, vtkm::IdComponent N>
|
||||
@ -186,9 +166,7 @@ struct TestArrayHandleCast
|
||||
RandomArrayHandle<vtkm::Vec<vtkm::Int8, N>>::Make(ArraySize));
|
||||
RunTest(array);
|
||||
RunTest(MakeTestUnknownArrayHandle(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array),
|
||||
vtkm::ListHas<VTKM_DEFAULT_STORAGE_LIST,
|
||||
vtkm::cont::StorageTagCast<vtkm::Int8, vtkm::cont::StorageTagBasic>>{});
|
||||
RunTest(MakeTestUncertainArrayHandle(array));
|
||||
}
|
||||
};
|
||||
|
||||
@ -201,8 +179,7 @@ struct TestArrayHandleConstant
|
||||
auto array = vtkm::cont::make_ArrayHandleConstant(cval, ArraySize);
|
||||
RunTest(array);
|
||||
RunTest(MakeTestUnknownArrayHandle(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array),
|
||||
vtkm::ListHas<VTKM_DEFAULT_STORAGE_LIST, vtkm::cont::StorageTagConstant>{});
|
||||
RunTest(MakeTestUncertainArrayHandle(array));
|
||||
}
|
||||
};
|
||||
|
||||
@ -216,8 +193,7 @@ struct TestArrayHandleCounting
|
||||
auto array = vtkm::cont::make_ArrayHandleCounting(start, step, ArraySize);
|
||||
RunTest(array);
|
||||
RunTest(MakeTestUnknownArrayHandle(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array),
|
||||
vtkm::ListHas<VTKM_DEFAULT_STORAGE_LIST, vtkm::cont::StorageTagCounting>{});
|
||||
RunTest(MakeTestUncertainArrayHandle(array));
|
||||
}
|
||||
};
|
||||
|
||||
@ -235,9 +211,7 @@ struct TestArrayHandleGroupVec
|
||||
auto array = vtkm::cont::make_ArrayHandleGroupVec<3>(flat);
|
||||
RunTest(array);
|
||||
RunTest(MakeTestUnknownArrayHandle(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array),
|
||||
vtkm::ListHas<VTKM_DEFAULT_STORAGE_LIST,
|
||||
vtkm::cont::StorageTagGroupVec<vtkm::cont::StorageTagBasic, 3>>{});
|
||||
RunTest(MakeTestUncertainArrayHandle(array));
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
@ -245,9 +219,7 @@ struct TestArrayHandleGroupVec
|
||||
auto array = vtkm::cont::make_ArrayHandleGroupVec<4>(flat);
|
||||
RunTest(array);
|
||||
RunTest(MakeTestUnknownArrayHandle(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array),
|
||||
vtkm::ListHas<VTKM_DEFAULT_STORAGE_LIST,
|
||||
vtkm::cont::StorageTagGroupVec<vtkm::cont::StorageTagBasic, 4>>{});
|
||||
RunTest(MakeTestUncertainArrayHandle(array));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -255,9 +227,7 @@ struct TestArrayHandleGroupVec
|
||||
auto array = vtkm::cont::make_ArrayHandleGroupVec<2>(flat);
|
||||
RunTest(array);
|
||||
RunTest(MakeTestUnknownArrayHandle(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array),
|
||||
vtkm::ListHas<VTKM_DEFAULT_STORAGE_LIST,
|
||||
vtkm::cont::StorageTagGroupVec<vtkm::cont::StorageTagBasic, 2>>{});
|
||||
RunTest(MakeTestUncertainArrayHandle(array));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -295,8 +265,7 @@ void TestArrayHandleIndex()
|
||||
auto array = vtkm::cont::ArrayHandleIndex(size);
|
||||
RunTest(array);
|
||||
RunTest(MakeTestUnknownArrayHandle(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array),
|
||||
vtkm::ListHas<VTKM_DEFAULT_STORAGE_LIST, vtkm::cont::StorageTagIndex>{});
|
||||
RunTest(MakeTestUncertainArrayHandle(array));
|
||||
}
|
||||
|
||||
struct TestArrayHandlePermutation
|
||||
@ -314,10 +283,7 @@ struct TestArrayHandlePermutation
|
||||
RandomArrayHandle<T>::Make(ArraySize));
|
||||
RunTest(array);
|
||||
RunTest(MakeTestUnknownArrayHandle(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array),
|
||||
vtkm::ListHas<VTKM_DEFAULT_STORAGE_LIST,
|
||||
vtkm::cont::StorageTagPermutation<vtkm::cont::StorageTagBasic,
|
||||
vtkm::cont::StorageTagBasic>>{});
|
||||
RunTest(MakeTestUncertainArrayHandle(array));
|
||||
}
|
||||
};
|
||||
|
||||
@ -329,9 +295,7 @@ struct TestArrayHandleReverse
|
||||
auto array = vtkm::cont::make_ArrayHandleReverse(RandomArrayHandle<T>::Make(ArraySize));
|
||||
RunTest(array);
|
||||
RunTest(MakeTestUnknownArrayHandle(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array),
|
||||
vtkm::ListHas<VTKM_DEFAULT_STORAGE_LIST,
|
||||
vtkm::cont::StorageTagReverse<vtkm::cont::StorageTagBasic>>{});
|
||||
RunTest(MakeTestUncertainArrayHandle(array));
|
||||
}
|
||||
};
|
||||
|
||||
@ -365,8 +329,7 @@ void TestArrayHandleUniformPointCoordinates()
|
||||
auto array = MakeRandomArrayHandleUniformPointCoordinates();
|
||||
RunTest(array);
|
||||
RunTest(MakeTestUnknownArrayHandle(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array),
|
||||
vtkm::ListHas<VTKM_DEFAULT_STORAGE_LIST, vtkm::cont::StorageTagUniformPoints>{});
|
||||
RunTest(MakeTestUncertainArrayHandle(array));
|
||||
}
|
||||
|
||||
|
||||
|
@ -8,6 +8,12 @@
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#include <vtkm/Deprecated.h>
|
||||
|
||||
// This is testing a deprecated functionality. Remove this test once VariantArrayHandle
|
||||
// is completely removed from VTK-m.
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
|
||||
#include <vtkm/TypeTraits.h>
|
||||
@ -120,7 +126,6 @@ struct CheckFunctor
|
||||
}
|
||||
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
template <typename T>
|
||||
void operator()(const vtkm::cont::ArrayHandleVirtual<T>& array,
|
||||
bool& vtkmNotUsed(calledBasic),
|
||||
@ -131,7 +136,6 @@ struct CheckFunctor
|
||||
|
||||
CheckArray(array);
|
||||
}
|
||||
VTKM_DEPRECATED_SUPPRESS_END
|
||||
#endif //VTKM_NO_DEPRECATED_VIRTUAL
|
||||
|
||||
template <typename T, typename S>
|
||||
@ -273,7 +277,6 @@ void CheckCastToVirtualArrayHandle(const ArrayType& array)
|
||||
|
||||
VariantArrayType arrayVariant = array;
|
||||
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
{
|
||||
auto testArray = arrayVariant.template AsVirtual<ValueType, StorageList>();
|
||||
VTKM_TEST_ASSERT(testArray.GetNumberOfValues() == array.GetNumberOfValues(),
|
||||
@ -329,7 +332,6 @@ void CheckCastToVirtualArrayHandle(const ArrayType& array)
|
||||
VTKM_TEST_ASSERT(threw,
|
||||
"Casting to different vector width did not throw expected "
|
||||
"ErrorBadType exception.");
|
||||
VTKM_DEPRECATED_SUPPRESS_END
|
||||
}
|
||||
#endif //VTKM_NO_DEPRECATED_VIRTUAL
|
||||
|
||||
@ -544,3 +546,7 @@ int UnitTestVariantArrayHandle(int argc, char* argv[])
|
||||
{
|
||||
return vtkm::cont::testing::Testing::Run(TestVariantArrayHandle, argc, argv);
|
||||
}
|
||||
|
||||
// The MSVC compiler is sometimes complaining about use of deprecated VariantArrayHandle at the
|
||||
// end of this file. This is the end of the translation unit, so just keep the suppression on.
|
||||
//VTKM_DEPRECATED_SUPPRESS_END
|
||||
|
@ -59,10 +59,10 @@ inline VTKM_CONT vtkm::cont::DataSet CreateResult(
|
||||
return clone;
|
||||
}
|
||||
|
||||
/// Use this function if you have a VariantArrayHandle that holds the data
|
||||
/// Use this function if you have a UnknownArrayHandle that holds the data
|
||||
/// for the field.
|
||||
inline VTKM_CONT vtkm::cont::DataSet CreateResult(const vtkm::cont::DataSet& inDataSet,
|
||||
const vtkm::cont::VariantArrayHandle& fieldArray,
|
||||
const vtkm::cont::UnknownArrayHandle& fieldArray,
|
||||
const std::string& fieldName,
|
||||
const vtkm::filter::FieldMetadata& metaData)
|
||||
{
|
||||
@ -96,11 +96,11 @@ inline VTKM_CONT vtkm::cont::DataSet CreateResultFieldCell(
|
||||
return clone;
|
||||
}
|
||||
|
||||
/// Use this function if you want to explicit construct a Cell field and have a VariantArrayHandle
|
||||
/// Use this function if you want to explicit construct a Cell field and have a UnknownArrayHandle
|
||||
/// that holds the data for the field.
|
||||
inline VTKM_CONT vtkm::cont::DataSet CreateResultFieldCell(
|
||||
const vtkm::cont::DataSet& inDataSet,
|
||||
const vtkm::cont::VariantArrayHandle& fieldArray,
|
||||
const vtkm::cont::UnknownArrayHandle& fieldArray,
|
||||
const std::string& fieldName)
|
||||
{
|
||||
VTKM_ASSERT(!fieldName.empty());
|
||||
@ -133,11 +133,11 @@ inline VTKM_CONT vtkm::cont::DataSet CreateResultFieldPoint(
|
||||
return clone;
|
||||
}
|
||||
|
||||
/// Use this function if you want to explicit construct a Point field and have a VariantArrayHandle
|
||||
/// Use this function if you want to explicit construct a Point field and have a UnknownArrayHandle
|
||||
/// that holds the data for the field.
|
||||
inline VTKM_CONT vtkm::cont::DataSet CreateResultFieldPoint(
|
||||
const vtkm::cont::DataSet& inDataSet,
|
||||
const vtkm::cont::VariantArrayHandle& fieldArray,
|
||||
const vtkm::cont::UnknownArrayHandle& fieldArray,
|
||||
const std::string& fieldName)
|
||||
{
|
||||
VTKM_ASSERT(!fieldName.empty());
|
||||
|
@ -67,7 +67,7 @@ public:
|
||||
/// but with a new name
|
||||
VTKM_CONT
|
||||
vtkm::cont::Field AsField(const std::string& name,
|
||||
const vtkm::cont::VariantArrayHandle& handle) const
|
||||
const vtkm::cont::UnknownArrayHandle& handle) const
|
||||
{
|
||||
return vtkm::cont::Field(name, this->Association, handle);
|
||||
}
|
||||
@ -79,7 +79,7 @@ public:
|
||||
return this->AsField(this->Name, handle);
|
||||
}
|
||||
/// Construct a new field with the same association and name as stored in this FieldMetaData
|
||||
VTKM_CONT vtkm::cont::Field AsField(const vtkm::cont::VariantArrayHandle& handle) const
|
||||
VTKM_CONT vtkm::cont::Field AsField(const vtkm::cont::UnknownArrayHandle& handle) const
|
||||
{
|
||||
return this->AsField(this->Name, handle);
|
||||
}
|
||||
|
@ -260,9 +260,13 @@ ApplyPolicyFieldOfType(const vtkm::cont::Field& field,
|
||||
/// the active field of this filter.
|
||||
///
|
||||
template <typename DerivedPolicy, typename FilterType>
|
||||
VTKM_CONT vtkm::cont::VariantArrayHandleBase<typename vtkm::filter::DeduceFilterFieldTypes<
|
||||
DerivedPolicy,
|
||||
typename vtkm::filter::FilterTraits<FilterType>::InputFieldTypeList>::TypeList>
|
||||
VTKM_CONT vtkm::cont::UncertainArrayHandle<
|
||||
typename vtkm::filter::DeduceFilterFieldTypes<
|
||||
DerivedPolicy,
|
||||
typename vtkm::filter::FilterTraits<FilterType>::InputFieldTypeList>::TypeList,
|
||||
typename vtkm::filter::DeduceFilterFieldStorage<
|
||||
DerivedPolicy,
|
||||
typename vtkm::filter::FilterTraits<FilterType>::AdditionalFieldStorage>::StorageList>
|
||||
ApplyPolicyFieldActive(const vtkm::cont::Field& field,
|
||||
vtkm::filter::PolicyBase<DerivedPolicy>,
|
||||
vtkm::filter::FilterTraits<FilterType>)
|
||||
@ -276,20 +280,6 @@ ApplyPolicyFieldActive(const vtkm::cont::Field& field,
|
||||
return field.GetData().ResetTypes(TypeList{}, StorageList{});
|
||||
}
|
||||
|
||||
////-----------------------------------------------------------------------------
|
||||
///// \brief Get an array from a `Field` limited to a given set of types.
|
||||
/////
|
||||
//template <typename DerivedPolicy, typename ListOfTypes>
|
||||
//VTKM_CONT vtkm::cont::VariantArrayHandleBase<
|
||||
// typename vtkm::filter::DeduceFilterFieldTypes<DerivedPolicy, ListOfTypes>::TypeList>
|
||||
//ApplyPolicyFieldOfTypes(
|
||||
// const vtkm::cont::Field& field, vtkm::filter::PolicyBase<DerivedPolicy>, ListOfTypes)
|
||||
//{
|
||||
// using TypeList =
|
||||
// typename vtkm::filter::DeduceFilterFieldTypes<DerivedPolicy, ListOfTypes>::TypeList;
|
||||
// return field.GetData().ResetTypes(TypeList());
|
||||
//}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \brief Ge a cell set from a `DynamicCellSet` object.
|
||||
///
|
||||
|
@ -62,9 +62,9 @@ void TestClipStructured()
|
||||
VTKM_TEST_ASSERT(outputData.GetNumberOfCells() == 8,
|
||||
"Wrong number of cells in the output dataset");
|
||||
|
||||
vtkm::cont::VariantArrayHandle temp = outputData.GetField("scalars").GetData();
|
||||
vtkm::cont::UnknownArrayHandle temp = outputData.GetField("scalars").GetData();
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> resultArrayHandle;
|
||||
temp.CopyTo(resultArrayHandle);
|
||||
temp.AsArrayHandle(resultArrayHandle);
|
||||
|
||||
VTKM_TEST_ASSERT(resultArrayHandle.GetNumberOfValues() == 13,
|
||||
"Wrong number of points in the output dataset");
|
||||
@ -98,9 +98,9 @@ void TestClipStructuredInverted()
|
||||
VTKM_TEST_ASSERT(outputData.GetNumberOfCells() == 4,
|
||||
"Wrong number of cells in the output dataset");
|
||||
|
||||
vtkm::cont::VariantArrayHandle temp = outputData.GetField("scalars").GetData();
|
||||
vtkm::cont::UnknownArrayHandle temp = outputData.GetField("scalars").GetData();
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> resultArrayHandle;
|
||||
temp.CopyTo(resultArrayHandle);
|
||||
temp.AsArrayHandle(resultArrayHandle);
|
||||
|
||||
VTKM_TEST_ASSERT(resultArrayHandle.GetNumberOfValues() == 13,
|
||||
"Wrong number of points in the output dataset");
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ArrayPortalToIterators.h>
|
||||
#include <vtkm/cont/Logging.h>
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
#include <vtkm/cont/UnknownArrayHandle.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
@ -33,9 +33,9 @@ inline void PrintVTKDataFileSummary(const vtkm::io::internal::VTKDataSetFile& df
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
// Since Fields and DataSets store data in the default VariantArrayHandle, convert
|
||||
// Since Fields and DataSets store data in the default UnknownArrayHandle, convert
|
||||
// the data to the closest type supported by default. The following will
|
||||
// need to be updated if VariantArrayHandle or TypeListCommon changes.
|
||||
// need to be updated if UnknownArrayHandle or TypeListCommon changes.
|
||||
template <typename T>
|
||||
struct ClosestCommonType
|
||||
{
|
||||
@ -119,7 +119,7 @@ struct ClosestFloat<vtkm::UInt64>
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
vtkm::cont::VariantArrayHandle CreateVariantArrayHandle(const std::vector<T>& vec)
|
||||
vtkm::cont::UnknownArrayHandle CreateUnknownArrayHandle(const std::vector<T>& vec)
|
||||
{
|
||||
switch (vtkm::VecTraits<T>::NUM_COMPONENTS)
|
||||
{
|
||||
@ -143,7 +143,7 @@ vtkm::cont::VariantArrayHandle CreateVariantArrayHandle(const std::vector<T>& ve
|
||||
portal.Set(i, static_cast<CommonType>(vec[static_cast<std::size_t>(i)]));
|
||||
}
|
||||
|
||||
return vtkm::cont::VariantArrayHandle(output);
|
||||
return vtkm::cont::UnknownArrayHandle(output);
|
||||
}
|
||||
case 2:
|
||||
case 3:
|
||||
@ -179,12 +179,12 @@ vtkm::cont::VariantArrayHandle CreateVariantArrayHandle(const std::vector<T>& ve
|
||||
portal.Set(i, outval);
|
||||
}
|
||||
|
||||
return vtkm::cont::VariantArrayHandle(output);
|
||||
return vtkm::cont::UnknownArrayHandle(output);
|
||||
}
|
||||
default:
|
||||
{
|
||||
VTKM_LOG_S(vtkm::cont::LogLevel::Warn, "Only 1, 2, 3, or 9 components supported. Skipping.");
|
||||
return vtkm::cont::VariantArrayHandle(vtkm::cont::ArrayHandle<vtkm::Float32>());
|
||||
return vtkm::cont::UnknownArrayHandle(vtkm::cont::ArrayHandle<vtkm::Float32>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -249,7 +249,7 @@ void VTKDataSetReaderBase::ReadPoints()
|
||||
std::size_t numPoints;
|
||||
this->DataFile->Stream >> numPoints >> dataType >> std::ws;
|
||||
|
||||
vtkm::cont::VariantArrayHandle points =
|
||||
vtkm::cont::UnknownArrayHandle points =
|
||||
this->DoReadArrayVariant(vtkm::cont::Field::Association::POINTS, dataType, numPoints, 3);
|
||||
|
||||
this->DataSet.AddCoordinateSystem(vtkm::cont::CoordinateSystem("coordinates", points));
|
||||
@ -446,7 +446,7 @@ void VTKDataSetReaderBase::ReadHeader()
|
||||
|
||||
void VTKDataSetReaderBase::AddField(const std::string& name,
|
||||
vtkm::cont::Field::Association association,
|
||||
vtkm::cont::VariantArrayHandle& data)
|
||||
vtkm::cont::UnknownArrayHandle& data)
|
||||
{
|
||||
if (data.GetNumberOfValues() > 0)
|
||||
{
|
||||
@ -491,7 +491,7 @@ void VTKDataSetReaderBase::ReadScalars(vtkm::cont::Field::Association associatio
|
||||
internal::parseAssert(tag == "LOOKUP_TABLE");
|
||||
this->DataFile->Stream >> lookupTableName >> std::ws;
|
||||
|
||||
vtkm::cont::VariantArrayHandle data =
|
||||
vtkm::cont::UnknownArrayHandle data =
|
||||
this->DoReadArrayVariant(association, dataType, numElements, numComponents);
|
||||
this->AddField(dataName, association, data);
|
||||
}
|
||||
@ -505,7 +505,7 @@ void VTKDataSetReaderBase::ReadColorScalars(vtkm::cont::Field::Association assoc
|
||||
vtkm::IdComponent numComponents;
|
||||
this->DataFile->Stream >> dataName >> numComponents >> std::ws;
|
||||
std::string dataType = this->DataFile->IsBinary ? "unsigned_char" : "float";
|
||||
vtkm::cont::VariantArrayHandle data =
|
||||
vtkm::cont::UnknownArrayHandle data =
|
||||
this->DoReadArrayVariant(association, dataType, numElements, numComponents);
|
||||
this->AddField(dataName, association, data);
|
||||
}
|
||||
@ -528,7 +528,7 @@ void VTKDataSetReaderBase::ReadTextureCoordinates(vtkm::cont::Field::Association
|
||||
std::string dataType;
|
||||
this->DataFile->Stream >> dataName >> numComponents >> dataType >> std::ws;
|
||||
|
||||
vtkm::cont::VariantArrayHandle data =
|
||||
vtkm::cont::UnknownArrayHandle data =
|
||||
this->DoReadArrayVariant(association, dataType, numElements, numComponents);
|
||||
this->AddField(dataName, association, data);
|
||||
}
|
||||
@ -540,7 +540,7 @@ void VTKDataSetReaderBase::ReadVectors(vtkm::cont::Field::Association associatio
|
||||
std::string dataType;
|
||||
this->DataFile->Stream >> dataName >> dataType >> std::ws;
|
||||
|
||||
vtkm::cont::VariantArrayHandle data =
|
||||
vtkm::cont::UnknownArrayHandle data =
|
||||
this->DoReadArrayVariant(association, dataType, numElements, 3);
|
||||
this->AddField(dataName, association, data);
|
||||
}
|
||||
@ -552,7 +552,7 @@ void VTKDataSetReaderBase::ReadTensors(vtkm::cont::Field::Association associatio
|
||||
std::string dataType;
|
||||
this->DataFile->Stream >> dataName >> dataType >> std::ws;
|
||||
|
||||
vtkm::cont::VariantArrayHandle data =
|
||||
vtkm::cont::UnknownArrayHandle data =
|
||||
this->DoReadArrayVariant(association, dataType, numElements, 9);
|
||||
this->AddField(dataName, association, data);
|
||||
}
|
||||
@ -571,7 +571,7 @@ void VTKDataSetReaderBase::ReadFields(vtkm::cont::Field::Association association
|
||||
this->DataFile->Stream >> arrayName >> numComponents >> numTuples >> dataType >> std::ws;
|
||||
if (numTuples == expectedNumElements)
|
||||
{
|
||||
vtkm::cont::VariantArrayHandle data =
|
||||
vtkm::cont::UnknownArrayHandle data =
|
||||
this->DoReadArrayVariant(association, dataType, numTuples, numComponents);
|
||||
this->AddField(arrayName, association, data);
|
||||
}
|
||||
@ -643,7 +643,7 @@ public:
|
||||
ReadArrayVariant(VTKDataSetReaderBase* reader,
|
||||
vtkm::cont::Field::Association association,
|
||||
std::size_t numElements,
|
||||
vtkm::cont::VariantArrayHandle& data)
|
||||
vtkm::cont::UnknownArrayHandle& data)
|
||||
: SkipArrayVariant(reader, numElements)
|
||||
, Association(association)
|
||||
, Data(&data)
|
||||
@ -658,7 +658,7 @@ public:
|
||||
if ((this->Association != vtkm::cont::Field::Association::CELL_SET) ||
|
||||
(this->Reader->GetCellsPermutation().GetNumberOfValues() < 1))
|
||||
{
|
||||
*this->Data = CreateVariantArrayHandle(buffer);
|
||||
*this->Data = CreateUnknownArrayHandle(buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -672,7 +672,7 @@ public:
|
||||
std::size_t inIndex = static_cast<std::size_t>(permutation.Get(outIndex));
|
||||
permutedBuffer[static_cast<std::size_t>(outIndex)] = buffer[inIndex];
|
||||
}
|
||||
*this->Data = CreateVariantArrayHandle(permutedBuffer);
|
||||
*this->Data = CreateUnknownArrayHandle(permutedBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -686,7 +686,7 @@ public:
|
||||
|
||||
private:
|
||||
vtkm::cont::Field::Association Association;
|
||||
vtkm::cont::VariantArrayHandle* Data;
|
||||
vtkm::cont::UnknownArrayHandle* Data;
|
||||
};
|
||||
|
||||
void VTKDataSetReaderBase::DoSkipArrayVariant(std::string dataType,
|
||||
@ -712,7 +712,7 @@ void VTKDataSetReaderBase::DoSkipArrayVariant(std::string dataType,
|
||||
}
|
||||
}
|
||||
|
||||
vtkm::cont::VariantArrayHandle VTKDataSetReaderBase::DoReadArrayVariant(
|
||||
vtkm::cont::UnknownArrayHandle VTKDataSetReaderBase::DoReadArrayVariant(
|
||||
vtkm::cont::Field::Association association,
|
||||
std::string dataType,
|
||||
std::size_t numElements,
|
||||
@ -720,7 +720,7 @@ vtkm::cont::VariantArrayHandle VTKDataSetReaderBase::DoReadArrayVariant(
|
||||
{
|
||||
// Create empty data to start so that the return can check if data were actually read
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> empty;
|
||||
vtkm::cont::VariantArrayHandle data(empty);
|
||||
vtkm::cont::UnknownArrayHandle data(empty);
|
||||
|
||||
vtkm::io::internal::DataType typeId = vtkm::io::internal::DataTypeId(dataType);
|
||||
vtkm::io::internal::SelectTypeAndCall(
|
||||
|
@ -157,7 +157,7 @@ private:
|
||||
VTKM_CONT void ReadHeader();
|
||||
VTKM_CONT void AddField(const std::string& name,
|
||||
vtkm::cont::Field::Association association,
|
||||
vtkm::cont::VariantArrayHandle& data);
|
||||
vtkm::cont::UnknownArrayHandle& data);
|
||||
VTKM_CONT void ReadScalars(vtkm::cont::Field::Association association, std::size_t numElements);
|
||||
VTKM_CONT void ReadColorScalars(vtkm::cont::Field::Association association,
|
||||
std::size_t numElements);
|
||||
@ -182,7 +182,7 @@ protected:
|
||||
VTKM_CONT void DoSkipArrayVariant(std::string dataType,
|
||||
std::size_t numElements,
|
||||
vtkm::IdComponent numComponents);
|
||||
VTKM_CONT vtkm::cont::VariantArrayHandle DoReadArrayVariant(
|
||||
VTKM_CONT vtkm::cont::UnknownArrayHandle DoReadArrayVariant(
|
||||
vtkm::cont::Field::Association association,
|
||||
std::string dataType,
|
||||
std::size_t numElements,
|
||||
|
@ -50,7 +50,7 @@ void VTKRectilinearGridReader::Read()
|
||||
//Read the points.
|
||||
std::string fileStorageDataType;
|
||||
std::size_t numPoints[3];
|
||||
vtkm::cont::VariantArrayHandle X, Y, Z;
|
||||
vtkm::cont::UnknownArrayHandle X, Y, Z;
|
||||
|
||||
this->DataFile->Stream >> tag >> numPoints[0] >> fileStorageDataType >> std::ws;
|
||||
if (tag != "X_COORDINATES")
|
||||
@ -90,13 +90,13 @@ void VTKRectilinearGridReader::Read()
|
||||
|
||||
// We need to store all coordinate arrays as FloatDefault.
|
||||
vtkm::cont::ArrayHandle<vtkm::FloatDefault> Xc, Yc, Zc;
|
||||
// But the VariantArrayHandle has type fileStorageDataType.
|
||||
// But the UnknownArrayHandle has type fileStorageDataType.
|
||||
// If the fileStorageDataType is the same as the storage type, no problem:
|
||||
if (fileStorageDataType == vtkm::io::internal::DataTypeName<vtkm::FloatDefault>::Name())
|
||||
{
|
||||
X.CopyTo(Xc);
|
||||
Y.CopyTo(Yc);
|
||||
Z.CopyTo(Zc);
|
||||
X.AsArrayHandle(Xc);
|
||||
Y.AsArrayHandle(Yc);
|
||||
Z.AsArrayHandle(Zc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -104,9 +104,9 @@ void VTKRectilinearGridReader::Read()
|
||||
if (fileStorageDataType == "float")
|
||||
{
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> Xcf, Ycf, Zcf;
|
||||
X.CopyTo(Xcf);
|
||||
Y.CopyTo(Ycf);
|
||||
Z.CopyTo(Zcf);
|
||||
X.AsArrayHandle(Xcf);
|
||||
Y.AsArrayHandle(Ycf);
|
||||
Z.AsArrayHandle(Zcf);
|
||||
vtkm::cont::ArrayCopy(Xcf, Xc);
|
||||
vtkm::cont::ArrayCopy(Ycf, Yc);
|
||||
vtkm::cont::ArrayCopy(Zcf, Zc);
|
||||
@ -114,9 +114,9 @@ void VTKRectilinearGridReader::Read()
|
||||
else
|
||||
{
|
||||
vtkm::cont::ArrayHandle<vtkm::Float64> Xcd, Ycd, Zcd;
|
||||
X.CopyTo(Xcd);
|
||||
Y.CopyTo(Ycd);
|
||||
Z.CopyTo(Zcd);
|
||||
X.AsArrayHandle(Xcd);
|
||||
Y.AsArrayHandle(Ycd);
|
||||
Z.AsArrayHandle(Zcd);
|
||||
vtkm::cont::ArrayCopy(Xcd, Xc);
|
||||
vtkm::cont::ArrayCopy(Ycd, Yc);
|
||||
vtkm::cont::ArrayCopy(Zcd, Zc);
|
||||
|
@ -904,24 +904,65 @@ struct ScalarVectorFieldTests : public vtkm::exec::FunctorBase
|
||||
VTKM_EXEC
|
||||
void TestDifferenceOfProducts() const
|
||||
{
|
||||
{
|
||||
// Example taken from:
|
||||
// https://pharr.org/matt/blog/2019/11/03/difference-of-floats.html
|
||||
vtkm::Float32 a = 33962.035f;
|
||||
vtkm::Float32 b = -30438.8f;
|
||||
vtkm::Float32 c = 41563.4f;
|
||||
vtkm::Float32 d = -24871.969f;
|
||||
vtkm::Float32 computed = vtkm::DifferenceOfProducts(a, b, c, d);
|
||||
// Expected result, computed in double precision and cast back to float:
|
||||
vtkm::Float32 expected = 5.376600027084351f;
|
||||
#ifdef FP_FAST_FMA
|
||||
// Example taken from:
|
||||
// https://pharr.org/matt/blog/2019/11/03/difference-of-floats.html
|
||||
vtkm::Float32 a = 33962.035f;
|
||||
vtkm::Float32 b = -30438.8f;
|
||||
vtkm::Float32 c = 41563.4f;
|
||||
vtkm::Float32 d = -24871.969f;
|
||||
vtkm::Float32 computed = vtkm::DifferenceOfProducts(a, b, c, d);
|
||||
// Expected result, computed in double precision and cast back to float:
|
||||
vtkm::Float32 expected = 5.376600027084351f;
|
||||
|
||||
vtkm::UInt64 dist = vtkm::FloatDistance(expected, computed);
|
||||
VTKM_MATH_ASSERT(
|
||||
dist < 2,
|
||||
"Float distance for difference of products exceeds 1.5; this is in violation of a theorem "
|
||||
"proved by Jeannerod in doi.org/10.1090/S0025-5718-2013-02679-8. Is your build compiled "
|
||||
"with fma's enabled?");
|
||||
}
|
||||
vtkm::UInt64 dist = vtkm::FloatDistance(expected, computed);
|
||||
VTKM_MATH_ASSERT(
|
||||
dist < 2,
|
||||
"Float distance for difference of products is which exceeds 1.5; this is in violation of a "
|
||||
"theorem "
|
||||
"proved by Jeannerod in doi.org/10.1090/S0025-5718-2013-02679-8. Is your build compiled "
|
||||
"with fma's enabled?");
|
||||
#endif
|
||||
}
|
||||
|
||||
VTKM_EXEC
|
||||
void TestQuadraticRoots() const
|
||||
{
|
||||
// (x-1)(x+1) = x² - 1:
|
||||
auto roots = vtkm::QuadraticRoots(1.0f, 0.0f, -1.0f);
|
||||
|
||||
vtkm::UInt64 dist = vtkm::FloatDistance(-1.0f, roots[0]);
|
||||
VTKM_MATH_ASSERT(dist < 3, "Float distance for quadratic roots exceeds 3 ulps.");
|
||||
|
||||
dist = vtkm::FloatDistance(1.0f, roots[1]);
|
||||
VTKM_MATH_ASSERT(dist < 3, "Float distance for quadratic roots exceeds 3 ulps.");
|
||||
|
||||
// No real roots:
|
||||
roots = vtkm::QuadraticRoots(1.0f, 0.0f, 1.0f);
|
||||
VTKM_MATH_ASSERT(vtkm::IsNan(roots[0]),
|
||||
"Roots should be Nan for a quadratic with complex roots.");
|
||||
VTKM_MATH_ASSERT(vtkm::IsNan(roots[1]),
|
||||
"Roots should be Nan for a quadratic with complex roots.");
|
||||
|
||||
#ifdef FP_FAST_FMA
|
||||
// Wikipedia example:
|
||||
// x² + 200x - 0.000015 = 0 has roots
|
||||
// -200.000000075, 7.5e-8
|
||||
roots = vtkm::QuadraticRoots(1.0f, 200.0f, -0.000015f);
|
||||
dist = vtkm::FloatDistance(-200.000000075f, roots[0]);
|
||||
VTKM_MATH_ASSERT(dist < 3, "Float distance for quadratic roots exceeds 3 ulps.");
|
||||
|
||||
dist = vtkm::FloatDistance(7.5e-8f, roots[1]);
|
||||
VTKM_MATH_ASSERT(dist < 3, "Float distance for quadratic roots exceeds 3 ulps.");
|
||||
|
||||
// Kahan's example:
|
||||
auto roots64 = vtkm::QuadraticRoots(94906265.625, 94906267.000, 94906268.375);
|
||||
dist = vtkm::FloatDistance(1.0, roots64[0]);
|
||||
VTKM_MATH_ASSERT(dist < 3, "Float distance for quadratic roots exceeds 3 ulps.");
|
||||
|
||||
dist = vtkm::FloatDistance(1.000000028975958, roots64[1]);
|
||||
VTKM_MATH_ASSERT(dist < 3, "Float distance for quadratic roots exceeds 3 ulps.");
|
||||
#endif
|
||||
}
|
||||
|
||||
VTKM_EXEC
|
||||
@ -942,6 +983,8 @@ struct ScalarVectorFieldTests : public vtkm::exec::FunctorBase
|
||||
this->TestLog1P();
|
||||
this->TestCopySign();
|
||||
this->TestFloatDistance();
|
||||
this->TestDifferenceOfProducts();
|
||||
this->TestQuadraticRoots();
|
||||
}
|
||||
};
|
||||
|
||||
|
2
vtkm/thirdparty/diy/update.sh
vendored
2
vtkm/thirdparty/diy/update.sh
vendored
@ -8,7 +8,7 @@ readonly name="diy"
|
||||
readonly ownership="Diy Upstream <kwrobot@kitware.com>"
|
||||
readonly subtree="vtkm/thirdparty/$name/vtkm$name"
|
||||
readonly repo="https://gitlab.kitware.com/third-party/diy2.git"
|
||||
readonly tag="for/vtk-m-20201026-master"
|
||||
readonly tag="for/vtk-m-20210412-master"
|
||||
readonly paths="
|
||||
cmake
|
||||
include
|
||||
|
4
vtkm/thirdparty/diy/vtkmdiy/CMakeLists.txt
vendored
4
vtkm/thirdparty/diy/vtkmdiy/CMakeLists.txt
vendored
@ -143,7 +143,7 @@ function(add_diy_mpi_library use_mpi)
|
||||
|
||||
add_library(${lib_name} ${sources})
|
||||
set_target_properties(${lib_name} PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
target_compile_features(${lib_name} PRIVATE cxx_std_11)
|
||||
target_compile_features(${lib_name} PRIVATE cxx_std_14)
|
||||
target_compile_definitions(${lib_name}
|
||||
PRIVATE -DVTKMDIY_HAS_MPI=${has_mpi_val}
|
||||
PRIVATE -Ddiy=${diy_prefix} # mangle diy namespace
|
||||
@ -186,7 +186,7 @@ if (build_diy_mpi_lib)
|
||||
endif() # build_diy_mpi_lib
|
||||
|
||||
add_library(${diy_prefix} INTERFACE)
|
||||
target_compile_features(${diy_prefix} INTERFACE cxx_std_11)
|
||||
target_compile_features(${diy_prefix} INTERFACE cxx_std_14)
|
||||
target_compile_definitions(${diy_prefix} INTERFACE ${diy_definitions})
|
||||
target_include_directories(${diy_prefix} SYSTEM INTERFACE
|
||||
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
|
||||
|
@ -850,7 +850,7 @@ inline Char* format_uint(Char* buffer, UInt value, int num_digits,
|
||||
buffer += num_digits;
|
||||
Char* end = buffer;
|
||||
do {
|
||||
const char* digits = upper ? "0123456789ABCDEF" : data::hex_digits;
|
||||
const char* digits = upper ? "0123456789ABCDEF" : "0123456789abcdef";
|
||||
unsigned digit = (value & ((1 << BASE_BITS) - 1));
|
||||
*--buffer = static_cast<Char>(BASE_BITS < 4 ? static_cast<char>('0' + digit)
|
||||
: digits[digit]);
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <vtkm/cont/CoordinateSystem.h>
|
||||
#include <vtkm/cont/DynamicCellSet.h>
|
||||
#include <vtkm/cont/Timer.h>
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
#include <vtkm/cont/UnknownArrayHandle.h>
|
||||
|
||||
#include <vtkm/ImplicitFunction.h>
|
||||
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
const InputDomainType& inputDomain = invocation.GetInputDomain();
|
||||
|
||||
// For a DispatcherMapField, the inputDomain must be an ArrayHandle (or
|
||||
// an VariantArrayHandle that gets cast to one). The size of the domain
|
||||
// an UnknownArrayHandle that gets cast to one). The size of the domain
|
||||
// (number of threads/worklet instances) is equal to the size of the
|
||||
// array.
|
||||
auto numInstances = SchedulingRange(inputDomain);
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
}
|
||||
//@}
|
||||
|
||||
// TODO? Create a version that accepts a VariantArrayHandle. Is this needed?
|
||||
// TODO? Create a version that accepts an UnknownArrayHandle. Is this needed?
|
||||
|
||||
template <typename RangeType>
|
||||
vtkm::Id GetThreadRange(RangeType vtkmNotUsed(outputRange)) const
|
||||
|
@ -127,12 +127,13 @@ struct MaskBuilder
|
||||
} // anonymous namespace
|
||||
|
||||
vtkm::worklet::MaskSelect::ThreadToOutputMapType vtkm::worklet::MaskSelect::Build(
|
||||
const VariantArrayHandleMask& maskArray,
|
||||
const vtkm::cont::UnknownArrayHandle& maskArray,
|
||||
vtkm::cont::DeviceAdapterId device)
|
||||
{
|
||||
VTKM_LOG_SCOPE(vtkm::cont::LogLevel::Perf, "MaskSelect::Build");
|
||||
|
||||
vtkm::worklet::MaskSelect::ThreadToOutputMapType threadToOutputMap;
|
||||
maskArray.CastAndCall(MaskBuilder(), threadToOutputMap, device);
|
||||
maskArray.CastAndCallForTypes<MaskTypes, vtkm::List<vtkm::cont::StorageTagBasic>>(
|
||||
MaskBuilder(), threadToOutputMap, device);
|
||||
return threadToOutputMap;
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <vtkm/worklet/internal/MaskBase.h>
|
||||
#include <vtkm/worklet/vtkm_worklet_export.h>
|
||||
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
#include <vtkm/cont/UnknownArrayHandle.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
@ -34,24 +34,16 @@ class VTKM_WORKLET_EXPORT MaskSelect : public internal::MaskBase
|
||||
{
|
||||
using MaskTypes =
|
||||
vtkm::List<vtkm::Int32, vtkm::Int64, vtkm::UInt32, vtkm::UInt64, vtkm::Int8, vtkm::UInt8, char>;
|
||||
using VariantArrayHandleMask = vtkm::cont::VariantArrayHandleBase<MaskTypes>;
|
||||
|
||||
public:
|
||||
using ThreadToOutputMapType = vtkm::cont::ArrayHandle<vtkm::Id>;
|
||||
|
||||
MaskSelect(const VariantArrayHandleMask& maskArray,
|
||||
MaskSelect(const vtkm::cont::UnknownArrayHandle& maskArray,
|
||||
vtkm::cont::DeviceAdapterId device = vtkm::cont::DeviceAdapterTagAny())
|
||||
{
|
||||
this->ThreadToOutputMap = this->Build(maskArray, device);
|
||||
}
|
||||
|
||||
template <typename TypeList>
|
||||
MaskSelect(const vtkm::cont::VariantArrayHandleBase<TypeList>& indexArray,
|
||||
vtkm::cont::DeviceAdapterId device = vtkm::cont::DeviceAdapterTagAny())
|
||||
{
|
||||
this->ThreadToOutputMap = this->Build(VariantArrayHandleMask(indexArray), device);
|
||||
}
|
||||
|
||||
template <typename RangeType>
|
||||
vtkm::Id GetThreadRange(RangeType vtkmNotUsed(outputRange)) const
|
||||
{
|
||||
@ -67,7 +59,7 @@ public:
|
||||
private:
|
||||
ThreadToOutputMapType ThreadToOutputMap;
|
||||
|
||||
VTKM_CONT ThreadToOutputMapType Build(const VariantArrayHandleMask& maskArray,
|
||||
VTKM_CONT ThreadToOutputMapType Build(const vtkm::cont::UnknownArrayHandle& maskArray,
|
||||
vtkm::cont::DeviceAdapterId device);
|
||||
};
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include <vtkm/cont/CellSetExplicit.h>
|
||||
#include <vtkm/cont/ExecutionAndControlObjectBase.h>
|
||||
#include <vtkm/cont/Invoker.h>
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
#include <vtkm/cont/UnknownArrayHandle.h>
|
||||
|
||||
#include <vtkm/Bounds.h>
|
||||
#include <vtkm/Hash.h>
|
||||
@ -443,18 +443,16 @@ public:
|
||||
points = concretePoints;
|
||||
}
|
||||
|
||||
template <typename TL>
|
||||
VTKM_CONT void Run(
|
||||
vtkm::Float64 delta, // Distance to consider two points coincident
|
||||
bool fastCheck, // If true, approximate distances are used
|
||||
const vtkm::Bounds& bounds, // Bounds of points
|
||||
vtkm::cont::VariantArrayHandleBase<TL>& points) // coordinates, modified to merge close
|
||||
VTKM_CONT void Run(vtkm::Float64 delta, // Distance to consider two points coincident
|
||||
bool fastCheck, // If true, approximate distances are used
|
||||
const vtkm::Bounds& bounds, // Bounds of points
|
||||
vtkm::cont::UnknownArrayHandle& points) // coordinates, modified to merge close
|
||||
{
|
||||
// Get a cast to a concrete set of point coordiantes so that it can be modified in place
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec3f> concretePoints;
|
||||
if (points.template IsType<decltype(concretePoints)>())
|
||||
{
|
||||
concretePoints = points.template Cast<decltype(concretePoints)>();
|
||||
points.AsArrayHandle(concretePoints);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -15,6 +15,8 @@
|
||||
#include <vtkm/cont/ArrayHandleConstant.h>
|
||||
#include <vtkm/cont/ArrayHandlePermutation.h>
|
||||
#include <vtkm/cont/CellSetExplicit.h>
|
||||
#include <vtkm/cont/UnknownArrayHandle.h>
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
#include <vtkm/worklet/ScatterCounting.h>
|
||||
@ -222,6 +224,7 @@ private:
|
||||
outHolder = vtkm::cont::UnknownArrayHandle{ outArray };
|
||||
}
|
||||
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
template <typename InT, typename InS>
|
||||
VTKM_CONT void operator()(const vtkm::cont::ArrayHandle<InT, InS>& inArray,
|
||||
vtkm::cont::VariantArrayHandleCommon& outHolder,
|
||||
@ -231,6 +234,7 @@ private:
|
||||
(*this)(inArray, outArray, self);
|
||||
outHolder = vtkm::cont::VariantArrayHandleCommon{ outArray };
|
||||
}
|
||||
VTKM_DEPRECATED_SUPPRESS_END
|
||||
};
|
||||
|
||||
public:
|
||||
@ -278,6 +282,7 @@ public:
|
||||
return outArray;
|
||||
}
|
||||
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
template <typename InArrayTypes, typename OutArrayHandle>
|
||||
VTKM_CONT void MapPointFieldDeep(const vtkm::cont::VariantArrayHandleBase<InArrayTypes>& inArray,
|
||||
OutArrayHandle& outArray) const
|
||||
@ -294,6 +299,7 @@ public:
|
||||
|
||||
return outArray;
|
||||
}
|
||||
VTKM_DEPRECATED_SUPPRESS_END
|
||||
///@}
|
||||
|
||||
const vtkm::worklet::ScatterCounting& GetPointScatter() const
|
||||
|
@ -199,12 +199,12 @@ struct ScatterCountingBuilder
|
||||
}
|
||||
} // namespace vtkm::worklet::detail
|
||||
|
||||
void vtkm::worklet::ScatterCounting::BuildArrays(const VariantArrayHandleCount& countArray,
|
||||
void vtkm::worklet::ScatterCounting::BuildArrays(const vtkm::cont::UnknownArrayHandle& countArray,
|
||||
vtkm::cont::DeviceAdapterId device,
|
||||
bool saveInputToOutputMap)
|
||||
{
|
||||
VTKM_LOG_SCOPE(vtkm::cont::LogLevel::Perf, "ScatterCounting::BuildArrays");
|
||||
|
||||
countArray.CastAndCall(
|
||||
countArray.CastAndCallForTypes<CountTypes, vtkm::List<vtkm::cont::StorageTagBasic>>(
|
||||
vtkm::worklet::detail::ScatterCountingBuilder(), device, saveInputToOutputMap, this);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <vtkm/worklet/internal/ScatterBase.h>
|
||||
#include <vtkm/worklet/vtkm_worklet_export.h>
|
||||
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
#include <vtkm/cont/UnknownArrayHandle.h>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
@ -51,7 +51,6 @@ struct VTKM_WORKLET_EXPORT ScatterCounting : internal::ScatterBase
|
||||
vtkm::UInt32,
|
||||
vtkm::UInt16,
|
||||
vtkm::UInt8>;
|
||||
using VariantArrayHandleCount = vtkm::cont::VariantArrayHandleBase<CountTypes>;
|
||||
|
||||
/// Construct a \c ScatterCounting object using an array of counts for the
|
||||
/// number of outputs for each input. Part of the construction requires
|
||||
@ -60,27 +59,14 @@ struct VTKM_WORKLET_EXPORT ScatterCounting : internal::ScatterBase
|
||||
/// other users might make use of it, so you can instruct the constructor
|
||||
/// to save the input to output map.
|
||||
///
|
||||
template <typename TypeList>
|
||||
VTKM_CONT ScatterCounting(const vtkm::cont::VariantArrayHandleBase<TypeList>& countArray,
|
||||
vtkm::cont::DeviceAdapterId device = vtkm::cont::DeviceAdapterTagAny(),
|
||||
bool saveInputToOutputMap = false)
|
||||
{
|
||||
this->BuildArrays(VariantArrayHandleCount(countArray), device, saveInputToOutputMap);
|
||||
}
|
||||
VTKM_CONT ScatterCounting(const VariantArrayHandleCount& countArray,
|
||||
VTKM_CONT ScatterCounting(const vtkm::cont::UnknownArrayHandle& countArray,
|
||||
vtkm::cont::DeviceAdapterId device = vtkm::cont::DeviceAdapterTagAny(),
|
||||
bool saveInputToOutputMap = false)
|
||||
{
|
||||
this->BuildArrays(countArray, device, saveInputToOutputMap);
|
||||
}
|
||||
template <typename TypeList>
|
||||
VTKM_CONT ScatterCounting(const vtkm::cont::VariantArrayHandleBase<TypeList>& countArray,
|
||||
VTKM_CONT ScatterCounting(const vtkm::cont::UnknownArrayHandle& countArray,
|
||||
bool saveInputToOutputMap)
|
||||
{
|
||||
this->BuildArrays(
|
||||
VariantArrayHandleCount(countArray), vtkm::cont::DeviceAdapterTagAny(), saveInputToOutputMap);
|
||||
}
|
||||
VTKM_CONT ScatterCounting(const VariantArrayHandleCount& countArray, bool saveInputToOutputMap)
|
||||
{
|
||||
this->BuildArrays(countArray, vtkm::cont::DeviceAdapterTagAny(), saveInputToOutputMap);
|
||||
}
|
||||
@ -135,7 +121,7 @@ private:
|
||||
|
||||
friend struct detail::ScatterCountingBuilder;
|
||||
|
||||
VTKM_CONT void BuildArrays(const VariantArrayHandleCount& countArray,
|
||||
VTKM_CONT void BuildArrays(const vtkm::cont::UnknownArrayHandle& countArray,
|
||||
vtkm::cont::DeviceAdapterId device,
|
||||
bool saveInputToOutputMap);
|
||||
};
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include <vtkm/CellTraits.h>
|
||||
#include <vtkm/TypeTraits.h>
|
||||
#include <vtkm/VectorAnalysis.h>
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
#include <vtkm/cont/UncertainArrayHandle.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
@ -194,10 +194,14 @@ public:
|
||||
vtkm::worklet::DispatcherMapTopology<Worklet>().Invoke(cellset, faceNormals, pointNormals);
|
||||
}
|
||||
|
||||
template <typename CellSetType, typename FaceNormalTypeList, typename NormalCompType>
|
||||
void Run(const CellSetType& cellset,
|
||||
const vtkm::cont::VariantArrayHandleBase<FaceNormalTypeList>& faceNormals,
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<NormalCompType, 3>>& pointNormals)
|
||||
template <typename CellSetType,
|
||||
typename FaceNormalTypeList,
|
||||
typename FaceNormalStorageList,
|
||||
typename NormalCompType>
|
||||
void Run(
|
||||
const CellSetType& cellset,
|
||||
const vtkm::cont::UncertainArrayHandle<FaceNormalTypeList, FaceNormalStorageList>& faceNormals,
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<NormalCompType, 3>>& pointNormals)
|
||||
{
|
||||
vtkm::worklet::DispatcherMapTopology<Worklet>().Invoke(cellset, faceNormals, pointNormals);
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <vtkm/cont/ArrayHandlePermutation.h>
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/cont/Logging.h>
|
||||
#include <vtkm/cont/UnknownArrayHandle.h>
|
||||
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
#include <vtkm/worklet/DispatcherMapTopology.h>
|
||||
@ -73,7 +74,7 @@ struct SelectRepresentativePoint : public vtkm::worklet::WorkletReduceByKey
|
||||
template <typename InputPointsArrayType, typename KeyType>
|
||||
VTKM_CONT void operator()(const InputPointsArrayType& points,
|
||||
const vtkm::worklet::Keys<KeyType>& keys,
|
||||
vtkm::cont::VariantArrayHandle& output) const
|
||||
vtkm::cont::UnknownArrayHandle& output) const
|
||||
{
|
||||
|
||||
vtkm::cont::ArrayHandle<typename InputPointsArrayType::ValueType> out;
|
||||
@ -85,11 +86,11 @@ struct SelectRepresentativePoint : public vtkm::worklet::WorkletReduceByKey
|
||||
};
|
||||
|
||||
template <typename KeyType, typename InputDynamicPointsArrayType>
|
||||
VTKM_CONT static vtkm::cont::VariantArrayHandle Run(
|
||||
VTKM_CONT static vtkm::cont::UnknownArrayHandle Run(
|
||||
const vtkm::worklet::Keys<KeyType>& keys,
|
||||
const InputDynamicPointsArrayType& inputPoints)
|
||||
{
|
||||
vtkm::cont::VariantArrayHandle output;
|
||||
vtkm::cont::UnknownArrayHandle output;
|
||||
RunTrampoline trampoline;
|
||||
vtkm::cont::CastAndCall(inputPoints, trampoline, keys, output);
|
||||
return output;
|
||||
@ -365,7 +366,7 @@ public:
|
||||
#endif
|
||||
|
||||
/// pass 2 : Choose a representative point from each cluster for the output:
|
||||
vtkm::cont::VariantArrayHandle repPointArray;
|
||||
vtkm::cont::UnknownArrayHandle repPointArray;
|
||||
{
|
||||
vtkm::worklet::Keys<vtkm::Id> keys;
|
||||
keys.BuildArrays(pointCidArray, vtkm::worklet::KeysSortType::Stable);
|
||||
|
@ -12,6 +12,7 @@
|
||||
#define vtk_m_worklet_connectivity_ImageConnectivity_h
|
||||
|
||||
#include <vtkm/cont/Invoker.h>
|
||||
#include <vtkm/cont/UncertainArrayHandle.h>
|
||||
#include <vtkm/worklet/WorkletMapField.h>
|
||||
#include <vtkm/worklet/WorkletPointNeighborhood.h>
|
||||
|
||||
@ -124,13 +125,14 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
template <int Dimension, typename T, typename OutputPortalType>
|
||||
template <int Dimension, typename OutputPortalType>
|
||||
void Run(const vtkm::cont::CellSetStructured<Dimension>& input,
|
||||
const vtkm::cont::VariantArrayHandleBase<T>& pixels,
|
||||
const vtkm::cont::UnknownArrayHandle& pixels,
|
||||
OutputPortalType& componentsOut) const
|
||||
{
|
||||
using Types = vtkm::TypeListScalarAll;
|
||||
vtkm::cont::CastAndCall(pixels.ResetTypes(Types{}), RunImpl(), input, componentsOut);
|
||||
using Storages = VTKM_DEFAULT_STORAGE_LIST;
|
||||
vtkm::cont::CastAndCall(pixels.ResetTypes<Types, Storages>(), RunImpl(), input, componentsOut);
|
||||
}
|
||||
|
||||
template <int Dimension, typename T, typename S, typename OutputPortalType>
|
||||
|
@ -324,9 +324,9 @@ public:
|
||||
const InputDomainType& inputDomain = invocation.GetInputDomain();
|
||||
|
||||
// For a DispatcherMapField, the inputDomain must be an ArrayHandle (or
|
||||
// an VariantArrayHandle that gets cast to one). The size of the domain
|
||||
// (number of threads/worklet instances) is equal to the size of the
|
||||
// array.
|
||||
// an UncertainArrayHandle or an UnknownArrayHandle that gets cast to one).
|
||||
// The size of the domain (number of threads/worklet instances) is equal
|
||||
// to the size of the array.
|
||||
//verify the overloads for SchedulingRange work
|
||||
auto numInstances = SchedulingRange(inputDomain);
|
||||
|
||||
|
@ -163,9 +163,8 @@ inline vtkm::cont::DataSet MakeRadiantDataSet::Make3DRadiantDataSet(vtkm::IdComp
|
||||
//Set point scalar
|
||||
dataSet.AddField(vtkm::cont::Field(
|
||||
"distanceToOrigin", vtkm::cont::Field::Association::POINTS, distanceToOrigin));
|
||||
dataSet.AddField(vtkm::cont::Field("distanceToOther",
|
||||
vtkm::cont::Field::Association::POINTS,
|
||||
vtkm::cont::VariantArrayHandle(distanceToOther)));
|
||||
dataSet.AddField(
|
||||
vtkm::cont::Field("distanceToOther", vtkm::cont::Field::Association::POINTS, distanceToOther));
|
||||
|
||||
CellSet cellSet;
|
||||
cellSet.Fill((dim + 1) * (dim + 1) * (dim + 1), HexTag::Id, HexTraits::NUM_POINTS, connectivity);
|
||||
|
@ -10,8 +10,6 @@
|
||||
#include <vtkm/cont/ArrayCopy.h>
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
#include <vtkm/worklet/WorkletMapField.h>
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ArrayHandleIndex.h>
|
||||
#include <vtkm/cont/ExecutionObjectBase.h>
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
#include <vtkm/cont/UncertainArrayHandle.h>
|
||||
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
#include <vtkm/worklet/WorkletMapField.h>
|
||||
@ -95,7 +95,8 @@ struct DoTestWorklet
|
||||
outputHandle = vtkm::cont::ArrayHandle<T>();
|
||||
outputHandle.Allocate(ARRAY_SIZE);
|
||||
|
||||
vtkm::cont::VariantArrayHandleBase<vtkm::List<T>> outputFieldDynamic(outputFieldArray);
|
||||
vtkm::cont::UncertainArrayHandle<vtkm::List<T>, vtkm::List<vtkm::cont::StorageTagBasic>>
|
||||
outputFieldDynamic(outputFieldArray);
|
||||
dispatcher.Invoke(counting, inputHandle, outputHandle, outputFieldDynamic, SimpleExecObject());
|
||||
|
||||
std::cout << "Check dynamic array result." << std::endl;
|
||||
|
@ -9,7 +9,7 @@
|
||||
//============================================================================
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ArrayHandleIndex.h>
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
#include <vtkm/cont/UncertainArrayHandle.h>
|
||||
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
#include <vtkm/worklet/WorkletMapField.h>
|
||||
@ -77,9 +77,12 @@ struct DoTestWholeArrayWorklet
|
||||
outHandle.Allocate(ARRAY_SIZE);
|
||||
|
||||
vtkm::worklet::DispatcherMapField<WorkletType> dispatcher;
|
||||
dispatcher.Invoke(vtkm::cont::VariantArrayHandle(inHandle).ResetTypes(vtkm::List<T>{}),
|
||||
vtkm::cont::VariantArrayHandle(inOutHandle).ResetTypes(vtkm::List<T>{}),
|
||||
vtkm::cont::VariantArrayHandle(outHandle).ResetTypes(vtkm::List<T>{}));
|
||||
dispatcher.Invoke(vtkm::cont::UnknownArrayHandle(inHandle)
|
||||
.ResetTypes<vtkm::List<T>, vtkm::List<VTKM_DEFAULT_STORAGE_TAG>>(),
|
||||
vtkm::cont::UnknownArrayHandle(inOutHandle)
|
||||
.ResetTypes<vtkm::List<T>, vtkm::List<VTKM_DEFAULT_STORAGE_TAG>>(),
|
||||
vtkm::cont::UnknownArrayHandle(outHandle)
|
||||
.ResetTypes<vtkm::List<T>, vtkm::List<VTKM_DEFAULT_STORAGE_TAG>>());
|
||||
|
||||
std::cout << "Check result." << std::endl;
|
||||
CheckPortal(inOutHandle.ReadPortal());
|
||||
|
@ -9,7 +9,7 @@
|
||||
//============================================================================
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ArrayHandleIndex.h>
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
#include <vtkm/cont/UncertainArrayHandle.h>
|
||||
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
#include <vtkm/worklet/WorkletMapField.h>
|
||||
@ -42,12 +42,14 @@ struct DoTestAtomicArrayWorklet
|
||||
|
||||
// This just demonstrates that the WholeArray tags support dynamic arrays.
|
||||
VTKM_CONT
|
||||
void CallWorklet(const vtkm::cont::VariantArrayHandle& inOutArray) const
|
||||
void CallWorklet(const vtkm::cont::UnknownArrayHandle& inOutArray) const
|
||||
{
|
||||
std::cout << "Create and run dispatcher." << std::endl;
|
||||
vtkm::worklet::DispatcherMapField<WorkletType> dispatcher;
|
||||
dispatcher.Invoke(vtkm::cont::ArrayHandleIndex(ARRAY_SIZE),
|
||||
inOutArray.ResetTypes<vtkm::cont::AtomicArrayTypeList>());
|
||||
dispatcher.Invoke(
|
||||
vtkm::cont::ArrayHandleIndex(ARRAY_SIZE),
|
||||
inOutArray
|
||||
.ResetTypes<vtkm::cont::AtomicArrayTypeList, vtkm::List<vtkm::cont::StorageTagBasic>>());
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -56,7 +58,7 @@ struct DoTestAtomicArrayWorklet
|
||||
std::cout << "Set up data." << std::endl;
|
||||
vtkm::cont::ArrayHandle<T> inOutHandle = vtkm::cont::make_ArrayHandle<T>({ 0 });
|
||||
|
||||
this->CallWorklet(vtkm::cont::VariantArrayHandle(inOutHandle));
|
||||
this->CallWorklet(inOutHandle);
|
||||
|
||||
std::cout << "Check result." << std::endl;
|
||||
T result = inOutHandle.ReadPortal().Get(0);
|
||||
|
Loading…
Reference in New Issue
Block a user