Merge branch 'master' into cellsetdim
This commit is contained in:
commit
d560cf1d85
@ -130,6 +130,10 @@ function(vtkm_install_template_sources)
|
||||
vtkm_get_kit_name(name dir_prefix)
|
||||
set(hfiles ${ARGN})
|
||||
vtkm_install_headers("${dir_prefix}" ${hfiles})
|
||||
# CMake does not add installed files as project files, and template sources
|
||||
# are not declared as source files anywhere, add a fake target here to let
|
||||
# an IDE know that these sources exist.
|
||||
add_custom_target(${name}_template_srcs SOURCES ${hfiles})
|
||||
endfunction(vtkm_install_template_sources)
|
||||
|
||||
# Declare a list of headers that require thrust to be enabled
|
||||
@ -253,7 +257,7 @@ function(vtkm_unit_tests)
|
||||
#generally require more time because of kernel generation.
|
||||
set(timeout 180)
|
||||
if (VTKm_UT_CUDA)
|
||||
set(timeout 600)
|
||||
set(timeout 1500)
|
||||
endif()
|
||||
|
||||
if (VTKm_UT_CUDA)
|
||||
@ -379,7 +383,7 @@ function(vtkm_worklet_unit_tests device_adapter)
|
||||
#
|
||||
set(timeout 180)
|
||||
if(is_cuda)
|
||||
set(timeout 600)
|
||||
set(timeout 1500)
|
||||
endif()
|
||||
|
||||
if(VTKm_ENABLE_TESTING)
|
||||
@ -443,19 +447,14 @@ endfunction(vtkm_worklet_unit_tests)
|
||||
#
|
||||
# vtkm_save_benchmarks( sources )
|
||||
#
|
||||
#
|
||||
# Each benchmark source file needs to implement main(int agrc, char *argv[])
|
||||
#
|
||||
# notes: will save the sources absolute path as the
|
||||
# vtkm_benchmarks_sources global property
|
||||
function(vtkm_save_benchmarks)
|
||||
|
||||
#create the benchmarks driver when we are called, since
|
||||
#the driver expects the files to be in the same
|
||||
#directory as the test driver
|
||||
#TODO: This is probably ok to use for benchmarks as well
|
||||
create_test_sourcelist(bench_sources BenchmarkDriver.cxx ${ARGN})
|
||||
|
||||
#store the absolute path for the driver and all the test
|
||||
#files
|
||||
set(driver ${CMAKE_CURRENT_BINARY_DIR}/BenchmarkDriver.cxx)
|
||||
#store the absolute path for all the test files
|
||||
set(cxx_sources)
|
||||
set(cu_sources)
|
||||
|
||||
@ -485,8 +484,6 @@ function(vtkm_save_benchmarks)
|
||||
PROPERTY vtkm_benchmarks_sources ${cxx_sources})
|
||||
set_property( GLOBAL APPEND
|
||||
PROPERTY vtkm_benchmarks_cu_sources ${cu_sources})
|
||||
set_property( GLOBAL APPEND
|
||||
PROPERTY vtkm_benchmarks_drivers ${driver})
|
||||
|
||||
endfunction(vtkm_save_benchmarks)
|
||||
|
||||
@ -504,10 +501,6 @@ function(vtkm_benchmarks device_adapter)
|
||||
get_property(benchmark_srcs GLOBAL
|
||||
PROPERTY vtkm_benchmarks_sources )
|
||||
|
||||
set(benchmark_drivers)
|
||||
get_property(benchmark_drivers GLOBAL
|
||||
PROPERTY vtkm_benchmarks_drivers )
|
||||
|
||||
#detect if we are generating a .cu files
|
||||
set(is_cuda FALSE)
|
||||
set(old_nvcc_flags ${CUDA_NVCC_FLAGS})
|
||||
@ -518,40 +511,50 @@ function(vtkm_benchmarks device_adapter)
|
||||
if(VTKm_ENABLE_BENCHMARKS AND VTKm_ENABLE_TESTING)
|
||||
string(REPLACE "VTKM_DEVICE_ADAPTER_" "" device_type ${device_adapter})
|
||||
|
||||
vtkm_get_kit_name(kit)
|
||||
|
||||
#inject the device adapter into the benchmark program name so each one is unique
|
||||
set(benchmark_prog Benchmarks_${device_type})
|
||||
|
||||
if(is_cuda)
|
||||
vtkm_setup_nvcc_flags( old_nvcc_flags )
|
||||
get_property(benchmark_srcs GLOBAL PROPERTY vtkm_benchmarks_cu_sources )
|
||||
cuda_add_executable(${benchmark_prog} ${benchmark_drivers} ${benchmark_srcs})
|
||||
set(CUDA_NVCC_FLAGS ${old_nvcc_flags})
|
||||
else()
|
||||
add_executable(${benchmark_prog} ${benchmark_drivers} ${benchmark_srcs})
|
||||
endif()
|
||||
|
||||
foreach( file ${benchmark_srcs})
|
||||
#inject the device adapter into the benchmark program name so each one is unique
|
||||
get_filename_component(benchmark_prog ${file} NAME_WE)
|
||||
set(benchmark_prog "${benchmark_prog}_${device_type}")
|
||||
|
||||
if(is_cuda)
|
||||
cuda_add_executable(${benchmark_prog} ${file})
|
||||
else()
|
||||
add_executable(${benchmark_prog} ${file})
|
||||
endif()
|
||||
|
||||
target_link_libraries(${benchmark_prog} ${VTKm_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
vtkm_setup_msvc_properties(${benchmark_prog})
|
||||
endif()
|
||||
if(MSVC)
|
||||
vtkm_setup_msvc_properties(${benchmark_prog})
|
||||
endif()
|
||||
|
||||
#add the specific compile options for this executable
|
||||
target_compile_options(${benchmark_prog} PRIVATE ${VTKm_COMPILE_OPTIONS})
|
||||
#add the specific compile options for this executable
|
||||
target_compile_options(${benchmark_prog} PRIVATE ${VTKm_COMPILE_OPTIONS})
|
||||
|
||||
#increase warning level if needed, we are going to skip cuda here
|
||||
#to remove all the false positive unused function warnings that cuda
|
||||
#generates
|
||||
if(VTKm_EXTRA_COMPILER_WARNINGS)
|
||||
#increase warning level if needed, we are going to skip cuda here
|
||||
#to remove all the false positive unused function warnings that cuda
|
||||
#generates
|
||||
if(VTKm_EXTRA_COMPILER_WARNINGS)
|
||||
set_property(TARGET ${benchmark_prog}
|
||||
APPEND PROPERTY COMPILE_FLAGS ${CMAKE_CXX_FLAGS_WARN_EXTRA} )
|
||||
endif()
|
||||
|
||||
#set the device adapter on the executable
|
||||
set_property(TARGET ${benchmark_prog}
|
||||
APPEND PROPERTY COMPILE_FLAGS ${CMAKE_CXX_FLAGS_WARN_EXTRA} )
|
||||
endif()
|
||||
APPEND
|
||||
PROPERTY COMPILE_DEFINITIONS "VTKM_DEVICE_ADAPTER=${device_adapter}" )
|
||||
|
||||
#set the device adapter on the executable
|
||||
set_property(TARGET ${benchmark_prog}
|
||||
APPEND
|
||||
PROPERTY COMPILE_DEFINITIONS "VTKM_DEVICE_ADAPTER=${device_adapter}" )
|
||||
|
||||
endforeach()
|
||||
|
||||
if(is_cuda)
|
||||
set(CUDA_NVCC_FLAGS ${old_nvcc_flags})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endfunction(vtkm_benchmarks)
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include <vtkm/Math.h>
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/Timer.h>
|
||||
#include <vtkm/opengl/TransferToOpenGL.h>
|
||||
#include <vtkm/interop/TransferToOpenGL.h>
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
#include <vtkm/worklet/WorkletMapField.h>
|
||||
|
||||
@ -58,8 +58,8 @@ struct HelloVTKMInterop
|
||||
GLuint ProgramId;
|
||||
GLuint VAOId;
|
||||
|
||||
vtkm::opengl::BufferState VBOState;
|
||||
vtkm::opengl::BufferState ColorState;
|
||||
vtkm::interop::BufferState VBOState;
|
||||
vtkm::interop::BufferState ColorState;
|
||||
|
||||
vtkm::cont::Timer<DeviceAdapter> Timer;
|
||||
|
||||
@ -166,8 +166,8 @@ struct HelloVTKMInterop
|
||||
GenerateSurfaceWorklet worklet( t );
|
||||
DispatcherType(worklet).Invoke( this->InHandle, this->OutCoords, this->OutColors );
|
||||
|
||||
vtkm::opengl::TransferToOpenGL( this->OutCoords, this->VBOState, DeviceAdapter() );
|
||||
vtkm::opengl::TransferToOpenGL( this->OutColors, this->ColorState, DeviceAdapter() );
|
||||
vtkm::interop::TransferToOpenGL( this->OutCoords, this->VBOState, DeviceAdapter() );
|
||||
vtkm::interop::TransferToOpenGL( this->OutColors, this->ColorState, DeviceAdapter() );
|
||||
|
||||
this->render();
|
||||
if(t > 10)
|
||||
|
@ -236,8 +236,8 @@ int main(int argc, char* argv[])
|
||||
filter.SetGenerateNormals(true);
|
||||
filter.SetMergeDuplicatePoints( false );
|
||||
filter.SetIsoValue( 0.5 );
|
||||
vtkm::filter::DataSetResult result = filter.Execute( dataSet,
|
||||
dataSet.GetField("nodevar") );
|
||||
vtkm::filter::ResultDataSet result =
|
||||
filter.Execute( dataSet, dataSet.GetField("nodevar") );
|
||||
|
||||
filter.MapFieldOntoOutput(result, dataSet.GetField("nodevar"));
|
||||
|
||||
|
45
vtkm/Assert.h
Normal file
45
vtkm/Assert.h
Normal file
@ -0,0 +1,45 @@
|
||||
//============================================================================
|
||||
// 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 2016 Sandia Corporation.
|
||||
// Copyright 2016 UT-Battelle, LLC.
|
||||
// Copyright 2016 Los Alamos National Security.
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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_Assert_h
|
||||
#define vtk_m_Assert_h
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
/// \def VTKM_ASSERT(condition)
|
||||
///
|
||||
/// Asserts that \a condition resolves to true. If \a condition is false,
|
||||
/// then a diagnostic message is outputted and execution is terminated. The
|
||||
/// behavior is essentially the same as the POSIX assert macro, but is
|
||||
/// wrapped for added portability.
|
||||
///
|
||||
/// Like the POSIX assert macro, the check will be removed when compiling
|
||||
/// in non-debug mode (specifically when NDEBUG is defined), so be prepared
|
||||
/// for the possibility that the condition is never evaluated.
|
||||
///
|
||||
#if !defined(NDEBUG)
|
||||
#define VTKM_ASSERT(condition) \
|
||||
assert(condition)
|
||||
#else
|
||||
#define VTKM_ASSERT(condition)
|
||||
#endif
|
||||
|
||||
|
||||
#endif //vtk_m_Assert_h
|
@ -21,6 +21,7 @@
|
||||
include_directories(${Boost_INCLUDE_DIRS})
|
||||
|
||||
set(headers
|
||||
Assert.h
|
||||
BinaryPredicates.h
|
||||
BinaryOperators.h
|
||||
CellShape.h
|
||||
@ -29,6 +30,7 @@ set(headers
|
||||
ListTag.h
|
||||
Math.h
|
||||
Matrix.h
|
||||
NewtonsMethod.h
|
||||
Pair.h
|
||||
StaticAssert.h
|
||||
TopologyElementTag.h
|
||||
@ -52,7 +54,7 @@ add_subdirectory(testing)
|
||||
add_subdirectory(internal)
|
||||
|
||||
if(VTKm_ENABLE_OPENGL_INTEROP)
|
||||
add_subdirectory(opengl)
|
||||
add_subdirectory(interop)
|
||||
endif(VTKm_ENABLE_OPENGL_INTEROP)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
@ -22,6 +22,7 @@
|
||||
#ifndef vtk_m_Matrix_h
|
||||
#define vtk_m_Matrix_h
|
||||
|
||||
#include <vtkm/Assert.h>
|
||||
#include <vtkm/Math.h>
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/TypeTraits.h>
|
||||
@ -59,6 +60,8 @@ public:
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
const vtkm::Vec<ComponentType, NUM_COLUMNS> &
|
||||
operator[](vtkm::IdComponent rowIndex) const {
|
||||
VTKM_ASSERT(rowIndex >= 0);
|
||||
VTKM_ASSERT(rowIndex < this->NUM_ROWS);
|
||||
return this->Components[rowIndex];
|
||||
}
|
||||
|
||||
@ -68,6 +71,8 @@ public:
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
vtkm::Vec<ComponentType, NUM_COLUMNS> &
|
||||
operator[](vtkm::IdComponent rowIndex) {
|
||||
VTKM_ASSERT(rowIndex >= 0);
|
||||
VTKM_ASSERT(rowIndex < this->NUM_ROWS);
|
||||
return this->Components[rowIndex];
|
||||
}
|
||||
|
||||
@ -77,6 +82,10 @@ public:
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
const ComponentType &
|
||||
operator()(vtkm::IdComponent rowIndex, vtkm::IdComponent colIndex) const {
|
||||
VTKM_ASSERT(rowIndex >= 0);
|
||||
VTKM_ASSERT(rowIndex < this->NUM_ROWS);
|
||||
VTKM_ASSERT(colIndex >= 0);
|
||||
VTKM_ASSERT(colIndex < this->NUM_COLUMNS);
|
||||
return (*this)[rowIndex][colIndex];
|
||||
}
|
||||
|
||||
@ -86,6 +95,10 @@ public:
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
ComponentType &
|
||||
operator()(vtkm::IdComponent rowIndex, vtkm::IdComponent colIndex) {
|
||||
VTKM_ASSERT(rowIndex >= 0);
|
||||
VTKM_ASSERT(rowIndex < this->NUM_ROWS);
|
||||
VTKM_ASSERT(colIndex >= 0);
|
||||
VTKM_ASSERT(colIndex < this->NUM_COLUMNS);
|
||||
return (*this)[rowIndex][colIndex];
|
||||
}
|
||||
|
||||
|
@ -17,14 +17,13 @@
|
||||
// Laboratory (LANL), the U.S. Government retains certain rights in
|
||||
// this software.
|
||||
//============================================================================
|
||||
#ifndef vtk_m_exec_NewtonsMethod_h
|
||||
#define vtk_m_exec_NewtonsMethod_h
|
||||
#ifndef vtk_m_NewtonsMethod_h
|
||||
#define vtk_m_NewtonsMethod_h
|
||||
|
||||
#include <vtkm/Math.h>
|
||||
#include <vtkm/Matrix.h>
|
||||
|
||||
namespace vtkm {
|
||||
namespace exec {
|
||||
|
||||
/// Uses Newton's method (a.k.a. Newton-Raphson method) to solve a nonlinear
|
||||
/// system of equations. This function assumes that the number of variables
|
||||
@ -36,11 +35,12 @@ namespace exec {
|
||||
/// that evaluates to the desired output, or the closest point found, is
|
||||
/// returned.
|
||||
///
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
template<typename ScalarType,
|
||||
vtkm::IdComponent Size,
|
||||
typename JacobianFunctor,
|
||||
typename FunctionFunctor>
|
||||
VTKM_EXEC_EXPORT
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
vtkm::Vec<ScalarType,Size>
|
||||
NewtonsMethod(JacobianFunctor jacobianEvaluator,
|
||||
FunctionFunctor functionEvaluator,
|
||||
@ -92,7 +92,6 @@ NewtonsMethod(JacobianFunctor jacobianEvaluator,
|
||||
return x;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace vtkm::exec
|
||||
} // namespace vtkm
|
||||
|
||||
#endif //vtk_m_exec_NewtonsMethod_h
|
||||
#endif //vtk_m_NewtonsMethod_h
|
10
vtkm/Types.h
10
vtkm/Types.h
@ -24,6 +24,8 @@
|
||||
#include <vtkm/internal/Configure.h>
|
||||
#include <vtkm/internal/ExportMacros.h>
|
||||
|
||||
#include <vtkm/Assert.h>
|
||||
|
||||
VTKM_THIRDPARTY_PRE_INCLUDE
|
||||
#include <boost/mpl/or.hpp>
|
||||
#include <boost/type_traits/is_floating_point.hpp>
|
||||
@ -74,10 +76,10 @@ VTKM_THIRDPARTY_POST_INCLUDE
|
||||
* change. This should not be used for projects using VTKm. Instead it servers
|
||||
* are a reference for the developers of VTKm.
|
||||
*
|
||||
* \namespace vtkm::opengl
|
||||
* \namespace vtkm::interop
|
||||
* \brief Utility opengl interop functions
|
||||
*
|
||||
* vtkm::opengl defines the publicly accessible API for interoperability between
|
||||
* vtkm::interop defines the publicly accessible API for interoperability between
|
||||
* vtkm and opengl.
|
||||
*
|
||||
* \namespace vtkm::testing
|
||||
@ -806,11 +808,15 @@ public:
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
const ComponentType &operator[](vtkm::IdComponent idx) const
|
||||
{
|
||||
VTKM_ASSERT(idx >= 0);
|
||||
VTKM_ASSERT(idx < this->NUM_COMPONENTS);
|
||||
return this->Components[idx];
|
||||
}
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
ComponentType &operator[](vtkm::IdComponent idx)
|
||||
{
|
||||
VTKM_ASSERT(idx >= 0);
|
||||
VTKM_ASSERT(idx < this->NUM_COMPONENTS);
|
||||
return this->Components[idx];
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#ifndef vtk_m_VecVariable_h
|
||||
#define vtk_m_VecVariable_h
|
||||
|
||||
#include <vtkm/Assert.h>
|
||||
#include <vtkm/Math.h>
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/TypeTraits.h>
|
||||
@ -48,6 +49,7 @@ public:
|
||||
VecVariable(const vtkm::VecVariable<ComponentType,SrcSize> &src)
|
||||
: NumComponents(src.GetNumberOfComponents())
|
||||
{
|
||||
VTKM_ASSERT(this->NumComponents <= MaxSize);
|
||||
for (vtkm::IdComponent index = 0; index < this->NumComponents; index++)
|
||||
{
|
||||
this->Data[index] = src[index];
|
||||
@ -59,6 +61,7 @@ public:
|
||||
VecVariable(const vtkm::Vec<ComponentType,SrcSize> &src)
|
||||
: NumComponents(SrcSize)
|
||||
{
|
||||
VTKM_ASSERT(this->NumComponents <= MaxSize);
|
||||
for (vtkm::IdComponent index = 0; index < this->NumComponents; index++)
|
||||
{
|
||||
this->Data[index] = src[index];
|
||||
@ -96,6 +99,7 @@ public:
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
void Append(ComponentType value)
|
||||
{
|
||||
VTKM_ASSERT(this->NumComponents < MaxSize);
|
||||
this->Data[this->NumComponents] = value;
|
||||
this->NumComponents++;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <string>
|
||||
#include <cctype>
|
||||
|
||||
int BenchmarkDeviceAdapter(int argc, char *argv[])
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int benchmarks = 0;
|
||||
if (argc < 2){
|
||||
@ -73,6 +73,8 @@ int BenchmarkDeviceAdapter(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//now actually execute the benchmarks
|
||||
return vtkm::benchmarking::BenchmarkDeviceAdapter
|
||||
<VTKM_DEFAULT_DEVICE_ADAPTER_TAG>::Run(benchmarks);
|
||||
}
|
||||
|
@ -122,13 +122,13 @@ bool is_sorted(ForwardIt first, ForwardIt last){
|
||||
// Get the value representing the `percent` percentile of the
|
||||
// sorted samples using linear interpolation
|
||||
vtkm::Float64 PercentileValue(const std::vector<vtkm::Float64> &samples, const vtkm::Float64 percent){
|
||||
VTKM_ASSERT_CONT(!samples.empty());
|
||||
VTKM_ASSERT(!samples.empty());
|
||||
if (samples.size() == 1){
|
||||
return samples.front();
|
||||
}
|
||||
VTKM_ASSERT_CONT(percent >= 0.0);
|
||||
VTKM_ASSERT_CONT(percent <= 100.0);
|
||||
VTKM_ASSERT_CONT(
|
||||
VTKM_ASSERT(percent >= 0.0);
|
||||
VTKM_ASSERT(percent <= 100.0);
|
||||
VTKM_ASSERT(
|
||||
vtkm::benchmarking::stats::is_sorted(samples.begin(), samples.end()));
|
||||
if (percent == 100.0){
|
||||
return samples.back();
|
||||
|
@ -20,9 +20,9 @@
|
||||
#ifndef vtk_m_cont_ArrayHandle_h
|
||||
#define vtk_m_cont_ArrayHandle_h
|
||||
|
||||
#include <vtkm/Assert.h>
|
||||
#include <vtkm/Types.h>
|
||||
|
||||
#include <vtkm/cont/Assert.h>
|
||||
#include <vtkm/cont/ErrorControlBadValue.h>
|
||||
#include <vtkm/cont/ErrorControlInternal.h>
|
||||
#include <vtkm/cont/Storage.h>
|
||||
@ -444,7 +444,7 @@ public:
|
||||
"ArrayHandle::Shrink cannot be used to grow array.");
|
||||
}
|
||||
|
||||
VTKM_ASSERT_CONT(this->GetNumberOfValues() == numberOfValues);
|
||||
VTKM_ASSERT(this->GetNumberOfValues() == numberOfValues);
|
||||
}
|
||||
|
||||
/// Releases any resources being used in the execution environment (that are
|
||||
@ -640,8 +640,8 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
VTKM_ASSERT_CONT(this->Internals->ExecutionArray == NULL);
|
||||
VTKM_ASSERT_CONT(!this->Internals->ExecutionArrayValid);
|
||||
VTKM_ASSERT(this->Internals->ExecutionArray == NULL);
|
||||
VTKM_ASSERT(!this->Internals->ExecutionArrayValid);
|
||||
// Need to change some state that does not change the logical state from
|
||||
// an external point of view.
|
||||
InternalStruct *internals
|
||||
|
@ -20,22 +20,21 @@
|
||||
#ifndef vtk_m_cont_ArrayHandleCartesianProduct_h
|
||||
#define vtk_m_cont_ArrayHandleCartesianProduct_h
|
||||
|
||||
#include <vtkm/Assert.h>
|
||||
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/Assert.h>
|
||||
#include <vtkm/cont/ErrorControlBadAllocation.h>
|
||||
|
||||
namespace vtkm {
|
||||
namespace exec {
|
||||
namespace internal {
|
||||
|
||||
/// \brief An array portal that acts as a 3D cartesian product of 3 arrays.
|
||||
/// for the execution environment
|
||||
|
||||
///
|
||||
template<typename ValueType_,
|
||||
typename PortalTypeFirst_,
|
||||
typename PortalTypeSecond_,
|
||||
typename PortalTypeThird_>
|
||||
class ArrayPortalExecCartesianProduct
|
||||
class ArrayPortalCartesianProduct
|
||||
{
|
||||
public:
|
||||
typedef ValueType_ ValueType;
|
||||
@ -46,78 +45,90 @@ public:
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
ArrayPortalExecCartesianProduct()
|
||||
ArrayPortalCartesianProduct()
|
||||
: PortalFirst(), PortalSecond(), PortalThird()
|
||||
{ } //needs to be host and device so that cuda can create lvalue of these
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
ArrayPortalExecCartesianProduct(const PortalTypeFirst &portalfirst,
|
||||
const PortalTypeSecond &portalsecond,
|
||||
const PortalTypeThird &portalthird)
|
||||
ArrayPortalCartesianProduct(const PortalTypeFirst &portalfirst,
|
||||
const PortalTypeSecond &portalsecond,
|
||||
const PortalTypeThird &portalthird)
|
||||
: PortalFirst(portalfirst), PortalSecond(portalsecond), PortalThird(portalthird)
|
||||
{ }
|
||||
|
||||
/// Copy constructor for any other ArrayPortalExecCartesianProduct with an iterator
|
||||
/// Copy constructor for any other ArrayPortalCartesianProduct with an iterator
|
||||
/// type that can be copied to this iterator type. This allows us to do any
|
||||
/// type casting that the iterators do (like the non-const to const cast).
|
||||
///
|
||||
|
||||
template<class OtherV, class OtherP1, class OtherP2, class OtherP3>
|
||||
VTKM_CONT_EXPORT
|
||||
ArrayPortalExecCartesianProduct(const ArrayPortalExecCartesianProduct<OtherV,OtherP1,OtherP2,OtherP3> &src)
|
||||
ArrayPortalCartesianProduct(const ArrayPortalCartesianProduct<OtherV,OtherP1,OtherP2,OtherP3> &src)
|
||||
: PortalFirst(src.GetPortalFirst()),
|
||||
PortalSecond(src.GetPortalSecond()),
|
||||
PortalThird(src.GetPortalThird())
|
||||
{ }
|
||||
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
vtkm::Id GetNumberOfValues() const
|
||||
{
|
||||
return this->PortalFirst.GetNumberOfValues() *
|
||||
this->PortalSecond.GetNumberOfValues() *
|
||||
this->PortalThird.GetNumberOfValues();
|
||||
return this->PortalFirst.GetNumberOfValues() *
|
||||
this->PortalSecond.GetNumberOfValues() *
|
||||
this->PortalThird.GetNumberOfValues();
|
||||
}
|
||||
|
||||
VTKM_EXEC_EXPORT
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
ValueType Get(vtkm::Id index) const
|
||||
{
|
||||
vtkm::Id dim1 = this->PortalFirst.GetNumberOfValues();
|
||||
vtkm::Id dim2 = this->PortalSecond.GetNumberOfValues();
|
||||
vtkm::Id dim12 = dim1*dim2;
|
||||
vtkm::Id idx12 = index % dim12;
|
||||
vtkm::Id i1 = idx12 % dim1;
|
||||
vtkm::Id i2 = idx12 / dim1;
|
||||
vtkm::Id i3 = index / dim12;
|
||||
VTKM_ASSERT(index >= 0);
|
||||
VTKM_ASSERT(index < this->GetNumberOfValues());
|
||||
|
||||
return vtkm::make_Vec(this->PortalFirst.Get(i1),
|
||||
this->PortalSecond.Get(i2),
|
||||
this->PortalThird.Get(i3));
|
||||
vtkm::Id dim1 = this->PortalFirst.GetNumberOfValues();
|
||||
vtkm::Id dim2 = this->PortalSecond.GetNumberOfValues();
|
||||
vtkm::Id dim12 = dim1*dim2;
|
||||
vtkm::Id idx12 = index % dim12;
|
||||
vtkm::Id i1 = idx12 % dim1;
|
||||
vtkm::Id i2 = idx12 / dim1;
|
||||
vtkm::Id i3 = index / dim12;
|
||||
|
||||
return vtkm::make_Vec(this->PortalFirst.Get(i1),
|
||||
this->PortalSecond.Get(i2),
|
||||
this->PortalThird.Get(i3));
|
||||
}
|
||||
|
||||
VTKM_EXEC_EXPORT
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
void Set(vtkm::Id index, const ValueType &value) const
|
||||
{
|
||||
vtkm::Id dim1 = this->PortalFirst.GetNumberOfValues();
|
||||
vtkm::Id dim2 = this->PortalSecond.GetNumberOfValues();
|
||||
vtkm::Id dim12 = dim1*dim2;
|
||||
vtkm::Id idx12 = index % dim12;
|
||||
VTKM_ASSERT(index >= 0);
|
||||
VTKM_ASSERT(index < this->GetNumberOfValues());
|
||||
|
||||
vtkm::Id i1 = idx12 % dim1;
|
||||
vtkm::Id i2 = idx12 / dim1;
|
||||
vtkm::Id i3 = index / dim12;
|
||||
vtkm::Id dim1 = this->PortalFirst.GetNumberOfValues();
|
||||
vtkm::Id dim2 = this->PortalSecond.GetNumberOfValues();
|
||||
vtkm::Id dim12 = dim1*dim2;
|
||||
vtkm::Id idx12 = index % dim12;
|
||||
|
||||
this->PortalFirst.Set(i1, value[0]);
|
||||
this->PortalSecond.Set(i2, value[1]);
|
||||
this->PortalThird.Set(i3, value[2]);
|
||||
vtkm::Id i1 = idx12 % dim1;
|
||||
vtkm::Id i2 = idx12 / dim1;
|
||||
vtkm::Id i3 = index / dim12;
|
||||
|
||||
this->PortalFirst.Set(i1, value[0]);
|
||||
this->PortalSecond.Set(i2, value[1]);
|
||||
this->PortalThird.Set(i3, value[2]);
|
||||
}
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
const PortalTypeFirst &GetFirstPortal() const { return this->PortalFirst; }
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
const PortalTypeSecond &GetSecondPortal() const { return this->PortalSecond; }
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
const PortalTypeThird &GetThirdPortal() const { return this->PortalThird; }
|
||||
|
||||
@ -129,8 +140,7 @@ private:
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace vtkm::exec::internal
|
||||
} // namespace vtkm::internal
|
||||
|
||||
|
||||
namespace vtkm {
|
||||
@ -138,94 +148,6 @@ namespace cont {
|
||||
|
||||
namespace internal {
|
||||
|
||||
/// \brief An array portal that zips two portals together into a single value
|
||||
/// for the control environment
|
||||
template<typename ValueType_,
|
||||
typename PortalTypeFirst,
|
||||
typename PortalTypeSecond,
|
||||
typename PortalTypeThird>
|
||||
class ArrayPortalContCartesianProduct
|
||||
{
|
||||
public:
|
||||
typedef ValueType_ ValueType;
|
||||
typedef ValueType_ IteratorType;
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
ArrayPortalContCartesianProduct(const PortalTypeFirst &portalfirst = PortalTypeFirst(),
|
||||
const PortalTypeSecond &portalsecond = PortalTypeSecond(),
|
||||
const PortalTypeSecond &portalthird = PortalTypeThird())
|
||||
: PortalFirst(portalfirst), PortalSecond(portalsecond), PortalThird(portalthird)
|
||||
{ }
|
||||
|
||||
/// Copy constructor for any other ArrayPortalContCartesianProduct with an iterator
|
||||
/// type that can be copied to this iterator type. This allows us to do any
|
||||
/// type casting that the iterators do (like the non-const to const cast).
|
||||
///
|
||||
template<class OtherV, class OtherP1, class OtherP2, class OtherP3>
|
||||
VTKM_CONT_EXPORT
|
||||
ArrayPortalContCartesianProduct(const ArrayPortalContCartesianProduct<OtherV,
|
||||
OtherP1,OtherP2,OtherP3> &src)
|
||||
: PortalFirst(src.GetPortalFirst()),
|
||||
PortalSecond(src.GetPortalSecond()),
|
||||
PortalThird(src.GetPortalThird())
|
||||
{ }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::Id GetNumberOfValues() const
|
||||
{
|
||||
return this->PortalFirst.GetNumberOfValues() *
|
||||
this->PortalSecond.GetNumberOfValues() *
|
||||
this->PortalThird.GetNumberOfValues();
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
ValueType Get(vtkm::Id index) const
|
||||
{
|
||||
vtkm::Id dim1 = this->PortalFirst.GetNumberOfValues();
|
||||
vtkm::Id dim2 = this->PortalSecond.GetNumberOfValues();
|
||||
vtkm::Id dim12 = dim1*dim2;
|
||||
vtkm::Id idx12 = index % dim12;
|
||||
vtkm::Id i1 = idx12 % dim1;
|
||||
vtkm::Id i2 = idx12 / dim1;
|
||||
vtkm::Id i3 = index / dim12;
|
||||
return vtkm::make_Vec(this->PortalFirst.Get(i1),
|
||||
this->PortalSecond.Get(i2),
|
||||
this->PortalThird.Get(i3));
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
void Set(vtkm::Id index, const ValueType &value) const
|
||||
{
|
||||
vtkm::Id dim1 = this->PortalFirst.GetNumberOfValues();
|
||||
vtkm::Id dim2 = this->PortalSecond.GetNumberOfValues();
|
||||
vtkm::Id dim12 = dim1*dim2;
|
||||
vtkm::Id idx12 = index % dim12;
|
||||
|
||||
vtkm::Id i1 = idx12 % dim1;
|
||||
vtkm::Id i2 = idx12 / dim1;
|
||||
vtkm::Id i3 = index / dim12;
|
||||
|
||||
this->PortalFirst.Set(i1, value[0]);
|
||||
this->PortalSecond.Set(i2, value[1]);
|
||||
this->PortalThird.Set(i3, value[2]);
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
const PortalTypeFirst &GetFirstPortal() const { return this->PortalFirst; }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
const PortalTypeSecond &GetSecondPortal() const { return this->PortalSecond; }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
const PortalTypeSecond &GetThirdPortal() const { return this->PortalThird; }
|
||||
|
||||
|
||||
private:
|
||||
PortalTypeFirst PortalFirst;
|
||||
PortalTypeSecond PortalSecond;
|
||||
PortalTypeThird PortalThird;
|
||||
};
|
||||
|
||||
template<typename FirstHandleType, typename SecondHandleType, typename ThirdHandleType>
|
||||
struct StorageTagCartesianProduct { };
|
||||
|
||||
@ -258,11 +180,11 @@ class Storage<T, StorageTagCartesianProduct<FirstHandleType, SecondHandleType, T
|
||||
public:
|
||||
typedef T ValueType;
|
||||
|
||||
typedef ArrayPortalContCartesianProduct< ValueType,
|
||||
typedef vtkm::internal::ArrayPortalCartesianProduct< ValueType,
|
||||
typename FirstHandleType::PortalControl,
|
||||
typename SecondHandleType::PortalControl,
|
||||
typename ThirdHandleType::PortalControl> PortalType;
|
||||
typedef ArrayPortalContCartesianProduct< ValueType,
|
||||
typedef vtkm::internal::ArrayPortalCartesianProduct< ValueType,
|
||||
typename FirstHandleType::PortalConstControl,
|
||||
typename SecondHandleType::PortalConstControl,
|
||||
typename ThirdHandleType::PortalConstControl>
|
||||
@ -362,14 +284,14 @@ public:
|
||||
typedef typename StorageType::PortalType PortalControl;
|
||||
typedef typename StorageType::PortalConstType PortalConstControl;
|
||||
|
||||
typedef vtkm::exec::internal::ArrayPortalExecCartesianProduct<
|
||||
typedef vtkm::internal::ArrayPortalCartesianProduct<
|
||||
ValueType,
|
||||
typename FirstHandleType::template ExecutionTypes<Device>::Portal,
|
||||
typename SecondHandleType::template ExecutionTypes<Device>::Portal,
|
||||
typename ThirdHandleType::template ExecutionTypes<Device>::Portal
|
||||
> PortalExecution;
|
||||
|
||||
typedef vtkm::exec::internal::ArrayPortalExecCartesianProduct<
|
||||
typedef vtkm::internal::ArrayPortalCartesianProduct<
|
||||
ValueType,
|
||||
typename FirstHandleType::template ExecutionTypes<Device>::PortalConst,
|
||||
typename SecondHandleType::template ExecutionTypes<Device>::PortalConst,
|
||||
|
@ -324,13 +324,13 @@ public:
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
const FunctionInterfaceWithArrays &GetArrays() const {
|
||||
VTKM_ASSERT_CONT(this->Valid);
|
||||
VTKM_ASSERT(this->Valid);
|
||||
return this->Arrays;
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
const ComponentMapType &GetSourceComponents() const {
|
||||
VTKM_ASSERT_CONT(this->Valid);
|
||||
VTKM_ASSERT(this->Valid);
|
||||
return this->SourceComponents;
|
||||
}
|
||||
|
||||
@ -547,6 +547,10 @@ template<typename ArrayHandleType1,
|
||||
typename ArrayHandleType4 = void>
|
||||
struct ArrayHandleCompositeVectorType
|
||||
{
|
||||
VTKM_IS_ARRAY_HANDLE(ArrayHandleType1);
|
||||
VTKM_IS_ARRAY_HANDLE(ArrayHandleType2);
|
||||
VTKM_IS_ARRAY_HANDLE(ArrayHandleType3);
|
||||
VTKM_IS_ARRAY_HANDLE(ArrayHandleType4);
|
||||
private:
|
||||
typedef typename vtkm::VecTraits<typename ArrayHandleType1::ValueType>::ComponentType
|
||||
ComponentType;
|
||||
@ -562,6 +566,9 @@ template<typename ArrayHandleType1,
|
||||
struct ArrayHandleCompositeVectorType<
|
||||
ArrayHandleType1,ArrayHandleType2,ArrayHandleType3>
|
||||
{
|
||||
VTKM_IS_ARRAY_HANDLE(ArrayHandleType1);
|
||||
VTKM_IS_ARRAY_HANDLE(ArrayHandleType2);
|
||||
VTKM_IS_ARRAY_HANDLE(ArrayHandleType3);
|
||||
private:
|
||||
typedef typename vtkm::VecTraits<typename ArrayHandleType1::ValueType>::ComponentType
|
||||
ComponentType;
|
||||
@ -575,6 +582,8 @@ template<typename ArrayHandleType1,
|
||||
typename ArrayHandleType2>
|
||||
struct ArrayHandleCompositeVectorType<ArrayHandleType1,ArrayHandleType2>
|
||||
{
|
||||
VTKM_IS_ARRAY_HANDLE(ArrayHandleType1);
|
||||
VTKM_IS_ARRAY_HANDLE(ArrayHandleType2);
|
||||
private:
|
||||
typedef typename vtkm::VecTraits<typename ArrayHandleType1::ValueType>::ComponentType
|
||||
ComponentType;
|
||||
@ -587,6 +596,7 @@ public:
|
||||
template<typename ArrayHandleType1>
|
||||
struct ArrayHandleCompositeVectorType<ArrayHandleType1>
|
||||
{
|
||||
VTKM_IS_ARRAY_HANDLE(ArrayHandleType1);
|
||||
private:
|
||||
typedef typename vtkm::VecTraits<typename ArrayHandleType1::ValueType>::ComponentType
|
||||
ComponentType;
|
||||
@ -609,83 +619,84 @@ make_ArrayHandleCompositeVector(
|
||||
vtkm::cont::ArrayHandle<ValueType1,Storage1> >::type(array1,
|
||||
sourceComponent1);
|
||||
}
|
||||
template<typename ValueType1, typename Storage1,
|
||||
typename ValueType2, typename Storage2>
|
||||
template<typename ArrayHandleType1>
|
||||
VTKM_CONT_EXPORT
|
||||
typename ArrayHandleCompositeVectorType<
|
||||
vtkm::cont::ArrayHandle<ValueType1,Storage1>,
|
||||
vtkm::cont::ArrayHandle<ValueType2,Storage2> >::type
|
||||
make_ArrayHandleCompositeVector(
|
||||
const vtkm::cont::ArrayHandle<ValueType1,Storage1> &array1,
|
||||
vtkm::IdComponent sourceComponent1,
|
||||
const vtkm::cont::ArrayHandle<ValueType2,Storage2> &array2,
|
||||
vtkm::IdComponent sourceComponent2)
|
||||
typename ArrayHandleCompositeVectorType<ArrayHandleType1>::type
|
||||
make_ArrayHandleCompositeVector(const ArrayHandleType1 &array1,
|
||||
vtkm::IdComponent sourceComponent1)
|
||||
{
|
||||
VTKM_IS_ARRAY_HANDLE(ArrayHandleType1);
|
||||
return typename ArrayHandleCompositeVectorType<
|
||||
vtkm::cont::ArrayHandle<ValueType1,Storage1>,
|
||||
vtkm::cont::ArrayHandle<ValueType2,Storage2> >::type(array1,
|
||||
sourceComponent1,
|
||||
array2,
|
||||
sourceComponent2);
|
||||
ArrayHandleType1>::type(array1, sourceComponent1);
|
||||
}
|
||||
template<typename ValueType1, typename Storage1,
|
||||
typename ValueType2, typename Storage2,
|
||||
typename ValueType3, typename Storage3>
|
||||
template<typename ArrayHandleType1,
|
||||
typename ArrayHandleType2>
|
||||
VTKM_CONT_EXPORT
|
||||
typename ArrayHandleCompositeVectorType<
|
||||
vtkm::cont::ArrayHandle<ValueType1,Storage1>,
|
||||
vtkm::cont::ArrayHandle<ValueType2,Storage2>,
|
||||
vtkm::cont::ArrayHandle<ValueType3,Storage3> >::type
|
||||
make_ArrayHandleCompositeVector(
|
||||
const vtkm::cont::ArrayHandle<ValueType1,Storage1> &array1,
|
||||
vtkm::IdComponent sourceComponent1,
|
||||
const vtkm::cont::ArrayHandle<ValueType2,Storage2> &array2,
|
||||
vtkm::IdComponent sourceComponent2,
|
||||
const vtkm::cont::ArrayHandle<ValueType3,Storage3> &array3,
|
||||
vtkm::IdComponent sourceComponent3)
|
||||
ArrayHandleType1, ArrayHandleType2>::type
|
||||
make_ArrayHandleCompositeVector(const ArrayHandleType1 &array1,
|
||||
vtkm::IdComponent sourceComponent1,
|
||||
const ArrayHandleType2 &array2,
|
||||
vtkm::IdComponent sourceComponent2)
|
||||
{
|
||||
VTKM_IS_ARRAY_HANDLE(ArrayHandleType1);
|
||||
VTKM_IS_ARRAY_HANDLE(ArrayHandleType2);
|
||||
return typename ArrayHandleCompositeVectorType<
|
||||
vtkm::cont::ArrayHandle<ValueType1,Storage1>,
|
||||
vtkm::cont::ArrayHandle<ValueType2,Storage2>,
|
||||
vtkm::cont::ArrayHandle<ValueType3,Storage3> >::type(array1,
|
||||
sourceComponent1,
|
||||
array2,
|
||||
sourceComponent2,
|
||||
array3,
|
||||
sourceComponent3);
|
||||
ArrayHandleType1,
|
||||
ArrayHandleType2>::type(array1, sourceComponent1,
|
||||
array2, sourceComponent2);
|
||||
}
|
||||
template<typename ValueType1, typename Storage1,
|
||||
typename ValueType2, typename Storage2,
|
||||
typename ValueType3, typename Storage3,
|
||||
typename ValueType4, typename Storage4>
|
||||
template<typename ArrayHandleType1,
|
||||
typename ArrayHandleType2,
|
||||
typename ArrayHandleType3>
|
||||
VTKM_CONT_EXPORT
|
||||
typename ArrayHandleCompositeVectorType<
|
||||
vtkm::cont::ArrayHandle<ValueType1,Storage1>,
|
||||
vtkm::cont::ArrayHandle<ValueType2,Storage2>,
|
||||
vtkm::cont::ArrayHandle<ValueType3,Storage3>,
|
||||
vtkm::cont::ArrayHandle<ValueType4,Storage4> >::type
|
||||
make_ArrayHandleCompositeVector(
|
||||
const vtkm::cont::ArrayHandle<ValueType1,Storage1> &array1,
|
||||
vtkm::IdComponent sourceComponent1,
|
||||
const vtkm::cont::ArrayHandle<ValueType2,Storage2> &array2,
|
||||
vtkm::IdComponent sourceComponent2,
|
||||
const vtkm::cont::ArrayHandle<ValueType3,Storage3> &array3,
|
||||
vtkm::IdComponent sourceComponent3,
|
||||
const vtkm::cont::ArrayHandle<ValueType4,Storage4> &array4,
|
||||
vtkm::IdComponent sourceComponent4)
|
||||
ArrayHandleType1, ArrayHandleType2, ArrayHandleType3>::type
|
||||
make_ArrayHandleCompositeVector(const ArrayHandleType1 &array1,
|
||||
vtkm::IdComponent sourceComponent1,
|
||||
const ArrayHandleType2 &array2,
|
||||
vtkm::IdComponent sourceComponent2,
|
||||
const ArrayHandleType3 &array3,
|
||||
vtkm::IdComponent sourceComponent3)
|
||||
{
|
||||
VTKM_IS_ARRAY_HANDLE(ArrayHandleType1);
|
||||
VTKM_IS_ARRAY_HANDLE(ArrayHandleType2);
|
||||
VTKM_IS_ARRAY_HANDLE(ArrayHandleType3);
|
||||
return typename ArrayHandleCompositeVectorType<
|
||||
vtkm::cont::ArrayHandle<ValueType1,Storage1>,
|
||||
vtkm::cont::ArrayHandle<ValueType2,Storage2>,
|
||||
vtkm::cont::ArrayHandle<ValueType3,Storage3>,
|
||||
vtkm::cont::ArrayHandle<ValueType4,Storage4> >::type(array1,
|
||||
sourceComponent1,
|
||||
array2,
|
||||
sourceComponent2,
|
||||
array3,
|
||||
sourceComponent3,
|
||||
array4,
|
||||
sourceComponent4);
|
||||
ArrayHandleType1,
|
||||
ArrayHandleType2,
|
||||
ArrayHandleType3>::type(array1, sourceComponent1,
|
||||
array2, sourceComponent2,
|
||||
array3, sourceComponent3);
|
||||
}
|
||||
template<typename ArrayHandleType1,
|
||||
typename ArrayHandleType2,
|
||||
typename ArrayHandleType3,
|
||||
typename ArrayHandleType4>
|
||||
VTKM_CONT_EXPORT
|
||||
typename ArrayHandleCompositeVectorType<
|
||||
ArrayHandleType1, ArrayHandleType2, ArrayHandleType3, ArrayHandleType4>::type
|
||||
make_ArrayHandleCompositeVector(const ArrayHandleType1 &array1,
|
||||
vtkm::IdComponent sourceComponent1,
|
||||
const ArrayHandleType2 &array2,
|
||||
vtkm::IdComponent sourceComponent2,
|
||||
const ArrayHandleType3 &array3,
|
||||
vtkm::IdComponent sourceComponent3,
|
||||
const ArrayHandleType4 &array4,
|
||||
vtkm::IdComponent sourceComponent4)
|
||||
{
|
||||
VTKM_IS_ARRAY_HANDLE(ArrayHandleType1);
|
||||
VTKM_IS_ARRAY_HANDLE(ArrayHandleType2);
|
||||
VTKM_IS_ARRAY_HANDLE(ArrayHandleType3);
|
||||
VTKM_IS_ARRAY_HANDLE(ArrayHandleType4);
|
||||
return typename ArrayHandleCompositeVectorType<
|
||||
ArrayHandleType1,
|
||||
ArrayHandleType2,
|
||||
ArrayHandleType3,
|
||||
ArrayHandleType4>::type(array1, sourceComponent1,
|
||||
array2, sourceComponent2,
|
||||
array3, sourceComponent3,
|
||||
array4, sourceComponent4);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ArrayPortal.h>
|
||||
#include <vtkm/cont/Assert.h>
|
||||
#include <vtkm/cont/ErrorControlBadValue.h>
|
||||
|
||||
VTKM_THIRDPARTY_PRE_INCLUDE
|
||||
@ -142,21 +141,21 @@ public:
|
||||
VTKM_CONT_EXPORT
|
||||
PortalType GetPortal()
|
||||
{
|
||||
VTKM_ASSERT_CONT(this->Valid);
|
||||
VTKM_ASSERT(this->Valid);
|
||||
return PortalType(this->SourceArray.GetPortalControl());
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
PortalConstType GetPortalConst() const
|
||||
{
|
||||
VTKM_ASSERT_CONT(this->Valid);
|
||||
VTKM_ASSERT(this->Valid);
|
||||
return PortalConstType(this->SourceArray.GetPortalConstControl());
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::Id GetNumberOfValues() const
|
||||
{
|
||||
VTKM_ASSERT_CONT(this->Valid);
|
||||
VTKM_ASSERT(this->Valid);
|
||||
vtkm::Id sourceSize = this->SourceArray.GetNumberOfValues();
|
||||
if(sourceSize%NUM_COMPONENTS != 0)
|
||||
{
|
||||
@ -169,14 +168,14 @@ public:
|
||||
VTKM_CONT_EXPORT
|
||||
void Allocate(vtkm::Id numberOfValues)
|
||||
{
|
||||
VTKM_ASSERT_CONT(this->Valid);
|
||||
VTKM_ASSERT(this->Valid);
|
||||
this->SourceArray.Allocate(numberOfValues*NUM_COMPONENTS);
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
void Shrink(vtkm::Id numberOfValues)
|
||||
{
|
||||
VTKM_ASSERT_CONT(this->Valid);
|
||||
VTKM_ASSERT(this->Valid);
|
||||
this->SourceArray.Shrink(numberOfValues*NUM_COMPONENTS);
|
||||
}
|
||||
|
||||
@ -193,7 +192,7 @@ public:
|
||||
VTKM_CONT_EXPORT
|
||||
const SourceArrayHandleType &GetSourceArray() const
|
||||
{
|
||||
VTKM_ASSERT_CONT(this->Valid);
|
||||
VTKM_ASSERT(this->Valid);
|
||||
return this->SourceArray;
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,6 @@
|
||||
#define vtk_m_ArrayHandlePermutation_h
|
||||
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/Assert.h>
|
||||
#include <vtkm/cont/ErrorControlBadType.h>
|
||||
#include <vtkm/cont/ErrorControlBadValue.h>
|
||||
|
||||
@ -132,16 +131,16 @@ public:
|
||||
VTKM_CONT_EXPORT
|
||||
ValueType Get(vtkm::Id index) const {
|
||||
vtkm::Id permutedIndex = this->IndexPortal.Get(index);
|
||||
VTKM_ASSERT_CONT(permutedIndex >= 0);
|
||||
VTKM_ASSERT_CONT(permutedIndex < this->ValuePortal.GetNumberOfValues());
|
||||
VTKM_ASSERT(permutedIndex >= 0);
|
||||
VTKM_ASSERT(permutedIndex < this->ValuePortal.GetNumberOfValues());
|
||||
return this->ValuePortal.Get(permutedIndex);
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
ValueType Set(vtkm::Id index, const ValueType &value) const {
|
||||
vtkm::Id permutedIndex = this->IndexPortal.Get(index);
|
||||
VTKM_ASSERT_CONT(permutedIndex >= 0);
|
||||
VTKM_ASSERT_CONT(permutedIndex < this->ValuePortal.GetNumberOfValues());
|
||||
VTKM_ASSERT(permutedIndex >= 0);
|
||||
VTKM_ASSERT(permutedIndex < this->ValuePortal.GetNumberOfValues());
|
||||
return this->ValuePortal.Set(permutedIndex, value);
|
||||
}
|
||||
|
||||
@ -186,21 +185,21 @@ public:
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
PortalType GetPortal() {
|
||||
VTKM_ASSERT_CONT(this->Valid);
|
||||
VTKM_ASSERT(this->Valid);
|
||||
return PortalType(this->IndexArray.GetPortalConstControl(),
|
||||
this->ValueArray.GetPortalControl());
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
PortalConstType GetPortalConst() const {
|
||||
VTKM_ASSERT_CONT(this->Valid);
|
||||
VTKM_ASSERT(this->Valid);
|
||||
return PortalConstType(this->IndexArray.GetPortalConstControl(),
|
||||
this->ValueArray.GetPortalConstControl());
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::Id GetNumberOfValues() const {
|
||||
VTKM_ASSERT_CONT(this->Valid);
|
||||
VTKM_ASSERT(this->Valid);
|
||||
return this->IndexArray.GetNumberOfValues();
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,6 @@
|
||||
#define vtk_m_cont_ArrayHandleTransform_h
|
||||
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/Assert.h>
|
||||
#include <vtkm/cont/ErrorControlBadType.h>
|
||||
#include <vtkm/cont/ErrorControlInternal.h>
|
||||
|
||||
@ -264,21 +263,21 @@ public:
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
PortalType GetPortal() {
|
||||
VTKM_ASSERT_CONT(this->Valid);
|
||||
VTKM_ASSERT(this->Valid);
|
||||
return PortalType(this->Array.GetPortalControl(),
|
||||
this->Functor);
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
PortalConstType GetPortalConst() const {
|
||||
VTKM_ASSERT_CONT(this->Valid);
|
||||
VTKM_ASSERT(this->Valid);
|
||||
return PortalConstType(this->Array.GetPortalConstControl(),
|
||||
this->Functor);
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::Id GetNumberOfValues() const {
|
||||
VTKM_ASSERT_CONT(this->Valid);
|
||||
VTKM_ASSERT(this->Valid);
|
||||
return this->Array.GetNumberOfValues();
|
||||
}
|
||||
|
||||
@ -303,7 +302,7 @@ public:
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
const ArrayHandleType &GetArray() const {
|
||||
VTKM_ASSERT_CONT(this->Valid);
|
||||
VTKM_ASSERT(this->Valid);
|
||||
return this->Array;
|
||||
}
|
||||
|
||||
@ -344,7 +343,7 @@ public:
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
PortalType GetPortal() {
|
||||
VTKM_ASSERT_CONT(this->Valid);
|
||||
VTKM_ASSERT(this->Valid);
|
||||
return PortalType(this->Array.GetPortalControl(),
|
||||
this->Functor,
|
||||
this->InverseFunctor);
|
||||
@ -352,7 +351,7 @@ public:
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
PortalConstType GetPortalConst() const {
|
||||
VTKM_ASSERT_CONT(this->Valid);
|
||||
VTKM_ASSERT(this->Valid);
|
||||
return PortalConstType(this->Array.GetPortalConstControl(),
|
||||
this->Functor,
|
||||
this->InverseFunctor);
|
||||
@ -360,7 +359,7 @@ public:
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::Id GetNumberOfValues() const {
|
||||
VTKM_ASSERT_CONT(this->Valid);
|
||||
VTKM_ASSERT(this->Valid);
|
||||
return this->Array.GetNumberOfValues();
|
||||
}
|
||||
|
||||
@ -383,7 +382,7 @@ public:
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
const ArrayHandleType &GetArray() const {
|
||||
VTKM_ASSERT_CONT(this->Valid);
|
||||
VTKM_ASSERT(this->Valid);
|
||||
return this->Array;
|
||||
}
|
||||
|
||||
|
@ -219,7 +219,7 @@ public:
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::Id GetNumberOfValues() const {
|
||||
VTKM_ASSERT_CONT(this->FirstArray.GetNumberOfValues()
|
||||
VTKM_ASSERT(this->FirstArray.GetNumberOfValues()
|
||||
== this->SecondArray.GetNumberOfValues());
|
||||
return this->FirstArray.GetNumberOfValues();
|
||||
}
|
||||
@ -295,7 +295,7 @@ public:
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::Id GetNumberOfValues() const
|
||||
{
|
||||
VTKM_ASSERT_CONT( this->FirstArray.GetNumberOfValues()
|
||||
VTKM_ASSERT( this->FirstArray.GetNumberOfValues()
|
||||
== this->SecondArray.GetNumberOfValues() );
|
||||
return this->FirstArray.GetNumberOfValues();
|
||||
}
|
||||
|
@ -1,75 +0,0 @@
|
||||
//============================================================================
|
||||
// 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 Sandia Corporation.
|
||||
// Copyright 2014 UT-Battelle, LLC.
|
||||
// Copyright 2014 Los Alamos National Security.
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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_Assert_h
|
||||
#define vtk_m_cont_Assert_h
|
||||
|
||||
#include <vtkm/cont/ErrorControlAssert.h>
|
||||
|
||||
// Stringify macros for VTKM_ASSERT_CONT
|
||||
#define __VTKM_ASSERT_CONT_STRINGIFY_2ND(s) #s
|
||||
#define __VTKM_ASSERT_CONT_STRINGIFY(s) __VTKM_ASSERT_CONT_STRINGIFY_2ND(s)
|
||||
|
||||
/// \def VTKM_ASSERT_CONT(condition)
|
||||
///
|
||||
/// Asserts that \a condition resolves to true. If \a condition is false,
|
||||
/// then an error is raised. This macro is meant to work in the VTKm control
|
||||
/// environment and throws an ErrorControlAssert object on failure.
|
||||
///
|
||||
/// Like the POSIX assert macro, the check will be removed when compiling
|
||||
/// in non-debug mode (specifically when NDEBUG is defined), so be prepared
|
||||
/// for the possibility that the condition is never evaluated.
|
||||
///
|
||||
/// VTKM_ASSERT_CONT will also be removed when compiling for CUDA devices.
|
||||
/// Technically speaking, this macro should not be used in methods targeted for
|
||||
/// CUDA devices since they run in the execution environment and this is for
|
||||
/// the control environment. However, it is often convenient to have an assert
|
||||
/// in a method that is to run in either control or execution environment, so
|
||||
/// we go ahead and let you declare the assert there as well.
|
||||
///
|
||||
#if !defined(NDEBUG) && !defined(__CUDA_ARCH__)
|
||||
#define VTKM_ASSERT_CONT(condition) \
|
||||
if (!(condition)) \
|
||||
::vtkm::cont::Assert(condition, __FILE__, __LINE__, #condition)
|
||||
#else
|
||||
#define VTKM_ASSERT_CONT(condition)
|
||||
#endif
|
||||
|
||||
namespace vtkm {
|
||||
namespace cont {
|
||||
|
||||
VTKM_CONT_EXPORT void Assert(bool condition,
|
||||
const std::string &file,
|
||||
vtkm::Id line,
|
||||
const std::string &message)
|
||||
{
|
||||
if (condition)
|
||||
{
|
||||
// Do nothing.
|
||||
}
|
||||
else
|
||||
{
|
||||
throw vtkm::cont::ErrorControlAssert(file, line, message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace vtkm::cont
|
||||
|
||||
#endif //vtk_m_cont_Assert_h
|
@ -36,7 +36,6 @@ set(headers
|
||||
ArrayHandleZip.h
|
||||
ArrayPortal.h
|
||||
ArrayPortalToIterators.h
|
||||
Assert.h
|
||||
CellSet.h
|
||||
CellSetExplicit.h
|
||||
CellSetListTag.h
|
||||
@ -56,7 +55,6 @@ set(headers
|
||||
DynamicCellSet.h
|
||||
Error.h
|
||||
ErrorControl.h
|
||||
ErrorControlAssert.h
|
||||
ErrorControlBadAllocation.h
|
||||
ErrorControlBadType.h
|
||||
ErrorControlBadValue.h
|
||||
|
@ -299,7 +299,7 @@ public:
|
||||
ConnectivityChooser<FromTopology,ToTopology>::ConnectivityType
|
||||
&connectivity = this->GetConnectivity(FromTopology(), ToTopology());
|
||||
|
||||
VTKM_ASSERT_CONT(connectivity.ElementsValid);
|
||||
VTKM_ASSERT(connectivity.ElementsValid);
|
||||
|
||||
typedef typename
|
||||
ExecutionTypes<Device,FromTopology,ToTopology>::ExecObjectType
|
||||
|
@ -56,27 +56,39 @@ public:
|
||||
VTKM_CONT_EXPORT
|
||||
const vtkm::cont::Field &GetField(vtkm::Id index) const
|
||||
{
|
||||
VTKM_ASSERT_CONT((index >= 0) &&
|
||||
(index < this->GetNumberOfFields()));
|
||||
VTKM_ASSERT((index >= 0) &&
|
||||
(index < this->GetNumberOfFields()));
|
||||
return this->Fields[static_cast<std::size_t>(index)];
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
bool HasField(
|
||||
const std::string &name,
|
||||
vtkm::cont::Field::AssociationEnum assoc = vtkm::cont::Field::ASSOC_ANY)
|
||||
const
|
||||
{
|
||||
bool found;
|
||||
this->FindFieldIndex(name, assoc, found);
|
||||
return found;
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::Id GetFieldIndex(
|
||||
const std::string &name,
|
||||
vtkm::cont::Field::AssociationEnum assoc = vtkm::cont::Field::ASSOC_ANY)
|
||||
const
|
||||
{
|
||||
for (std::size_t i=0; i < this->Fields.size(); ++i)
|
||||
bool found;
|
||||
vtkm::Id index = this->FindFieldIndex(name, assoc, found);
|
||||
if (found)
|
||||
{
|
||||
if ((assoc == vtkm::cont::Field::ASSOC_ANY ||
|
||||
assoc == this->Fields[i].GetAssociation()) &&
|
||||
this->Fields[i].GetName() == name)
|
||||
{
|
||||
return static_cast<vtkm::Id>(i);
|
||||
}
|
||||
return index;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw vtkm::cont::ErrorControlBadValue(
|
||||
"No field with requested name: " + name);
|
||||
}
|
||||
throw vtkm::cont::ErrorControlBadValue("No field with requested name: "+name);
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
@ -97,23 +109,33 @@ public:
|
||||
const vtkm::cont::CoordinateSystem &
|
||||
GetCoordinateSystem(vtkm::Id index=0) const
|
||||
{
|
||||
VTKM_ASSERT_CONT((index >= 0) &&
|
||||
VTKM_ASSERT((index >= 0) &&
|
||||
(index < this->GetNumberOfCoordinateSystems()));
|
||||
return this->CoordSystems[static_cast<std::size_t>(index)];
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
bool HasCoordinateSystem(const std::string &name) const
|
||||
{
|
||||
bool found;
|
||||
this->FindCoordinateSystemIndex(name, found);
|
||||
return found;
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::Id GetCoordinateSystemIndex(const std::string &name) const
|
||||
{
|
||||
for (std::size_t i=0; i < this->CoordSystems.size(); ++i)
|
||||
bool found;
|
||||
vtkm::Id index = this->FindCoordinateSystemIndex(name, found);
|
||||
if (found)
|
||||
{
|
||||
if (this->CoordSystems[i].GetName() == name)
|
||||
{
|
||||
return static_cast<vtkm::Id>(i);
|
||||
}
|
||||
return index;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw vtkm::cont::ErrorControlBadValue(
|
||||
"No coordinate system with requested name");
|
||||
}
|
||||
throw vtkm::cont::ErrorControlBadValue(
|
||||
"No coordinate system with requested name");
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
@ -140,22 +162,32 @@ public:
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::cont::DynamicCellSet GetCellSet(vtkm::Id index=0) const
|
||||
{
|
||||
VTKM_ASSERT_CONT((index >= 0) &&
|
||||
VTKM_ASSERT((index >= 0) &&
|
||||
(index < this->GetNumberOfCellSets()));
|
||||
return this->CellSets[static_cast<std::size_t>(index)];
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
bool HasCellSet(const std::string &name) const
|
||||
{
|
||||
bool found;
|
||||
this->FindCellSetIndex(name, found);
|
||||
return found;
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::Id GetCellSetIndex(const std::string &name) const
|
||||
{
|
||||
for (std::size_t i=0; i < static_cast<size_t>(this->GetNumberOfCellSets()); ++i)
|
||||
bool found;
|
||||
vtkm::Id index = this->FindCellSetIndex(name, found);
|
||||
if (found)
|
||||
{
|
||||
if (this->CellSets[i].GetCellSet().GetName() == name)
|
||||
{
|
||||
return static_cast<vtkm::Id>(i);
|
||||
}
|
||||
return index;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw vtkm::cont::ErrorControlBadValue("No cell set with requested name");
|
||||
}
|
||||
throw vtkm::cont::ErrorControlBadValue("No cell set with requested name");
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
@ -187,21 +219,21 @@ public:
|
||||
{
|
||||
out<<"DataSet:\n";
|
||||
out<<" CoordSystems["<<this->CoordSystems.size()<<"]\n";
|
||||
for (std::size_t i = 0; i < this->CoordSystems.size(); i++)
|
||||
for (std::size_t index = 0; index < this->CoordSystems.size(); index++)
|
||||
{
|
||||
this->CoordSystems[i].PrintSummary(out);
|
||||
this->CoordSystems[index].PrintSummary(out);
|
||||
}
|
||||
|
||||
out<<" CellSets["<<this->GetNumberOfCellSets()<<"]\n";
|
||||
for (vtkm::Id i = 0; i < this->GetNumberOfCellSets(); i++)
|
||||
for (vtkm::Id index = 0; index < this->GetNumberOfCellSets(); index++)
|
||||
{
|
||||
this->GetCellSet(i).GetCellSet().PrintSummary(out);
|
||||
this->GetCellSet(index).GetCellSet().PrintSummary(out);
|
||||
}
|
||||
|
||||
out<<" Fields["<<this->GetNumberOfFields()<<"]\n";
|
||||
for (vtkm::Id i = 0; i < this->GetNumberOfFields(); i++)
|
||||
for (vtkm::Id index = 0; index < this->GetNumberOfFields(); index++)
|
||||
{
|
||||
this->GetField(i).PrintSummary(out);
|
||||
this->GetField(index).PrintSummary(out);
|
||||
}
|
||||
}
|
||||
|
||||
@ -209,6 +241,55 @@ private:
|
||||
std::vector<vtkm::cont::CoordinateSystem> CoordSystems;
|
||||
std::vector<vtkm::cont::Field> Fields;
|
||||
std::vector<vtkm::cont::DynamicCellSet> CellSets;
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::Id FindFieldIndex(const std::string &name,
|
||||
vtkm::cont::Field::AssociationEnum association,
|
||||
bool &found) const
|
||||
{
|
||||
for (std::size_t index=0; index < this->Fields.size(); ++index)
|
||||
{
|
||||
if ((association == vtkm::cont::Field::ASSOC_ANY ||
|
||||
association == this->Fields[index].GetAssociation()) &&
|
||||
this->Fields[index].GetName() == name)
|
||||
{
|
||||
found= true;
|
||||
return static_cast<vtkm::Id>(index);
|
||||
}
|
||||
}
|
||||
found = false;
|
||||
return -1;
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::Id FindCoordinateSystemIndex(const std::string &name, bool &found) const
|
||||
{
|
||||
for (std::size_t index=0; index < this->CoordSystems.size(); ++index)
|
||||
{
|
||||
if (this->CoordSystems[index].GetName() == name)
|
||||
{
|
||||
found = true;
|
||||
return static_cast<vtkm::Id>(index);
|
||||
}
|
||||
}
|
||||
found = false;
|
||||
return -1;
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::Id FindCellSetIndex(const std::string &name, bool &found) const
|
||||
{
|
||||
for (std::size_t index=0; index < static_cast<size_t>(this->GetNumberOfCellSets()); ++index)
|
||||
{
|
||||
if (this->CellSets[index].GetCellSet().GetName() == name)
|
||||
{
|
||||
found = true;
|
||||
return static_cast<vtkm::Id>(index);
|
||||
}
|
||||
}
|
||||
found = false;
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace cont
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include <vtkm/cont/ArrayHandleCompositeVector.h>
|
||||
#include <vtkm/cont/ArrayPortalToIterators.h>
|
||||
#include <vtkm/cont/Assert.h>
|
||||
#include <vtkm/cont/CoordinateSystem.h>
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
|
||||
@ -206,9 +205,9 @@ DataSetBuilderExplicit::Create(const std::vector<T> &xVals,
|
||||
const std::string &coordsNm,
|
||||
const std::string &cellNm)
|
||||
{
|
||||
VTKM_ASSERT_CONT(xVals.size() == yVals.size() &&
|
||||
yVals.size() == zVals.size() &&
|
||||
xVals.size() > 0);
|
||||
VTKM_ASSERT(xVals.size() == yVals.size() &&
|
||||
yVals.size() == zVals.size() &&
|
||||
xVals.size() > 0);
|
||||
|
||||
vtkm::cont::ArrayHandle<T> Xc, Yc, Zc;
|
||||
DataSetBuilderExplicit::CopyInto(xVals, Xc);
|
||||
@ -238,7 +237,7 @@ DataSetBuilderExplicit::BuildDataSet(
|
||||
const std::string &coordsNm,
|
||||
const std::string &cellNm)
|
||||
{
|
||||
VTKM_ASSERT_CONT(X.GetNumberOfValues() == Y.GetNumberOfValues() &&
|
||||
VTKM_ASSERT(X.GetNumberOfValues() == Y.GetNumberOfValues() &&
|
||||
Y.GetNumberOfValues() == Z.GetNumberOfValues() &&
|
||||
X.GetNumberOfValues() > 0 &&
|
||||
shapes.GetNumberOfValues() == numIndices.GetNumberOfValues());
|
||||
@ -426,7 +425,7 @@ public:
|
||||
VTKM_CONT_EXPORT
|
||||
void AddCellPoint(vtkm::Id pointIndex)
|
||||
{
|
||||
VTKM_ASSERT_CONT(this->numIdx.size() > 0);
|
||||
VTKM_ASSERT(this->numIdx.size() > 0);
|
||||
this->connectivity.push_back(pointIndex);
|
||||
this->numIdx.back() += 1;
|
||||
}
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include <vtkm/cont/ArrayHandleCartesianProduct.h>
|
||||
#include <vtkm/cont/ArrayPortalToIterators.h>
|
||||
#include <vtkm/cont/Assert.h>
|
||||
#include <vtkm/cont/CoordinateSystem.h>
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/cont/DeviceAdapterSerial.h>
|
||||
@ -88,8 +87,8 @@ public:
|
||||
T *xvals, T *yvals, T *zvals,
|
||||
std::string coordNm, std::string cellNm)
|
||||
{
|
||||
VTKM_ASSERT_CONT(nx>1 && ny>1 &&
|
||||
((dim==2 && nz==1)||(dim==3 && nz>=1)));
|
||||
VTKM_ASSERT(nx>1 && ny>1 &&
|
||||
((dim==2 && nz==1)||(dim==3 && nz>=1)));
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::FloatDefault> Xc, Yc, Zc;
|
||||
DataSetBuilderRectilinear::CopyInto(xvals,nx,Xc);
|
||||
@ -120,7 +119,7 @@ public:
|
||||
const vtkm::cont::ArrayHandle<T> &yvals,
|
||||
std::string coordNm="coords", std::string cellNm="cells")
|
||||
{
|
||||
VTKM_ASSERT_CONT(xvals.GetNumberOfValues()>1 && yvals.GetNumberOfValues()>1);
|
||||
VTKM_ASSERT(xvals.GetNumberOfValues()>1 && yvals.GetNumberOfValues()>1);
|
||||
|
||||
vtkm::cont::ArrayHandle<T> zvals;
|
||||
zvals.Allocate(1);
|
||||
@ -164,7 +163,7 @@ public:
|
||||
const vtkm::cont::ArrayHandle<T> &zvals,
|
||||
std::string coordNm="coords", std::string cellNm="cells")
|
||||
{
|
||||
VTKM_ASSERT_CONT(xvals.GetNumberOfValues()>1 &&
|
||||
VTKM_ASSERT(xvals.GetNumberOfValues()>1 &&
|
||||
yvals.GetNumberOfValues()>1 &&
|
||||
zvals.GetNumberOfValues()>1);
|
||||
return DataSetBuilderRectilinear::BuildDataSet(
|
||||
@ -182,8 +181,8 @@ private:
|
||||
const std::vector<T> &zvals,
|
||||
std::string coordNm, std::string cellNm)
|
||||
{
|
||||
VTKM_ASSERT_CONT(xvals.size()>1 && yvals.size()>1 &&
|
||||
((dim==2 && zvals.size()==1)||(dim==3 && zvals.size()>=1)));
|
||||
VTKM_ASSERT(xvals.size()>1 && yvals.size()>1 &&
|
||||
((dim==2 && zvals.size()==1)||(dim==3 && zvals.size()>=1)));
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::FloatDefault> Xc, Yc, Zc;
|
||||
DataSetBuilderRectilinear::CopyInto(xvals, Xc);
|
||||
|
@ -20,9 +20,8 @@
|
||||
#ifndef vtk_m_cont_DataSetBuilderUniform_h
|
||||
#define vtk_m_cont_DataSetBuilderUniform_h
|
||||
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/cont/CoordinateSystem.h>
|
||||
#include <vtkm/cont/Assert.h>
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
|
||||
namespace vtkm {
|
||||
namespace cont {
|
||||
@ -77,8 +76,8 @@ private:
|
||||
const vtkm::Vec<vtkm::FloatDefault,3> &spacing,
|
||||
std::string coordNm, std::string cellNm)
|
||||
{
|
||||
VTKM_ASSERT_CONT(nx>1 && ny>1 && ((dim==2 && nz==1)||(dim==3 && nz>=1)));
|
||||
VTKM_ASSERT_CONT(spacing[0]>0 && spacing[1]>0 && spacing[2]>0);
|
||||
VTKM_ASSERT(nx>1 && ny>1 && ((dim==2 && nz==1)||(dim==3 && nz>=1)));
|
||||
VTKM_ASSERT(spacing[0]>0 && spacing[1]>0 && spacing[2]>0);
|
||||
vtkm::cont::DataSet dataSet;
|
||||
|
||||
vtkm::cont::ArrayHandleUniformPointCoordinates
|
||||
|
@ -34,7 +34,10 @@ namespace cont {
|
||||
class Error
|
||||
{
|
||||
public:
|
||||
//See note about GetMessage macro below.
|
||||
#ifndef GetMessage
|
||||
const std::string &GetMessage() const { return this->Message; }
|
||||
#endif
|
||||
|
||||
//GetMessage is a macro defined by <windows.h> to redirrect to
|
||||
//GetMessageA or W depending on if you are using ansi or unicode.
|
||||
|
@ -1,56 +0,0 @@
|
||||
//============================================================================
|
||||
// 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 Sandia Corporation.
|
||||
// Copyright 2014 UT-Battelle, LLC.
|
||||
// Copyright 2014 Los Alamos National Security.
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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_ErrorControlAssert_h
|
||||
#define vtk_m_cont_ErrorControlAssert_h
|
||||
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/cont/ErrorControl.h>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace vtkm {
|
||||
namespace cont {
|
||||
|
||||
/// This error is thrown whenever VTKM_ASSERT_CONT fails.
|
||||
///
|
||||
class ErrorControlAssert : public vtkm::cont::ErrorControl
|
||||
{
|
||||
public:
|
||||
ErrorControlAssert(const std::string &file,
|
||||
vtkm::Id line,
|
||||
const std::string &condition)
|
||||
: ErrorControl(), File(file), Line(line), Condition(condition)
|
||||
{
|
||||
std::stringstream message;
|
||||
message << this->File << ":" << this->Line
|
||||
<< ": Assert Failed (" << this->Condition << ")";
|
||||
this->SetMessage(message.str());
|
||||
}
|
||||
|
||||
private:
|
||||
std::string File;
|
||||
vtkm::Id Line;
|
||||
std::string Condition;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif //vtk_m_cont_ErrorControlAssert_h
|
@ -263,8 +263,8 @@ public:
|
||||
Bounds(),
|
||||
ModifiedFlag(true)
|
||||
{
|
||||
VTKM_ASSERT_CONT(this->Association == ASSOC_WHOLE_MESH ||
|
||||
this->Association == ASSOC_POINTS);
|
||||
VTKM_ASSERT(this->Association == ASSOC_WHOLE_MESH ||
|
||||
this->Association == ASSOC_POINTS);
|
||||
}
|
||||
|
||||
template<typename T, typename Storage>
|
||||
@ -280,8 +280,8 @@ public:
|
||||
Bounds(),
|
||||
ModifiedFlag(true)
|
||||
{
|
||||
VTKM_ASSERT_CONT((this->Association == ASSOC_WHOLE_MESH) ||
|
||||
(this->Association == ASSOC_POINTS));
|
||||
VTKM_ASSERT((this->Association == ASSOC_WHOLE_MESH) ||
|
||||
(this->Association == ASSOC_POINTS));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -296,8 +296,8 @@ public:
|
||||
Bounds(),
|
||||
ModifiedFlag(true)
|
||||
{
|
||||
VTKM_ASSERT_CONT((this->Association == ASSOC_WHOLE_MESH) ||
|
||||
(this->Association == ASSOC_POINTS));
|
||||
VTKM_ASSERT((this->Association == ASSOC_WHOLE_MESH) ||
|
||||
(this->Association == ASSOC_POINTS));
|
||||
this->CopyData(&data[0], static_cast<vtkm::Id>(data.size()));
|
||||
}
|
||||
|
||||
@ -314,8 +314,8 @@ public:
|
||||
Bounds(),
|
||||
ModifiedFlag(true)
|
||||
{
|
||||
VTKM_ASSERT_CONT((this->Association == ASSOC_WHOLE_MESH) ||
|
||||
(this->Association == ASSOC_POINTS));
|
||||
VTKM_ASSERT((this->Association == ASSOC_WHOLE_MESH) ||
|
||||
(this->Association == ASSOC_POINTS));
|
||||
this->CopyData(data, nvals);
|
||||
}
|
||||
|
||||
@ -333,7 +333,7 @@ public:
|
||||
Bounds(),
|
||||
ModifiedFlag(true)
|
||||
{
|
||||
VTKM_ASSERT_CONT(this->Association == ASSOC_CELL_SET);
|
||||
VTKM_ASSERT(this->Association == ASSOC_CELL_SET);
|
||||
}
|
||||
|
||||
template <typename T, typename Storage>
|
||||
@ -350,7 +350,7 @@ public:
|
||||
Bounds(),
|
||||
ModifiedFlag(true)
|
||||
{
|
||||
VTKM_ASSERT_CONT(this->Association == ASSOC_CELL_SET);
|
||||
VTKM_ASSERT(this->Association == ASSOC_CELL_SET);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -366,7 +366,7 @@ public:
|
||||
Bounds(),
|
||||
ModifiedFlag(true)
|
||||
{
|
||||
VTKM_ASSERT_CONT(this->Association == ASSOC_CELL_SET);
|
||||
VTKM_ASSERT(this->Association == ASSOC_CELL_SET);
|
||||
this->CopyData(&data[0], static_cast<vtkm::Id>(data.size()));
|
||||
}
|
||||
|
||||
@ -384,7 +384,7 @@ public:
|
||||
Bounds(),
|
||||
ModifiedFlag(true)
|
||||
{
|
||||
VTKM_ASSERT_CONT(this->Association == ASSOC_CELL_SET);
|
||||
VTKM_ASSERT(this->Association == ASSOC_CELL_SET);
|
||||
this->CopyData(data, nvals);
|
||||
}
|
||||
|
||||
@ -402,7 +402,7 @@ public:
|
||||
Bounds(),
|
||||
ModifiedFlag(true)
|
||||
{
|
||||
VTKM_ASSERT_CONT(this->Association == ASSOC_LOGICAL_DIM);
|
||||
VTKM_ASSERT(this->Association == ASSOC_LOGICAL_DIM);
|
||||
}
|
||||
|
||||
template <typename T, typename Storage>
|
||||
@ -418,7 +418,7 @@ public:
|
||||
Bounds(),
|
||||
ModifiedFlag(true)
|
||||
{
|
||||
VTKM_ASSERT_CONT(this->Association == ASSOC_LOGICAL_DIM);
|
||||
VTKM_ASSERT(this->Association == ASSOC_LOGICAL_DIM);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -433,7 +433,7 @@ public:
|
||||
Bounds(),
|
||||
ModifiedFlag(true)
|
||||
{
|
||||
VTKM_ASSERT_CONT(this->Association == ASSOC_LOGICAL_DIM);
|
||||
VTKM_ASSERT(this->Association == ASSOC_LOGICAL_DIM);
|
||||
this->CopyData(&data[0], static_cast<vtkm::Id>(data.size()));
|
||||
}
|
||||
|
||||
@ -449,7 +449,7 @@ public:
|
||||
Bounds(),
|
||||
ModifiedFlag(true)
|
||||
{
|
||||
VTKM_ASSERT_CONT(this->Association == ASSOC_LOGICAL_DIM);
|
||||
VTKM_ASSERT(this->Association == ASSOC_LOGICAL_DIM);
|
||||
CopyData(data, nvals);
|
||||
}
|
||||
|
||||
|
@ -20,8 +20,8 @@
|
||||
#ifndef vtk_m_cont_StorageBasic_h
|
||||
#define vtk_m_cont_StorageBasic_h
|
||||
|
||||
#include <vtkm/Assert.h>
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/cont/Assert.h>
|
||||
#include <vtkm/cont/ErrorControlBadValue.h>
|
||||
#include <vtkm/cont/ErrorControlBadAllocation.h>
|
||||
#include <vtkm/cont/Storage.h>
|
||||
@ -230,7 +230,7 @@ public:
|
||||
{
|
||||
if (this->NumberOfValues > 0)
|
||||
{
|
||||
VTKM_ASSERT_CONT(this->Array != NULL);
|
||||
VTKM_ASSERT(this->Array != NULL);
|
||||
if (this->DeallocateOnRelease)
|
||||
{
|
||||
AllocatorType allocator;
|
||||
@ -243,7 +243,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
VTKM_ASSERT_CONT(this->Array == NULL);
|
||||
VTKM_ASSERT(this->Array == NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@ -275,7 +275,7 @@ public:
|
||||
else
|
||||
{
|
||||
// ReleaseResources should have already set AllocatedSize to 0.
|
||||
VTKM_ASSERT_CONT(this->AllocatedSize == 0);
|
||||
VTKM_ASSERT(this->AllocatedSize == 0);
|
||||
}
|
||||
}
|
||||
catch (std::bad_alloc err)
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include <vtkm/Types.h>
|
||||
|
||||
#include <vtkm/cont/Assert.h>
|
||||
#include <vtkm/cont/ErrorControlBadValue.h>
|
||||
#include <vtkm/cont/Storage.h>
|
||||
|
||||
|
@ -160,7 +160,7 @@ public:
|
||||
VTKM_CONT_EXPORT
|
||||
void Shrink(vtkm::Id numberOfValues)
|
||||
{
|
||||
VTKM_ASSERT_CONT(numberOfValues <= this->GetNumberOfValues());
|
||||
VTKM_ASSERT(numberOfValues <= this->GetNumberOfValues());
|
||||
|
||||
this->NumberOfValues = numberOfValues;
|
||||
if (numberOfValues == 0 && this->OwnsResources())
|
||||
|
@ -223,7 +223,7 @@ public:
|
||||
{
|
||||
// The operation will succeed even if this assertion fails, but this
|
||||
// is still supposed to be a precondition to Shrink.
|
||||
VTKM_ASSERT_CONT(numberOfValues <= static_cast<vtkm::Id>(this->Array.size()));
|
||||
VTKM_ASSERT(numberOfValues <= static_cast<vtkm::Id>(this->Array.size()));
|
||||
|
||||
this->Array.resize(static_cast<vtkm::UInt64>(numberOfValues));
|
||||
}
|
||||
|
@ -400,9 +400,10 @@ private:
|
||||
vtkm::exec::cuda::internal::WrappedBinaryOperator<ValueType,
|
||||
BinaryFunctor> bop(binary_functor);
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
result_iterators = ::thrust::reduce_by_key(thrust::cuda::par,
|
||||
result_iterators = ::thrust::reduce_by_key(vtkm_cuda_policy(),
|
||||
IteratorBegin(keys),
|
||||
IteratorEnd(keys),
|
||||
IteratorBegin(values),
|
||||
@ -573,7 +574,7 @@ private:
|
||||
BinaryCompare> bop(binary_compare);
|
||||
try
|
||||
{
|
||||
::thrust::sort_by_key(thrust::cuda::par,
|
||||
::thrust::sort_by_key(vtkm_cuda_policy(),
|
||||
IteratorBegin(keys),
|
||||
IteratorEnd(keys),
|
||||
IteratorBegin(values),
|
||||
|
@ -20,9 +20,9 @@
|
||||
#ifndef vtk_m_cont_internal_ArrayManagerExecutionShareWithControl_h
|
||||
#define vtk_m_cont_internal_ArrayManagerExecutionShareWithControl_h
|
||||
|
||||
#include <vtkm/Assert.h>
|
||||
#include <vtkm/Types.h>
|
||||
|
||||
#include <vtkm/cont/Assert.h>
|
||||
#include <vtkm/cont/Storage.h>
|
||||
|
||||
#include <algorithm>
|
||||
@ -90,7 +90,7 @@ public:
|
||||
void RetrieveOutputData(StorageType *storage) const
|
||||
{
|
||||
(void)storage;
|
||||
VTKM_ASSERT_CONT(storage == this->Storage);
|
||||
VTKM_ASSERT(storage == this->Storage);
|
||||
}
|
||||
|
||||
/// This methods copies data from the execution array into the given
|
||||
|
@ -20,10 +20,10 @@
|
||||
#ifndef vtk_m_cont_internal_ArrayPortalFromIterators_h
|
||||
#define vtk_m_cont_internal_ArrayPortalFromIterators_h
|
||||
|
||||
#include <vtkm/Assert.h>
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/cont/ArrayPortal.h>
|
||||
#include <vtkm/cont/ArrayPortalToIterators.h>
|
||||
#include <vtkm/cont/Assert.h>
|
||||
#include <vtkm/cont/ErrorControlBadAllocation.h>
|
||||
|
||||
#include <iterator>
|
||||
@ -54,7 +54,7 @@ public:
|
||||
{
|
||||
typename std::iterator_traits<IteratorT>::difference_type numberOfValues =
|
||||
std::distance(begin, end);
|
||||
VTKM_ASSERT_CONT(numberOfValues >= 0);
|
||||
VTKM_ASSERT(numberOfValues >= 0);
|
||||
#ifndef VTKM_USE_64BIT_IDS
|
||||
if (numberOfValues > std::numeric_limits<vtkm::Id>::max())
|
||||
{
|
||||
@ -111,8 +111,8 @@ private:
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
IteratorT IteratorAt(vtkm::Id index) const
|
||||
{
|
||||
VTKM_ASSERT_CONT(index >= 0);
|
||||
VTKM_ASSERT_CONT(index < this->GetNumberOfValues());
|
||||
VTKM_ASSERT(index >= 0);
|
||||
VTKM_ASSERT(index < this->GetNumberOfValues());
|
||||
|
||||
return this->BeginIterator + index;
|
||||
}
|
||||
|
@ -20,10 +20,10 @@
|
||||
#ifndef vtk_m_cont_internal_ArrayPortalShrink_h
|
||||
#define vtk_m_cont_internal_ArrayPortalShrink_h
|
||||
|
||||
#include <vtkm/Assert.h>
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/cont/ArrayPortal.h>
|
||||
#include <vtkm/cont/ArrayPortalToIterators.h>
|
||||
#include <vtkm/cont/Assert.h>
|
||||
|
||||
#include <iterator>
|
||||
|
||||
@ -53,7 +53,7 @@ public:
|
||||
vtkm::Id numberOfValues)
|
||||
: DelegatePortal(delegatePortal), NumberOfValues(numberOfValues)
|
||||
{
|
||||
VTKM_ASSERT_CONT(numberOfValues <= delegatePortal.GetNumberOfValues());
|
||||
VTKM_ASSERT(numberOfValues <= delegatePortal.GetNumberOfValues());
|
||||
}
|
||||
|
||||
/// Copy constructor for any other ArrayPortalShrink with a delegate type
|
||||
@ -73,16 +73,16 @@ public:
|
||||
VTKM_CONT_EXPORT
|
||||
ValueType Get(vtkm::Id index) const
|
||||
{
|
||||
VTKM_ASSERT_CONT(index >= 0);
|
||||
VTKM_ASSERT_CONT(index < this->GetNumberOfValues());
|
||||
VTKM_ASSERT(index >= 0);
|
||||
VTKM_ASSERT(index < this->GetNumberOfValues());
|
||||
return this->DelegatePortal.Get(index);
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
void Set(vtkm::Id index, const ValueType& value) const
|
||||
{
|
||||
VTKM_ASSERT_CONT(index >= 0);
|
||||
VTKM_ASSERT_CONT(index < this->GetNumberOfValues());
|
||||
VTKM_ASSERT(index >= 0);
|
||||
VTKM_ASSERT(index < this->GetNumberOfValues());
|
||||
this->DelegatePortal.Set(index, value);
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ public:
|
||||
VTKM_CONT_EXPORT
|
||||
void Shrink(vtkm::Id numberOfValues)
|
||||
{
|
||||
VTKM_ASSERT_CONT(numberOfValues < this->GetNumberOfValues());
|
||||
VTKM_ASSERT(numberOfValues < this->GetNumberOfValues());
|
||||
this->NumberOfValues = numberOfValues;
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ArrayHandleCast.h>
|
||||
#include <vtkm/cont/Assert.h>
|
||||
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
|
||||
|
||||
namespace vtkm {
|
||||
@ -117,7 +116,7 @@ struct ConnectivityExplicitInternals
|
||||
VTKM_CONT_EXPORT
|
||||
void BuildIndexOffsets(Device) const
|
||||
{
|
||||
VTKM_ASSERT_CONT(this->ElementsValid);
|
||||
VTKM_ASSERT(this->ElementsValid);
|
||||
|
||||
if(!this->IndexOffsetsValid)
|
||||
{
|
||||
|
@ -260,7 +260,7 @@ public:
|
||||
vtkm::cont::ArrayHandle<U,VOut> &values_output,
|
||||
BinaryFunctor binary_functor)
|
||||
{
|
||||
VTKM_ASSERT_CONT(keys.GetNumberOfValues() == values.GetNumberOfValues());
|
||||
VTKM_ASSERT(keys.GetNumberOfValues() == values.GetNumberOfValues());
|
||||
const vtkm::Id numberOfKeys = keys.GetNumberOfValues();
|
||||
|
||||
if(numberOfKeys <= 1)
|
||||
@ -525,7 +525,7 @@ public:
|
||||
vtkm::cont::ArrayHandle<T,COut>& output,
|
||||
UnaryPredicate unary_predicate)
|
||||
{
|
||||
VTKM_ASSERT_CONT(input.GetNumberOfValues() == stencil.GetNumberOfValues());
|
||||
VTKM_ASSERT(input.GetNumberOfValues() == stencil.GetNumberOfValues());
|
||||
vtkm::Id arrayLength = stencil.GetNumberOfValues();
|
||||
|
||||
typedef vtkm::cont::ArrayHandle<
|
||||
@ -720,7 +720,8 @@ public:
|
||||
T* lockedValue;
|
||||
#if defined(VTKM_MSVC)
|
||||
typedef typename vtkm::cont::ArrayPortalToIterators<PortalType>::IteratorType IteratorType;
|
||||
typename IteratorType::pointer temp = &(*(Iterators.GetBegin()+index));
|
||||
typename IteratorType::pointer temp =
|
||||
&(*(Iterators.GetBegin() + static_cast<std::ptrdiff_t>(index)));
|
||||
lockedValue = temp;
|
||||
return vtkmAtomicAdd(lockedValue, value);
|
||||
#else
|
||||
@ -735,7 +736,8 @@ public:
|
||||
T* lockedValue;
|
||||
#if defined(VTKM_MSVC)
|
||||
typedef typename vtkm::cont::ArrayPortalToIterators<PortalType>::IteratorType IteratorType;
|
||||
typename IteratorType::pointer temp = &(*(Iterators.GetBegin()+index));
|
||||
typename IteratorType::pointer temp =
|
||||
&(*(Iterators.GetBegin()+static_cast<std::ptrdiff_t>(index)));
|
||||
lockedValue = temp;
|
||||
return vtkmCompareAndSwap(lockedValue, newValue, oldValue);
|
||||
#else
|
||||
|
@ -348,7 +348,7 @@ private:
|
||||
::template ExecutionTypes<Device>::Portal PortalVout;
|
||||
|
||||
const vtkm::Id n = values.GetNumberOfValues();
|
||||
VTKM_ASSERT_CONT(n == index.GetNumberOfValues() );
|
||||
VTKM_ASSERT(n == index.GetNumberOfValues() );
|
||||
|
||||
PortalVIn valuesPortal = values.PrepareForInput(Device());
|
||||
PortalI indexPortal = index.PrepareForInput(Device());
|
||||
|
@ -20,9 +20,9 @@
|
||||
#ifndef vtk_m_cont_internal_IteratorFromArrayPortal_h
|
||||
#define vtk_m_cont_internal_IteratorFromArrayPortal_h
|
||||
|
||||
#include <vtkm/cont/ArrayPortal.h>
|
||||
#include <vtkm/Assert.h>
|
||||
|
||||
#include <vtkm/cont/Assert.h>
|
||||
#include <vtkm/cont/ArrayPortal.h>
|
||||
|
||||
VTKM_THIRDPARTY_PRE_INCLUDE
|
||||
#include <boost/iterator/iterator_facade.hpp>
|
||||
@ -135,16 +135,16 @@ private:
|
||||
void increment()
|
||||
{
|
||||
this->Index++;
|
||||
VTKM_ASSERT_CONT(this->Index >= 0);
|
||||
VTKM_ASSERT_CONT(this->Index <= this->Portal.GetNumberOfValues());
|
||||
VTKM_ASSERT(this->Index >= 0);
|
||||
VTKM_ASSERT(this->Index <= this->Portal.GetNumberOfValues());
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
void decrement()
|
||||
{
|
||||
this->Index--;
|
||||
VTKM_ASSERT_CONT(this->Index >= 0);
|
||||
VTKM_ASSERT_CONT(this->Index <= this->Portal.GetNumberOfValues());
|
||||
VTKM_ASSERT(this->Index >= 0);
|
||||
VTKM_ASSERT(this->Index <= this->Portal.GetNumberOfValues());
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
@ -152,8 +152,8 @@ private:
|
||||
typename IteratorFromArrayPortal<ArrayPortalType>::difference_type delta)
|
||||
{
|
||||
this->Index += static_cast<vtkm::Id>(delta);
|
||||
VTKM_ASSERT_CONT(this->Index >= 0);
|
||||
VTKM_ASSERT_CONT(this->Index <= this->Portal.GetNumberOfValues());
|
||||
VTKM_ASSERT(this->Index >= 0);
|
||||
VTKM_ASSERT(this->Index <= this->Portal.GetNumberOfValues());
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/TypeTraits.h>
|
||||
#include <vtkm/cont/ArrayPortalToIterators.h>
|
||||
#include <vtkm/cont/Error.h>
|
||||
#include <vtkm/cont/internal/FunctorsGeneral.h>
|
||||
#include <vtkm/exec/internal/ErrorMessageBuffer.h>
|
||||
|
||||
@ -482,7 +483,7 @@ VTKM_CONT_EXPORT static void ScatterPortal(InputPortalType inputPortal,
|
||||
OutputPortalType outputPortal)
|
||||
{
|
||||
const vtkm::Id size = inputPortal.GetNumberOfValues();
|
||||
VTKM_ASSERT_CONT(size == indexPortal.GetNumberOfValues() );
|
||||
VTKM_ASSERT(size == indexPortal.GetNumberOfValues() );
|
||||
|
||||
ScatterKernel<InputPortalType,
|
||||
IndexPortalType,
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include <vtkm/cont/ArrayHandleCartesianProduct.h>
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
|
||||
#include <vtkm/cont/Assert.h>
|
||||
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
|
||||
|
@ -27,6 +27,8 @@
|
||||
|
||||
#include <vtkm/VecTraits.h>
|
||||
|
||||
#include <vtkm/cont/ArrayHandleConstant.h>
|
||||
#include <vtkm/cont/ArrayHandleIndex.h>
|
||||
#include <vtkm/cont/DeviceAdapterSerial.h>
|
||||
#include <vtkm/cont/StorageBasic.h>
|
||||
|
||||
@ -283,6 +285,38 @@ void TryVector()
|
||||
TryVector1(MakeInputArray<vtkm::Vec<vtkm::FloatDefault,3> >(0));
|
||||
}
|
||||
|
||||
void TrySpecialArrays()
|
||||
{
|
||||
std::cout << "Trying special arrays." << std::endl;
|
||||
|
||||
typedef vtkm::cont::ArrayHandleIndex ArrayType1;
|
||||
ArrayType1 array1(ARRAY_SIZE);
|
||||
|
||||
typedef vtkm::cont::ArrayHandleConstant<vtkm::Id> ArrayType2;
|
||||
ArrayType2 array2(295, ARRAY_SIZE);
|
||||
|
||||
typedef vtkm::cont::ArrayHandleCompositeVectorType<ArrayType1,ArrayType2>::type
|
||||
CompositeArrayType;
|
||||
|
||||
CompositeArrayType compositeArray =
|
||||
vtkm::cont::make_ArrayHandleCompositeVector(array1, 0, array2, 0);
|
||||
|
||||
vtkm::cont::printSummary_ArrayHandle(compositeArray, std::cout);
|
||||
std::cout << std::endl;
|
||||
|
||||
VTKM_TEST_ASSERT(compositeArray.GetNumberOfValues() == ARRAY_SIZE,
|
||||
"Wrong array size.");
|
||||
|
||||
CompositeArrayType::PortalConstControl compositePortal =
|
||||
compositeArray.GetPortalConstControl();
|
||||
for (vtkm::Id index = 0; index < ARRAY_SIZE; index++)
|
||||
{
|
||||
VTKM_TEST_ASSERT(
|
||||
test_equal(compositePortal.Get(index), vtkm::Id2(index,295)),
|
||||
"Bad value.");
|
||||
}
|
||||
}
|
||||
|
||||
void TestBadArrayLengths() {
|
||||
std::cout << "Checking behavior when size of input arrays do not agree."
|
||||
<< std::endl;
|
||||
@ -311,6 +345,8 @@ void TestCompositeVector() {
|
||||
|
||||
TryVector();
|
||||
|
||||
TrySpecialArrays();
|
||||
|
||||
TestBadArrayLengths();
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,6 @@
|
||||
#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL
|
||||
|
||||
#include <vtkm/cont/ArrayHandleCounting.h>
|
||||
#include <vtkm/cont/Assert.h>
|
||||
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
|
||||
@ -40,7 +39,7 @@ public:
|
||||
StringInt() {}
|
||||
StringInt(vtkm::Id v)
|
||||
{
|
||||
VTKM_ASSERT_CONT(v >= 0);
|
||||
VTKM_ASSERT(v >= 0);
|
||||
for (vtkm::Id i = 0; i < v; i++)
|
||||
{
|
||||
++(*this);
|
||||
|
@ -21,7 +21,7 @@
|
||||
// This meta-test makes sure that the testing environment is properly reporting
|
||||
// errors.
|
||||
|
||||
#include <vtkm/cont/Assert.h>
|
||||
#include <vtkm/Assert.h>
|
||||
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
|
||||
@ -37,15 +37,10 @@ void BadTestAssert()
|
||||
VTKM_TEST_ASSERT(0 == 1, "I expect this error.");
|
||||
}
|
||||
|
||||
void BadAssert()
|
||||
{
|
||||
VTKM_ASSERT_CONT(0 == 1);
|
||||
}
|
||||
|
||||
void GoodAssert()
|
||||
{
|
||||
VTKM_TEST_ASSERT(1 == 1, "Always true.");
|
||||
VTKM_ASSERT_CONT(1 == 1);
|
||||
VTKM_ASSERT(1 == 1);
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
@ -65,20 +60,6 @@ int UnitTestContTesting(int, char *[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
//VTKM_ASSERT_CONT only is a valid call when you are building with debug
|
||||
#ifndef NDEBUG
|
||||
int expectedResult=0;
|
||||
#else
|
||||
int expectedResult=1;
|
||||
#endif
|
||||
|
||||
std::cout << "-------\nThis call should fail on debug builds." << std::endl;
|
||||
if (vtkm::cont::testing::Testing::Run(BadAssert) == expectedResult)
|
||||
{
|
||||
std::cout << "Did not get expected fail!" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::cout << "-------\nThis call should pass." << std::endl;
|
||||
// This is what your main function typically looks like.
|
||||
return vtkm::cont::testing::Testing::Run(GoodAssert);
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include <vtkm/cont/DataSetBuilderExplicit.h>
|
||||
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
|
||||
#include <vtkm/cont/Assert.h>
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
#include <vtkm/cont/testing/ExplicitTestData.h>
|
||||
|
||||
|
@ -20,11 +20,10 @@
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
#include <vtkm/cont/DataSetBuilderRectilinear.h>
|
||||
#include <vtkm/cont/DynamicCellSet.h>
|
||||
#include <vtkm/cont/CellSetStructured.h>
|
||||
#include <vtkm/cont/DataSetBuilderRectilinear.h>
|
||||
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
|
||||
#include <vtkm/cont/Assert.h>
|
||||
#include <vtkm/cont/DynamicCellSet.h>
|
||||
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
|
||||
|
@ -20,11 +20,10 @@
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
#include <vtkm/cont/DataSetBuilderUniform.h>
|
||||
#include <vtkm/cont/DynamicCellSet.h>
|
||||
#include <vtkm/cont/CellSetStructured.h>
|
||||
#include <vtkm/cont/DataSetBuilderUniform.h>
|
||||
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
|
||||
#include <vtkm/cont/Assert.h>
|
||||
#include <vtkm/cont/DynamicCellSet.h>
|
||||
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
|
||||
|
@ -1,74 +0,0 @@
|
||||
//============================================================================
|
||||
// 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 Sandia Corporation.
|
||||
// Copyright 2015 UT-Battelle, LLC.
|
||||
// Copyright 2015 Los Alamos National Security.
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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_exec_Assert_h
|
||||
#define vtk_m_exec_Assert_h
|
||||
|
||||
#include <vtkm/internal/ExportMacros.h>
|
||||
|
||||
// Stringify macros for DAX_ASSERT_EXEC
|
||||
#define __VTKM_ASSERT_EXEC_STRINGIFY_2ND(s) #s
|
||||
#define __VTKM_ASSERT_EXEC_STRINGIFY(s) __VTKM_ASSERT_EXEC_STRINGIFY_2ND(s)
|
||||
|
||||
/// \def VTKM_ASSERT_EXEC(condition, work)
|
||||
///
|
||||
/// Asserts that \a condition resolves to true. If \a condition is false, then
|
||||
/// an error is raised. This macro is meant to work in the VTK-m execution
|
||||
/// environment and requires the \a work object to raise the error and throw it
|
||||
/// in the control environment.
|
||||
///
|
||||
#ifndef NDEBUG
|
||||
#define VTKM_ASSERT_EXEC(condition, work) \
|
||||
if (!(condition)) \
|
||||
::vtkm::exec::Assert( \
|
||||
condition, \
|
||||
__FILE__ ":" __VTKM_ASSERT_EXEC_STRINGIFY(__LINE__) ": " \
|
||||
"Assert Failed (" #condition ")", \
|
||||
work)
|
||||
#else
|
||||
//in release mode we just act like we use the result of the condition
|
||||
//and the worklet so that we don't introduce new issues.
|
||||
#define VTKM_ASSERT_EXEC(condition, work) \
|
||||
(void)(condition); \
|
||||
(void)(work);
|
||||
#endif
|
||||
|
||||
namespace vtkm {
|
||||
namespace exec {
|
||||
|
||||
/// Implements the assert functionality of VTKM_ASSERT_EXEC.
|
||||
///
|
||||
template<typename WorkType>
|
||||
VTKM_EXEC_EXPORT
|
||||
void Assert(bool condition, const char *message, WorkType work)
|
||||
{
|
||||
if (condition)
|
||||
{
|
||||
// Do nothing.
|
||||
}
|
||||
else
|
||||
{
|
||||
work.RaiseError(message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace vtkm::exec
|
||||
|
||||
#endif //vtk_m_exec_Assert_h
|
@ -19,7 +19,6 @@
|
||||
##============================================================================
|
||||
|
||||
set(headers
|
||||
Assert.h
|
||||
AtomicArray.h
|
||||
CellDerivative.h
|
||||
CellInterpolate.h
|
||||
@ -29,7 +28,6 @@ set(headers
|
||||
ExecutionObjectBase.h
|
||||
ExecutionWholeArray.h
|
||||
FunctorBase.h
|
||||
NewtonsMethod.h
|
||||
ParametricCoordinates.h
|
||||
)
|
||||
|
||||
|
@ -20,13 +20,13 @@
|
||||
#ifndef vtk_m_exec_Derivative_h
|
||||
#define vtk_m_exec_Derivative_h
|
||||
|
||||
#include <vtkm/Assert.h>
|
||||
#include <vtkm/CellShape.h>
|
||||
#include <vtkm/Math.h>
|
||||
#include <vtkm/Matrix.h>
|
||||
#include <vtkm/VecRectilinearPointCoordinates.h>
|
||||
#include <vtkm/VectorAnalysis.h>
|
||||
|
||||
#include <vtkm/exec/Assert.h>
|
||||
#include <vtkm/exec/CellInterpolate.h>
|
||||
#include <vtkm/exec/FunctorBase.h>
|
||||
|
||||
@ -663,10 +663,12 @@ CellDerivative(const FieldVecType &field,
|
||||
const WorldCoordType &wCoords,
|
||||
const vtkm::Vec<ParametricCoordType,3> &,
|
||||
vtkm::CellShapeTagVertex,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &vtkmNotUsed(worklet))
|
||||
{
|
||||
VTKM_ASSERT_EXEC(field.GetNumberOfComponents() == 1, worklet);
|
||||
VTKM_ASSERT_EXEC(wCoords.GetNumberOfComponents() == 1, worklet);
|
||||
(void)field;
|
||||
(void)wCoords;
|
||||
VTKM_ASSERT(field.GetNumberOfComponents() == 1);
|
||||
VTKM_ASSERT(wCoords.GetNumberOfComponents() == 1);
|
||||
|
||||
typedef vtkm::Vec<typename FieldVecType::ComponentType,3> GradientType;
|
||||
return GradientType(0,0,0);
|
||||
@ -682,10 +684,10 @@ CellDerivative(const FieldVecType &field,
|
||||
const WorldCoordType &wCoords,
|
||||
const vtkm::Vec<ParametricCoordType,3> &vtkmNotUsed(pcoords),
|
||||
vtkm::CellShapeTagLine,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &vtkmNotUsed(worklet))
|
||||
{
|
||||
VTKM_ASSERT_EXEC(field.GetNumberOfComponents() == 2, worklet);
|
||||
VTKM_ASSERT_EXEC(wCoords.GetNumberOfComponents() == 2, worklet);
|
||||
VTKM_ASSERT(field.GetNumberOfComponents() == 2);
|
||||
VTKM_ASSERT(wCoords.GetNumberOfComponents() == 2);
|
||||
|
||||
typedef typename FieldVecType::ComponentType FieldType;
|
||||
typedef vtkm::Vec<FieldType,3> GradientType;
|
||||
@ -709,9 +711,9 @@ CellDerivative(const FieldVecType &field,
|
||||
const vtkm::VecRectilinearPointCoordinates<1> &wCoords,
|
||||
const vtkm::Vec<ParametricCoordType,3> &vtkmNotUsed(pcoords),
|
||||
vtkm::CellShapeTagLine,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &vtkmNotUsed(worklet))
|
||||
{
|
||||
VTKM_ASSERT_EXEC(field.GetNumberOfComponents() == 2, worklet);
|
||||
VTKM_ASSERT(field.GetNumberOfComponents() == 2);
|
||||
|
||||
typedef typename FieldVecType::ComponentType T;
|
||||
|
||||
@ -728,10 +730,10 @@ CellDerivative(const FieldVecType &field,
|
||||
const WorldCoordType &wCoords,
|
||||
const vtkm::Vec<ParametricCoordType,3> &vtkmNotUsed(pcoords),
|
||||
vtkm::CellShapeTagTriangle,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &vtkmNotUsed(worklet))
|
||||
{
|
||||
VTKM_ASSERT_EXEC(field.GetNumberOfComponents() == 3, worklet);
|
||||
VTKM_ASSERT_EXEC(wCoords.GetNumberOfComponents() == 3, worklet);
|
||||
VTKM_ASSERT(field.GetNumberOfComponents() == 3);
|
||||
VTKM_ASSERT(wCoords.GetNumberOfComponents() == 3);
|
||||
|
||||
typedef typename FieldVecType::ComponentType FieldType;
|
||||
typedef vtkm::Vec<FieldType,3> GradientType;
|
||||
@ -799,12 +801,10 @@ CellDerivative(const FieldVecType &field,
|
||||
vtkm::CellShapeTagPolygon,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
{
|
||||
VTKM_ASSERT_EXEC(field.GetNumberOfComponents() ==
|
||||
wCoords.GetNumberOfComponents(),
|
||||
worklet);
|
||||
VTKM_ASSERT(field.GetNumberOfComponents() == wCoords.GetNumberOfComponents());
|
||||
|
||||
const vtkm::IdComponent numPoints = field.GetNumberOfComponents();
|
||||
VTKM_ASSERT_EXEC(numPoints > 0, worklet);
|
||||
VTKM_ASSERT(numPoints > 0);
|
||||
|
||||
switch (field.GetNumberOfComponents())
|
||||
{
|
||||
@ -910,10 +910,10 @@ CellDerivative(const FieldVecType &field,
|
||||
const WorldCoordType &wCoords,
|
||||
const vtkm::Vec<ParametricCoordType,3> &pcoords,
|
||||
vtkm::CellShapeTagQuad,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &vtkmNotUsed(worklet))
|
||||
{
|
||||
VTKM_ASSERT_EXEC(field.GetNumberOfComponents() == 4, worklet);
|
||||
VTKM_ASSERT_EXEC(wCoords.GetNumberOfComponents() == 4, worklet);
|
||||
VTKM_ASSERT(field.GetNumberOfComponents() == 4);
|
||||
VTKM_ASSERT(wCoords.GetNumberOfComponents() == 4);
|
||||
|
||||
return detail::CellDerivativeFor2DCell(
|
||||
field, wCoords, pcoords, vtkm::CellShapeTagQuad());
|
||||
@ -927,9 +927,9 @@ CellDerivative(const FieldVecType &field,
|
||||
const vtkm::VecRectilinearPointCoordinates<2> &wCoords,
|
||||
const vtkm::Vec<ParametricCoordType,3> &pcoords,
|
||||
vtkm::CellShapeTagQuad,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &vtkmNotUsed(worklet))
|
||||
{
|
||||
VTKM_ASSERT_EXEC(field.GetNumberOfComponents() == 4, worklet);
|
||||
VTKM_ASSERT(field.GetNumberOfComponents() == 4);
|
||||
|
||||
typedef typename FieldVecType::ComponentType T;
|
||||
typedef vtkm::Vec<T,2> VecT;
|
||||
@ -958,10 +958,10 @@ CellDerivative(const FieldVecType &field,
|
||||
const WorldCoordType &wCoords,
|
||||
const vtkm::Vec<ParametricCoordType,3> &vtkmNotUsed(pcoords),
|
||||
vtkm::CellShapeTagTetra,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &vtkmNotUsed(worklet))
|
||||
{
|
||||
VTKM_ASSERT_EXEC(field.GetNumberOfComponents() == 4, worklet);
|
||||
VTKM_ASSERT_EXEC(wCoords.GetNumberOfComponents() == 4, worklet);
|
||||
VTKM_ASSERT(field.GetNumberOfComponents() == 4);
|
||||
VTKM_ASSERT(wCoords.GetNumberOfComponents() == 4);
|
||||
|
||||
typedef typename FieldVecType::ComponentType FieldType;
|
||||
typedef vtkm::Vec<FieldType,3> GradientType;
|
||||
@ -1026,10 +1026,10 @@ CellDerivative(const FieldVecType &field,
|
||||
const WorldCoordType &wCoords,
|
||||
const vtkm::Vec<ParametricCoordType,3> &pcoords,
|
||||
vtkm::CellShapeTagHexahedron,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &vtkmNotUsed(worklet))
|
||||
{
|
||||
VTKM_ASSERT_EXEC(field.GetNumberOfComponents() == 8, worklet);
|
||||
VTKM_ASSERT_EXEC(wCoords.GetNumberOfComponents() == 8, worklet);
|
||||
VTKM_ASSERT(field.GetNumberOfComponents() == 8);
|
||||
VTKM_ASSERT(wCoords.GetNumberOfComponents() == 8);
|
||||
|
||||
return detail::CellDerivativeFor3DCell(
|
||||
field, wCoords, pcoords, vtkm::CellShapeTagHexahedron());
|
||||
@ -1043,9 +1043,9 @@ CellDerivative(const FieldVecType &field,
|
||||
const vtkm::VecRectilinearPointCoordinates<3> &wCoords,
|
||||
const vtkm::Vec<ParametricCoordType,3> &pcoords,
|
||||
vtkm::CellShapeTagHexahedron,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &vtkmNotUsed(worklet))
|
||||
{
|
||||
VTKM_ASSERT_EXEC(field.GetNumberOfComponents() == 8, worklet);
|
||||
VTKM_ASSERT(field.GetNumberOfComponents() == 8);
|
||||
|
||||
typedef typename FieldVecType::ComponentType T;
|
||||
typedef vtkm::Vec<T,3> VecT;
|
||||
@ -1078,10 +1078,10 @@ CellDerivative(const FieldVecType &field,
|
||||
const WorldCoordType &wCoords,
|
||||
const vtkm::Vec<ParametricCoordType,3> &pcoords,
|
||||
vtkm::CellShapeTagWedge,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &vtkmNotUsed(worklet))
|
||||
{
|
||||
VTKM_ASSERT_EXEC(field.GetNumberOfComponents() == 6, worklet);
|
||||
VTKM_ASSERT_EXEC(wCoords.GetNumberOfComponents() == 6, worklet);
|
||||
VTKM_ASSERT(field.GetNumberOfComponents() == 6);
|
||||
VTKM_ASSERT(wCoords.GetNumberOfComponents() == 6);
|
||||
|
||||
return detail::CellDerivativeFor3DCell(
|
||||
field, wCoords, pcoords, vtkm::CellShapeTagWedge());
|
||||
@ -1098,10 +1098,10 @@ CellDerivative(const FieldVecType &field,
|
||||
const WorldCoordType &wCoords,
|
||||
const vtkm::Vec<ParametricCoordType,3> &pcoords,
|
||||
vtkm::CellShapeTagPyramid,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &vtkmNotUsed(worklet))
|
||||
{
|
||||
VTKM_ASSERT_EXEC(field.GetNumberOfComponents() == 5, worklet);
|
||||
VTKM_ASSERT_EXEC(wCoords.GetNumberOfComponents() == 5, worklet);
|
||||
VTKM_ASSERT(field.GetNumberOfComponents() == 5);
|
||||
VTKM_ASSERT(wCoords.GetNumberOfComponents() == 5);
|
||||
|
||||
return detail::CellDerivativeFor3DCell(
|
||||
field, wCoords, pcoords, vtkm::CellShapeTagPyramid());
|
||||
|
@ -20,11 +20,11 @@
|
||||
#ifndef vtk_m_exec_Interpolate_h
|
||||
#define vtk_m_exec_Interpolate_h
|
||||
|
||||
#include <vtkm/Assert.h>
|
||||
#include <vtkm/CellShape.h>
|
||||
#include <vtkm/Math.h>
|
||||
#include <vtkm/VecRectilinearPointCoordinates.h>
|
||||
#include <vtkm/VectorAnalysis.h>
|
||||
#include <vtkm/exec/Assert.h>
|
||||
#include <vtkm/exec/FunctorBase.h>
|
||||
|
||||
namespace vtkm {
|
||||
@ -40,10 +40,9 @@ VTKM_EXEC_EXPORT
|
||||
typename WorldCoordVector::ComponentType
|
||||
ReverseInterpolateTriangle(
|
||||
const WorldCoordVector &pointWCoords,
|
||||
const typename WorldCoordVector::ComponentType &wcoords,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const typename WorldCoordVector::ComponentType &wcoords)
|
||||
{
|
||||
VTKM_ASSERT_EXEC(pointWCoords.GetNumberOfComponents() == 3, worklet);
|
||||
VTKM_ASSERT(pointWCoords.GetNumberOfComponents() == 3);
|
||||
|
||||
// We will solve the world to parametric coordinates problem geometrically.
|
||||
// Consider the parallelogram formed by wcoords and p0 of the triangle and
|
||||
@ -179,9 +178,9 @@ typename FieldVecType::ComponentType
|
||||
CellInterpolate(const FieldVecType &pointFieldValues,
|
||||
const vtkm::Vec<ParametricCoordType,3>,
|
||||
vtkm::CellShapeTagVertex,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &vtkmNotUsed(worklet))
|
||||
{
|
||||
VTKM_ASSERT_EXEC(pointFieldValues.GetNumberOfComponents() == 1, worklet);
|
||||
VTKM_ASSERT(pointFieldValues.GetNumberOfComponents() == 1);
|
||||
return pointFieldValues[0];
|
||||
}
|
||||
|
||||
@ -193,9 +192,9 @@ typename FieldVecType::ComponentType
|
||||
CellInterpolate(const FieldVecType &pointFieldValues,
|
||||
const vtkm::Vec<ParametricCoordType,3> ¶metricCoords,
|
||||
vtkm::CellShapeTagLine,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &vtkmNotUsed(worklet))
|
||||
{
|
||||
VTKM_ASSERT_EXEC(pointFieldValues.GetNumberOfComponents() == 2, worklet);
|
||||
VTKM_ASSERT(pointFieldValues.GetNumberOfComponents() == 2);
|
||||
return vtkm::Lerp(pointFieldValues[0],
|
||||
pointFieldValues[1],
|
||||
parametricCoords[0]);
|
||||
@ -227,9 +226,9 @@ typename FieldVecType::ComponentType
|
||||
CellInterpolate(const FieldVecType &field,
|
||||
const vtkm::Vec<ParametricCoordType,3> &pcoords,
|
||||
vtkm::CellShapeTagTriangle,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &vtkmNotUsed(worklet))
|
||||
{
|
||||
VTKM_ASSERT_EXEC(field.GetNumberOfComponents() == 3, worklet);
|
||||
VTKM_ASSERT(field.GetNumberOfComponents() == 3);
|
||||
typedef typename FieldVecType::ComponentType T;
|
||||
return static_cast<T>( (field[0] * (1 - pcoords[0] - pcoords[1]))
|
||||
+ (field[1] * pcoords[0])
|
||||
@ -247,7 +246,7 @@ CellInterpolate(const FieldVecType &field,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
{
|
||||
const vtkm::IdComponent numPoints = field.GetNumberOfComponents();
|
||||
VTKM_ASSERT_EXEC(numPoints > 0, worklet);
|
||||
VTKM_ASSERT(numPoints > 0);
|
||||
switch (numPoints)
|
||||
{
|
||||
case 1:
|
||||
@ -316,8 +315,7 @@ CellInterpolate(const FieldVecType &field,
|
||||
polygonCoords[2][2] = 0.0f;
|
||||
|
||||
vtkm::Vec<ParametricCoordType,3> trianglePCoords =
|
||||
vtkm::exec::internal::ReverseInterpolateTriangle(
|
||||
polygonCoords, pcoords, worklet);
|
||||
vtkm::exec::internal::ReverseInterpolateTriangle(polygonCoords, pcoords);
|
||||
|
||||
// Set up parameters for triangle that pcoords is in
|
||||
vtkm::Vec<FieldType,3> triangleField;
|
||||
@ -340,9 +338,9 @@ typename FieldVecType::ComponentType
|
||||
CellInterpolate(const FieldVecType &field,
|
||||
const vtkm::Vec<ParametricCoordType,3> &pcoords,
|
||||
vtkm::CellShapeTagQuad,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &vtkmNotUsed(worklet))
|
||||
{
|
||||
VTKM_ASSERT_EXEC(field.GetNumberOfComponents() == 4, worklet);
|
||||
VTKM_ASSERT(field.GetNumberOfComponents() == 4);
|
||||
|
||||
typedef typename FieldVecType::ComponentType T;
|
||||
|
||||
@ -378,9 +376,9 @@ typename FieldVecType::ComponentType
|
||||
CellInterpolate(const FieldVecType &field,
|
||||
const vtkm::Vec<ParametricCoordType,3> &pcoords,
|
||||
vtkm::CellShapeTagTetra,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &vtkmNotUsed(worklet))
|
||||
{
|
||||
VTKM_ASSERT_EXEC(field.GetNumberOfComponents() == 4, worklet);
|
||||
VTKM_ASSERT(field.GetNumberOfComponents() == 4);
|
||||
typedef typename FieldVecType::ComponentType T;
|
||||
return static_cast<T>( (field[0] * (1-pcoords[0]-pcoords[1]-pcoords[2]))
|
||||
+ (field[1] * pcoords[0])
|
||||
@ -396,9 +394,9 @@ typename FieldVecType::ComponentType
|
||||
CellInterpolate(const FieldVecType &field,
|
||||
const vtkm::Vec<ParametricCoordType,3> &pcoords,
|
||||
vtkm::CellShapeTagHexahedron,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &vtkmNotUsed(worklet))
|
||||
{
|
||||
VTKM_ASSERT_EXEC(field.GetNumberOfComponents() == 8, worklet);
|
||||
VTKM_ASSERT(field.GetNumberOfComponents() == 8);
|
||||
|
||||
typedef typename FieldVecType::ComponentType T;
|
||||
|
||||
@ -437,9 +435,9 @@ typename FieldVecType::ComponentType
|
||||
CellInterpolate(const FieldVecType &field,
|
||||
const vtkm::Vec<ParametricCoordType,3> &pcoords,
|
||||
vtkm::CellShapeTagWedge,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &vtkmNotUsed(worklet))
|
||||
{
|
||||
VTKM_ASSERT_EXEC(field.GetNumberOfComponents() == 6, worklet);
|
||||
VTKM_ASSERT(field.GetNumberOfComponents() == 6);
|
||||
|
||||
typedef typename FieldVecType::ComponentType T;
|
||||
|
||||
@ -462,9 +460,9 @@ typename FieldVecType::ComponentType
|
||||
CellInterpolate(const FieldVecType &field,
|
||||
const vtkm::Vec<ParametricCoordType,3> &pcoords,
|
||||
vtkm::CellShapeTagPyramid,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &vtkmNotUsed(worklet))
|
||||
{
|
||||
VTKM_ASSERT_EXEC(field.GetNumberOfComponents() == 5, worklet);
|
||||
VTKM_ASSERT(field.GetNumberOfComponents() == 5);
|
||||
|
||||
typedef typename FieldVecType::ComponentType T;
|
||||
|
||||
|
@ -20,14 +20,15 @@
|
||||
#ifndef vtk_m_exec_ParametricCoordinates_h
|
||||
#define vtk_m_exec_ParametricCoordinates_h
|
||||
|
||||
#include <vtkm/Assert.h>
|
||||
#include <vtkm/CellShape.h>
|
||||
#include <vtkm/Math.h>
|
||||
#include <vtkm/NewtonsMethod.h>
|
||||
#include <vtkm/VecRectilinearPointCoordinates.h>
|
||||
#include <vtkm/exec/Assert.h>
|
||||
#include <vtkm/internal/Assume.h>
|
||||
#include <vtkm/exec/CellDerivative.h>
|
||||
#include <vtkm/exec/CellInterpolate.h>
|
||||
#include <vtkm/exec/FunctorBase.h>
|
||||
#include <vtkm/exec/NewtonsMethod.h>
|
||||
|
||||
namespace vtkm {
|
||||
namespace exec {
|
||||
@ -38,9 +39,10 @@ VTKM_EXEC_EXPORT
|
||||
void ParametricCoordinatesCenter(vtkm::IdComponent numPoints,
|
||||
vtkm::Vec<ParametricCoordType,3> &pcoords,
|
||||
vtkm::CellShapeTagEmpty,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &)
|
||||
{
|
||||
VTKM_ASSERT_EXEC(numPoints == 0, worklet);
|
||||
(void)numPoints; // Silence compiler warnings.
|
||||
VTKM_ASSERT(numPoints == 0);
|
||||
pcoords[0] = 0;
|
||||
pcoords[1] = 0;
|
||||
pcoords[2] = 0;
|
||||
@ -51,9 +53,10 @@ VTKM_EXEC_EXPORT
|
||||
void ParametricCoordinatesCenter(vtkm::IdComponent numPoints,
|
||||
vtkm::Vec<ParametricCoordType,3> &pcoords,
|
||||
vtkm::CellShapeTagVertex,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &)
|
||||
{
|
||||
VTKM_ASSERT_EXEC(numPoints == 1, worklet);
|
||||
(void)numPoints; // Silence compiler warnings.
|
||||
VTKM_ASSERT(numPoints == 1);
|
||||
pcoords[0] = 0;
|
||||
pcoords[1] = 0;
|
||||
pcoords[2] = 0;
|
||||
@ -64,9 +67,10 @@ VTKM_EXEC_EXPORT
|
||||
void ParametricCoordinatesCenter(vtkm::IdComponent numPoints,
|
||||
vtkm::Vec<ParametricCoordType,3> &pcoords,
|
||||
vtkm::CellShapeTagLine,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &)
|
||||
{
|
||||
VTKM_ASSERT_EXEC(numPoints == 2, worklet);
|
||||
(void)numPoints; // Silence compiler warnings.
|
||||
VTKM_ASSERT(numPoints == 2);
|
||||
pcoords[0] = 0.5;
|
||||
pcoords[1] = 0;
|
||||
pcoords[2] = 0;
|
||||
@ -77,9 +81,10 @@ VTKM_EXEC_EXPORT
|
||||
void ParametricCoordinatesCenter(vtkm::IdComponent numPoints,
|
||||
vtkm::Vec<ParametricCoordType,3> &pcoords,
|
||||
vtkm::CellShapeTagTriangle,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &)
|
||||
{
|
||||
VTKM_ASSERT_EXEC(numPoints == 3, worklet);
|
||||
(void)numPoints; // Silence compiler warnings.
|
||||
VTKM_ASSERT(numPoints == 3);
|
||||
pcoords[0] = static_cast<ParametricCoordType>(1.0/3.0);
|
||||
pcoords[1] = static_cast<ParametricCoordType>(1.0/3.0);
|
||||
pcoords[2] = 0;
|
||||
@ -92,7 +97,7 @@ void ParametricCoordinatesCenter(vtkm::IdComponent numPoints,
|
||||
vtkm::CellShapeTagPolygon,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
{
|
||||
VTKM_ASSERT_EXEC(numPoints > 0, worklet);
|
||||
VTKM_ASSERT(numPoints > 0);
|
||||
switch (numPoints)
|
||||
{
|
||||
case 1:
|
||||
@ -120,9 +125,10 @@ VTKM_EXEC_EXPORT
|
||||
void ParametricCoordinatesCenter(vtkm::IdComponent numPoints,
|
||||
vtkm::Vec<ParametricCoordType,3> &pcoords,
|
||||
vtkm::CellShapeTagQuad,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &)
|
||||
{
|
||||
VTKM_ASSERT_EXEC(numPoints == 4, worklet);
|
||||
(void)numPoints; // Silence compiler warnings.
|
||||
VTKM_ASSERT(numPoints == 4);
|
||||
pcoords[0] = 0.5;
|
||||
pcoords[1] = 0.5;
|
||||
pcoords[2] = 0;
|
||||
@ -133,9 +139,10 @@ VTKM_EXEC_EXPORT
|
||||
void ParametricCoordinatesCenter(vtkm::IdComponent numPoints,
|
||||
vtkm::Vec<ParametricCoordType,3> &pcoords,
|
||||
vtkm::CellShapeTagTetra,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &)
|
||||
{
|
||||
VTKM_ASSERT_EXEC(numPoints == 4, worklet);
|
||||
(void)numPoints; // Silence compiler warnings.
|
||||
VTKM_ASSERT(numPoints == 4);
|
||||
pcoords[0] = 0.25;
|
||||
pcoords[1] = 0.25;
|
||||
pcoords[2] = 0.25;
|
||||
@ -146,9 +153,10 @@ VTKM_EXEC_EXPORT
|
||||
void ParametricCoordinatesCenter(vtkm::IdComponent numPoints,
|
||||
vtkm::Vec<ParametricCoordType,3> &pcoords,
|
||||
vtkm::CellShapeTagHexahedron,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &)
|
||||
{
|
||||
VTKM_ASSERT_EXEC(numPoints == 8, worklet);
|
||||
(void)numPoints; // Silence compiler warnings.
|
||||
VTKM_ASSERT(numPoints == 8);
|
||||
pcoords[0] = 0.5;
|
||||
pcoords[1] = 0.5;
|
||||
pcoords[2] = 0.5;
|
||||
@ -159,9 +167,10 @@ VTKM_EXEC_EXPORT
|
||||
void ParametricCoordinatesCenter(vtkm::IdComponent numPoints,
|
||||
vtkm::Vec<ParametricCoordType,3> &pcoords,
|
||||
vtkm::CellShapeTagWedge,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &)
|
||||
{
|
||||
VTKM_ASSERT_EXEC(numPoints == 6, worklet);
|
||||
(void)numPoints; // Silence compiler warnings.
|
||||
VTKM_ASSERT(numPoints == 6);
|
||||
pcoords[0] = static_cast<ParametricCoordType>(1.0/3.0);
|
||||
pcoords[1] = static_cast<ParametricCoordType>(1.0/3.0);
|
||||
pcoords[2] = 0.5;
|
||||
@ -172,9 +181,10 @@ VTKM_EXEC_EXPORT
|
||||
void ParametricCoordinatesCenter(vtkm::IdComponent numPoints,
|
||||
vtkm::Vec<ParametricCoordType,3> &pcoords,
|
||||
vtkm::CellShapeTagPyramid,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &)
|
||||
{
|
||||
VTKM_ASSERT_EXEC(numPoints == 5, worklet);
|
||||
(void)numPoints; // Silence compiler warnings.
|
||||
VTKM_ASSERT(numPoints == 5);
|
||||
pcoords[0] = 0.5;
|
||||
pcoords[1] = 0.5;
|
||||
pcoords[2] = static_cast<ParametricCoordType>(0.2);
|
||||
@ -238,10 +248,12 @@ void ParametricCoordinatesPoint(vtkm::IdComponent numPoints,
|
||||
vtkm::IdComponent pointIndex,
|
||||
vtkm::Vec<ParametricCoordType,3> &pcoords,
|
||||
vtkm::CellShapeTagVertex,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &)
|
||||
{
|
||||
VTKM_ASSERT_EXEC(numPoints == 1, worklet);
|
||||
VTKM_ASSERT_EXEC(pointIndex == 0, worklet);
|
||||
(void)numPoints; // Silence compiler warnings.
|
||||
(void)pointIndex; // Silence compiler warnings.
|
||||
VTKM_ASSUME(numPoints == 1);
|
||||
VTKM_ASSUME(pointIndex == 0);
|
||||
pcoords[0] = 0;
|
||||
pcoords[1] = 0;
|
||||
pcoords[2] = 0;
|
||||
@ -253,10 +265,11 @@ void ParametricCoordinatesPoint(vtkm::IdComponent numPoints,
|
||||
vtkm::IdComponent pointIndex,
|
||||
vtkm::Vec<ParametricCoordType,3> &pcoords,
|
||||
vtkm::CellShapeTagLine,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &)
|
||||
{
|
||||
VTKM_ASSERT_EXEC(numPoints == 2, worklet);
|
||||
VTKM_ASSERT_EXEC((pointIndex >= 0) && (pointIndex < 2), worklet);
|
||||
(void)numPoints; // Silence compiler warnings.
|
||||
VTKM_ASSUME(numPoints == 2);
|
||||
VTKM_ASSUME((pointIndex >= 0) && (pointIndex < 2));
|
||||
|
||||
pcoords[0] = static_cast<ParametricCoordType>(pointIndex);
|
||||
pcoords[1] = 0;
|
||||
@ -269,18 +282,17 @@ void ParametricCoordinatesPoint(vtkm::IdComponent numPoints,
|
||||
vtkm::IdComponent pointIndex,
|
||||
vtkm::Vec<ParametricCoordType,3> &pcoords,
|
||||
vtkm::CellShapeTagTriangle,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &)
|
||||
{
|
||||
VTKM_ASSERT_EXEC(numPoints == 3, worklet);
|
||||
(void)numPoints; // Silence compiler warnings.
|
||||
VTKM_ASSUME(numPoints == 3);
|
||||
VTKM_ASSUME((pointIndex >= 0) && (pointIndex < 3));
|
||||
|
||||
switch (pointIndex)
|
||||
{
|
||||
case 0: pcoords[0] = 0; pcoords[1] = 0; break;
|
||||
case 1: pcoords[0] = 1; pcoords[1] = 0; break;
|
||||
case 2: pcoords[0] = 0; pcoords[1] = 1; break;
|
||||
default: worklet.RaiseError("Bad point index.");
|
||||
pcoords[0] = pcoords[1] = pcoords[2] = 0;
|
||||
break;
|
||||
}
|
||||
pcoords[2] = 0;
|
||||
}
|
||||
@ -293,7 +305,8 @@ void ParametricCoordinatesPoint(vtkm::IdComponent numPoints,
|
||||
vtkm::CellShapeTagPolygon,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
{
|
||||
VTKM_ASSERT_EXEC(numPoints > 0, worklet);
|
||||
VTKM_ASSUME( (numPoints > 0) );
|
||||
VTKM_ASSUME( (pointIndex >= 0) && (pointIndex < numPoints) );
|
||||
|
||||
switch (numPoints)
|
||||
{
|
||||
@ -343,9 +356,11 @@ void ParametricCoordinatesPoint(vtkm::IdComponent numPoints,
|
||||
vtkm::IdComponent pointIndex,
|
||||
vtkm::Vec<ParametricCoordType,3> &pcoords,
|
||||
vtkm::CellShapeTagQuad,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &)
|
||||
{
|
||||
VTKM_ASSERT_EXEC(numPoints == 4, worklet);
|
||||
(void)numPoints; // Silence compiler warnings.
|
||||
VTKM_ASSUME(numPoints == 4);
|
||||
VTKM_ASSUME((pointIndex >= 0) && (pointIndex < 4));
|
||||
|
||||
switch (pointIndex)
|
||||
{
|
||||
@ -353,10 +368,6 @@ void ParametricCoordinatesPoint(vtkm::IdComponent numPoints,
|
||||
case 1: pcoords[0] = 1; pcoords[1] = 0; break;
|
||||
case 2: pcoords[0] = 1; pcoords[1] = 1; break;
|
||||
case 3: pcoords[0] = 0; pcoords[1] = 1; break;
|
||||
default:
|
||||
worklet.RaiseError("Bad point index.");
|
||||
pcoords[0] = pcoords[1] = pcoords[2] = 0;
|
||||
break;
|
||||
}
|
||||
pcoords[2] = 0;
|
||||
}
|
||||
@ -367,9 +378,11 @@ void ParametricCoordinatesPoint(vtkm::IdComponent numPoints,
|
||||
vtkm::IdComponent pointIndex,
|
||||
vtkm::Vec<ParametricCoordType,3> &pcoords,
|
||||
vtkm::CellShapeTagTetra,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &)
|
||||
{
|
||||
VTKM_ASSERT_EXEC(numPoints == 4, worklet);
|
||||
(void)numPoints; // Silence compiler warnings.
|
||||
VTKM_ASSUME(numPoints == 4);
|
||||
VTKM_ASSUME((pointIndex >= 0) && (pointIndex < 4));
|
||||
|
||||
switch (pointIndex)
|
||||
{
|
||||
@ -377,10 +390,6 @@ void ParametricCoordinatesPoint(vtkm::IdComponent numPoints,
|
||||
case 1: pcoords[0] = 1; pcoords[1] = 0; pcoords[2] = 0; break;
|
||||
case 2: pcoords[0] = 0; pcoords[1] = 1; pcoords[2] = 0; break;
|
||||
case 3: pcoords[0] = 0; pcoords[1] = 0; pcoords[2] = 1; break;
|
||||
default:
|
||||
worklet.RaiseError("Bad point index.");
|
||||
pcoords[0] = pcoords[1] = pcoords[2] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -390,9 +399,11 @@ void ParametricCoordinatesPoint(vtkm::IdComponent numPoints,
|
||||
vtkm::IdComponent pointIndex,
|
||||
vtkm::Vec<ParametricCoordType,3> &pcoords,
|
||||
vtkm::CellShapeTagHexahedron,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &)
|
||||
{
|
||||
VTKM_ASSERT_EXEC(numPoints == 8, worklet);
|
||||
(void)numPoints; // Silence compiler warnings.
|
||||
VTKM_ASSUME(numPoints == 8);
|
||||
VTKM_ASSUME((pointIndex >= 0) && (pointIndex < 8));
|
||||
|
||||
switch (pointIndex)
|
||||
{
|
||||
@ -404,10 +415,6 @@ void ParametricCoordinatesPoint(vtkm::IdComponent numPoints,
|
||||
case 5: pcoords[0] = 1; pcoords[1] = 0; pcoords[2] = 1; break;
|
||||
case 6: pcoords[0] = 1; pcoords[1] = 1; pcoords[2] = 1; break;
|
||||
case 7: pcoords[0] = 0; pcoords[1] = 1; pcoords[2] = 1; break;
|
||||
default:
|
||||
worklet.RaiseError("Bad point index.");
|
||||
pcoords[0] = pcoords[1] = pcoords[2] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -417,9 +424,11 @@ void ParametricCoordinatesPoint(vtkm::IdComponent numPoints,
|
||||
vtkm::IdComponent pointIndex,
|
||||
vtkm::Vec<ParametricCoordType,3> &pcoords,
|
||||
vtkm::CellShapeTagWedge,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &)
|
||||
{
|
||||
VTKM_ASSERT_EXEC(numPoints == 6, worklet);
|
||||
(void)numPoints; // Silence compiler warnings.
|
||||
VTKM_ASSUME(numPoints == 6);
|
||||
VTKM_ASSUME((pointIndex >= 0) && (pointIndex < 6));
|
||||
|
||||
switch (pointIndex)
|
||||
{
|
||||
@ -429,10 +438,6 @@ void ParametricCoordinatesPoint(vtkm::IdComponent numPoints,
|
||||
case 3: pcoords[0] = 0; pcoords[1] = 0; pcoords[2] = 1; break;
|
||||
case 4: pcoords[0] = 0; pcoords[1] = 1; pcoords[2] = 1; break;
|
||||
case 5: pcoords[0] = 1; pcoords[1] = 0; pcoords[2] = 1; break;
|
||||
default:
|
||||
worklet.RaiseError("Bad point index.");
|
||||
pcoords[0] = pcoords[1] = pcoords[2] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -442,9 +447,11 @@ void ParametricCoordinatesPoint(vtkm::IdComponent numPoints,
|
||||
vtkm::IdComponent pointIndex,
|
||||
vtkm::Vec<ParametricCoordType,3> &pcoords,
|
||||
vtkm::CellShapeTagPyramid,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &)
|
||||
{
|
||||
VTKM_ASSERT_EXEC(numPoints == 5, worklet);
|
||||
(void)numPoints; // Silence compiler warnings.
|
||||
VTKM_ASSUME(numPoints == 5);
|
||||
VTKM_ASSUME((pointIndex >= 0) && (pointIndex < 5));
|
||||
|
||||
switch (pointIndex)
|
||||
{
|
||||
@ -453,10 +460,6 @@ void ParametricCoordinatesPoint(vtkm::IdComponent numPoints,
|
||||
case 2: pcoords[0] = 1; pcoords[1] = 1; pcoords[2] = 0; break;
|
||||
case 3: pcoords[0] = 0; pcoords[1] = 1; pcoords[2] = 0; break;
|
||||
case 4: pcoords[0] = 0.5; pcoords[1] = 0.5; pcoords[2] = 1; break;
|
||||
default:
|
||||
worklet.RaiseError("Bad point index.");
|
||||
pcoords[0] = pcoords[1] = pcoords[2] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -644,7 +647,7 @@ WorldCoordinatesToParametricCoordinates3D(
|
||||
CellShapeTag,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
{
|
||||
return vtkm::exec::NewtonsMethod(
|
||||
return vtkm::NewtonsMethod(
|
||||
JacobianFunctor3DCell<WorldCoordVector,CellShapeTag>(&pointWCoords),
|
||||
CoordinatesFunctor3DCell<WorldCoordVector,CellShapeTag>(&pointWCoords, &worklet),
|
||||
wcoords,
|
||||
@ -700,9 +703,10 @@ WorldCoordinatesToParametricCoordinates(
|
||||
const WorldCoordVector &pointWCoords,
|
||||
const typename WorldCoordVector::ComponentType &,
|
||||
vtkm::CellShapeTagVertex,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &vtkmNotUsed(worklet))
|
||||
{
|
||||
VTKM_ASSERT_EXEC(pointWCoords.GetNumberOfComponents() == 1, worklet);
|
||||
(void)pointWCoords; // Silence compiler warnings.
|
||||
VTKM_ASSERT(pointWCoords.GetNumberOfComponents() == 1);
|
||||
return typename WorldCoordVector::ComponentType(0, 0, 0);
|
||||
}
|
||||
|
||||
@ -713,9 +717,9 @@ WorldCoordinatesToParametricCoordinates(
|
||||
const WorldCoordVector &pointWCoords,
|
||||
const typename WorldCoordVector::ComponentType &wcoords,
|
||||
vtkm::CellShapeTagLine,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &vtkmNotUsed(worklet))
|
||||
{
|
||||
VTKM_ASSERT_EXEC(pointWCoords.GetNumberOfComponents() == 2, worklet);
|
||||
VTKM_ASSERT(pointWCoords.GetNumberOfComponents() == 2);
|
||||
|
||||
// Because this is a line, there is only one vaild parametric coordinate. Let
|
||||
// vec be the vector from the first point to the second point
|
||||
@ -754,10 +758,10 @@ WorldCoordinatesToParametricCoordinates(
|
||||
const WorldCoordVector &pointWCoords,
|
||||
const typename WorldCoordVector::ComponentType &wcoords,
|
||||
vtkm::CellShapeTagTriangle,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &vtkmNotUsed(worklet))
|
||||
{
|
||||
return vtkm::exec::internal::ReverseInterpolateTriangle(
|
||||
pointWCoords, wcoords, worklet);
|
||||
pointWCoords, wcoords);
|
||||
}
|
||||
|
||||
template<typename WorldCoordVector>
|
||||
@ -770,7 +774,7 @@ WorldCoordinatesToParametricCoordinates(
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
{
|
||||
const vtkm::IdComponent numPoints = pointWCoords.GetNumberOfComponents();
|
||||
VTKM_ASSERT_EXEC(numPoints > 0, worklet);
|
||||
VTKM_ASSERT(numPoints > 0);
|
||||
switch (numPoints)
|
||||
{
|
||||
case 1:
|
||||
@ -905,7 +909,7 @@ WorldCoordinatesToParametricCoordinates(
|
||||
vtkm::CellShapeTagQuad,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
{
|
||||
VTKM_ASSERT_EXEC(pointWCoords.GetNumberOfComponents() == 4, worklet);
|
||||
VTKM_ASSERT(pointWCoords.GetNumberOfComponents() == 4);
|
||||
|
||||
typedef typename WorldCoordVector::ComponentType::ComponentType T;
|
||||
typedef vtkm::Vec<T,2> Vector2;
|
||||
@ -917,7 +921,7 @@ WorldCoordinatesToParametricCoordinates(
|
||||
pointWCoords[0], pointWCoords[1], pointWCoords[3]);
|
||||
|
||||
Vector2 pcoords =
|
||||
vtkm::exec::NewtonsMethod(
|
||||
vtkm::NewtonsMethod(
|
||||
detail::JacobianFunctorQuad<WorldCoordVector,vtkm::CellShapeTagQuad>(&pointWCoords, &space),
|
||||
detail::CoordinatesFunctorQuad<WorldCoordVector,vtkm::CellShapeTagQuad>(&pointWCoords, &space, &worklet),
|
||||
space.ConvertCoordToSpace(wcoords),
|
||||
@ -944,9 +948,9 @@ WorldCoordinatesToParametricCoordinates(
|
||||
const WorldCoordVector &pointWCoords,
|
||||
const typename WorldCoordVector::ComponentType &wcoords,
|
||||
vtkm::CellShapeTagTetra,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
const vtkm::exec::FunctorBase &vtkmNotUsed(worklet))
|
||||
{
|
||||
VTKM_ASSERT_EXEC(pointWCoords.GetNumberOfComponents() == 4, worklet);
|
||||
VTKM_ASSERT(pointWCoords.GetNumberOfComponents() == 4);
|
||||
|
||||
// We solve the world to parametric coordinates problem for tetrahedra
|
||||
// similarly to that for triangles. Before understanding this code, you
|
||||
@ -1002,7 +1006,7 @@ WorldCoordinatesToParametricCoordinates(
|
||||
vtkm::CellShapeTagHexahedron,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
{
|
||||
VTKM_ASSERT_EXEC(pointWCoords.GetNumberOfComponents() == 8, worklet);
|
||||
VTKM_ASSERT(pointWCoords.GetNumberOfComponents() == 8);
|
||||
|
||||
return detail::WorldCoordinatesToParametricCoordinates3D(
|
||||
pointWCoords, wcoords, vtkm::CellShapeTagHexahedron(), worklet);
|
||||
@ -1028,7 +1032,7 @@ WorldCoordinatesToParametricCoordinates(
|
||||
vtkm::CellShapeTagWedge,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
{
|
||||
VTKM_ASSERT_EXEC(pointWCoords.GetNumberOfComponents() == 6, worklet);
|
||||
VTKM_ASSERT(pointWCoords.GetNumberOfComponents() == 6);
|
||||
|
||||
return detail::WorldCoordinatesToParametricCoordinates3D(
|
||||
pointWCoords, wcoords, vtkm::CellShapeTagWedge(), worklet);
|
||||
@ -1044,7 +1048,7 @@ WorldCoordinatesToParametricCoordinates(
|
||||
vtkm::CellShapeTagPyramid,
|
||||
const vtkm::exec::FunctorBase &worklet)
|
||||
{
|
||||
VTKM_ASSERT_EXEC(pointWCoords.GetNumberOfComponents() == 5, worklet);
|
||||
VTKM_ASSERT(pointWCoords.GetNumberOfComponents() == 5);
|
||||
|
||||
return detail::WorldCoordinatesToParametricCoordinates3D(
|
||||
pointWCoords, wcoords, vtkm::CellShapeTagPyramid(), worklet);
|
||||
|
@ -42,12 +42,11 @@ namespace arg {
|
||||
class ThreadIndicesBasic
|
||||
{
|
||||
public:
|
||||
template<typename Invocation>
|
||||
VTKM_EXEC_EXPORT
|
||||
ThreadIndicesBasic(vtkm::Id threadIndex, const Invocation &invocation)
|
||||
: InputIndex(invocation.OutputToInputMap.Get(threadIndex)),
|
||||
ThreadIndicesBasic(vtkm::Id threadIndex, vtkm::Id inIndex, vtkm::IdComponent visitIndex)
|
||||
: InputIndex(inIndex),
|
||||
OutputIndex(threadIndex),
|
||||
VisitIndex(invocation.VisitArray.Get(threadIndex))
|
||||
VisitIndex(visitIndex)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -72,10 +72,13 @@ public:
|
||||
typedef typename ConnectivityType::IndicesType IndicesFromType;
|
||||
typedef typename ConnectivityType::CellShapeTag CellShapeTag;
|
||||
|
||||
template<typename Invocation>
|
||||
template<typename OutToInArrayType, typename VisitArrayType>
|
||||
VTKM_EXEC_EXPORT
|
||||
ThreadIndicesTopologyMap(vtkm::Id threadIndex, const Invocation &invocation)
|
||||
: Superclass(threadIndex, invocation),
|
||||
ThreadIndicesTopologyMap(vtkm::Id threadIndex,
|
||||
const OutToInArrayType& inToOut,
|
||||
const VisitArrayType& visit,
|
||||
const ConnectivityType& connectivity)
|
||||
: Superclass(threadIndex, inToOut.Get(threadIndex), visit.Get(threadIndex)),
|
||||
CellShape(detail::CellShapeInitializer<CellShapeTag>::GetDefault())
|
||||
{
|
||||
// The connectivity is stored in the invocation parameter at the given
|
||||
@ -83,8 +86,6 @@ public:
|
||||
// of the domain will match the connectivity type used here. If there is
|
||||
// a compile error here about a type mismatch, chances are a worklet has
|
||||
// set its input domain incorrectly.
|
||||
const ConnectivityType &connectivity = invocation.GetInputDomain();
|
||||
|
||||
this->IndicesFrom = connectivity.GetIndices(this->GetInputIndex());
|
||||
this->CellShape = connectivity.GetCellShape(this->GetInputIndex());
|
||||
}
|
||||
@ -183,44 +184,39 @@ public:
|
||||
typedef typename ConnectivityType::CellShapeTag CellShapeTag;
|
||||
typedef typename ConnectivityType::SchedulingRangeType LogicalIndexType;
|
||||
|
||||
template<typename Invocation>
|
||||
template<typename OutToInArrayType, typename VisitArrayType>
|
||||
VTKM_EXEC_EXPORT
|
||||
ThreadIndicesTopologyMap(vtkm::Id threadIndex, const Invocation &invocation)
|
||||
ThreadIndicesTopologyMap(vtkm::Id threadIndex,
|
||||
const OutToInArrayType& inToOut,
|
||||
const VisitArrayType& visit,
|
||||
const ConnectivityType& connectivity)
|
||||
{
|
||||
// The connectivity is stored in the invocation parameter at the given
|
||||
// input domain index. If this class is being used correctly, the type
|
||||
// of the domain will match the connectivity type used here. If there is
|
||||
// a compile error here about a type mismatch, chances are a worklet has
|
||||
// set its input domain incorrectly.
|
||||
const ConnectivityType &connectivity = invocation.GetInputDomain();
|
||||
|
||||
this->InputIndex = invocation.OutputToInputMap.Get(threadIndex);
|
||||
this->InputIndex = inToOut.Get(threadIndex);
|
||||
this->OutputIndex = threadIndex;
|
||||
this->VisitIndex = invocation.VisitArray.Get(threadIndex);
|
||||
this->VisitIndex = visit.Get(threadIndex);
|
||||
this->LogicalIndex = connectivity.FlatToLogicalToIndex(this->InputIndex);
|
||||
this->IndicesFrom = connectivity.GetIndices(this->LogicalIndex);
|
||||
this->CellShape = connectivity.GetCellShape(this->InputIndex);
|
||||
}
|
||||
|
||||
template<typename Invocation>
|
||||
template<typename OutToInArrayType, typename VisitArrayType>
|
||||
VTKM_EXEC_EXPORT
|
||||
ThreadIndicesTopologyMap(vtkm::Id3 threadIndex, const Invocation &invocation)
|
||||
ThreadIndicesTopologyMap(const vtkm::Id3& threadIndex,
|
||||
const OutToInArrayType&,
|
||||
const VisitArrayType& visit,
|
||||
const ConnectivityType& connectivity)
|
||||
{
|
||||
// The connectivity is stored in the invocation parameter at the given
|
||||
// input domain index. If this class is being used correctly, the type
|
||||
// of the domain will match the connectivity type used here. If there is
|
||||
// a compile error here about a type mismatch, chances are a worklet has
|
||||
// set its input domain incorrectly.
|
||||
const ConnectivityType &connectivity = invocation.GetInputDomain();
|
||||
|
||||
// We currently only support multidimensional indices on one-to-one input-
|
||||
// to-output mappings. (We don't have a use case otherwise.)
|
||||
// that is why the OutToInArrayType is ignored
|
||||
const LogicalIndexType logicalIndex =
|
||||
detail::Deflate(threadIndex, LogicalIndexType());
|
||||
const vtkm::Id index = connectivity.LogicalToFlatToIndex(logicalIndex);
|
||||
|
||||
// We currently only support multidimensional indices on one-to-one input-
|
||||
// to-output mappings. (We don't have a use case otherwise.)
|
||||
this->InputIndex = this->OutputIndex = index;
|
||||
this->VisitIndex = invocation.VisitArray.Get(index);
|
||||
this->InputIndex = index;
|
||||
this->OutputIndex = index;
|
||||
this->VisitIndex = visit.Get(index);
|
||||
this->LogicalIndex = logicalIndex;
|
||||
this->IndicesFrom = connectivity.GetIndices(logicalIndex);
|
||||
this->CellShape = connectivity.GetCellShape(index);
|
||||
|
@ -84,7 +84,11 @@ struct FetchArrayTopologyMapInTests
|
||||
|
||||
FetchType fetch;
|
||||
|
||||
ThreadIndicesType indices(0, invocation);
|
||||
ThreadIndicesType indices(0,
|
||||
invocation.OutputToInputMap,
|
||||
invocation.VisitArray,
|
||||
invocation.GetInputDomain()
|
||||
);
|
||||
|
||||
typename FetchType::ValueType value = fetch.Load(
|
||||
indices, invocation.Parameters.template GetParameter<ParamIndex>());
|
||||
@ -175,14 +179,20 @@ void TryStructuredPointCoordinatesInvocation(const Invocation &invocation)
|
||||
TestValue(1, vtkm::Vec<vtkm::FloatDefault,3>());
|
||||
|
||||
vtkm::VecRectilinearPointCoordinates<NumDimensions> value = fetch.Load(
|
||||
ThreadIndicesType(0, invocation),
|
||||
ThreadIndicesType(0,
|
||||
invocation.OutputToInputMap,
|
||||
invocation.VisitArray,
|
||||
invocation.GetInputDomain()),
|
||||
invocation.Parameters.template GetParameter<ParamIndex>());
|
||||
VTKM_TEST_ASSERT(test_equal(value.GetOrigin(), origin), "Bad origin.");
|
||||
VTKM_TEST_ASSERT(test_equal(value.GetSpacing(), spacing), "Bad spacing.");
|
||||
|
||||
origin[0] += spacing[0];
|
||||
value = fetch.Load(
|
||||
ThreadIndicesType(1, invocation),
|
||||
ThreadIndicesType(1,
|
||||
invocation.OutputToInputMap,
|
||||
invocation.VisitArray,
|
||||
invocation.GetInputDomain()),
|
||||
invocation.Parameters.template GetParameter<ParamIndex>());
|
||||
VTKM_TEST_ASSERT(test_equal(value.GetOrigin(), origin), "Bad origin.");
|
||||
VTKM_TEST_ASSERT(test_equal(value.GetSpacing(), spacing), "Bad spacing.");
|
||||
|
@ -49,6 +49,19 @@ __host__ __device__
|
||||
return thrust::sort(thrust::cuda::par, first, last, thrust::less<T>());
|
||||
}
|
||||
|
||||
template<typename T,
|
||||
typename RandomAccessIterator>
|
||||
__host__ __device__
|
||||
void sort_by_key(const vtkm_cuda_policy &exec,
|
||||
thrust::system::cuda::pointer<T> first,
|
||||
thrust::system::cuda::pointer<T> last,
|
||||
RandomAccessIterator values_first,
|
||||
vtkm::exec::cuda::internal::WrappedBinaryPredicate<T, vtkm::SortLess > comp)
|
||||
{ //sort for concrete pointers and less than op
|
||||
//this makes sure that we invoke the thrust radix sort and not merge sort
|
||||
return thrust::sort_by_key(thrust::cuda::par, first, last, values_first, thrust::less<T>());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
__host__ __device__
|
||||
void sort(const vtkm_cuda_policy &exec,
|
||||
@ -60,6 +73,19 @@ __host__ __device__
|
||||
return thrust::sort(thrust::cuda::par, first, last, thrust::less<T>());
|
||||
}
|
||||
|
||||
template<typename T,
|
||||
typename RandomAccessIterator>
|
||||
__host__ __device__
|
||||
void sort_by_key(const vtkm_cuda_policy &exec,
|
||||
thrust::system::cuda::pointer<T> first,
|
||||
thrust::system::cuda::pointer<T> last,
|
||||
RandomAccessIterator values_first,
|
||||
vtkm::exec::cuda::internal::WrappedBinaryPredicate<T, ::thrust::less<T> > comp)
|
||||
{ //sort for concrete pointers and less than op
|
||||
//this makes sure that we invoke the thrust radix sort and not merge sort
|
||||
return thrust::sort_by_key(thrust::cuda::par, first, last, values_first, thrust::less<T>());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
__host__ __device__
|
||||
void sort(const vtkm_cuda_policy &exec,
|
||||
@ -71,6 +97,19 @@ __host__ __device__
|
||||
return thrust::sort(thrust::cuda::par, first, last, thrust::greater<T>());
|
||||
}
|
||||
|
||||
template<typename T,
|
||||
typename RandomAccessIterator>
|
||||
__host__ __device__
|
||||
void sort_by_key(const vtkm_cuda_policy &exec,
|
||||
thrust::system::cuda::pointer<T> first,
|
||||
thrust::system::cuda::pointer<T> last,
|
||||
RandomAccessIterator values_first,
|
||||
vtkm::exec::cuda::internal::WrappedBinaryPredicate<T, vtkm::SortGreater> comp)
|
||||
{ //sort for concrete pointers and greater than op
|
||||
//this makes sure that we invoke the thrust radix sort and not merge sort
|
||||
return thrust::sort_by_key(thrust::cuda::par, first, last, values_first, thrust::greater<T>());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
__host__ __device__
|
||||
void sort(const vtkm_cuda_policy &exec,
|
||||
@ -82,6 +121,19 @@ __host__ __device__
|
||||
return thrust::sort(thrust::cuda::par, first, last, thrust::greater<T>());
|
||||
}
|
||||
|
||||
template<typename T,
|
||||
typename RandomAccessIterator>
|
||||
__host__ __device__
|
||||
void sort_by_key(const vtkm_cuda_policy &exec,
|
||||
thrust::system::cuda::pointer<T> first,
|
||||
thrust::system::cuda::pointer<T> last,
|
||||
RandomAccessIterator values_first,
|
||||
vtkm::exec::cuda::internal::WrappedBinaryPredicate<T, ::thrust::greater<T> > comp)
|
||||
{ //sort for concrete pointers and greater than op
|
||||
//this makes sure that we invoke the thrust radix sort and not merge sort
|
||||
return thrust::sort_by_key(thrust::cuda::par, first, last, values_first, thrust::greater<T>());
|
||||
}
|
||||
|
||||
template<typename RandomAccessIterator,
|
||||
typename StrictWeakOrdering>
|
||||
__host__ __device__
|
||||
@ -97,5 +149,76 @@ __host__ __device__
|
||||
return thrust::sort(thrust::cuda::par, first, last, comp);
|
||||
}
|
||||
|
||||
template<typename RandomAccessIteratorKeys,
|
||||
typename RandomAccessIteratorValues,
|
||||
typename StrictWeakOrdering>
|
||||
__host__ __device__
|
||||
void sort_by_key(const vtkm_cuda_policy &exec,
|
||||
RandomAccessIteratorKeys first,
|
||||
RandomAccessIteratorKeys last,
|
||||
RandomAccessIteratorValues values_first,
|
||||
StrictWeakOrdering comp)
|
||||
{
|
||||
//At this point the pointer type is not a cuda pointers and/or
|
||||
//the operator is not an approved less/greater operator.
|
||||
//This most likely will cause thrust to internally determine that
|
||||
//the best sort implementation is merge sort.
|
||||
return thrust::sort_by_key(thrust::cuda::par, first, last, values_first, comp);
|
||||
}
|
||||
|
||||
|
||||
template<typename T,
|
||||
typename InputIterator2,
|
||||
typename OutputIterator1,
|
||||
typename OutputIterator2,
|
||||
typename BinaryPredicate,
|
||||
typename BinaryFunction>
|
||||
__host__
|
||||
::thrust::pair<OutputIterator1,OutputIterator2>
|
||||
reduce_by_key(const vtkm_cuda_policy &exec,
|
||||
thrust::system::cuda::pointer<T> keys_first,
|
||||
thrust::system::cuda::pointer<T> keys_last,
|
||||
InputIterator2 values_first,
|
||||
OutputIterator1 keys_output,
|
||||
OutputIterator2 values_output,
|
||||
BinaryPredicate binary_pred,
|
||||
BinaryFunction binary_op)
|
||||
|
||||
{
|
||||
#if defined(__CUDACC_VER__) && (__CUDACC_VER__ >= 70500) && (__CUDACC_VER__ < 80000)
|
||||
::thrust::pair<OutputIterator1,OutputIterator2> result = thrust::reduce_by_key(thrust::cuda::par, keys_first.get(), keys_last.get(), values_first, keys_output, values_output, binary_pred, binary_op);
|
||||
cudaDeviceSynchronize();
|
||||
return result;
|
||||
#else
|
||||
return thrust::reduce_by_key(thrust::cuda::par, keys_first, keys_last, values_first, keys_output, values_output, binary_pred, binary_op);
|
||||
#endif
|
||||
}
|
||||
|
||||
template<typename InputIterator1,
|
||||
typename InputIterator2,
|
||||
typename OutputIterator1,
|
||||
typename OutputIterator2,
|
||||
typename BinaryPredicate,
|
||||
typename BinaryFunction>
|
||||
__host__
|
||||
::thrust::pair<OutputIterator1,OutputIterator2>
|
||||
reduce_by_key(const vtkm_cuda_policy &exec,
|
||||
InputIterator1 keys_first,
|
||||
InputIterator1 keys_last,
|
||||
InputIterator2 values_first,
|
||||
OutputIterator1 keys_output,
|
||||
OutputIterator2 values_output,
|
||||
BinaryPredicate binary_pred,
|
||||
BinaryFunction binary_op)
|
||||
|
||||
{
|
||||
#if defined(__CUDACC_VER__) && (__CUDACC_VER__ >= 70500) && (__CUDACC_VER__ < 80000)
|
||||
::thrust::pair<OutputIterator1,OutputIterator2> result = thrust::reduce_by_key(thrust::cuda::par, keys_first, keys_last, values_first, keys_output, values_output, binary_pred, binary_op);
|
||||
cudaDeviceSynchronize();
|
||||
return result;
|
||||
#else
|
||||
return thrust::reduce_by_key(thrust::cuda::par, keys_first, keys_last, values_first, keys_output, values_output, binary_pred, binary_op);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -56,8 +56,11 @@ public:
|
||||
{
|
||||
detail::DoWorkletInvokeFunctor(this->Worklet,
|
||||
this->Invocation,
|
||||
this->Worklet.GetThreadIndices(
|
||||
index, this->Invocation));
|
||||
this->Worklet.GetThreadIndices(index,
|
||||
this->Invocation.OutputToInputMap,
|
||||
this->Invocation.VisitArray,
|
||||
this->Invocation.GetInputDomain())
|
||||
);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -181,12 +181,17 @@ struct TestWorkletProxy : vtkm::exec::FunctorBase
|
||||
return input + 200;
|
||||
}
|
||||
|
||||
template<typename Invocation>
|
||||
template<typename T, typename OutToInArrayType, typename VisitArrayType, typename InputDomainType>
|
||||
VTKM_EXEC_EXPORT
|
||||
vtkm::exec::arg::ThreadIndicesBasic
|
||||
GetThreadIndices(vtkm::Id threadIndex, const Invocation &invocation) const
|
||||
GetThreadIndices(const T& threadIndex,
|
||||
const OutToInArrayType& outToIn,
|
||||
const VisitArrayType& visit,
|
||||
const InputDomainType &) const
|
||||
{
|
||||
return vtkm::exec::arg::ThreadIndicesBasic(threadIndex, invocation);
|
||||
return vtkm::exec::arg::ThreadIndicesBasic(threadIndex,
|
||||
outToIn.Get(threadIndex),
|
||||
visit.Get(threadIndex) );
|
||||
}
|
||||
};
|
||||
|
||||
@ -201,12 +206,17 @@ struct TestWorkletErrorProxy : vtkm::exec::FunctorBase
|
||||
this->RaiseError(ERROR_MESSAGE);
|
||||
}
|
||||
|
||||
template<typename Invocation>
|
||||
template<typename T, typename OutToInArrayType, typename VisitArrayType, typename InputDomainType>
|
||||
VTKM_EXEC_EXPORT
|
||||
vtkm::exec::arg::ThreadIndicesBasic
|
||||
GetThreadIndices(vtkm::Id threadIndex, const Invocation &invocation) const
|
||||
GetThreadIndices(const T& threadIndex,
|
||||
const OutToInArrayType& outToIn,
|
||||
const VisitArrayType& visit,
|
||||
const InputDomainType &) const
|
||||
{
|
||||
return vtkm::exec::arg::ThreadIndicesBasic(threadIndex, invocation);
|
||||
return vtkm::exec::arg::ThreadIndicesBasic(threadIndex,
|
||||
outToIn.Get(threadIndex),
|
||||
visit.Get(threadIndex) );
|
||||
}
|
||||
};
|
||||
|
||||
@ -230,7 +240,10 @@ void CallDoWorkletInvokeFunctor(const Invocation &invocation, vtkm::Id index)
|
||||
vtkm::exec::internal::detail::DoWorkletInvokeFunctor(
|
||||
TestWorkletProxy(),
|
||||
invocation,
|
||||
vtkm::exec::arg::ThreadIndicesBasic(index, invocation));
|
||||
vtkm::exec::arg::ThreadIndicesBasic(index,
|
||||
invocation.OutputToInputMap.Get(index),
|
||||
invocation.VisitArray.Get(index) )
|
||||
);
|
||||
}
|
||||
|
||||
void TestDoWorkletInvoke()
|
||||
|
@ -23,7 +23,6 @@
|
||||
set(unit_tests
|
||||
UnitTestCellDerivative.cxx
|
||||
UnitTestCellInterpolate.cxx
|
||||
UnitTestNewtonsMethod.cxx
|
||||
UnitTestParametricCoordinates.cxx
|
||||
)
|
||||
vtkm_unit_tests(SOURCES ${unit_tests})
|
||||
|
@ -20,28 +20,31 @@
|
||||
|
||||
set(headers
|
||||
CellAverage.h
|
||||
CellFilter.h
|
||||
DataSetFilter.h
|
||||
DataSetWithFieldFilter.h
|
||||
DefaultPolicy.h
|
||||
ExternalFaces.h
|
||||
FieldFilter.h
|
||||
FieldMetadata.h
|
||||
FilterCell.h
|
||||
FilterDataSet.h
|
||||
FilterDataSetWithField.h
|
||||
FilterField.h
|
||||
FilterTraits.h
|
||||
MarchingCubes.h
|
||||
PointElevation.h
|
||||
PolicyBase.h
|
||||
PolicyDefault.h
|
||||
ResultBase.h
|
||||
ResultDataSet.h
|
||||
ResultField.h
|
||||
Threshold.h
|
||||
VertexClustering.h
|
||||
)
|
||||
|
||||
set(header_template_sources
|
||||
CellAverage.hxx
|
||||
CellFilter.hxx
|
||||
DataSetFilter.hxx
|
||||
DataSetWithFieldFilter.hxx
|
||||
ExternalFaces.hxx
|
||||
FieldFilter.hxx
|
||||
FilterCell.hxx
|
||||
FilterDataSet.hxx
|
||||
FilterDataSetWithField.hxx
|
||||
FilterField.hxx
|
||||
MarchingCubes.hxx
|
||||
PointElevation.hxx
|
||||
Threshold.hxx
|
||||
|
@ -21,13 +21,13 @@
|
||||
#ifndef vtk_m_filter_CellAverage_h
|
||||
#define vtk_m_filter_CellAverage_h
|
||||
|
||||
#include <vtkm/filter/CellFilter.h>
|
||||
#include <vtkm/filter/FilterCell.h>
|
||||
#include <vtkm/worklet/CellAverage.h>
|
||||
|
||||
namespace vtkm {
|
||||
namespace filter {
|
||||
|
||||
class CellAverage : public vtkm::filter::CellFilter<CellAverage>
|
||||
class CellAverage : public vtkm::filter::FilterCell<CellAverage>
|
||||
{
|
||||
public:
|
||||
VTKM_CONT_EXPORT
|
||||
@ -35,7 +35,7 @@ public:
|
||||
|
||||
template<typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::filter::FieldResult DoExecute(const vtkm::cont::DataSet &input,
|
||||
vtkm::filter::ResultField DoExecute(const vtkm::cont::DataSet &input,
|
||||
const vtkm::cont::ArrayHandle<T, StorageType>& field,
|
||||
const vtkm::filter::FieldMetadata& fieldMeta,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
|
||||
|
@ -28,7 +28,7 @@ namespace filter {
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
CellAverage::CellAverage():
|
||||
vtkm::filter::CellFilter<CellAverage>(),
|
||||
vtkm::filter::FilterCell<CellAverage>(),
|
||||
Worklet()
|
||||
{
|
||||
|
||||
@ -39,11 +39,12 @@ template<typename T,
|
||||
typename StorageType,
|
||||
typename DerivedPolicy,
|
||||
typename DeviceAdapter>
|
||||
vtkm::filter::FieldResult CellAverage::DoExecute(const vtkm::cont::DataSet &input,
|
||||
const vtkm::cont::ArrayHandle<T, StorageType>& field,
|
||||
const vtkm::filter::FieldMetadata&,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>&,
|
||||
const DeviceAdapter&)
|
||||
vtkm::filter::ResultField CellAverage::DoExecute(
|
||||
const vtkm::cont::DataSet &input,
|
||||
const vtkm::cont::ArrayHandle<T, StorageType> &inField,
|
||||
const vtkm::filter::FieldMetadata &fieldMetadata,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>&,
|
||||
const DeviceAdapter&)
|
||||
{
|
||||
vtkm::cont::DynamicCellSet cellSet =
|
||||
input.GetCellSet(this->GetActiveCellSetIndex());
|
||||
@ -57,14 +58,20 @@ vtkm::filter::FieldResult CellAverage::DoExecute(const vtkm::cont::DataSet &inpu
|
||||
|
||||
//todo: we need to use the policy to determine the valid conversions
|
||||
//that the dispatcher should do, including the result from GetCellSet
|
||||
dispatcher.Invoke(field, cellSet, outArray);
|
||||
dispatcher.Invoke(inField, cellSet, outArray);
|
||||
|
||||
vtkm::cont::Field outField(this->GetOutputFieldName(),
|
||||
vtkm::cont::Field::ASSOC_CELL_SET,
|
||||
cellSet.GetCellSet().GetName(),
|
||||
outArray);
|
||||
std::string outputName = this->GetOutputFieldName();
|
||||
if (outputName == "")
|
||||
{
|
||||
// Default name is name of input.
|
||||
outputName = fieldMetadata.GetName();
|
||||
}
|
||||
|
||||
return vtkm::filter::FieldResult(outField);
|
||||
return vtkm::filter::ResultField(input,
|
||||
outArray,
|
||||
outputName,
|
||||
vtkm::cont::Field::ASSOC_CELL_SET,
|
||||
cellSet.GetCellSet().GetName());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,13 +21,13 @@
|
||||
#ifndef vtk_m_filter_ExternalFaces_h
|
||||
#define vtk_m_filter_ExternalFaces_h
|
||||
|
||||
#include <vtkm/filter/DataSetFilter.h>
|
||||
#include <vtkm/filter/FilterDataSet.h>
|
||||
#include <vtkm/worklet/ExternalFaces.h>
|
||||
|
||||
namespace vtkm {
|
||||
namespace filter {
|
||||
|
||||
class ExternalFaces : public vtkm::filter::DataSetFilter<ExternalFaces>
|
||||
class ExternalFaces : public vtkm::filter::FilterDataSet<ExternalFaces>
|
||||
{
|
||||
public:
|
||||
VTKM_CONT_EXPORT
|
||||
@ -35,7 +35,7 @@ public:
|
||||
|
||||
template<typename DerivedPolicy, typename DeviceAdapter>
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::filter::DataSetResult DoExecute(const vtkm::cont::DataSet& input,
|
||||
vtkm::filter::ResultDataSet DoExecute(const vtkm::cont::DataSet& input,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
|
||||
const DeviceAdapter& tag);
|
||||
|
||||
@ -43,7 +43,7 @@ public:
|
||||
//this call is only valid
|
||||
template<typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
|
||||
VTKM_CONT_EXPORT
|
||||
bool DoMapField(vtkm::filter::DataSetResult& result,
|
||||
bool DoMapField(vtkm::filter::ResultDataSet& result,
|
||||
const vtkm::cont::ArrayHandle<T, StorageType>& input,
|
||||
const vtkm::filter::FieldMetadata& fieldMeta,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
|
||||
|
@ -83,7 +83,7 @@ public:
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
ExternalFaces::ExternalFaces():
|
||||
vtkm::filter::DataSetFilter<ExternalFaces>()
|
||||
vtkm::filter::FilterDataSet<ExternalFaces>()
|
||||
{
|
||||
|
||||
}
|
||||
@ -91,7 +91,7 @@ ExternalFaces::ExternalFaces():
|
||||
//-----------------------------------------------------------------------------
|
||||
template<typename DerivedPolicy,
|
||||
typename DeviceAdapter>
|
||||
vtkm::filter::DataSetResult ExternalFaces::DoExecute(const vtkm::cont::DataSet& input,
|
||||
vtkm::filter::ResultDataSet ExternalFaces::DoExecute(const vtkm::cont::DataSet& input,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
|
||||
const DeviceAdapter&)
|
||||
{
|
||||
@ -109,13 +109,13 @@ vtkm::filter::DataSetResult ExternalFaces::DoExecute(const vtkm::cont::DataSet&
|
||||
|
||||
if(!workletRan)
|
||||
{
|
||||
return vtkm::filter::DataSetResult();
|
||||
return vtkm::filter::ResultDataSet();
|
||||
}
|
||||
|
||||
//3. add coordinates, etc to the
|
||||
output.AddCoordinateSystem(
|
||||
input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()) );
|
||||
return vtkm::filter::DataSetResult(output);
|
||||
return vtkm::filter::ResultDataSet(output);
|
||||
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ template<typename T,
|
||||
typename StorageType,
|
||||
typename DerivedPolicy,
|
||||
typename DeviceAdapter>
|
||||
bool ExternalFaces::DoMapField(vtkm::filter::DataSetResult&,
|
||||
bool ExternalFaces::DoMapField(vtkm::filter::ResultDataSet&,
|
||||
const vtkm::cont::ArrayHandle<T, StorageType>&,
|
||||
const vtkm::filter::FieldMetadata&,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>&,
|
||||
|
@ -66,6 +66,10 @@ public:
|
||||
const std::string& GetName() const
|
||||
{return this->Name; }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::cont::Field::AssociationEnum GetAssociation() const
|
||||
{ return this->Association; }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
const std::string& GetCellSetName() const
|
||||
{return this->CellSetName; }
|
||||
|
@ -21,17 +21,17 @@
|
||||
#ifndef vtk_m_filter_CellFilter_h
|
||||
#define vtk_m_filter_CellFilter_h
|
||||
|
||||
#include <vtkm/filter/FieldFilter.h>
|
||||
#include <vtkm/filter/FilterField.h>
|
||||
|
||||
namespace vtkm {
|
||||
namespace filter {
|
||||
|
||||
template<class Derived>
|
||||
class CellFilter : public vtkm::filter::FieldFilter< Derived >
|
||||
class FilterCell : public vtkm::filter::FilterField< Derived >
|
||||
{
|
||||
public:
|
||||
VTKM_CONT_EXPORT
|
||||
CellFilter();
|
||||
FilterCell();
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
void SetActiveCellSet(vtkm::Id index)
|
||||
@ -49,6 +49,6 @@ protected:
|
||||
} // namespace vtkm::filter
|
||||
|
||||
|
||||
#include <vtkm/filter/CellFilter.hxx>
|
||||
#include <vtkm/filter/FilterCell.hxx>
|
||||
|
||||
#endif // vtk_m_filter_CellFilter_h
|
@ -24,8 +24,8 @@ namespace filter {
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
template<class Derived>
|
||||
CellFilter<Derived>::CellFilter():
|
||||
vtkm::filter::FieldFilter< Derived >(),
|
||||
FilterCell<Derived>::FilterCell():
|
||||
vtkm::filter::FilterField< Derived >(),
|
||||
CellSetIndex(0)
|
||||
{
|
||||
|
@ -27,44 +27,19 @@
|
||||
#include <vtkm/cont/Field.h>
|
||||
|
||||
#include <vtkm/filter/PolicyBase.h>
|
||||
#include <vtkm/filter/ResultDataSet.h>
|
||||
#include <vtkm/filter/internal/RuntimeDeviceTracker.h>
|
||||
|
||||
namespace vtkm {
|
||||
namespace filter {
|
||||
|
||||
class DataSetResult
|
||||
{
|
||||
public:
|
||||
VTKM_CONT_EXPORT
|
||||
DataSetResult(): Valid(false), Data()
|
||||
{ }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
DataSetResult(const vtkm::cont::DataSet& ds): Valid(true), Data(ds)
|
||||
{ }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
bool IsValid() const { return this->Valid; }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
const vtkm::cont::DataSet& GetDataSet() const { return this->Data; }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::cont::DataSet& GetDataSet() { return this->Data; }
|
||||
|
||||
private:
|
||||
bool Valid;
|
||||
vtkm::cont::DataSet Data;
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<class Derived>
|
||||
class DataSetFilter
|
||||
class FilterDataSet
|
||||
{
|
||||
public:
|
||||
VTKM_CONT_EXPORT
|
||||
DataSetFilter();
|
||||
FilterDataSet();
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
void SetActiveCellSet(vtkm::Id index)
|
||||
@ -83,11 +58,11 @@ public:
|
||||
{ return this->CoordinateSystemIndex; }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
DataSetResult Execute(const vtkm::cont::DataSet &input);
|
||||
ResultDataSet Execute(const vtkm::cont::DataSet &input);
|
||||
|
||||
template<typename DerivedPolicy>
|
||||
VTKM_CONT_EXPORT
|
||||
DataSetResult Execute(const vtkm::cont::DataSet &input,
|
||||
ResultDataSet Execute(const vtkm::cont::DataSet &input,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy );
|
||||
|
||||
//From the field we can extract the association component
|
||||
@ -97,19 +72,19 @@ public:
|
||||
// ASSOC_CELL_SET -> how do we map this?
|
||||
// ASSOC_LOGICAL_DIM -> unable to map?
|
||||
VTKM_CONT_EXPORT
|
||||
bool MapFieldOntoOutput(DataSetResult& result,
|
||||
bool MapFieldOntoOutput(ResultDataSet& result,
|
||||
const vtkm::cont::Field& field);
|
||||
|
||||
template<typename DerivedPolicy>
|
||||
VTKM_CONT_EXPORT
|
||||
bool MapFieldOntoOutput(DataSetResult& result,
|
||||
bool MapFieldOntoOutput(ResultDataSet& result,
|
||||
const vtkm::cont::Field& field,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy);
|
||||
|
||||
private:
|
||||
template<typename DerivedPolicy>
|
||||
VTKM_CONT_EXPORT
|
||||
DataSetResult PrepareForExecution(const vtkm::cont::DataSet& input,
|
||||
ResultDataSet PrepareForExecution(const vtkm::cont::DataSet& input,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy);
|
||||
|
||||
std::string OutputFieldName;
|
||||
@ -122,6 +97,6 @@ private:
|
||||
} // namespace vtkm::filter
|
||||
|
||||
|
||||
#include <vtkm/filter/DataSetFilter.hxx>
|
||||
#include <vtkm/filter/FilterDataSet.hxx>
|
||||
|
||||
#endif // vtk_m_filter_DataSetFilter_h
|
@ -18,9 +18,9 @@
|
||||
// this software.
|
||||
//============================================================================
|
||||
|
||||
#include <vtkm/filter/DefaultPolicy.h>
|
||||
#include <vtkm/filter/FieldMetadata.h>
|
||||
#include <vtkm/filter/FilterTraits.h>
|
||||
#include <vtkm/filter/PolicyDefault.h>
|
||||
|
||||
#include <vtkm/filter/internal/ResolveFieldTypeAndExecute.h>
|
||||
#include <vtkm/filter/internal/ResolveFieldTypeAndMap.h>
|
||||
@ -37,7 +37,7 @@ namespace filter {
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
template<class Derived>
|
||||
DataSetFilter<Derived>::DataSetFilter():
|
||||
FilterDataSet<Derived>::FilterDataSet():
|
||||
OutputFieldName(),
|
||||
CellSetIndex(0),
|
||||
CoordinateSystemIndex(0),
|
||||
@ -48,7 +48,7 @@ DataSetFilter<Derived>::DataSetFilter():
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template<typename Derived>
|
||||
DataSetResult DataSetFilter<Derived>::Execute(const vtkm::cont::DataSet &input)
|
||||
ResultDataSet FilterDataSet<Derived>::Execute(const vtkm::cont::DataSet &input)
|
||||
{
|
||||
return this->Execute(input, vtkm::filter::DefaultPolicy());
|
||||
}
|
||||
@ -56,7 +56,7 @@ DataSetResult DataSetFilter<Derived>::Execute(const vtkm::cont::DataSet &input)
|
||||
//-----------------------------------------------------------------------------
|
||||
template<typename Derived>
|
||||
template<typename DerivedPolicy>
|
||||
DataSetResult DataSetFilter<Derived>::Execute(const vtkm::cont::DataSet &input,
|
||||
ResultDataSet FilterDataSet<Derived>::Execute(const vtkm::cont::DataSet &input,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy )
|
||||
{
|
||||
return this->PrepareForExecution(input, policy);
|
||||
@ -66,21 +66,21 @@ DataSetResult DataSetFilter<Derived>::Execute(const vtkm::cont::DataSet &input,
|
||||
//-----------------------------------------------------------------------------
|
||||
template<typename Derived>
|
||||
template<typename DerivedPolicy>
|
||||
DataSetResult DataSetFilter<Derived>::PrepareForExecution(const vtkm::cont::DataSet &input,
|
||||
ResultDataSet FilterDataSet<Derived>::PrepareForExecution(const vtkm::cont::DataSet &input,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy )
|
||||
{
|
||||
typedef vtkm::cont::DeviceAdapterTagCuda CudaTag;
|
||||
typedef vtkm::cont::DeviceAdapterTagTBB TBBTag;
|
||||
typedef vtkm::cont::DeviceAdapterTagSerial SerialTag;
|
||||
|
||||
DataSetResult result = run_if_valid<DataSetResult>( static_cast<Derived*>(this),
|
||||
ResultDataSet result = run_if_valid<ResultDataSet>( static_cast<Derived*>(this),
|
||||
input,
|
||||
policy,
|
||||
this->Tracker,
|
||||
CudaTag() );
|
||||
if( !result.IsValid() )
|
||||
{
|
||||
result = run_if_valid<DataSetResult>( static_cast<Derived*>(this),
|
||||
result = run_if_valid<ResultDataSet>( static_cast<Derived*>(this),
|
||||
input,
|
||||
policy,
|
||||
this->Tracker,
|
||||
@ -88,7 +88,7 @@ DataSetResult DataSetFilter<Derived>::PrepareForExecution(const vtkm::cont::Data
|
||||
}
|
||||
if( !result.IsValid() )
|
||||
{
|
||||
result = run_if_valid<DataSetResult>( static_cast<Derived*>(this),
|
||||
result = run_if_valid<ResultDataSet>( static_cast<Derived*>(this),
|
||||
input,
|
||||
policy,
|
||||
this->Tracker,
|
||||
@ -100,7 +100,7 @@ DataSetResult DataSetFilter<Derived>::PrepareForExecution(const vtkm::cont::Data
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template<typename Derived>
|
||||
bool DataSetFilter<Derived>::MapFieldOntoOutput(DataSetResult& result,
|
||||
bool FilterDataSet<Derived>::MapFieldOntoOutput(ResultDataSet& result,
|
||||
const vtkm::cont::Field& field)
|
||||
{
|
||||
return this->MapFieldOntoOutput(result, field, vtkm::filter::DefaultPolicy());
|
||||
@ -109,7 +109,7 @@ bool DataSetFilter<Derived>::MapFieldOntoOutput(DataSetResult& result,
|
||||
//-----------------------------------------------------------------------------
|
||||
template<typename Derived>
|
||||
template<typename DerivedPolicy>
|
||||
bool DataSetFilter<Derived>::MapFieldOntoOutput(DataSetResult& result,
|
||||
bool FilterDataSet<Derived>::MapFieldOntoOutput(ResultDataSet& result,
|
||||
const vtkm::cont::Field& field,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy)
|
||||
{
|
||||
@ -132,7 +132,7 @@ bool DataSetFilter<Derived>::MapFieldOntoOutput(DataSetResult& result,
|
||||
|
||||
//the bool valid will be modified by the map algorithm to hold if the
|
||||
//mapping occurred or not. If the mapping was good a new field has been
|
||||
//added to the DataSetResult that was passed in.
|
||||
//added to the ResultDataSet that was passed in.
|
||||
return valid;
|
||||
|
||||
}
|
@ -27,18 +27,18 @@
|
||||
#include <vtkm/cont/Field.h>
|
||||
|
||||
#include <vtkm/filter/PolicyBase.h>
|
||||
#include <vtkm/filter/DataSetFilter.h>
|
||||
#include <vtkm/filter/ResultDataSet.h>
|
||||
#include <vtkm/filter/internal/RuntimeDeviceTracker.h>
|
||||
|
||||
namespace vtkm {
|
||||
namespace filter {
|
||||
|
||||
template<class Derived>
|
||||
class DataSetWithFieldFilter
|
||||
class FilterDataSetWithField
|
||||
{
|
||||
public:
|
||||
VTKM_CONT_EXPORT
|
||||
DataSetWithFieldFilter();
|
||||
FilterDataSetWithField();
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
void SetActiveCellSet(vtkm::Id index)
|
||||
@ -57,30 +57,30 @@ public:
|
||||
{ return this->CoordinateSystemIndex; }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
DataSetResult Execute(const vtkm::cont::DataSet &input, const std::string &inFieldName);
|
||||
ResultDataSet Execute(const vtkm::cont::DataSet &input, const std::string &inFieldName);
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
DataSetResult Execute(const vtkm::cont::DataSet &input, const vtkm::cont::Field &field);
|
||||
ResultDataSet Execute(const vtkm::cont::DataSet &input, const vtkm::cont::Field &field);
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
DataSetResult Execute(const vtkm::cont::DataSet &input, const vtkm::cont::CoordinateSystem &field);
|
||||
ResultDataSet Execute(const vtkm::cont::DataSet &input, const vtkm::cont::CoordinateSystem &field);
|
||||
|
||||
|
||||
template<typename DerivedPolicy>
|
||||
VTKM_CONT_EXPORT
|
||||
DataSetResult Execute(const vtkm::cont::DataSet &input,
|
||||
ResultDataSet Execute(const vtkm::cont::DataSet &input,
|
||||
const std::string &inFieldName,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy );
|
||||
|
||||
template<typename DerivedPolicy>
|
||||
VTKM_CONT_EXPORT
|
||||
DataSetResult Execute(const vtkm::cont::DataSet &input,
|
||||
ResultDataSet Execute(const vtkm::cont::DataSet &input,
|
||||
const vtkm::cont::Field &field,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy );
|
||||
|
||||
template<typename DerivedPolicy>
|
||||
VTKM_CONT_EXPORT
|
||||
DataSetResult Execute(const vtkm::cont::DataSet &input,
|
||||
ResultDataSet Execute(const vtkm::cont::DataSet &input,
|
||||
const vtkm::cont::CoordinateSystem &field,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy );
|
||||
|
||||
@ -91,26 +91,26 @@ public:
|
||||
// ASSOC_CELL_SET -> how do we map this?
|
||||
// ASSOC_LOGICAL_DIM -> unable to map?
|
||||
VTKM_CONT_EXPORT
|
||||
bool MapFieldOntoOutput(DataSetResult& result,
|
||||
bool MapFieldOntoOutput(ResultDataSet& result,
|
||||
const vtkm::cont::Field& field);
|
||||
|
||||
template<typename DerivedPolicy>
|
||||
VTKM_CONT_EXPORT
|
||||
bool MapFieldOntoOutput(DataSetResult& result,
|
||||
bool MapFieldOntoOutput(ResultDataSet& result,
|
||||
const vtkm::cont::Field& field,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy);
|
||||
|
||||
private:
|
||||
template<typename DerivedPolicy>
|
||||
VTKM_CONT_EXPORT
|
||||
DataSetResult PrepareForExecution(const vtkm::cont::DataSet& input,
|
||||
ResultDataSet PrepareForExecution(const vtkm::cont::DataSet& input,
|
||||
const vtkm::cont::Field& field,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy);
|
||||
|
||||
//How do we specify float/double coordinate types?
|
||||
template<typename DerivedPolicy>
|
||||
VTKM_CONT_EXPORT
|
||||
DataSetResult PrepareForExecution(const vtkm::cont::DataSet& input,
|
||||
ResultDataSet PrepareForExecution(const vtkm::cont::DataSet& input,
|
||||
const vtkm::cont::CoordinateSystem& field,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy);
|
||||
|
||||
@ -124,6 +124,6 @@ private:
|
||||
} // namespace vtkm::filter
|
||||
|
||||
|
||||
#include <vtkm/filter/DataSetWithFieldFilter.hxx>
|
||||
#include <vtkm/filter/FilterDataSetWithField.hxx>
|
||||
|
||||
#endif // vtk_m_filter_DataSetWithFieldFilter_h
|
@ -18,9 +18,9 @@
|
||||
// this software.
|
||||
//============================================================================
|
||||
|
||||
#include <vtkm/filter/DefaultPolicy.h>
|
||||
#include <vtkm/filter/FieldMetadata.h>
|
||||
#include <vtkm/filter/FilterTraits.h>
|
||||
#include <vtkm/filter/PolicyDefault.h>
|
||||
|
||||
#include <vtkm/filter/internal/ResolveFieldTypeAndExecute.h>
|
||||
#include <vtkm/filter/internal/ResolveFieldTypeAndMap.h>
|
||||
@ -37,7 +37,7 @@ namespace filter {
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
template<class Derived>
|
||||
DataSetWithFieldFilter<Derived>::DataSetWithFieldFilter():
|
||||
FilterDataSetWithField<Derived>::FilterDataSetWithField():
|
||||
OutputFieldName(),
|
||||
CellSetIndex(0),
|
||||
CoordinateSystemIndex(0),
|
||||
@ -48,7 +48,7 @@ DataSetWithFieldFilter<Derived>::DataSetWithFieldFilter():
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template<typename Derived>
|
||||
DataSetResult DataSetWithFieldFilter<Derived>::Execute(const vtkm::cont::DataSet &input,
|
||||
ResultDataSet FilterDataSetWithField<Derived>::Execute(const vtkm::cont::DataSet &input,
|
||||
const std::string &inFieldName)
|
||||
{
|
||||
return this->Execute(input,
|
||||
@ -58,7 +58,7 @@ DataSetResult DataSetWithFieldFilter<Derived>::Execute(const vtkm::cont::DataSet
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template<typename Derived>
|
||||
DataSetResult DataSetWithFieldFilter<Derived>::Execute(const vtkm::cont::DataSet &input,
|
||||
ResultDataSet FilterDataSetWithField<Derived>::Execute(const vtkm::cont::DataSet &input,
|
||||
const vtkm::cont::Field &field)
|
||||
{
|
||||
return this->Execute(input,
|
||||
@ -68,7 +68,7 @@ DataSetResult DataSetWithFieldFilter<Derived>::Execute(const vtkm::cont::DataSet
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template<typename Derived>
|
||||
DataSetResult DataSetWithFieldFilter<Derived>::Execute(const vtkm::cont::DataSet &input,
|
||||
ResultDataSet FilterDataSetWithField<Derived>::Execute(const vtkm::cont::DataSet &input,
|
||||
const vtkm::cont::CoordinateSystem &field)
|
||||
{
|
||||
return this->Execute(input,
|
||||
@ -79,7 +79,7 @@ DataSetResult DataSetWithFieldFilter<Derived>::Execute(const vtkm::cont::DataSet
|
||||
//-----------------------------------------------------------------------------
|
||||
template<typename Derived>
|
||||
template<typename DerivedPolicy>
|
||||
DataSetResult DataSetWithFieldFilter<Derived>::Execute(const vtkm::cont::DataSet &input,
|
||||
ResultDataSet FilterDataSetWithField<Derived>::Execute(const vtkm::cont::DataSet &input,
|
||||
const std::string &inFieldName,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy )
|
||||
{
|
||||
@ -91,7 +91,7 @@ DataSetResult DataSetWithFieldFilter<Derived>::Execute(const vtkm::cont::DataSet
|
||||
//-----------------------------------------------------------------------------
|
||||
template<typename Derived>
|
||||
template<typename DerivedPolicy>
|
||||
DataSetResult DataSetWithFieldFilter<Derived>::Execute(const vtkm::cont::DataSet &input,
|
||||
ResultDataSet FilterDataSetWithField<Derived>::Execute(const vtkm::cont::DataSet &input,
|
||||
const vtkm::cont::Field &field,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy )
|
||||
{
|
||||
@ -101,7 +101,7 @@ DataSetResult DataSetWithFieldFilter<Derived>::Execute(const vtkm::cont::DataSet
|
||||
//-----------------------------------------------------------------------------
|
||||
template<typename Derived>
|
||||
template<typename DerivedPolicy>
|
||||
DataSetResult DataSetWithFieldFilter<Derived>::Execute(const vtkm::cont::DataSet &input,
|
||||
ResultDataSet FilterDataSetWithField<Derived>::Execute(const vtkm::cont::DataSet &input,
|
||||
const vtkm::cont::CoordinateSystem &field,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy )
|
||||
{
|
||||
@ -113,15 +113,15 @@ DataSetResult DataSetWithFieldFilter<Derived>::Execute(const vtkm::cont::DataSet
|
||||
//-----------------------------------------------------------------------------
|
||||
template<typename Derived>
|
||||
template<typename DerivedPolicy>
|
||||
DataSetResult DataSetWithFieldFilter<Derived>::PrepareForExecution(const vtkm::cont::DataSet &input,
|
||||
ResultDataSet FilterDataSetWithField<Derived>::PrepareForExecution(const vtkm::cont::DataSet &input,
|
||||
const vtkm::cont::Field &field,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy )
|
||||
{
|
||||
vtkm::filter::FieldMetadata metaData(field);
|
||||
DataSetResult result;
|
||||
ResultDataSet result;
|
||||
|
||||
typedef internal::ResolveFieldTypeAndExecute< Derived, DerivedPolicy,
|
||||
DataSetResult > FunctorType;
|
||||
ResultDataSet > FunctorType;
|
||||
FunctorType functor(static_cast<Derived*>(this),
|
||||
input,
|
||||
metaData,
|
||||
@ -138,7 +138,7 @@ DataSetResult DataSetWithFieldFilter<Derived>::PrepareForExecution(const vtkm::c
|
||||
//-----------------------------------------------------------------------------
|
||||
template<typename Derived>
|
||||
template<typename DerivedPolicy>
|
||||
DataSetResult DataSetWithFieldFilter<Derived>::PrepareForExecution(const vtkm::cont::DataSet &input,
|
||||
ResultDataSet FilterDataSetWithField<Derived>::PrepareForExecution(const vtkm::cont::DataSet &input,
|
||||
const vtkm::cont::CoordinateSystem &field,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy )
|
||||
{
|
||||
@ -147,9 +147,9 @@ DataSetResult DataSetWithFieldFilter<Derived>::PrepareForExecution(const vtkm::c
|
||||
vtkm::filter::FieldMetadata metaData(field);
|
||||
|
||||
//determine the field type first
|
||||
DataSetResult result;
|
||||
ResultDataSet result;
|
||||
typedef internal::ResolveFieldTypeAndExecute< Derived, DerivedPolicy,
|
||||
DataSetResult > FunctorType;
|
||||
ResultDataSet > FunctorType;
|
||||
FunctorType functor(static_cast<Derived*>(this),
|
||||
input,
|
||||
metaData,
|
||||
@ -165,7 +165,7 @@ DataSetResult DataSetWithFieldFilter<Derived>::PrepareForExecution(const vtkm::c
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template<typename Derived>
|
||||
bool DataSetWithFieldFilter<Derived>::MapFieldOntoOutput(DataSetResult& result,
|
||||
bool FilterDataSetWithField<Derived>::MapFieldOntoOutput(ResultDataSet& result,
|
||||
const vtkm::cont::Field& field)
|
||||
{
|
||||
return this->MapFieldOntoOutput(result, field, vtkm::filter::DefaultPolicy());
|
||||
@ -174,7 +174,7 @@ bool DataSetWithFieldFilter<Derived>::MapFieldOntoOutput(DataSetResult& result,
|
||||
//-----------------------------------------------------------------------------
|
||||
template<typename Derived>
|
||||
template<typename DerivedPolicy>
|
||||
bool DataSetWithFieldFilter<Derived>::MapFieldOntoOutput(DataSetResult& result,
|
||||
bool FilterDataSetWithField<Derived>::MapFieldOntoOutput(ResultDataSet& result,
|
||||
const vtkm::cont::Field& field,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy)
|
||||
{
|
||||
@ -197,7 +197,7 @@ bool DataSetWithFieldFilter<Derived>::MapFieldOntoOutput(DataSetResult& result,
|
||||
|
||||
//the bool valid will be modified by the map algorithm to hold if the
|
||||
//mapping occurred or not. If the mapping was good a new field has been
|
||||
//added to the DataSetResult that was passed in.
|
||||
//added to the ResultDataSet that was passed in.
|
||||
return valid;
|
||||
|
||||
}
|
@ -26,44 +26,14 @@
|
||||
#include <vtkm/cont/Field.h>
|
||||
|
||||
#include <vtkm/filter/PolicyBase.h>
|
||||
#include <vtkm/filter/ResultField.h>
|
||||
#include <vtkm/filter/internal/RuntimeDeviceTracker.h>
|
||||
|
||||
namespace vtkm {
|
||||
namespace filter {
|
||||
|
||||
class FieldResult
|
||||
{
|
||||
public:
|
||||
VTKM_CONT_EXPORT
|
||||
FieldResult(): Valid(false), Field()
|
||||
{ }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
FieldResult(const vtkm::cont::Field& f): Valid(true), Field(f)
|
||||
{ }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
bool IsValid() const { return this->Valid; }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
const vtkm::cont::Field& GetField() const { return this->Field; }
|
||||
|
||||
template<typename T, typename StorageTag>
|
||||
VTKM_CONT_EXPORT
|
||||
bool FieldAs(vtkm::cont::ArrayHandle<T, StorageTag>& dest) const;
|
||||
|
||||
template<typename T, typename StorageTag, typename DerivedPolicy>
|
||||
VTKM_CONT_EXPORT
|
||||
bool FieldAs(vtkm::cont::ArrayHandle<T, StorageTag>& dest,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy) const;
|
||||
|
||||
private:
|
||||
bool Valid;
|
||||
vtkm::cont::Field Field;
|
||||
};
|
||||
|
||||
template<class Derived>
|
||||
class FieldFilter
|
||||
class FilterField
|
||||
{
|
||||
public:
|
||||
VTKM_CONT_EXPORT
|
||||
@ -75,30 +45,30 @@ public:
|
||||
{ return this->OutputFieldName; }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
FieldResult Execute(const vtkm::cont::DataSet &input, const std::string &inFieldName);
|
||||
ResultField Execute(const vtkm::cont::DataSet &input, const std::string &inFieldName);
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
FieldResult Execute(const vtkm::cont::DataSet &input, const vtkm::cont::Field &field);
|
||||
ResultField Execute(const vtkm::cont::DataSet &input, const vtkm::cont::Field &field);
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
FieldResult Execute(const vtkm::cont::DataSet &input, const vtkm::cont::CoordinateSystem &field);
|
||||
ResultField Execute(const vtkm::cont::DataSet &input, const vtkm::cont::CoordinateSystem &field);
|
||||
|
||||
|
||||
template<typename DerivedPolicy>
|
||||
VTKM_CONT_EXPORT
|
||||
FieldResult Execute(const vtkm::cont::DataSet &input,
|
||||
ResultField Execute(const vtkm::cont::DataSet &input,
|
||||
const std::string &inFieldName,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy );
|
||||
|
||||
template<typename DerivedPolicy>
|
||||
VTKM_CONT_EXPORT
|
||||
FieldResult Execute(const vtkm::cont::DataSet &input,
|
||||
ResultField Execute(const vtkm::cont::DataSet &input,
|
||||
const vtkm::cont::Field &field,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy );
|
||||
|
||||
template<typename DerivedPolicy>
|
||||
VTKM_CONT_EXPORT
|
||||
FieldResult Execute(const vtkm::cont::DataSet &input,
|
||||
ResultField Execute(const vtkm::cont::DataSet &input,
|
||||
const vtkm::cont::CoordinateSystem &field,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy );
|
||||
|
||||
@ -107,13 +77,13 @@ private:
|
||||
|
||||
template<typename DerivedPolicy>
|
||||
VTKM_CONT_EXPORT
|
||||
FieldResult PrepareForExecution(const vtkm::cont::DataSet& input,
|
||||
ResultField PrepareForExecution(const vtkm::cont::DataSet& input,
|
||||
const vtkm::cont::Field& field,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy);
|
||||
|
||||
template<typename DerivedPolicy>
|
||||
VTKM_CONT_EXPORT
|
||||
FieldResult PrepareForExecution(const vtkm::cont::DataSet& input,
|
||||
ResultField PrepareForExecution(const vtkm::cont::DataSet& input,
|
||||
const vtkm::cont::CoordinateSystem& field,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy);
|
||||
|
||||
@ -125,6 +95,6 @@ private:
|
||||
} // namespace vtkm::filter
|
||||
|
||||
|
||||
#include <vtkm/filter/FieldFilter.hxx>
|
||||
#include <vtkm/filter/FilterField.hxx>
|
||||
|
||||
#endif // vtk_m_filter_FieldFilter_h
|
@ -18,9 +18,9 @@
|
||||
// this software.
|
||||
//============================================================================
|
||||
|
||||
#include <vtkm/filter/DefaultPolicy.h>
|
||||
#include <vtkm/filter/FieldMetadata.h>
|
||||
#include <vtkm/filter/FilterTraits.h>
|
||||
#include <vtkm/filter/PolicyDefault.h>
|
||||
|
||||
#include <vtkm/filter/internal/ResolveFieldTypeAndExecute.h>
|
||||
|
||||
@ -35,38 +35,9 @@ namespace vtkm {
|
||||
namespace filter {
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template<typename T, typename StorageTag>
|
||||
bool FieldResult::FieldAs(vtkm::cont::ArrayHandle<T, StorageTag>& dest) const
|
||||
{
|
||||
return this->FieldAs(dest, vtkm::filter::DefaultPolicy());
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template<typename T, typename StorageTag, typename DerivedPolicy>
|
||||
bool FieldResult::FieldAs(vtkm::cont::ArrayHandle<T, StorageTag>& dest,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>&) const
|
||||
{
|
||||
try
|
||||
{
|
||||
typedef typename DerivedPolicy::FieldTypeList TypeList;
|
||||
typedef typename DerivedPolicy::FieldStorageList StorageList;
|
||||
|
||||
vtkm::cont::DynamicArrayHandle handle = this->Field.GetData();
|
||||
handle.ResetTypeAndStorageLists(TypeList(),StorageList()).CopyTo(dest);
|
||||
return true;
|
||||
}
|
||||
catch(vtkm::cont::Error e)
|
||||
{
|
||||
(void)e;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template<typename Derived>
|
||||
FieldResult FieldFilter<Derived>::Execute(const vtkm::cont::DataSet &input,
|
||||
ResultField FilterField<Derived>::Execute(const vtkm::cont::DataSet &input,
|
||||
const std::string &inFieldName)
|
||||
{
|
||||
return this->Execute(input,
|
||||
@ -76,7 +47,7 @@ FieldResult FieldFilter<Derived>::Execute(const vtkm::cont::DataSet &input,
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template<typename Derived>
|
||||
FieldResult FieldFilter<Derived>::Execute(const vtkm::cont::DataSet &input,
|
||||
ResultField FilterField<Derived>::Execute(const vtkm::cont::DataSet &input,
|
||||
const vtkm::cont::Field &field)
|
||||
{
|
||||
return this->Execute(input,
|
||||
@ -86,7 +57,7 @@ FieldResult FieldFilter<Derived>::Execute(const vtkm::cont::DataSet &input,
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template<typename Derived>
|
||||
FieldResult FieldFilter<Derived>::Execute(const vtkm::cont::DataSet &input,
|
||||
ResultField FilterField<Derived>::Execute(const vtkm::cont::DataSet &input,
|
||||
const vtkm::cont::CoordinateSystem &field)
|
||||
{
|
||||
return this->Execute(input,
|
||||
@ -97,7 +68,7 @@ FieldResult FieldFilter<Derived>::Execute(const vtkm::cont::DataSet &input,
|
||||
//-----------------------------------------------------------------------------
|
||||
template<typename Derived>
|
||||
template<typename DerivedPolicy>
|
||||
FieldResult FieldFilter<Derived>::Execute(const vtkm::cont::DataSet &input,
|
||||
ResultField FilterField<Derived>::Execute(const vtkm::cont::DataSet &input,
|
||||
const std::string &inFieldName,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy )
|
||||
{
|
||||
@ -109,7 +80,7 @@ FieldResult FieldFilter<Derived>::Execute(const vtkm::cont::DataSet &input,
|
||||
//-----------------------------------------------------------------------------
|
||||
template<typename Derived>
|
||||
template<typename DerivedPolicy>
|
||||
FieldResult FieldFilter<Derived>::Execute(const vtkm::cont::DataSet &input,
|
||||
ResultField FilterField<Derived>::Execute(const vtkm::cont::DataSet &input,
|
||||
const vtkm::cont::Field &field,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy )
|
||||
{
|
||||
@ -119,7 +90,7 @@ FieldResult FieldFilter<Derived>::Execute(const vtkm::cont::DataSet &input,
|
||||
//-----------------------------------------------------------------------------
|
||||
template<typename Derived>
|
||||
template<typename DerivedPolicy>
|
||||
FieldResult FieldFilter<Derived>::Execute(const vtkm::cont::DataSet &input,
|
||||
ResultField FilterField<Derived>::Execute(const vtkm::cont::DataSet &input,
|
||||
const vtkm::cont::CoordinateSystem &field,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy )
|
||||
{
|
||||
@ -131,15 +102,15 @@ FieldResult FieldFilter<Derived>::Execute(const vtkm::cont::DataSet &input,
|
||||
//-----------------------------------------------------------------------------
|
||||
template<typename Derived>
|
||||
template<typename DerivedPolicy>
|
||||
FieldResult FieldFilter<Derived>::PrepareForExecution(const vtkm::cont::DataSet &input,
|
||||
ResultField FilterField<Derived>::PrepareForExecution(const vtkm::cont::DataSet &input,
|
||||
const vtkm::cont::Field &field,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy )
|
||||
{
|
||||
vtkm::filter::FieldMetadata metaData(field);
|
||||
FieldResult result;
|
||||
ResultField result;
|
||||
|
||||
typedef internal::ResolveFieldTypeAndExecute< Derived, DerivedPolicy,
|
||||
FieldResult > FunctorType;
|
||||
ResultField > FunctorType;
|
||||
FunctorType functor(static_cast<Derived*>(this),
|
||||
input,
|
||||
metaData,
|
||||
@ -155,7 +126,7 @@ FieldResult FieldFilter<Derived>::PrepareForExecution(const vtkm::cont::DataSet
|
||||
//-----------------------------------------------------------------------------
|
||||
template<typename Derived>
|
||||
template<typename DerivedPolicy>
|
||||
FieldResult FieldFilter<Derived>::PrepareForExecution(const vtkm::cont::DataSet &input,
|
||||
ResultField FilterField<Derived>::PrepareForExecution(const vtkm::cont::DataSet &input,
|
||||
const vtkm::cont::CoordinateSystem &field,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy )
|
||||
{
|
||||
@ -163,10 +134,10 @@ FieldResult FieldFilter<Derived>::PrepareForExecution(const vtkm::cont::DataSet
|
||||
//the policy for the storage types and value types just for coordinate systems
|
||||
|
||||
vtkm::filter::FieldMetadata metaData(field);
|
||||
FieldResult result;
|
||||
ResultField result;
|
||||
|
||||
typedef internal::ResolveFieldTypeAndExecute< Derived, DerivedPolicy,
|
||||
FieldResult > FunctorType;
|
||||
ResultField > FunctorType;
|
||||
FunctorType functor(static_cast<Derived*>(this),
|
||||
input,
|
||||
metaData,
|
@ -21,7 +21,7 @@
|
||||
#ifndef vtk_m_filter_MarchingCubes_h
|
||||
#define vtk_m_filter_MarchingCubes_h
|
||||
|
||||
#include <vtkm/filter/DataSetWithFieldFilter.h>
|
||||
#include <vtkm/filter/FilterDataSetWithField.h>
|
||||
#include <vtkm/worklet/MarchingCubes.h>
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ namespace filter {
|
||||
*
|
||||
*/
|
||||
|
||||
class MarchingCubes : public vtkm::filter::DataSetWithFieldFilter<MarchingCubes>
|
||||
class MarchingCubes : public vtkm::filter::FilterDataSetWithField<MarchingCubes>
|
||||
{
|
||||
public:
|
||||
VTKM_CONT_EXPORT
|
||||
@ -64,7 +64,7 @@ public:
|
||||
|
||||
template<typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::filter::DataSetResult DoExecute(const vtkm::cont::DataSet& input,
|
||||
vtkm::filter::ResultDataSet DoExecute(const vtkm::cont::DataSet& input,
|
||||
const vtkm::cont::ArrayHandle<T, StorageType>& field,
|
||||
const vtkm::filter::FieldMetadata& fieldMeta,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
|
||||
@ -74,7 +74,7 @@ public:
|
||||
//this call is only valid
|
||||
template<typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
|
||||
VTKM_CONT_EXPORT
|
||||
bool DoMapField(vtkm::filter::DataSetResult& result,
|
||||
bool DoMapField(vtkm::filter::ResultDataSet& result,
|
||||
const vtkm::cont::ArrayHandle<T, StorageType>& input,
|
||||
const vtkm::filter::FieldMetadata& fieldMeta,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
|
||||
|
@ -314,7 +314,7 @@ struct FirstValueSame
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
MarchingCubes::MarchingCubes():
|
||||
vtkm::filter::DataSetWithFieldFilter<MarchingCubes>(),
|
||||
vtkm::filter::FilterDataSetWithField<MarchingCubes>(),
|
||||
IsoValue(0),
|
||||
MergeDuplicatePoints(true),
|
||||
GenerateNormals(false),
|
||||
@ -341,7 +341,7 @@ template<typename T,
|
||||
typename StorageType,
|
||||
typename DerivedPolicy,
|
||||
typename DeviceAdapter>
|
||||
vtkm::filter::DataSetResult MarchingCubes::DoExecute(const vtkm::cont::DataSet& input,
|
||||
vtkm::filter::ResultDataSet MarchingCubes::DoExecute(const vtkm::cont::DataSet& input,
|
||||
const vtkm::cont::ArrayHandle<T, StorageType>& field,
|
||||
const vtkm::filter::FieldMetadata& fieldMeta,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
|
||||
@ -357,7 +357,7 @@ vtkm::filter::DataSetResult MarchingCubes::DoExecute(const vtkm::cont::DataSet&
|
||||
{
|
||||
//todo: we need to mark this as a failure of input, not a failure
|
||||
//of the algorithm
|
||||
return vtkm::filter::DataSetResult();
|
||||
return vtkm::filter::ResultDataSet();
|
||||
}
|
||||
|
||||
//get the cells and coordinates of the dataset
|
||||
@ -526,7 +526,7 @@ vtkm::filter::DataSetResult MarchingCubes::DoExecute(const vtkm::cont::DataSet&
|
||||
output.AddCoordinateSystem( outputCoords );
|
||||
|
||||
//todo: figure out how to pass the fields to interpolate to the Result
|
||||
return vtkm::filter::DataSetResult(output);
|
||||
return vtkm::filter::ResultDataSet(output);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -534,7 +534,7 @@ template<typename T,
|
||||
typename StorageType,
|
||||
typename DerivedPolicy,
|
||||
typename DeviceAdapter>
|
||||
bool MarchingCubes::DoMapField(vtkm::filter::DataSetResult& result,
|
||||
bool MarchingCubes::DoMapField(vtkm::filter::ResultDataSet& result,
|
||||
const vtkm::cont::ArrayHandle<T, StorageType>& input,
|
||||
const vtkm::filter::FieldMetadata& fieldMeta,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>&,
|
||||
|
@ -21,14 +21,14 @@
|
||||
#ifndef vtk_m_filter_PointElevation_h
|
||||
#define vtk_m_filter_PointElevation_h
|
||||
|
||||
#include <vtkm/filter/FieldFilter.h>
|
||||
#include <vtkm/filter/FilterField.h>
|
||||
#include <vtkm/worklet/PointElevation.h>
|
||||
|
||||
|
||||
namespace vtkm {
|
||||
namespace filter {
|
||||
|
||||
class PointElevation : public vtkm::filter::FieldFilter<PointElevation>
|
||||
class PointElevation : public vtkm::filter::FilterField<PointElevation>
|
||||
{
|
||||
public:
|
||||
VTKM_CONT_EXPORT
|
||||
@ -46,7 +46,7 @@ public:
|
||||
|
||||
template<typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::filter::FieldResult DoExecute(const vtkm::cont::DataSet &input,
|
||||
vtkm::filter::ResultField DoExecute(const vtkm::cont::DataSet &input,
|
||||
const vtkm::cont::ArrayHandle<T, StorageType> &field,
|
||||
const vtkm::filter::FieldMetadata& fieldMeta,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
|
||||
|
@ -28,7 +28,7 @@ namespace filter {
|
||||
PointElevation::PointElevation():
|
||||
Worklet()
|
||||
{
|
||||
|
||||
this->SetOutputFieldName("elevation");
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -54,10 +54,10 @@ template<typename T,
|
||||
typename StorageType,
|
||||
typename DerivedPolicy,
|
||||
typename DeviceAdapter>
|
||||
vtkm::filter::FieldResult
|
||||
PointElevation::DoExecute(const vtkm::cont::DataSet &,
|
||||
vtkm::filter::ResultField
|
||||
PointElevation::DoExecute(const vtkm::cont::DataSet &inDataSet,
|
||||
const vtkm::cont::ArrayHandle<T,StorageType> &field,
|
||||
const vtkm::filter::FieldMetadata&,
|
||||
const vtkm::filter::FieldMetadata &fieldMetadata,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>&,
|
||||
const DeviceAdapter&)
|
||||
{
|
||||
@ -69,10 +69,11 @@ PointElevation::DoExecute(const vtkm::cont::DataSet &,
|
||||
//that the dispatcher should do
|
||||
dispatcher.Invoke(field, outArray);
|
||||
|
||||
vtkm::cont::Field outField(this->GetOutputFieldName(),
|
||||
vtkm::cont::Field::ASSOC_WHOLE_MESH,
|
||||
outArray);
|
||||
return vtkm::filter::FieldResult(outField);
|
||||
return vtkm::filter::ResultField(inDataSet,
|
||||
outArray,
|
||||
this->GetOutputFieldName(),
|
||||
fieldMetadata.GetAssociation(),
|
||||
fieldMetadata.GetCellSetName());
|
||||
}
|
||||
|
||||
}
|
||||
|
90
vtkm/filter/ResultBase.h
Normal file
90
vtkm/filter/ResultBase.h
Normal file
@ -0,0 +1,90 @@
|
||||
//============================================================================
|
||||
// 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 2016 Sandia Corporation.
|
||||
// Copyright 2016 UT-Battelle, LLC.
|
||||
// Copyright 2016 Los Alamos National Security.
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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_filter_ResultBase_h
|
||||
#define vtk_m_filter_ResultBase_h
|
||||
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
|
||||
namespace vtkm {
|
||||
namespace filter {
|
||||
|
||||
/// \brief Base class for result returned from a filter.
|
||||
///
|
||||
/// \c ResultBase is the base class for the return value from any filter. It
|
||||
/// contains a valid flag that signals whether the filter successfully
|
||||
/// executed. Also, every filter produces some data on a data set. The
|
||||
/// resulting data set is also available from this base clase.
|
||||
///
|
||||
/// Subclasses may define additional data (usually subparts of the data set)
|
||||
/// specific to the type of operation.
|
||||
///
|
||||
class ResultBase
|
||||
{
|
||||
public:
|
||||
/// Returns true if these results are from a successful execution of a
|
||||
/// filter.
|
||||
///
|
||||
VTKM_CONT_EXPORT
|
||||
bool IsValid() const { return this->Valid; }
|
||||
|
||||
/// Returns the results of the filter in terms of a \c DataSet.
|
||||
///
|
||||
VTKM_CONT_EXPORT
|
||||
const vtkm::cont::DataSet &GetDataSet() const { return this->Data; }
|
||||
|
||||
protected:
|
||||
VTKM_CONT_EXPORT
|
||||
ResultBase(): Valid(false) { }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
ResultBase(const vtkm::cont::DataSet &dataSet)
|
||||
: Valid(true), Data(dataSet) { }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
void SetValid(bool valid)
|
||||
{
|
||||
this->Valid = valid;
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
void SetDataSet(const vtkm::cont::DataSet &dataSet)
|
||||
{
|
||||
this->Data = dataSet;
|
||||
this->SetValid(true);
|
||||
}
|
||||
|
||||
/// Returns a writable reference to the data set.
|
||||
///
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::cont::DataSet &GetDataSetReference()
|
||||
{
|
||||
return this->Data;
|
||||
}
|
||||
|
||||
private:
|
||||
bool Valid;
|
||||
vtkm::cont::DataSet Data;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace vtkm::filter
|
||||
|
||||
#endif //vtk_m_filter_ResultBase_h
|
65
vtkm/filter/ResultDataSet.h
Normal file
65
vtkm/filter/ResultDataSet.h
Normal file
@ -0,0 +1,65 @@
|
||||
//============================================================================
|
||||
// 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 2016 Sandia Corporation.
|
||||
// Copyright 2016 UT-Battelle, LLC.
|
||||
// Copyright 2016 Los Alamos National Security.
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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_filter_ResultDataSet_h
|
||||
#define vtk_m_filter_ResultDataSet_h
|
||||
|
||||
#include <vtkm/filter/ResultBase.h>
|
||||
|
||||
namespace vtkm {
|
||||
namespace filter {
|
||||
|
||||
/// \brief Results for filters that generate new geometry
|
||||
///
|
||||
/// \c ResultDataSet contains the results for a filter that generates
|
||||
/// a wholly new data set (new geometry). Typically little if any data
|
||||
/// is shared between the filter input and this result.
|
||||
///
|
||||
/// Also, data set filters often have secondary operations on the resulting
|
||||
/// data structure (such as interpolating fields). Thus, this class also
|
||||
/// allows you to get modifiable versions of the data set.
|
||||
///
|
||||
class ResultDataSet : public vtkm::filter::ResultBase
|
||||
{
|
||||
public:
|
||||
VTKM_CONT_EXPORT
|
||||
ResultDataSet() { }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
ResultDataSet(const vtkm::cont::DataSet &dataSet)
|
||||
: ResultBase(dataSet) { }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
const vtkm::cont::DataSet &GetDataSet() const
|
||||
{
|
||||
return this->ResultBase::GetDataSet();
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::cont::DataSet &GetDataSet()
|
||||
{
|
||||
return this->ResultBase::GetDataSetReference();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace vtkm::filter
|
||||
|
||||
#endif //vtk_m_filter_ResultDataSet_h
|
197
vtkm/filter/ResultField.h
Normal file
197
vtkm/filter/ResultField.h
Normal file
@ -0,0 +1,197 @@
|
||||
//============================================================================
|
||||
// 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 2016 Sandia Corporation.
|
||||
// Copyright 2016 UT-Battelle, LLC.
|
||||
// Copyright 2016 Los Alamos National Security.
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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_filter_ResultField_h
|
||||
#define vtk_m_filter_ResultField_h
|
||||
|
||||
#include <vtkm/filter/ResultBase.h>
|
||||
|
||||
#include <vtkm/cont/Field.h>
|
||||
|
||||
namespace vtkm {
|
||||
namespace filter {
|
||||
|
||||
/// \brief Results for filters that create a field
|
||||
///
|
||||
/// \c ResultField contains the results for a filter that generates a new
|
||||
/// field. The geometry of the underlying data is a shallow copy of the
|
||||
/// original input.
|
||||
///
|
||||
/// This class also holds the field that has been added.
|
||||
///
|
||||
class ResultField : public vtkm::filter::ResultBase
|
||||
{
|
||||
public:
|
||||
VTKM_CONT_EXPORT
|
||||
ResultField() { }
|
||||
|
||||
/// Use this constructor if the field has already been added to the data set.
|
||||
/// In this case, just tell us what the field name is (and optionally its
|
||||
/// association).
|
||||
///
|
||||
VTKM_CONT_EXPORT
|
||||
ResultField(const vtkm::cont::DataSet &dataSet,
|
||||
const std::string &fieldName,
|
||||
vtkm::cont::Field::AssociationEnum fieldAssociation
|
||||
= vtkm::cont::Field::ASSOC_ANY)
|
||||
: ResultBase(dataSet),
|
||||
FieldName(fieldName),
|
||||
FieldAssociation(fieldAssociation)
|
||||
{
|
||||
VTKM_ASSERT(fieldName != "");
|
||||
VTKM_ASSERT(dataSet.HasField(fieldName, fieldAssociation));
|
||||
}
|
||||
|
||||
/// Use this constructor if you have build a \c Field object. An output
|
||||
/// \c DataSet will be created by adding the field to the input.
|
||||
///
|
||||
VTKM_CONT_EXPORT
|
||||
ResultField(const vtkm::cont::DataSet &inDataSet,
|
||||
const vtkm::cont::Field &field)
|
||||
: FieldName(field.GetName()), FieldAssociation(field.GetAssociation())
|
||||
{
|
||||
VTKM_ASSERT(this->FieldName != "");
|
||||
|
||||
vtkm::cont::DataSet outDataSet = inDataSet;
|
||||
outDataSet.AddField(field);
|
||||
this->SetDataSet(outDataSet);
|
||||
|
||||
// Sanity check.
|
||||
VTKM_ASSERT(this->GetDataSet().HasField(this->FieldName,
|
||||
this->FieldAssociation));
|
||||
}
|
||||
|
||||
/// Use this constructor if you have an ArrayHandle that holds the data for
|
||||
/// the field. You also need to specify a name and an association for the
|
||||
/// field. If the field is associated with a particular element set (for
|
||||
/// example, a cell association is associated with a cell set), the name of
|
||||
/// that associated set must also be given. The element set name is ignored
|
||||
/// for \c ASSOC_WHOLE_MESH and \c ASSOC_POINTS associations.
|
||||
///
|
||||
template<typename T, typename Storage>
|
||||
VTKM_CONT_EXPORT
|
||||
ResultField(const vtkm::cont::DataSet &inDataSet,
|
||||
const vtkm::cont::ArrayHandle<T, Storage> &fieldArray,
|
||||
const std::string &fieldName,
|
||||
vtkm::cont::Field::AssociationEnum fieldAssociation,
|
||||
const std::string &elementSetName = "")
|
||||
: FieldName(fieldName), FieldAssociation(fieldAssociation)
|
||||
{
|
||||
VTKM_ASSERT(fieldName != "");
|
||||
VTKM_ASSERT(fieldAssociation != vtkm::cont::Field::ASSOC_ANY);
|
||||
VTKM_ASSERT(fieldAssociation != vtkm::cont::Field::ASSOC_LOGICAL_DIM);
|
||||
|
||||
vtkm::cont::DataSet outDataSet = inDataSet;
|
||||
|
||||
if ((fieldAssociation == vtkm::cont::Field::ASSOC_WHOLE_MESH) ||
|
||||
(fieldAssociation == vtkm::cont::Field::ASSOC_POINTS))
|
||||
{
|
||||
vtkm::cont::Field field(fieldName, fieldAssociation, fieldArray);
|
||||
outDataSet.AddField(field);
|
||||
}
|
||||
else
|
||||
{
|
||||
vtkm::cont::Field field(fieldName,
|
||||
fieldAssociation,
|
||||
elementSetName,
|
||||
fieldArray);
|
||||
outDataSet.AddField(field);
|
||||
}
|
||||
|
||||
this->SetDataSet(outDataSet);
|
||||
|
||||
// Sanity check.
|
||||
VTKM_ASSERT(this->GetDataSet().HasField(this->FieldName,
|
||||
this->FieldAssociation));
|
||||
}
|
||||
|
||||
/// Use this constructor if you have a DynamicArrayHandle that holds the data
|
||||
/// for the field. You also need to specify a name and an association for the
|
||||
/// field. If the field is associated with a particular element set (for
|
||||
/// example, a cell association is associated with a cell set), the name of
|
||||
/// that associated set must also be given. The element set name is ignored
|
||||
/// for \c ASSOC_WHOLE_MESH and \c ASSOC_POINTS associations.
|
||||
///
|
||||
VTKM_CONT_EXPORT
|
||||
ResultField(const vtkm::cont::DataSet &inDataSet,
|
||||
const vtkm::cont::DynamicArrayHandle &fieldArray,
|
||||
const std::string &fieldName,
|
||||
vtkm::cont::Field::AssociationEnum fieldAssociation,
|
||||
const std::string &elementSetName = "")
|
||||
: FieldName(fieldName), FieldAssociation(fieldAssociation)
|
||||
{
|
||||
VTKM_ASSERT(fieldName != "");
|
||||
VTKM_ASSERT(fieldAssociation != vtkm::cont::Field::ASSOC_ANY);
|
||||
VTKM_ASSERT(fieldAssociation != vtkm::cont::Field::ASSOC_LOGICAL_DIM);
|
||||
|
||||
vtkm::cont::DataSet outDataSet = inDataSet;
|
||||
|
||||
if ((fieldAssociation == vtkm::cont::Field::ASSOC_WHOLE_MESH) ||
|
||||
(fieldAssociation == vtkm::cont::Field::ASSOC_POINTS))
|
||||
{
|
||||
vtkm::cont::Field field(fieldName, fieldAssociation, fieldArray);
|
||||
outDataSet.AddField(field);
|
||||
}
|
||||
else
|
||||
{
|
||||
vtkm::cont::Field field(fieldName,
|
||||
fieldAssociation,
|
||||
elementSetName,
|
||||
fieldArray);
|
||||
outDataSet.AddField(field);
|
||||
}
|
||||
|
||||
this->SetDataSet(outDataSet);
|
||||
|
||||
// Sanity check.
|
||||
VTKM_ASSERT(this->GetDataSet().HasField(this->FieldName,
|
||||
this->FieldAssociation));
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
const vtkm::cont::Field &GetField() const
|
||||
{
|
||||
return this->GetDataSet().GetField(this->FieldName, this->FieldAssociation);
|
||||
}
|
||||
|
||||
template<typename T, typename Storage>
|
||||
VTKM_CONT_EXPORT
|
||||
bool FieldAs(vtkm::cont::ArrayHandle<T, Storage> &dest) const
|
||||
{
|
||||
try
|
||||
{
|
||||
this->GetField().GetData().CopyTo(dest);
|
||||
return true;
|
||||
}
|
||||
catch(vtkm::cont::Error)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
std::string FieldName;
|
||||
vtkm::cont::Field::AssociationEnum FieldAssociation;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace vtkm::filter
|
||||
|
||||
#endif //vtk_m_filter_ResultField_h
|
@ -21,13 +21,13 @@
|
||||
#ifndef vtk_m_filter_Threshold_h
|
||||
#define vtk_m_filter_Threshold_h
|
||||
|
||||
#include <vtkm/filter/DataSetWithFieldFilter.h>
|
||||
#include <vtkm/filter/FilterDataSetWithField.h>
|
||||
#include <vtkm/worklet/Threshold.h>
|
||||
|
||||
namespace vtkm {
|
||||
namespace filter {
|
||||
|
||||
class Threshold : public vtkm::filter::DataSetWithFieldFilter<Threshold>
|
||||
class Threshold : public vtkm::filter::FilterDataSetWithField<Threshold>
|
||||
{
|
||||
public:
|
||||
VTKM_CONT_EXPORT
|
||||
@ -45,7 +45,7 @@ public:
|
||||
|
||||
template<typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::filter::DataSetResult DoExecute(const vtkm::cont::DataSet& input,
|
||||
vtkm::filter::ResultDataSet DoExecute(const vtkm::cont::DataSet& input,
|
||||
const vtkm::cont::ArrayHandle<T, StorageType>& field,
|
||||
const vtkm::filter::FieldMetadata& fieldMeta,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
|
||||
@ -55,7 +55,7 @@ public:
|
||||
//this call is only valid
|
||||
template<typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
|
||||
VTKM_CONT_EXPORT
|
||||
bool DoMapField(vtkm::filter::DataSetResult& result,
|
||||
bool DoMapField(vtkm::filter::ResultDataSet& result,
|
||||
const vtkm::cont::ArrayHandle<T, StorageType>& input,
|
||||
const vtkm::filter::FieldMetadata& fieldMeta,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
|
||||
|
@ -81,7 +81,7 @@ namespace filter {
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
Threshold::Threshold():
|
||||
vtkm::filter::DataSetWithFieldFilter<Threshold>(),
|
||||
vtkm::filter::FilterDataSetWithField<Threshold>(),
|
||||
LowerValue(0),
|
||||
UpperValue(0),
|
||||
ValidCellIds()
|
||||
@ -94,7 +94,7 @@ template<typename T,
|
||||
typename StorageType,
|
||||
typename DerivedPolicy,
|
||||
typename DeviceAdapter>
|
||||
vtkm::filter::DataSetResult Threshold::DoExecute(const vtkm::cont::DataSet& input,
|
||||
vtkm::filter::ResultDataSet Threshold::DoExecute(const vtkm::cont::DataSet& input,
|
||||
const vtkm::cont::ArrayHandle<T, StorageType>& field,
|
||||
const vtkm::filter::FieldMetadata& fieldMeta,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
|
||||
@ -126,7 +126,7 @@ vtkm::filter::DataSetResult Threshold::DoExecute(const vtkm::cont::DataSet& inpu
|
||||
{
|
||||
//todo: we need to mark this as a failure of input, not a failure
|
||||
//of the algorithm
|
||||
return vtkm::filter::DataSetResult();
|
||||
return vtkm::filter::ResultDataSet();
|
||||
}
|
||||
|
||||
typedef vtkm::cont::DeviceAdapterAlgorithm<DeviceAdapter> Algorithm;
|
||||
@ -156,7 +156,7 @@ template<typename T,
|
||||
typename StorageType,
|
||||
typename DerivedPolicy,
|
||||
typename DeviceAdapter>
|
||||
bool Threshold::DoMapField(vtkm::filter::DataSetResult& result,
|
||||
bool Threshold::DoMapField(vtkm::filter::ResultDataSet& result,
|
||||
const vtkm::cont::ArrayHandle<T, StorageType>& input,
|
||||
const vtkm::filter::FieldMetadata& fieldMeta,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>&,
|
||||
|
@ -21,13 +21,13 @@
|
||||
#ifndef vtk_m_filter_VertexClustering_h
|
||||
#define vtk_m_filter_VertexClustering_h
|
||||
|
||||
#include <vtkm/filter/DataSetFilter.h>
|
||||
#include <vtkm/filter/FilterDataSet.h>
|
||||
#include <vtkm/worklet/VertexClustering.h>
|
||||
|
||||
namespace vtkm {
|
||||
namespace filter {
|
||||
|
||||
class VertexClustering : public vtkm::filter::DataSetFilter<VertexClustering>
|
||||
class VertexClustering : public vtkm::filter::FilterDataSet<VertexClustering>
|
||||
{
|
||||
public:
|
||||
VTKM_CONT_EXPORT
|
||||
@ -41,7 +41,7 @@ public:
|
||||
|
||||
template<typename DerivedPolicy, typename DeviceAdapter>
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::filter::DataSetResult DoExecute(const vtkm::cont::DataSet& input,
|
||||
vtkm::filter::ResultDataSet DoExecute(const vtkm::cont::DataSet& input,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
|
||||
const DeviceAdapter& tag);
|
||||
|
||||
@ -49,7 +49,7 @@ public:
|
||||
//this call is only valid
|
||||
template<typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
|
||||
VTKM_CONT_EXPORT
|
||||
bool DoMapField(vtkm::filter::DataSetResult& result,
|
||||
bool DoMapField(vtkm::filter::ResultDataSet& result,
|
||||
const vtkm::cont::ArrayHandle<T, StorageType>& input,
|
||||
const vtkm::filter::FieldMetadata& fieldMeta,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
|
||||
|
@ -41,7 +41,7 @@ namespace
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
VertexClustering::VertexClustering():
|
||||
vtkm::filter::DataSetFilter<VertexClustering>(),
|
||||
vtkm::filter::FilterDataSet<VertexClustering>(),
|
||||
NumberOfDivisions(256, 256, 256)
|
||||
{
|
||||
|
||||
@ -50,7 +50,7 @@ VertexClustering::VertexClustering():
|
||||
//-----------------------------------------------------------------------------
|
||||
template<typename DerivedPolicy,
|
||||
typename DeviceAdapter>
|
||||
vtkm::filter::DataSetResult VertexClustering::DoExecute(const vtkm::cont::DataSet& input,
|
||||
vtkm::filter::ResultDataSet VertexClustering::DoExecute(const vtkm::cont::DataSet& input,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
|
||||
const DeviceAdapter& tag)
|
||||
{
|
||||
@ -68,7 +68,7 @@ vtkm::filter::DataSetResult VertexClustering::DoExecute(const vtkm::cont::DataSe
|
||||
this->GetNumberOfDivisions(),
|
||||
tag);
|
||||
|
||||
return vtkm::filter::DataSetResult(outDataSet);
|
||||
return vtkm::filter::ResultDataSet(outDataSet);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -76,7 +76,7 @@ template<typename T,
|
||||
typename StorageType,
|
||||
typename DerivedPolicy,
|
||||
typename DeviceAdapter>
|
||||
bool VertexClustering::DoMapField(vtkm::filter::DataSetResult&,
|
||||
bool VertexClustering::DoMapField(vtkm::filter::ResultDataSet&,
|
||||
const vtkm::cont::ArrayHandle<T, StorageType>&,
|
||||
const vtkm::filter::FieldMetadata&,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>&,
|
||||
|
@ -150,13 +150,6 @@ struct CanExecute<ReturnType,true>
|
||||
//another device adapter
|
||||
std::cerr << "caught ErrorControlBadValue : " << e.GetMessage() << std::endl;
|
||||
}
|
||||
catch(vtkm::cont::ErrorControlAssert e)
|
||||
{
|
||||
//assert occurred, generally caused by going out of bounds on an array
|
||||
//this won't be solved by trying a different device adapter
|
||||
//so stop the filter
|
||||
std::cerr << "caught ErrorControlAssert : " << e.GetMessage() << std::endl;
|
||||
}
|
||||
catch(vtkm::cont::Error e)
|
||||
{
|
||||
//general errors should be caught and let us try the next device adapter.
|
||||
@ -204,13 +197,6 @@ struct CanExecute<ReturnType,true>
|
||||
//another device adapter
|
||||
std::cerr << "caught ErrorControlBadValue : " << e.GetMessage() << std::endl;
|
||||
}
|
||||
catch(vtkm::cont::ErrorControlAssert e)
|
||||
{
|
||||
//assert occurred, generally caused by going out of bounds on an array
|
||||
//this won't be solved by trying a different device adapter
|
||||
//so stop the filter
|
||||
std::cerr << "caught ErrorControlAssert : " << e.GetMessage() << std::endl;
|
||||
}
|
||||
catch(vtkm::cont::Error e)
|
||||
{
|
||||
//general errors should be caught and let us try the next device adapter.
|
||||
|
@ -30,7 +30,7 @@
|
||||
//forward declarations needed
|
||||
namespace vtkm {
|
||||
namespace filter {
|
||||
class DataSetResult;
|
||||
class ResultDataSet;
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ template<typename ClassType,
|
||||
typename DeviceAdapterTag
|
||||
>
|
||||
bool map_if_valid(ClassType* c,
|
||||
vtkm::filter::DataSetResult& input,
|
||||
vtkm::filter::ResultDataSet& input,
|
||||
const ArrayType &field,
|
||||
const vtkm::filter::FieldMetadata& fieldMeta,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
|
||||
@ -70,7 +70,7 @@ struct CanMap<false>
|
||||
typename DerivedPolicy,
|
||||
typename DeviceAdapterTag>
|
||||
static bool Run(ClassType*,
|
||||
vtkm::filter::DataSetResult&,
|
||||
vtkm::filter::ResultDataSet&,
|
||||
const ArrayType &,
|
||||
const vtkm::filter::FieldMetadata&,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>&,
|
||||
@ -91,7 +91,7 @@ struct CanMap<true>
|
||||
typename DerivedPolicy,
|
||||
typename DeviceAdapterTag>
|
||||
static bool Run(ClassType* c,
|
||||
vtkm::filter::DataSetResult& input,
|
||||
vtkm::filter::ResultDataSet& input,
|
||||
const ArrayType &field,
|
||||
const vtkm::filter::FieldMetadata& fieldMeta,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
|
||||
@ -126,13 +126,6 @@ struct CanMap<true>
|
||||
//another device adapter
|
||||
std::cerr << "caught ErrorControlBadValue : " << e.GetMessage() << std::endl;
|
||||
}
|
||||
catch(vtkm::cont::ErrorControlAssert e)
|
||||
{
|
||||
//assert occurred, generally caused by going out of bounds on an array
|
||||
//this won't be solved by trying a different device adapter
|
||||
//so stop the filter
|
||||
std::cerr << "caught ErrorControlAssert : " << e.GetMessage() << std::endl;
|
||||
}
|
||||
catch(vtkm::cont::Error e)
|
||||
{
|
||||
//general errors should be caught and let us try the next device adapter.
|
||||
@ -155,7 +148,7 @@ namespace
|
||||
struct ResolveFieldTypeAndMap
|
||||
{
|
||||
Derived* DerivedClass;
|
||||
vtkm::filter::DataSetResult& InputResult;
|
||||
vtkm::filter::ResultDataSet& InputResult;
|
||||
const vtkm::filter::FieldMetadata& Metadata;
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& Policy;
|
||||
vtkm::filter::internal::RuntimeDeviceTracker& Tracker;
|
||||
@ -163,7 +156,7 @@ namespace
|
||||
|
||||
|
||||
ResolveFieldTypeAndMap(Derived* derivedClass,
|
||||
vtkm::filter::DataSetResult& inResult,
|
||||
vtkm::filter::ResultDataSet& inResult,
|
||||
const vtkm::filter::FieldMetadata& fieldMeta,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
|
||||
vtkm::filter::internal::RuntimeDeviceTracker& tracker,
|
||||
|
@ -31,12 +31,17 @@ void TestCellAverageRegular3D()
|
||||
vtkm::cont::testing::MakeTestDataSet testDataSet;
|
||||
vtkm::cont::DataSet dataSet = testDataSet.Make3DUniformDataSet0();
|
||||
|
||||
vtkm::filter::FieldResult result;
|
||||
vtkm::filter::ResultField result;
|
||||
vtkm::filter::CellAverage cavg;
|
||||
cavg.SetOutputFieldName("avgvals");
|
||||
|
||||
result = cavg.Execute( dataSet, dataSet.GetField("pointvar"));
|
||||
|
||||
VTKM_TEST_ASSERT(result.GetField().GetName() == "avgvals",
|
||||
"Field was given the wrong name.");
|
||||
VTKM_TEST_ASSERT(result.GetField().GetAssociation() ==
|
||||
vtkm::cont::Field::ASSOC_CELL_SET,
|
||||
"Field was given the wrong association.");
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> resultArrayHandle;
|
||||
const bool valid = result.FieldAs(resultArrayHandle);
|
||||
|
||||
@ -58,12 +63,17 @@ void TestCellAverageRegular2D()
|
||||
vtkm::cont::testing::MakeTestDataSet testDataSet;
|
||||
vtkm::cont::DataSet dataSet = testDataSet.Make2DUniformDataSet0();
|
||||
|
||||
vtkm::filter::FieldResult result;
|
||||
vtkm::filter::ResultField result;
|
||||
vtkm::filter::CellAverage cavg;
|
||||
cavg.SetOutputFieldName("avgvals");
|
||||
|
||||
result = cavg.Execute( dataSet, dataSet.GetField("pointvar"));
|
||||
|
||||
// If no name is given, should have the same name as the input.
|
||||
VTKM_TEST_ASSERT(result.GetField().GetName() == "pointvar",
|
||||
"Field was given the wrong name.");
|
||||
VTKM_TEST_ASSERT(result.GetField().GetAssociation() ==
|
||||
vtkm::cont::Field::ASSOC_CELL_SET,
|
||||
"Field was given the wrong association.");
|
||||
vtkm::cont::Field resultField = result.GetField();
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> resultArrayHandle;
|
||||
resultField.GetData().CopyTo(resultArrayHandle);
|
||||
@ -86,12 +96,17 @@ void TestCellAverageExplicit()
|
||||
vtkm::cont::testing::MakeTestDataSet testDataSet;
|
||||
vtkm::cont::DataSet dataSet = testDataSet.Make3DExplicitDataSet0();
|
||||
|
||||
vtkm::filter::FieldResult result;
|
||||
vtkm::filter::ResultField result;
|
||||
vtkm::filter::CellAverage cavg;
|
||||
cavg.SetOutputFieldName("avgvals");
|
||||
|
||||
result = cavg.Execute( dataSet, dataSet.GetField("pointvar"));
|
||||
|
||||
// If no name is given, should have the same name as the input.
|
||||
VTKM_TEST_ASSERT(result.GetField().GetName() == "pointvar",
|
||||
"Field was given the wrong name.");
|
||||
VTKM_TEST_ASSERT(result.GetField().GetAssociation() ==
|
||||
vtkm::cont::Field::ASSOC_CELL_SET,
|
||||
"Field was given the wrong association.");
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> resultArrayHandle;
|
||||
const bool valid = result.FieldAs(resultArrayHandle);
|
||||
|
||||
|
@ -77,7 +77,7 @@ void TestExternalFacesExplicitGrid()
|
||||
|
||||
//Run the External Faces filter
|
||||
vtkm::filter::ExternalFaces externalFaces;
|
||||
vtkm::filter::DataSetResult result = externalFaces.Execute(ds);
|
||||
vtkm::filter::ResultDataSet result = externalFaces.Execute(ds);
|
||||
|
||||
//Validate the number of external faces (output) returned by the worklet
|
||||
VTKM_TEST_ASSERT(result.IsValid(), "Results should be valid");
|
||||
|
@ -264,7 +264,7 @@ void TestMarchingCubesUniformGrid()
|
||||
vtkm::Id3 dims(4,4,4);
|
||||
vtkm::cont::DataSet dataSet = MakeIsosurfaceTestDataSet(dims);
|
||||
|
||||
vtkm::filter::DataSetResult result;
|
||||
vtkm::filter::ResultDataSet result;
|
||||
vtkm::filter::MarchingCubes mc;
|
||||
|
||||
mc.SetGenerateNormals(true);
|
||||
@ -274,7 +274,7 @@ void TestMarchingCubesUniformGrid()
|
||||
dataSet.GetField("nodevar") );
|
||||
|
||||
{
|
||||
vtkm::cont::DataSet& outputData = result.GetDataSet();
|
||||
const vtkm::cont::DataSet& outputData = result.GetDataSet();
|
||||
VTKM_TEST_ASSERT(outputData.GetNumberOfCellSets() == 1,
|
||||
"Wrong number of cellsets in the output dataset");
|
||||
VTKM_TEST_ASSERT(outputData.GetNumberOfCoordinateSystems() == 1,
|
||||
@ -308,7 +308,7 @@ void TestMarchingCubesUniformGrid()
|
||||
dataSet.GetField("nodevar") );
|
||||
|
||||
{
|
||||
vtkm::cont::DataSet& outputData = result.GetDataSet();
|
||||
const vtkm::cont::DataSet& outputData = result.GetDataSet();
|
||||
vtkm::cont::CoordinateSystem coords = outputData.GetCoordinateSystem();
|
||||
|
||||
VTKM_TEST_ASSERT(coords.GetData().GetNumberOfValues() == 480,
|
||||
@ -336,7 +336,7 @@ void TestMarchingCubesCustomPolicy()
|
||||
|
||||
vtkm::cont::Field contourField = dataSet.GetField("distanceToOrigin");
|
||||
|
||||
vtkm::filter::DataSetResult result;
|
||||
vtkm::filter::ResultDataSet result;
|
||||
vtkm::filter::MarchingCubes mc;
|
||||
|
||||
mc.SetGenerateNormals( false );
|
||||
@ -352,7 +352,7 @@ void TestMarchingCubesCustomPolicy()
|
||||
mc.MapFieldOntoOutput(result, projectedField, RadiantDataSetPolicy());
|
||||
mc.MapFieldOntoOutput(result, contourField, RadiantDataSetPolicy());
|
||||
|
||||
vtkm::cont::DataSet& outputData = result.GetDataSet();
|
||||
const vtkm::cont::DataSet& outputData = result.GetDataSet();
|
||||
VTKM_TEST_ASSERT(outputData.GetNumberOfCellSets() == 1,
|
||||
"Wrong number of cellsets in the output dataset");
|
||||
VTKM_TEST_ASSERT(outputData.GetNumberOfCoordinateSystems() == 1,
|
||||
|
@ -81,13 +81,18 @@ void TestPointElevationNoPolicy()
|
||||
filter.SetHighPoint( 0.0, 1.0, 0.0 );
|
||||
filter.SetRange( 0.0, 2.0 );
|
||||
|
||||
filter.SetOutputFieldName("elevation");
|
||||
vtkm::filter::FieldResult result;
|
||||
filter.SetOutputFieldName("height");
|
||||
vtkm::filter::ResultField result;
|
||||
result = filter.Execute(inputData,
|
||||
inputData.GetCoordinateSystem());
|
||||
|
||||
//verify the result
|
||||
VTKM_TEST_ASSERT( result.IsValid(), "result should be valid" );
|
||||
VTKM_TEST_ASSERT(result.GetField().GetName() == "height",
|
||||
"Output field has wrong name.");
|
||||
VTKM_TEST_ASSERT(result.GetField().GetAssociation() ==
|
||||
vtkm::cont::Field::ASSOC_POINTS,
|
||||
"Output field has wrong association");
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Float64> resultArrayHandle;
|
||||
const bool valid = result.FieldAs(resultArrayHandle);
|
||||
@ -118,8 +123,7 @@ void TestPointElevationWithPolicy()
|
||||
filter.SetHighPoint( 0.0, 1.0, 0.0 );
|
||||
filter.SetRange( 0.0, 2.0 );
|
||||
|
||||
filter.SetOutputFieldName("elevation");
|
||||
vtkm::filter::FieldResult result;
|
||||
vtkm::filter::ResultField result;
|
||||
|
||||
vtkm::filter::DefaultPolicy p;
|
||||
result = filter.Execute(inputData,
|
||||
@ -128,9 +132,14 @@ void TestPointElevationWithPolicy()
|
||||
|
||||
//verify the result
|
||||
VTKM_TEST_ASSERT( result.IsValid(), "result should be valid" );
|
||||
VTKM_TEST_ASSERT(result.GetField().GetName() == "elevation",
|
||||
"Output field has wrong name.");
|
||||
VTKM_TEST_ASSERT(result.GetField().GetAssociation() ==
|
||||
vtkm::cont::Field::ASSOC_POINTS,
|
||||
"Output field has wrong association");
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Float64> resultArrayHandle;
|
||||
const bool valid = result.FieldAs(resultArrayHandle, p);
|
||||
const bool valid = result.FieldAs(resultArrayHandle);
|
||||
if(valid)
|
||||
{
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float32,3> > coordinates;
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
vtkm::cont::DataSet dataset = MakeTestDataSet().Make2DUniformDataSet0();
|
||||
|
||||
vtkm::filter::Threshold threshold;
|
||||
vtkm::filter::DataSetResult result;
|
||||
vtkm::filter::ResultDataSet result;
|
||||
|
||||
threshold.SetLowerThreshold(60.1);
|
||||
threshold.SetUpperThreshold(60.1);
|
||||
@ -68,7 +68,7 @@ public:
|
||||
vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DUniformDataSet0();
|
||||
|
||||
vtkm::filter::Threshold threshold;
|
||||
vtkm::filter::DataSetResult result;
|
||||
vtkm::filter::ResultDataSet result;
|
||||
|
||||
threshold.SetLowerThreshold(20.1);
|
||||
threshold.SetUpperThreshold(20.1);
|
||||
@ -99,7 +99,7 @@ public:
|
||||
vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DExplicitDataSet1();
|
||||
|
||||
vtkm::filter::Threshold threshold;
|
||||
vtkm::filter::DataSetResult result;
|
||||
vtkm::filter::ResultDataSet result;
|
||||
|
||||
threshold.SetLowerThreshold(20.1);
|
||||
threshold.SetUpperThreshold(20.1);
|
||||
@ -130,7 +130,7 @@ public:
|
||||
vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DExplicitDataSet1();
|
||||
|
||||
vtkm::filter::Threshold threshold;
|
||||
vtkm::filter::DataSetResult result;
|
||||
vtkm::filter::ResultDataSet result;
|
||||
|
||||
threshold.SetLowerThreshold(500.1);
|
||||
threshold.SetUpperThreshold(500.1);
|
||||
|
@ -34,7 +34,7 @@ void TestVertexClustering()
|
||||
vtkm::cont::DataSet dataSet = maker.Make3DExplicitDataSetCowNose();
|
||||
|
||||
vtkm::filter::VertexClustering clustering;
|
||||
vtkm::filter::DataSetResult result;
|
||||
vtkm::filter::ResultDataSet result;
|
||||
|
||||
clustering.SetNumberOfDivisions( vtkm::Id3(3, 3, 3) );
|
||||
result = clustering.Execute(dataSet);
|
||||
|
@ -20,6 +20,7 @@
|
||||
#ifndef vtk_m_internal_ArrayPortalUniformPointCoordinates_h
|
||||
#define vtk_m_internal_ArrayPortalUniformPointCoordinates_h
|
||||
|
||||
#include <vtkm/Assert.h>
|
||||
#include <vtkm/Types.h>
|
||||
|
||||
namespace vtkm {
|
||||
@ -70,6 +71,8 @@ public:
|
||||
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
ValueType Get(vtkm::Id index) const {
|
||||
VTKM_ASSERT(index >= 0);
|
||||
VTKM_ASSERT(index < this->GetNumberOfValues());
|
||||
return this->Get(
|
||||
vtkm::Id3(index%this->Dimensions[0],
|
||||
(index/this->Dimensions[0])%this->Dimensions[1],
|
||||
@ -81,6 +84,10 @@ public:
|
||||
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
ValueType Get(vtkm::Id3 index) const {
|
||||
VTKM_ASSERT((index[0] >= 0) && (index[1] >= 0) && (index[2] >= 0));
|
||||
VTKM_ASSERT((index[0] < this->Dimensions[0]) &&
|
||||
(index[1] < this->Dimensions[1]) &&
|
||||
(index[2] < this->Dimensions[2]));
|
||||
return ValueType(this->Origin[0] + this->Spacing[0] * static_cast<vtkm::FloatDefault>(index[0]),
|
||||
this->Origin[1] + this->Spacing[1] * static_cast<vtkm::FloatDefault>(index[1]),
|
||||
this->Origin[2] + this->Spacing[2] * static_cast<vtkm::FloatDefault>(index[2]));
|
||||
|
58
vtkm/internal/Assume.h
Normal file
58
vtkm/internal/Assume.h
Normal file
@ -0,0 +1,58 @@
|
||||
//============================================================================
|
||||
// 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 Sandia Corporation.
|
||||
// Copyright 2014 UT-Battelle, LLC.
|
||||
// Copyright 2014 Los Alamos National Security.
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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_internal_Assume_h
|
||||
#define vtk_m_internal_Assume_h
|
||||
|
||||
|
||||
#include <vtkm/Assert.h>
|
||||
|
||||
// Description:
|
||||
// VTKM_ASSUME instructs the compiler that a certain non-obvious condition will
|
||||
// *always* be true. Beware that if cond is false at runtime, the results are
|
||||
// unpredictable (and likely catastrophic). A runtime assertion is added so
|
||||
// that debugging builds may easily catch violations of the condition.
|
||||
//
|
||||
// A useful application of this macro is when a method is passed in a
|
||||
// vtkm::Vec that is uninitialized and conditional fills the vtkm::Vec
|
||||
// based on other runtime information such as cell type. This allows you to
|
||||
// assert that only valid cell types will be used, producing more efficient
|
||||
// code.
|
||||
//
|
||||
#define VTKM_ASSUME(cond) \
|
||||
do { \
|
||||
const bool c = cond; \
|
||||
VTKM_ASSERT("Bad assumption in VTKM_ASSUME: " #cond && c); \
|
||||
VTKM_ASSUME_IMPL(c); \
|
||||
(void)c; /* Prevents unused var warnings */ \
|
||||
} while (false) /* do-while prevents extra semicolon warnings */
|
||||
|
||||
// VTKM_ASSUME_IMPL is compiler-specific:
|
||||
#if defined(VTKM_MSVC) || defined(VTKM_ICC)
|
||||
# define VTKM_ASSUME_IMPL(cond) __assume(cond)
|
||||
#elif defined(VTKM_GCC) && ( __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) )
|
||||
// Added in 4.5.0:
|
||||
# define VTKM_ASSUME_IMPL(cond) if (!(cond)) __builtin_unreachable()
|
||||
#elif defined(VTKM_CLANG)
|
||||
# define VTKM_ASSUME_IMPL(cond) if (!(cond)) __builtin_unreachable()
|
||||
#else
|
||||
# define VTKM_ASSUME_IMPL(cond) do {} while (false) /* no-op */
|
||||
#endif
|
||||
|
||||
#endif // vtk_m_internal_Assume_h
|
@ -250,7 +250,6 @@ VTKM_THIRDPARTY_PRE_INCLUDE
|
||||
# include <boost/config.hpp>
|
||||
VTKM_THIRDPARTY_POST_INCLUDE
|
||||
|
||||
|
||||
# if defined(BOOST_HAS_VARIADIC_TMPL)
|
||||
# define VTKM_USE_VARIADIC_TEMPLATE 1
|
||||
# endif
|
||||
@ -260,4 +259,25 @@ VTKM_THIRDPARTY_POST_INCLUDE
|
||||
# error Both VTKM_USE_VARIADIC_TEMPLATE and VTKM_NO_VARIADIC_TEMPLATE defined. Do not know what to do.
|
||||
#endif
|
||||
|
||||
#ifdef VTKM_MSVC
|
||||
//With MSVC the types that we generate cause warning C4503 (long symbol names)
|
||||
//this doesn't affect the resulting binary so we just supress that warning
|
||||
//
|
||||
#pragma warning(disable:4503)
|
||||
|
||||
//MSVC has a warning for using "unsafe" algorithms such as fill_n that can
|
||||
//easily overrun the end of unchecked pointers. The problem is that there
|
||||
//are lots of valid uses of these algorithms, and the signal that this is
|
||||
//a valid use is MSVC-specific. Even less fortunate is the fact that if
|
||||
//another header violates the warning, it is impossible to suppress it
|
||||
//because it happens in a system header file (xutility), which was included
|
||||
//far before the actual offending code occured. Even less fortunate than
|
||||
//that, a boost header we (indirectly) use sets off this warning, cannot
|
||||
//be suppressed, and is not going to be fixed
|
||||
//(https://svn.boost.org/trac/boost/ticket/11426). The best solution is to
|
||||
//turn off this problematic warning for everybody.
|
||||
//
|
||||
#pragma warning(disable:4996)
|
||||
#endif
|
||||
|
||||
#endif //vtkm_internal_Configure_h
|
||||
|
@ -368,7 +368,7 @@ public:
|
||||
}
|
||||
|
||||
static const vtkm::IdComponent NUM_POINTS_IN_CELL = 8;
|
||||
static const vtkm::IdComponent MAX_CELL_TO_POINT = 6;
|
||||
static const vtkm::IdComponent MAX_CELL_TO_POINT = 8;
|
||||
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
vtkm::Id GetNumberOfCells() const
|
||||
|
@ -39,6 +39,8 @@ VTKM_THIRDPARTY_PRE_INCLUDE
|
||||
#include <boost/mpl/insert.hpp>
|
||||
#include <boost/mpl/less.hpp>
|
||||
#include <boost/mpl/push_back.hpp>
|
||||
#include <boost/mpl/joint_view.hpp>
|
||||
#include <boost/mpl/single_view.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
VTKM_THIRDPARTY_POST_INCLUDE
|
||||
|
||||
@ -61,21 +63,6 @@ struct IdentityFunctor {
|
||||
const T &operator()(const T &x) const { return x; }
|
||||
};
|
||||
|
||||
|
||||
template<vtkm::IdComponent ParameterIndex, typename FunctionSignature>
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
const typename ParameterContainerAccess<ParameterIndex,FunctionSignature>::ParameterType &
|
||||
GetParameter(const ParameterContainer<FunctionSignature> ¶meters) {
|
||||
return ParameterContainerAccess<ParameterIndex,FunctionSignature>::GetParameter(parameters);
|
||||
}
|
||||
|
||||
template<vtkm::IdComponent ParameterIndex, typename FunctionSignature>
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
void SetParameter(ParameterContainer<FunctionSignature> ¶meters,
|
||||
const typename ParameterContainerAccess<ParameterIndex,FunctionSignature>::ParameterType &value) {
|
||||
return ParameterContainerAccess<ParameterIndex,FunctionSignature>::SetParameter(parameters, value);
|
||||
}
|
||||
|
||||
// These functions exist to help copy components of a FunctionInterface.
|
||||
|
||||
template<vtkm::IdComponent NumToCopy, vtkm::IdComponent ParameterIndex = 1>
|
||||
@ -87,8 +74,8 @@ struct FunctionInterfaceCopyParameters {
|
||||
void Copy(vtkm::internal::detail::ParameterContainer<DestSignature> &dest,
|
||||
const vtkm::internal::detail::ParameterContainer<SrcSignature> &src)
|
||||
{
|
||||
vtkm::internal::detail::SetParameter<ParameterIndex>(
|
||||
dest,vtkm::internal::detail::GetParameter<ParameterIndex>(src));
|
||||
ParameterContainerAccess<ParameterIndex> pca;
|
||||
pca.Set( dest, pca.Get(src) );
|
||||
FunctionInterfaceCopyParameters<NumToCopy-1,ParameterIndex+1>::Copy(dest, src);
|
||||
}
|
||||
};
|
||||
@ -273,12 +260,13 @@ public:
|
||||
typedef typename boost::function_types::result_type<FunctionSignature>::type
|
||||
ResultType;
|
||||
|
||||
typedef typename boost::function_types::components<FunctionSignature> FunctionSignatureComponents;
|
||||
|
||||
template<vtkm::IdComponent ParameterIndex>
|
||||
struct ParameterType {
|
||||
typedef typename boost::mpl::at_c<
|
||||
boost::function_types::components<FunctionSignature>,
|
||||
ParameterIndex>::type type;
|
||||
typedef typename detail::AtType<FunctionSignature, ParameterIndex>::type type;
|
||||
};
|
||||
|
||||
static const bool RETURN_VALID = FunctionInterfaceReturnContainer<ResultType>::VALID;
|
||||
|
||||
/// The number of parameters in this \c Function Interface.
|
||||
@ -351,7 +339,7 @@ public:
|
||||
GetParameter(
|
||||
vtkm::internal::IndexTag<ParameterIndex> =
|
||||
vtkm::internal::IndexTag<ParameterIndex>()) const {
|
||||
return detail::GetParameter<ParameterIndex>(this->Parameters);
|
||||
return (detail::ParameterContainerAccess<ParameterIndex>()).Get(this->Parameters);
|
||||
}
|
||||
|
||||
/// Sets the value for the parameter of the given index. Parameters are
|
||||
@ -398,7 +386,7 @@ public:
|
||||
vtkm::internal::IndexTag<ParameterIndex> =
|
||||
vtkm::internal::IndexTag<ParameterIndex>())
|
||||
{
|
||||
detail::SetParameter<ParameterIndex>(this->Parameters, parameter);
|
||||
return (detail::ParameterContainerAccess<ParameterIndex>()).Set(this->Parameters, parameter);
|
||||
}
|
||||
|
||||
/// Copies the parameters and return values from the given \c
|
||||
@ -411,9 +399,16 @@ public:
|
||||
void Copy(const FunctionInterface<SrcFunctionSignature> &src)
|
||||
{
|
||||
this->Result = src.GetReturnValueSafe();
|
||||
detail::FunctionInterfaceCopyParameters<
|
||||
boost::static_unsigned_min<ARITY, FunctionInterface<SrcFunctionSignature>::ARITY>::value>::
|
||||
Copy(this->Parameters, src.Parameters);
|
||||
typedef boost::static_unsigned_min< ARITY,
|
||||
FunctionInterface<SrcFunctionSignature>::ARITY > MinArity;
|
||||
|
||||
(detail::CopyAllParameters<MinArity::value>()).Copy(this->Parameters, src.Parameters);
|
||||
}
|
||||
|
||||
void Copy(const FunctionInterface<FunctionSignature> &src)
|
||||
{ //optimized version for assignment/copy
|
||||
this->Result = src.GetReturnValueSafe();
|
||||
this->Parameters = src.Parameters;
|
||||
}
|
||||
|
||||
/// Invoke a function \c f using the arguments stored in this
|
||||
@ -488,16 +483,15 @@ public:
|
||||
|
||||
template<typename NewType>
|
||||
struct AppendType {
|
||||
typedef FunctionInterface<
|
||||
typename boost::function_types::function_type<
|
||||
typename boost::mpl::push_back<
|
||||
boost::function_types::components<FunctionSignature>,
|
||||
NewType
|
||||
>::type
|
||||
>::type
|
||||
> type;
|
||||
private:
|
||||
typedef boost::mpl::single_view<NewType> NewTypeSeq;
|
||||
typedef boost::mpl::joint_view<FunctionSignatureComponents, NewTypeSeq> JointType;
|
||||
typedef boost::function_types::function_type<JointType> FuntionType;
|
||||
public:
|
||||
typedef FunctionInterface< typename FuntionType::type > type;
|
||||
};
|
||||
|
||||
|
||||
/// Returns a new \c FunctionInterface with all the parameters of this \c
|
||||
/// FunctionInterface and the given method argument appended to these
|
||||
/// parameters. The return type can be determined with the \c AppendType
|
||||
@ -506,8 +500,11 @@ public:
|
||||
template<typename NewType>
|
||||
VTKM_CONT_EXPORT
|
||||
typename AppendType<NewType>::type
|
||||
Append(const NewType& newParameter) const {
|
||||
typename AppendType<NewType>::type appendedFuncInterface;
|
||||
Append(const NewType& newParameter) const
|
||||
{
|
||||
typedef typename AppendType<NewType>::type AppendInterfaceType;
|
||||
|
||||
AppendInterfaceType appendedFuncInterface;
|
||||
appendedFuncInterface.Copy(*this);
|
||||
appendedFuncInterface.template SetParameter<ARITY+1>(newParameter);
|
||||
return appendedFuncInterface;
|
||||
@ -515,9 +512,8 @@ public:
|
||||
|
||||
template<vtkm::IdComponent ParameterIndex, typename NewType>
|
||||
class ReplaceType {
|
||||
typedef boost::function_types::components<FunctionSignature> ThisFunctionComponents;
|
||||
typedef typename boost::mpl::advance_c<typename boost::mpl::begin<ThisFunctionComponents>::type, ParameterIndex>::type ToRemovePos;
|
||||
typedef typename boost::mpl::erase<ThisFunctionComponents, ToRemovePos>::type ComponentRemoved;
|
||||
typedef typename boost::mpl::advance_c<typename boost::mpl::begin<FunctionSignatureComponents>::type, ParameterIndex>::type ToRemovePos;
|
||||
typedef typename boost::mpl::erase<FunctionSignatureComponents, ToRemovePos>::type ComponentRemoved;
|
||||
typedef typename boost::mpl::advance_c<typename boost::mpl::begin<ComponentRemoved>::type, ParameterIndex>::type ToInsertPos;
|
||||
typedef typename boost::mpl::insert<ComponentRemoved, ToInsertPos, NewType>::type ComponentInserted;
|
||||
typedef typename boost::function_types::function_type<ComponentInserted>::type NewSignature;
|
||||
@ -567,11 +563,16 @@ public:
|
||||
typename ReplaceType<ParameterIndex, NewType>::type
|
||||
Replace(const NewType& newParameter,
|
||||
vtkm::internal::IndexTag<ParameterIndex> =
|
||||
vtkm::internal::IndexTag<ParameterIndex>()) const {
|
||||
vtkm::internal::IndexTag<ParameterIndex>()) const
|
||||
{
|
||||
|
||||
typename ReplaceType<ParameterIndex, NewType>::type replacedFuncInterface;
|
||||
|
||||
detail::FunctionInterfaceCopyParameters<ParameterIndex-1>::
|
||||
Copy(replacedFuncInterface.Parameters, this->Parameters);
|
||||
|
||||
replacedFuncInterface.template SetParameter<ParameterIndex>(newParameter);
|
||||
|
||||
detail::FunctionInterfaceCopyParameters<ARITY-ParameterIndex,ParameterIndex+1>::
|
||||
Copy(replacedFuncInterface.Parameters, this->Parameters);
|
||||
return replacedFuncInterface;
|
||||
@ -803,8 +804,12 @@ public:
|
||||
VTKM_CONT_EXPORT
|
||||
void operator()(const T& newParameter) const
|
||||
{
|
||||
typedef typename vtkm::internal::FunctionInterface<NewFunction>::template AppendType<T>::type
|
||||
NextInterfaceType;
|
||||
typedef typename FunctionInterface<NewFunction>::FunctionSignatureComponents NewFSigComp;
|
||||
|
||||
typedef boost::mpl::single_view<T> NewTypeSeq;
|
||||
typedef boost::mpl::joint_view<NewFSigComp, NewTypeSeq> JointType;
|
||||
typedef boost::function_types::function_type<JointType> FuntionType;
|
||||
typedef FunctionInterface< typename FuntionType::type > NextInterfaceType;
|
||||
|
||||
//Determine if we should do the next transform, and if so convert from
|
||||
//boost mpl to boost::true_type/false_type ( for readability of sigs)
|
||||
|
@ -223,241 +223,415 @@ struct ParameterContainer<R(P1,P2,P3,P4,P5,P6,P7,P8,P9,P10)> {
|
||||
|
||||
|
||||
//============================================================================
|
||||
template< typename FS, int Index>
|
||||
struct AtType
|
||||
{
|
||||
typedef boost::function_types::components<FS> ParamterTypes;
|
||||
typedef typename boost::mpl::at_c<ParamterTypes, Index>::type type;
|
||||
};
|
||||
|
||||
template<int ParameterIndex, typename FunctionSignature>
|
||||
|
||||
//============================================================================
|
||||
|
||||
template<int ParameterIndex>
|
||||
struct ParameterContainerAccess;
|
||||
|
||||
template<typename FunctionSignature>
|
||||
struct ParameterContainerAccess<1, FunctionSignature> {
|
||||
typedef typename boost::mpl::at_c<
|
||||
boost::function_types::components<FunctionSignature>, 1>::type
|
||||
ParameterType;
|
||||
template<>
|
||||
struct ParameterContainerAccess<1> {
|
||||
|
||||
template<typename FunctionSignature>
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
static
|
||||
const ParameterType&
|
||||
GetParameter(const ParameterContainer<FunctionSignature> ¶meters) {
|
||||
const typename AtType<FunctionSignature, 1>::type &
|
||||
Get(const ParameterContainer<FunctionSignature> ¶meters) {
|
||||
return parameters.Parameter1;
|
||||
}
|
||||
|
||||
template<typename FunctionSignature>
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
static
|
||||
void SetParameter(ParameterContainer<FunctionSignature> ¶meters,
|
||||
const ParameterType &value) {
|
||||
void Set(ParameterContainer<FunctionSignature> ¶meters,
|
||||
const typename AtType<FunctionSignature, 1>::type &value) {
|
||||
parameters.Parameter1 = value;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename FunctionSignature>
|
||||
struct ParameterContainerAccess<2, FunctionSignature> {
|
||||
typedef typename boost::mpl::at_c<
|
||||
boost::function_types::components<FunctionSignature>, 2>::type
|
||||
ParameterType;
|
||||
template<>
|
||||
struct ParameterContainerAccess<2> {
|
||||
|
||||
template<typename FunctionSignature>
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
static
|
||||
const ParameterType&
|
||||
GetParameter(const ParameterContainer<FunctionSignature> ¶meters) {
|
||||
const typename AtType<FunctionSignature, 2>::type &
|
||||
Get(const ParameterContainer<FunctionSignature> ¶meters) {
|
||||
return parameters.Parameter2;
|
||||
}
|
||||
|
||||
template<typename FunctionSignature>
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
static
|
||||
void SetParameter(ParameterContainer<FunctionSignature> ¶meters,
|
||||
const ParameterType &value) {
|
||||
void Set(ParameterContainer<FunctionSignature> ¶meters,
|
||||
const typename AtType<FunctionSignature, 2>::type &value) {
|
||||
parameters.Parameter2 = value;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename FunctionSignature>
|
||||
struct ParameterContainerAccess<3, FunctionSignature> {
|
||||
typedef typename boost::mpl::at_c<
|
||||
boost::function_types::components<FunctionSignature>, 3>::type
|
||||
ParameterType;
|
||||
template<>
|
||||
struct ParameterContainerAccess<3> {
|
||||
|
||||
template<typename FunctionSignature>
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
static
|
||||
const ParameterType&
|
||||
GetParameter(const ParameterContainer<FunctionSignature> ¶meters) {
|
||||
const typename AtType<FunctionSignature, 3>::type &
|
||||
Get(const ParameterContainer<FunctionSignature> ¶meters) {
|
||||
return parameters.Parameter3;
|
||||
}
|
||||
|
||||
template<typename FunctionSignature>
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
static
|
||||
void SetParameter(ParameterContainer<FunctionSignature> ¶meters,
|
||||
const ParameterType &value) {
|
||||
void Set(ParameterContainer<FunctionSignature> ¶meters,
|
||||
const typename AtType<FunctionSignature, 3>::type &value) {
|
||||
parameters.Parameter3 = value;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename FunctionSignature>
|
||||
struct ParameterContainerAccess<4, FunctionSignature> {
|
||||
typedef typename boost::mpl::at_c<
|
||||
boost::function_types::components<FunctionSignature>, 4>::type
|
||||
ParameterType;
|
||||
template<>
|
||||
struct ParameterContainerAccess<4> {
|
||||
|
||||
template<typename FunctionSignature>
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
static
|
||||
const ParameterType&
|
||||
GetParameter(const ParameterContainer<FunctionSignature> ¶meters) {
|
||||
const typename AtType<FunctionSignature, 4>::type &
|
||||
Get(const ParameterContainer<FunctionSignature> ¶meters) {
|
||||
return parameters.Parameter4;
|
||||
}
|
||||
|
||||
template<typename FunctionSignature>
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
static
|
||||
void SetParameter(ParameterContainer<FunctionSignature> ¶meters,
|
||||
const ParameterType &value) {
|
||||
void Set(ParameterContainer<FunctionSignature> ¶meters,
|
||||
const typename AtType<FunctionSignature, 4>::type &value) {
|
||||
parameters.Parameter4 = value;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename FunctionSignature>
|
||||
struct ParameterContainerAccess<5, FunctionSignature> {
|
||||
typedef typename boost::mpl::at_c<
|
||||
boost::function_types::components<FunctionSignature>, 5>::type
|
||||
ParameterType;
|
||||
template<>
|
||||
struct ParameterContainerAccess<5> {
|
||||
|
||||
template<typename FunctionSignature>
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
static
|
||||
const ParameterType&
|
||||
GetParameter(const ParameterContainer<FunctionSignature> ¶meters) {
|
||||
const typename AtType<FunctionSignature, 5>::type &
|
||||
Get(const ParameterContainer<FunctionSignature> ¶meters) {
|
||||
return parameters.Parameter5;
|
||||
}
|
||||
|
||||
template<typename FunctionSignature>
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
static
|
||||
void SetParameter(ParameterContainer<FunctionSignature> ¶meters,
|
||||
const ParameterType &value) {
|
||||
void Set(ParameterContainer<FunctionSignature> ¶meters,
|
||||
const typename AtType<FunctionSignature, 5>::type &value) {
|
||||
parameters.Parameter5 = value;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename FunctionSignature>
|
||||
struct ParameterContainerAccess<6, FunctionSignature> {
|
||||
typedef typename boost::mpl::at_c<
|
||||
boost::function_types::components<FunctionSignature>, 6>::type
|
||||
ParameterType;
|
||||
template<>
|
||||
struct ParameterContainerAccess<6> {
|
||||
|
||||
template<typename FunctionSignature>
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
static
|
||||
const ParameterType&
|
||||
GetParameter(const ParameterContainer<FunctionSignature> ¶meters) {
|
||||
const typename AtType<FunctionSignature, 6>::type &
|
||||
Get(const ParameterContainer<FunctionSignature> ¶meters) {
|
||||
return parameters.Parameter6;
|
||||
}
|
||||
|
||||
template<typename FunctionSignature>
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
static
|
||||
void SetParameter(ParameterContainer<FunctionSignature> ¶meters,
|
||||
const ParameterType &value) {
|
||||
void Set(ParameterContainer<FunctionSignature> ¶meters,
|
||||
const typename AtType<FunctionSignature, 6>::type &value) {
|
||||
parameters.Parameter6 = value;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename FunctionSignature>
|
||||
struct ParameterContainerAccess<7, FunctionSignature> {
|
||||
typedef typename boost::mpl::at_c<
|
||||
boost::function_types::components<FunctionSignature>, 7>::type
|
||||
ParameterType;
|
||||
template<>
|
||||
struct ParameterContainerAccess<7> {
|
||||
|
||||
template<typename FunctionSignature>
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
static
|
||||
const ParameterType&
|
||||
GetParameter(const ParameterContainer<FunctionSignature> ¶meters) {
|
||||
const typename AtType<FunctionSignature, 7>::type &
|
||||
Get(const ParameterContainer<FunctionSignature> ¶meters) {
|
||||
return parameters.Parameter7;
|
||||
}
|
||||
|
||||
template<typename FunctionSignature>
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
static
|
||||
void SetParameter(ParameterContainer<FunctionSignature> ¶meters,
|
||||
const ParameterType &value) {
|
||||
void Set(ParameterContainer<FunctionSignature> ¶meters,
|
||||
const typename AtType<FunctionSignature, 7>::type &value) {
|
||||
parameters.Parameter7 = value;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename FunctionSignature>
|
||||
struct ParameterContainerAccess<8, FunctionSignature> {
|
||||
typedef typename boost::mpl::at_c<
|
||||
boost::function_types::components<FunctionSignature>, 8>::type
|
||||
ParameterType;
|
||||
template<>
|
||||
struct ParameterContainerAccess<8> {
|
||||
|
||||
template<typename FunctionSignature>
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
static
|
||||
const ParameterType&
|
||||
GetParameter(const ParameterContainer<FunctionSignature> ¶meters) {
|
||||
const typename AtType<FunctionSignature, 8>::type &
|
||||
Get(const ParameterContainer<FunctionSignature> ¶meters) {
|
||||
return parameters.Parameter8;
|
||||
}
|
||||
|
||||
template<typename FunctionSignature>
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
static
|
||||
void SetParameter(ParameterContainer<FunctionSignature> ¶meters,
|
||||
const ParameterType &value) {
|
||||
void Set(ParameterContainer<FunctionSignature> ¶meters,
|
||||
const typename AtType<FunctionSignature, 8>::type &value) {
|
||||
parameters.Parameter8 = value;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename FunctionSignature>
|
||||
struct ParameterContainerAccess<9, FunctionSignature> {
|
||||
typedef typename boost::mpl::at_c<
|
||||
boost::function_types::components<FunctionSignature>, 9>::type
|
||||
ParameterType;
|
||||
template<>
|
||||
struct ParameterContainerAccess<9> {
|
||||
|
||||
template<typename FunctionSignature>
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
static
|
||||
const ParameterType&
|
||||
GetParameter(const ParameterContainer<FunctionSignature> ¶meters) {
|
||||
const typename AtType<FunctionSignature, 9>::type &
|
||||
Get(const ParameterContainer<FunctionSignature> ¶meters) {
|
||||
return parameters.Parameter9;
|
||||
}
|
||||
|
||||
template<typename FunctionSignature>
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
static
|
||||
void SetParameter(ParameterContainer<FunctionSignature> ¶meters,
|
||||
const ParameterType &value) {
|
||||
void Set(ParameterContainer<FunctionSignature> ¶meters,
|
||||
const typename AtType<FunctionSignature, 9>::type &value) {
|
||||
parameters.Parameter9 = value;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename FunctionSignature>
|
||||
struct ParameterContainerAccess<10, FunctionSignature> {
|
||||
typedef typename boost::mpl::at_c<
|
||||
boost::function_types::components<FunctionSignature>, 10>::type
|
||||
ParameterType;
|
||||
template<>
|
||||
struct ParameterContainerAccess<10> {
|
||||
|
||||
template<typename FunctionSignature>
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
static
|
||||
const ParameterType&
|
||||
GetParameter(const ParameterContainer<FunctionSignature> ¶meters) {
|
||||
const typename AtType<FunctionSignature, 10>::type &
|
||||
Get(const ParameterContainer<FunctionSignature> ¶meters) {
|
||||
return parameters.Parameter10;
|
||||
}
|
||||
|
||||
template<typename FunctionSignature>
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
static
|
||||
void SetParameter(ParameterContainer<FunctionSignature> ¶meters,
|
||||
const ParameterType &value) {
|
||||
void Set(ParameterContainer<FunctionSignature> ¶meters,
|
||||
const typename AtType<FunctionSignature, 10>::type &value) {
|
||||
parameters.Parameter10 = value;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//============================================================================
|
||||
template<vtkm::IdComponent NumToCopy>
|
||||
struct CopyAllParameters;
|
||||
|
||||
|
||||
template<>
|
||||
struct CopyAllParameters<1> {
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
template<typename DestSignature, typename SrcSignature>
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
void Copy(vtkm::internal::detail::ParameterContainer<DestSignature> &dest,
|
||||
const vtkm::internal::detail::ParameterContainer<SrcSignature> &src)
|
||||
{
|
||||
dest.Parameter1 = src.Parameter1;
|
||||
}
|
||||
|
||||
};
|
||||
template<>
|
||||
struct CopyAllParameters<2> {
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
template<typename DestSignature, typename SrcSignature>
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
void Copy(vtkm::internal::detail::ParameterContainer<DestSignature> &dest,
|
||||
const vtkm::internal::detail::ParameterContainer<SrcSignature> &src)
|
||||
{
|
||||
dest.Parameter1 = src.Parameter1;
|
||||
dest.Parameter2 = src.Parameter2;
|
||||
}
|
||||
|
||||
};
|
||||
template<>
|
||||
struct CopyAllParameters<3> {
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
template<typename DestSignature, typename SrcSignature>
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
void Copy(vtkm::internal::detail::ParameterContainer<DestSignature> &dest,
|
||||
const vtkm::internal::detail::ParameterContainer<SrcSignature> &src)
|
||||
{
|
||||
dest.Parameter1 = src.Parameter1;
|
||||
dest.Parameter2 = src.Parameter2;
|
||||
dest.Parameter3 = src.Parameter3;
|
||||
}
|
||||
|
||||
};
|
||||
template<>
|
||||
struct CopyAllParameters<4> {
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
template<typename DestSignature, typename SrcSignature>
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
void Copy(vtkm::internal::detail::ParameterContainer<DestSignature> &dest,
|
||||
const vtkm::internal::detail::ParameterContainer<SrcSignature> &src)
|
||||
{
|
||||
dest.Parameter1 = src.Parameter1;
|
||||
dest.Parameter2 = src.Parameter2;
|
||||
dest.Parameter3 = src.Parameter3;
|
||||
dest.Parameter4 = src.Parameter4;
|
||||
}
|
||||
|
||||
};
|
||||
template<>
|
||||
struct CopyAllParameters<5> {
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
template<typename DestSignature, typename SrcSignature>
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
void Copy(vtkm::internal::detail::ParameterContainer<DestSignature> &dest,
|
||||
const vtkm::internal::detail::ParameterContainer<SrcSignature> &src)
|
||||
{
|
||||
dest.Parameter1 = src.Parameter1;
|
||||
dest.Parameter2 = src.Parameter2;
|
||||
dest.Parameter3 = src.Parameter3;
|
||||
dest.Parameter4 = src.Parameter4;
|
||||
dest.Parameter5 = src.Parameter5;
|
||||
}
|
||||
|
||||
};
|
||||
template<>
|
||||
struct CopyAllParameters<6> {
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
template<typename DestSignature, typename SrcSignature>
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
void Copy(vtkm::internal::detail::ParameterContainer<DestSignature> &dest,
|
||||
const vtkm::internal::detail::ParameterContainer<SrcSignature> &src)
|
||||
{
|
||||
dest.Parameter1 = src.Parameter1;
|
||||
dest.Parameter2 = src.Parameter2;
|
||||
dest.Parameter3 = src.Parameter3;
|
||||
dest.Parameter4 = src.Parameter4;
|
||||
dest.Parameter5 = src.Parameter5;
|
||||
dest.Parameter6 = src.Parameter6;
|
||||
}
|
||||
|
||||
};
|
||||
template<>
|
||||
struct CopyAllParameters<7> {
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
template<typename DestSignature, typename SrcSignature>
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
void Copy(vtkm::internal::detail::ParameterContainer<DestSignature> &dest,
|
||||
const vtkm::internal::detail::ParameterContainer<SrcSignature> &src)
|
||||
{
|
||||
dest.Parameter1 = src.Parameter1;
|
||||
dest.Parameter2 = src.Parameter2;
|
||||
dest.Parameter3 = src.Parameter3;
|
||||
dest.Parameter4 = src.Parameter4;
|
||||
dest.Parameter5 = src.Parameter5;
|
||||
dest.Parameter6 = src.Parameter6;
|
||||
dest.Parameter7 = src.Parameter7;
|
||||
}
|
||||
|
||||
};
|
||||
template<>
|
||||
struct CopyAllParameters<8> {
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
template<typename DestSignature, typename SrcSignature>
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
void Copy(vtkm::internal::detail::ParameterContainer<DestSignature> &dest,
|
||||
const vtkm::internal::detail::ParameterContainer<SrcSignature> &src)
|
||||
{
|
||||
dest.Parameter1 = src.Parameter1;
|
||||
dest.Parameter2 = src.Parameter2;
|
||||
dest.Parameter3 = src.Parameter3;
|
||||
dest.Parameter4 = src.Parameter4;
|
||||
dest.Parameter5 = src.Parameter5;
|
||||
dest.Parameter6 = src.Parameter6;
|
||||
dest.Parameter7 = src.Parameter7;
|
||||
dest.Parameter8 = src.Parameter8;
|
||||
}
|
||||
|
||||
};
|
||||
template<>
|
||||
struct CopyAllParameters<9> {
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
template<typename DestSignature, typename SrcSignature>
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
void Copy(vtkm::internal::detail::ParameterContainer<DestSignature> &dest,
|
||||
const vtkm::internal::detail::ParameterContainer<SrcSignature> &src)
|
||||
{
|
||||
dest.Parameter1 = src.Parameter1;
|
||||
dest.Parameter2 = src.Parameter2;
|
||||
dest.Parameter3 = src.Parameter3;
|
||||
dest.Parameter4 = src.Parameter4;
|
||||
dest.Parameter5 = src.Parameter5;
|
||||
dest.Parameter6 = src.Parameter6;
|
||||
dest.Parameter7 = src.Parameter7;
|
||||
dest.Parameter8 = src.Parameter8;
|
||||
dest.Parameter9 = src.Parameter9;
|
||||
}
|
||||
|
||||
};
|
||||
template<>
|
||||
struct CopyAllParameters<10> {
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
template<typename DestSignature, typename SrcSignature>
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
void Copy(vtkm::internal::detail::ParameterContainer<DestSignature> &dest,
|
||||
const vtkm::internal::detail::ParameterContainer<SrcSignature> &src)
|
||||
{
|
||||
dest.Parameter1 = src.Parameter1;
|
||||
dest.Parameter2 = src.Parameter2;
|
||||
dest.Parameter3 = src.Parameter3;
|
||||
dest.Parameter4 = src.Parameter4;
|
||||
dest.Parameter5 = src.Parameter5;
|
||||
dest.Parameter6 = src.Parameter6;
|
||||
dest.Parameter7 = src.Parameter7;
|
||||
dest.Parameter8 = src.Parameter8;
|
||||
dest.Parameter9 = src.Parameter9;
|
||||
dest.Parameter10 = src.Parameter10;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template<>
|
||||
struct CopyAllParameters<0> {
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
template<typename DestSignature, typename SrcSignature>
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
void Copy(vtkm::internal::detail::ParameterContainer<DestSignature> &,
|
||||
const vtkm::internal::detail::ParameterContainer<SrcSignature> &)
|
||||
{
|
||||
// Nothing to copy.
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//============================================================================
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user