From cc497e6a1b41a3014a1d8de436bff94c1ba91e88 Mon Sep 17 00:00:00 2001 From: Kenneth Moreland Date: Wed, 20 Apr 2016 15:41:14 -0600 Subject: [PATCH] Remove cont/Assert.h and exec/Assert.h These asserts are consolidated into the unified Assert.h. Also made some minor edits to add asserts where appropriate and a little bit of reconfiguring as found. --- vtkm/benchmarking/Benchmarker.h | 8 +- vtkm/cont/ArrayHandle.h | 8 +- vtkm/cont/ArrayHandleCartesianProduct.h | 182 +++++------------- vtkm/cont/ArrayHandleCompositeVector.h | 4 +- vtkm/cont/ArrayHandleGroupVec.h | 13 +- vtkm/cont/ArrayHandlePermutation.h | 15 +- vtkm/cont/ArrayHandleTransform.h | 17 +- vtkm/cont/ArrayHandleZip.h | 4 +- vtkm/cont/Assert.h | 75 -------- vtkm/cont/CMakeLists.txt | 2 - vtkm/cont/CellSetExplicit.h | 2 +- vtkm/cont/DataSet.h | 6 +- vtkm/cont/DataSetBuilderExplicit.h | 11 +- vtkm/cont/DataSetBuilderRectilinear.h | 13 +- vtkm/cont/DataSetBuilderUniform.h | 7 +- vtkm/cont/ErrorControlAssert.h | 56 ------ vtkm/cont/Field.h | 32 +-- vtkm/cont/StorageBasic.h | 8 +- vtkm/cont/StorageImplicit.h | 1 - vtkm/cont/cuda/ArrayHandleCuda.h | 2 +- .../ArrayManagerExecutionThrustDevice.h | 2 +- .../ArrayManagerExecutionShareWithControl.h | 4 +- vtkm/cont/internal/ArrayPortalFromIterators.h | 8 +- vtkm/cont/internal/ArrayPortalShrink.h | 14 +- .../internal/ConnectivityExplicitInternals.h | 3 +- .../internal/DeviceAdapterAlgorithmGeneral.h | 4 +- .../internal/DeviceAdapterAlgorithmSerial.h | 2 +- vtkm/cont/internal/IteratorFromArrayPortal.h | 16 +- vtkm/cont/tbb/internal/FunctorsTBB.h | 3 +- .../UnitTestArrayHandleCartesianProduct.cxx | 1 - .../testing/UnitTestArrayHandleCounting.cxx | 3 +- vtkm/cont/testing/UnitTestContTesting.cxx | 23 +-- .../UnitTestDataSetBuilderExplicit.cxx | 1 - .../UnitTestDataSetBuilderRectilinear.cxx | 5 +- .../testing/UnitTestDataSetBuilderUniform.cxx | 5 +- vtkm/exec/Assert.h | 74 ------- vtkm/exec/CMakeLists.txt | 1 - vtkm/exec/CellDerivative.h | 68 ++++--- vtkm/exec/CellInterpolate.h | 44 ++--- vtkm/exec/ParametricCoordinates.h | 134 ++++++------- .../internal/ResolveFieldTypeAndExecute.h | 14 -- vtkm/filter/internal/ResolveFieldTypeAndMap.h | 7 - .../ArrayPortalUniformPointCoordinates.h | 7 + vtkm/interop/cuda/internal/TransferToOpenGL.h | 2 +- vtkm/io/writer/VTKDataSetWriter.h | 6 +- vtkm/worklet/VertexClustering.h | 4 +- 46 files changed, 285 insertions(+), 636 deletions(-) delete mode 100644 vtkm/cont/Assert.h delete mode 100644 vtkm/cont/ErrorControlAssert.h delete mode 100644 vtkm/exec/Assert.h diff --git a/vtkm/benchmarking/Benchmarker.h b/vtkm/benchmarking/Benchmarker.h index 695156074..6ea08f986 100644 --- a/vtkm/benchmarking/Benchmarker.h +++ b/vtkm/benchmarking/Benchmarker.h @@ -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 &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(); diff --git a/vtkm/cont/ArrayHandle.h b/vtkm/cont/ArrayHandle.h index 194a00f6a..9ee88e976 100644 --- a/vtkm/cont/ArrayHandle.h +++ b/vtkm/cont/ArrayHandle.h @@ -20,9 +20,9 @@ #ifndef vtk_m_cont_ArrayHandle_h #define vtk_m_cont_ArrayHandle_h +#include #include -#include #include #include #include @@ -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 diff --git a/vtkm/cont/ArrayHandleCartesianProduct.h b/vtkm/cont/ArrayHandleCartesianProduct.h index 6d58b4580..b9302bc50 100644 --- a/vtkm/cont/ArrayHandleCartesianProduct.h +++ b/vtkm/cont/ArrayHandleCartesianProduct.h @@ -20,22 +20,21 @@ #ifndef vtk_m_cont_ArrayHandleCartesianProduct_h #define vtk_m_cont_ArrayHandleCartesianProduct_h +#include + #include -#include #include 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 -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 VTKM_CONT_EXPORT - ArrayPortalExecCartesianProduct(const ArrayPortalExecCartesianProduct &src) + ArrayPortalCartesianProduct(const ArrayPortalCartesianProduct &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 -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 - VTKM_CONT_EXPORT - ArrayPortalContCartesianProduct(const ArrayPortalContCartesianProduct &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 struct StorageTagCartesianProduct { }; @@ -258,11 +180,11 @@ class Storage 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::Portal, typename SecondHandleType::template ExecutionTypes::Portal, typename ThirdHandleType::template ExecutionTypes::Portal > PortalExecution; - typedef vtkm::exec::internal::ArrayPortalExecCartesianProduct< + typedef vtkm::internal::ArrayPortalCartesianProduct< ValueType, typename FirstHandleType::template ExecutionTypes::PortalConst, typename SecondHandleType::template ExecutionTypes::PortalConst, diff --git a/vtkm/cont/ArrayHandleCompositeVector.h b/vtkm/cont/ArrayHandleCompositeVector.h index e3f048fd5..c0714c5d9 100644 --- a/vtkm/cont/ArrayHandleCompositeVector.h +++ b/vtkm/cont/ArrayHandleCompositeVector.h @@ -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; } diff --git a/vtkm/cont/ArrayHandleGroupVec.h b/vtkm/cont/ArrayHandleGroupVec.h index 21417322e..5fbd7dc83 100644 --- a/vtkm/cont/ArrayHandleGroupVec.h +++ b/vtkm/cont/ArrayHandleGroupVec.h @@ -22,7 +22,6 @@ #include #include -#include #include 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; } diff --git a/vtkm/cont/ArrayHandlePermutation.h b/vtkm/cont/ArrayHandlePermutation.h index c36d44efc..252c36baa 100644 --- a/vtkm/cont/ArrayHandlePermutation.h +++ b/vtkm/cont/ArrayHandlePermutation.h @@ -23,7 +23,6 @@ #define vtk_m_ArrayHandlePermutation_h #include -#include #include #include @@ -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(); } diff --git a/vtkm/cont/ArrayHandleTransform.h b/vtkm/cont/ArrayHandleTransform.h index 6d6c71504..9082f7d7c 100644 --- a/vtkm/cont/ArrayHandleTransform.h +++ b/vtkm/cont/ArrayHandleTransform.h @@ -23,7 +23,6 @@ #define vtk_m_cont_ArrayHandleTransform_h #include -#include #include #include @@ -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; } diff --git a/vtkm/cont/ArrayHandleZip.h b/vtkm/cont/ArrayHandleZip.h index 793bf17e7..8b6e62ed8 100644 --- a/vtkm/cont/ArrayHandleZip.h +++ b/vtkm/cont/ArrayHandleZip.h @@ -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(); } diff --git a/vtkm/cont/Assert.h b/vtkm/cont/Assert.h deleted file mode 100644 index 8041d13ee..000000000 --- a/vtkm/cont/Assert.h +++ /dev/null @@ -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 - -// 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 diff --git a/vtkm/cont/CMakeLists.txt b/vtkm/cont/CMakeLists.txt index c0417f3f2..4020d78fa 100644 --- a/vtkm/cont/CMakeLists.txt +++ b/vtkm/cont/CMakeLists.txt @@ -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 diff --git a/vtkm/cont/CellSetExplicit.h b/vtkm/cont/CellSetExplicit.h index 6544ca0e1..d5d2386d0 100644 --- a/vtkm/cont/CellSetExplicit.h +++ b/vtkm/cont/CellSetExplicit.h @@ -300,7 +300,7 @@ public: ConnectivityChooser::ConnectivityType &connectivity = this->GetConnectivity(FromTopology(), ToTopology()); - VTKM_ASSERT_CONT(connectivity.ElementsValid); + VTKM_ASSERT(connectivity.ElementsValid); typedef typename ExecutionTypes::ExecObjectType diff --git a/vtkm/cont/DataSet.h b/vtkm/cont/DataSet.h index be24c9611..444c94003 100644 --- a/vtkm/cont/DataSet.h +++ b/vtkm/cont/DataSet.h @@ -56,7 +56,7 @@ public: VTKM_CONT_EXPORT const vtkm::cont::Field &GetField(vtkm::Id index) const { - VTKM_ASSERT_CONT((index >= 0) && + VTKM_ASSERT((index >= 0) && (index < this->GetNumberOfFields())); return this->Fields[static_cast(index)]; } @@ -97,7 +97,7 @@ 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(index)]; } @@ -140,7 +140,7 @@ 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(index)]; } diff --git a/vtkm/cont/DataSetBuilderExplicit.h b/vtkm/cont/DataSetBuilderExplicit.h index 7b32d004c..619789d36 100644 --- a/vtkm/cont/DataSetBuilderExplicit.h +++ b/vtkm/cont/DataSetBuilderExplicit.h @@ -22,7 +22,6 @@ #include #include -#include #include #include @@ -215,9 +214,9 @@ DataSetBuilderExplicit::Create(const std::vector &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 Xc, Yc, Zc; DataSetBuilderExplicit::CopyInto(xVals, Xc); @@ -248,7 +247,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()); @@ -440,7 +439,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; } diff --git a/vtkm/cont/DataSetBuilderRectilinear.h b/vtkm/cont/DataSetBuilderRectilinear.h index cd6a32423..6bbb60177 100644 --- a/vtkm/cont/DataSetBuilderRectilinear.h +++ b/vtkm/cont/DataSetBuilderRectilinear.h @@ -22,7 +22,6 @@ #include #include -#include #include #include #include @@ -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 Xc, Yc, Zc; DataSetBuilderRectilinear::CopyInto(xvals,nx,Xc); @@ -120,7 +119,7 @@ public: const vtkm::cont::ArrayHandle &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 zvals; zvals.Allocate(1); @@ -164,7 +163,7 @@ public: const vtkm::cont::ArrayHandle &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 &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 Xc, Yc, Zc; DataSetBuilderRectilinear::CopyInto(xvals, Xc); diff --git a/vtkm/cont/DataSetBuilderUniform.h b/vtkm/cont/DataSetBuilderUniform.h index 89b064045..6ea09d39a 100644 --- a/vtkm/cont/DataSetBuilderUniform.h +++ b/vtkm/cont/DataSetBuilderUniform.h @@ -20,9 +20,8 @@ #ifndef vtk_m_cont_DataSetBuilderUniform_h #define vtk_m_cont_DataSetBuilderUniform_h -#include #include -#include +#include namespace vtkm { namespace cont { @@ -77,8 +76,8 @@ private: const vtkm::Vec &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 diff --git a/vtkm/cont/ErrorControlAssert.h b/vtkm/cont/ErrorControlAssert.h deleted file mode 100644 index 0b2046d8a..000000000 --- a/vtkm/cont/ErrorControlAssert.h +++ /dev/null @@ -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 -#include - -#include - -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 diff --git a/vtkm/cont/Field.h b/vtkm/cont/Field.h index 1a1957c74..e99463bf5 100644 --- a/vtkm/cont/Field.h +++ b/vtkm/cont/Field.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 @@ -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 @@ -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(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 @@ -350,7 +350,7 @@ public: Bounds(), ModifiedFlag(true) { - VTKM_ASSERT_CONT(this->Association == ASSOC_CELL_SET); + VTKM_ASSERT(this->Association == ASSOC_CELL_SET); } template @@ -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(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 @@ -418,7 +418,7 @@ public: Bounds(), ModifiedFlag(true) { - VTKM_ASSERT_CONT(this->Association == ASSOC_LOGICAL_DIM); + VTKM_ASSERT(this->Association == ASSOC_LOGICAL_DIM); } template @@ -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(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); } diff --git a/vtkm/cont/StorageBasic.h b/vtkm/cont/StorageBasic.h index fcfd1c936..76d180d85 100644 --- a/vtkm/cont/StorageBasic.h +++ b/vtkm/cont/StorageBasic.h @@ -20,8 +20,8 @@ #ifndef vtk_m_cont_StorageBasic_h #define vtk_m_cont_StorageBasic_h +#include #include -#include #include #include #include @@ -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) diff --git a/vtkm/cont/StorageImplicit.h b/vtkm/cont/StorageImplicit.h index 0c8205715..bee91c711 100644 --- a/vtkm/cont/StorageImplicit.h +++ b/vtkm/cont/StorageImplicit.h @@ -22,7 +22,6 @@ #include -#include #include #include diff --git a/vtkm/cont/cuda/ArrayHandleCuda.h b/vtkm/cont/cuda/ArrayHandleCuda.h index ecef2ce0b..25b45e280 100644 --- a/vtkm/cont/cuda/ArrayHandleCuda.h +++ b/vtkm/cont/cuda/ArrayHandleCuda.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()) diff --git a/vtkm/cont/cuda/internal/ArrayManagerExecutionThrustDevice.h b/vtkm/cont/cuda/internal/ArrayManagerExecutionThrustDevice.h index d3163292c..acd01e7b2 100644 --- a/vtkm/cont/cuda/internal/ArrayManagerExecutionThrustDevice.h +++ b/vtkm/cont/cuda/internal/ArrayManagerExecutionThrustDevice.h @@ -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(this->Array.size())); + VTKM_ASSERT(numberOfValues <= static_cast(this->Array.size())); this->Array.resize(static_cast(numberOfValues)); } diff --git a/vtkm/cont/internal/ArrayManagerExecutionShareWithControl.h b/vtkm/cont/internal/ArrayManagerExecutionShareWithControl.h index 275b190a5..6cb4d0ef1 100644 --- a/vtkm/cont/internal/ArrayManagerExecutionShareWithControl.h +++ b/vtkm/cont/internal/ArrayManagerExecutionShareWithControl.h @@ -20,9 +20,9 @@ #ifndef vtk_m_cont_internal_ArrayManagerExecutionShareWithControl_h #define vtk_m_cont_internal_ArrayManagerExecutionShareWithControl_h +#include #include -#include #include #include @@ -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 diff --git a/vtkm/cont/internal/ArrayPortalFromIterators.h b/vtkm/cont/internal/ArrayPortalFromIterators.h index f4db60342..c12a32092 100644 --- a/vtkm/cont/internal/ArrayPortalFromIterators.h +++ b/vtkm/cont/internal/ArrayPortalFromIterators.h @@ -20,10 +20,10 @@ #ifndef vtk_m_cont_internal_ArrayPortalFromIterators_h #define vtk_m_cont_internal_ArrayPortalFromIterators_h +#include #include #include #include -#include #include #include @@ -54,7 +54,7 @@ public: { typename std::iterator_traits::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::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; } diff --git a/vtkm/cont/internal/ArrayPortalShrink.h b/vtkm/cont/internal/ArrayPortalShrink.h index a7eddc42f..cec91f8ab 100644 --- a/vtkm/cont/internal/ArrayPortalShrink.h +++ b/vtkm/cont/internal/ArrayPortalShrink.h @@ -20,10 +20,10 @@ #ifndef vtk_m_cont_internal_ArrayPortalShrink_h #define vtk_m_cont_internal_ArrayPortalShrink_h +#include #include #include #include -#include #include @@ -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; } diff --git a/vtkm/cont/internal/ConnectivityExplicitInternals.h b/vtkm/cont/internal/ConnectivityExplicitInternals.h index 580b3c467..24d4db218 100644 --- a/vtkm/cont/internal/ConnectivityExplicitInternals.h +++ b/vtkm/cont/internal/ConnectivityExplicitInternals.h @@ -22,7 +22,6 @@ #include #include -#include #include 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) { diff --git a/vtkm/cont/internal/DeviceAdapterAlgorithmGeneral.h b/vtkm/cont/internal/DeviceAdapterAlgorithmGeneral.h index 9aafa6fec..d60b91eda 100644 --- a/vtkm/cont/internal/DeviceAdapterAlgorithmGeneral.h +++ b/vtkm/cont/internal/DeviceAdapterAlgorithmGeneral.h @@ -260,7 +260,7 @@ public: vtkm::cont::ArrayHandle &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& 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< diff --git a/vtkm/cont/internal/DeviceAdapterAlgorithmSerial.h b/vtkm/cont/internal/DeviceAdapterAlgorithmSerial.h index ad511e7e1..d44dcfa42 100644 --- a/vtkm/cont/internal/DeviceAdapterAlgorithmSerial.h +++ b/vtkm/cont/internal/DeviceAdapterAlgorithmSerial.h @@ -348,7 +348,7 @@ private: ::template ExecutionTypes::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()); diff --git a/vtkm/cont/internal/IteratorFromArrayPortal.h b/vtkm/cont/internal/IteratorFromArrayPortal.h index 0b2da021f..a602aea39 100644 --- a/vtkm/cont/internal/IteratorFromArrayPortal.h +++ b/vtkm/cont/internal/IteratorFromArrayPortal.h @@ -20,9 +20,9 @@ #ifndef vtk_m_cont_internal_IteratorFromArrayPortal_h #define vtk_m_cont_internal_IteratorFromArrayPortal_h -#include +#include -#include +#include VTKM_THIRDPARTY_PRE_INCLUDE #include @@ -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::difference_type delta) { this->Index += static_cast(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 diff --git a/vtkm/cont/tbb/internal/FunctorsTBB.h b/vtkm/cont/tbb/internal/FunctorsTBB.h index bf238aa4f..09914cdef 100644 --- a/vtkm/cont/tbb/internal/FunctorsTBB.h +++ b/vtkm/cont/tbb/internal/FunctorsTBB.h @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -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 #include #include -#include #include diff --git a/vtkm/cont/testing/UnitTestArrayHandleCounting.cxx b/vtkm/cont/testing/UnitTestArrayHandleCounting.cxx index 122dace42..322a9af6a 100644 --- a/vtkm/cont/testing/UnitTestArrayHandleCounting.cxx +++ b/vtkm/cont/testing/UnitTestArrayHandleCounting.cxx @@ -21,7 +21,6 @@ #define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL #include -#include #include @@ -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); diff --git a/vtkm/cont/testing/UnitTestContTesting.cxx b/vtkm/cont/testing/UnitTestContTesting.cxx index c7cd34af6..5330ebdcc 100644 --- a/vtkm/cont/testing/UnitTestContTesting.cxx +++ b/vtkm/cont/testing/UnitTestContTesting.cxx @@ -21,7 +21,7 @@ // This meta-test makes sure that the testing environment is properly reporting // errors. -#include +#include #include @@ -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); diff --git a/vtkm/cont/testing/UnitTestDataSetBuilderExplicit.cxx b/vtkm/cont/testing/UnitTestDataSetBuilderExplicit.cxx index 87ec26126..3b17ad835 100644 --- a/vtkm/cont/testing/UnitTestDataSetBuilderExplicit.cxx +++ b/vtkm/cont/testing/UnitTestDataSetBuilderExplicit.cxx @@ -22,7 +22,6 @@ #include #include -#include #include #include diff --git a/vtkm/cont/testing/UnitTestDataSetBuilderRectilinear.cxx b/vtkm/cont/testing/UnitTestDataSetBuilderRectilinear.cxx index e5fb8dd36..4229bc767 100644 --- a/vtkm/cont/testing/UnitTestDataSetBuilderRectilinear.cxx +++ b/vtkm/cont/testing/UnitTestDataSetBuilderRectilinear.cxx @@ -20,11 +20,10 @@ // //============================================================================= -#include -#include #include +#include #include -#include +#include #include diff --git a/vtkm/cont/testing/UnitTestDataSetBuilderUniform.cxx b/vtkm/cont/testing/UnitTestDataSetBuilderUniform.cxx index b57b1010f..6e8fba61f 100644 --- a/vtkm/cont/testing/UnitTestDataSetBuilderUniform.cxx +++ b/vtkm/cont/testing/UnitTestDataSetBuilderUniform.cxx @@ -20,11 +20,10 @@ // //============================================================================= -#include -#include #include +#include #include -#include +#include #include diff --git a/vtkm/exec/Assert.h b/vtkm/exec/Assert.h deleted file mode 100644 index bbf14ba33..000000000 --- a/vtkm/exec/Assert.h +++ /dev/null @@ -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 - -// 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 -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 diff --git a/vtkm/exec/CMakeLists.txt b/vtkm/exec/CMakeLists.txt index 00eb03a20..2330091a3 100644 --- a/vtkm/exec/CMakeLists.txt +++ b/vtkm/exec/CMakeLists.txt @@ -19,7 +19,6 @@ ##============================================================================ set(headers - Assert.h AtomicArray.h CellDerivative.h CellInterpolate.h diff --git a/vtkm/exec/CellDerivative.h b/vtkm/exec/CellDerivative.h index 9510b95e7..aabdf28e9 100644 --- a/vtkm/exec/CellDerivative.h +++ b/vtkm/exec/CellDerivative.h @@ -20,13 +20,13 @@ #ifndef vtk_m_exec_Derivative_h #define vtk_m_exec_Derivative_h +#include #include #include #include #include #include -#include #include #include @@ -663,10 +663,10 @@ CellDerivative(const FieldVecType &field, const WorldCoordType &wCoords, const vtkm::Vec &, 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); + VTKM_ASSERT(field.GetNumberOfComponents() == 1); + VTKM_ASSERT(wCoords.GetNumberOfComponents() == 1); typedef vtkm::Vec GradientType; return GradientType(0,0,0); @@ -682,10 +682,10 @@ CellDerivative(const FieldVecType &field, const WorldCoordType &wCoords, const vtkm::Vec &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 GradientType; @@ -709,9 +709,9 @@ CellDerivative(const FieldVecType &field, const vtkm::VecRectilinearPointCoordinates<1> &wCoords, const vtkm::Vec &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 +728,10 @@ CellDerivative(const FieldVecType &field, const WorldCoordType &wCoords, const vtkm::Vec &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 GradientType; @@ -799,12 +799,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 +908,10 @@ CellDerivative(const FieldVecType &field, const WorldCoordType &wCoords, const vtkm::Vec &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 +925,9 @@ CellDerivative(const FieldVecType &field, const vtkm::VecRectilinearPointCoordinates<2> &wCoords, const vtkm::Vec &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 VecT; @@ -958,10 +956,10 @@ CellDerivative(const FieldVecType &field, const WorldCoordType &wCoords, const vtkm::Vec &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 GradientType; @@ -1026,10 +1024,10 @@ CellDerivative(const FieldVecType &field, const WorldCoordType &wCoords, const vtkm::Vec &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 +1041,9 @@ CellDerivative(const FieldVecType &field, const vtkm::VecRectilinearPointCoordinates<3> &wCoords, const vtkm::Vec &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 VecT; @@ -1078,10 +1076,10 @@ CellDerivative(const FieldVecType &field, const WorldCoordType &wCoords, const vtkm::Vec &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 +1096,10 @@ CellDerivative(const FieldVecType &field, const WorldCoordType &wCoords, const vtkm::Vec &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()); diff --git a/vtkm/exec/CellInterpolate.h b/vtkm/exec/CellInterpolate.h index ff167fb5c..54fc3f15a 100644 --- a/vtkm/exec/CellInterpolate.h +++ b/vtkm/exec/CellInterpolate.h @@ -20,11 +20,11 @@ #ifndef vtk_m_exec_Interpolate_h #define vtk_m_exec_Interpolate_h +#include #include #include #include #include -#include #include 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, 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 ¶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 &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( (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 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 triangleField; @@ -340,9 +338,9 @@ typename FieldVecType::ComponentType CellInterpolate(const FieldVecType &field, const vtkm::Vec &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 &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( (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 &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 &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 &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; diff --git a/vtkm/exec/ParametricCoordinates.h b/vtkm/exec/ParametricCoordinates.h index b436761b4..a0a813c51 100644 --- a/vtkm/exec/ParametricCoordinates.h +++ b/vtkm/exec/ParametricCoordinates.h @@ -20,11 +20,11 @@ #ifndef vtk_m_exec_ParametricCoordinates_h #define vtk_m_exec_ParametricCoordinates_h +#include #include #include #include #include -#include #include #include #include @@ -38,9 +38,9 @@ VTKM_EXEC_EXPORT void ParametricCoordinatesCenter(vtkm::IdComponent numPoints, vtkm::Vec &pcoords, vtkm::CellShapeTagEmpty, - const vtkm::exec::FunctorBase &worklet) + const vtkm::exec::FunctorBase &) { - VTKM_ASSERT_EXEC(numPoints == 0, worklet); + VTKM_ASSERT(numPoints == 0); pcoords[0] = 0; pcoords[1] = 0; pcoords[2] = 0; @@ -51,9 +51,9 @@ VTKM_EXEC_EXPORT void ParametricCoordinatesCenter(vtkm::IdComponent numPoints, vtkm::Vec &pcoords, vtkm::CellShapeTagVertex, - const vtkm::exec::FunctorBase &worklet) + const vtkm::exec::FunctorBase &) { - VTKM_ASSERT_EXEC(numPoints == 1, worklet); + VTKM_ASSERT(numPoints == 1); pcoords[0] = 0; pcoords[1] = 0; pcoords[2] = 0; @@ -64,9 +64,9 @@ VTKM_EXEC_EXPORT void ParametricCoordinatesCenter(vtkm::IdComponent numPoints, vtkm::Vec &pcoords, vtkm::CellShapeTagLine, - const vtkm::exec::FunctorBase &worklet) + const vtkm::exec::FunctorBase &) { - VTKM_ASSERT_EXEC(numPoints == 2, worklet); + VTKM_ASSERT(numPoints == 2); pcoords[0] = 0.5; pcoords[1] = 0; pcoords[2] = 0; @@ -77,9 +77,9 @@ VTKM_EXEC_EXPORT void ParametricCoordinatesCenter(vtkm::IdComponent numPoints, vtkm::Vec &pcoords, vtkm::CellShapeTagTriangle, - const vtkm::exec::FunctorBase &worklet) + const vtkm::exec::FunctorBase &) { - VTKM_ASSERT_EXEC(numPoints == 3, worklet); + VTKM_ASSERT(numPoints == 3); pcoords[0] = static_cast(1.0/3.0); pcoords[1] = static_cast(1.0/3.0); pcoords[2] = 0; @@ -92,7 +92,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 +120,9 @@ VTKM_EXEC_EXPORT void ParametricCoordinatesCenter(vtkm::IdComponent numPoints, vtkm::Vec &pcoords, vtkm::CellShapeTagQuad, - const vtkm::exec::FunctorBase &worklet) + const vtkm::exec::FunctorBase &) { - VTKM_ASSERT_EXEC(numPoints == 4, worklet); + VTKM_ASSERT(numPoints == 4); pcoords[0] = 0.5; pcoords[1] = 0.5; pcoords[2] = 0; @@ -133,9 +133,9 @@ VTKM_EXEC_EXPORT void ParametricCoordinatesCenter(vtkm::IdComponent numPoints, vtkm::Vec &pcoords, vtkm::CellShapeTagTetra, - const vtkm::exec::FunctorBase &worklet) + const vtkm::exec::FunctorBase &) { - VTKM_ASSERT_EXEC(numPoints == 4, worklet); + VTKM_ASSERT(numPoints == 4); pcoords[0] = 0.25; pcoords[1] = 0.25; pcoords[2] = 0.25; @@ -146,9 +146,9 @@ VTKM_EXEC_EXPORT void ParametricCoordinatesCenter(vtkm::IdComponent numPoints, vtkm::Vec &pcoords, vtkm::CellShapeTagHexahedron, - const vtkm::exec::FunctorBase &worklet) + const vtkm::exec::FunctorBase &) { - VTKM_ASSERT_EXEC(numPoints == 8, worklet); + VTKM_ASSERT(numPoints == 8); pcoords[0] = 0.5; pcoords[1] = 0.5; pcoords[2] = 0.5; @@ -159,9 +159,9 @@ VTKM_EXEC_EXPORT void ParametricCoordinatesCenter(vtkm::IdComponent numPoints, vtkm::Vec &pcoords, vtkm::CellShapeTagWedge, - const vtkm::exec::FunctorBase &worklet) + const vtkm::exec::FunctorBase &) { - VTKM_ASSERT_EXEC(numPoints == 6, worklet); + VTKM_ASSERT(numPoints == 6); pcoords[0] = static_cast(1.0/3.0); pcoords[1] = static_cast(1.0/3.0); pcoords[2] = 0.5; @@ -172,9 +172,9 @@ VTKM_EXEC_EXPORT void ParametricCoordinatesCenter(vtkm::IdComponent numPoints, vtkm::Vec &pcoords, vtkm::CellShapeTagPyramid, - const vtkm::exec::FunctorBase &worklet) + const vtkm::exec::FunctorBase &) { - VTKM_ASSERT_EXEC(numPoints == 5, worklet); + VTKM_ASSERT(numPoints == 5); pcoords[0] = 0.5; pcoords[1] = 0.5; pcoords[2] = static_cast(0.2); @@ -238,10 +238,10 @@ void ParametricCoordinatesPoint(vtkm::IdComponent numPoints, vtkm::IdComponent pointIndex, vtkm::Vec &pcoords, vtkm::CellShapeTagVertex, - const vtkm::exec::FunctorBase &worklet) + const vtkm::exec::FunctorBase &) { - VTKM_ASSERT_EXEC(numPoints == 1, worklet); - VTKM_ASSERT_EXEC(pointIndex == 0, worklet); + VTKM_ASSERT(numPoints == 1); + VTKM_ASSERT(pointIndex == 0); pcoords[0] = 0; pcoords[1] = 0; pcoords[2] = 0; @@ -253,10 +253,10 @@ void ParametricCoordinatesPoint(vtkm::IdComponent numPoints, vtkm::IdComponent pointIndex, vtkm::Vec &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); + VTKM_ASSERT(numPoints == 2); + VTKM_ASSERT((pointIndex >= 0) && (pointIndex < numPoints)); pcoords[0] = static_cast(pointIndex); pcoords[1] = 0; @@ -269,18 +269,16 @@ void ParametricCoordinatesPoint(vtkm::IdComponent numPoints, vtkm::IdComponent pointIndex, vtkm::Vec &pcoords, vtkm::CellShapeTagTriangle, - const vtkm::exec::FunctorBase &worklet) + const vtkm::exec::FunctorBase &) { - VTKM_ASSERT_EXEC(numPoints == 3, worklet); + VTKM_ASSERT(numPoints == 3); + VTKM_ASSERT((pointIndex >= 0) && (pointIndex < numPoints)); 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 +291,8 @@ void ParametricCoordinatesPoint(vtkm::IdComponent numPoints, vtkm::CellShapeTagPolygon, const vtkm::exec::FunctorBase &worklet) { - VTKM_ASSERT_EXEC(numPoints > 0, worklet); + VTKM_ASSERT(numPoints > 0); + VTKM_ASSERT((pointIndex >= 0) && (pointIndex < numPoints)); switch (numPoints) { @@ -343,9 +342,10 @@ void ParametricCoordinatesPoint(vtkm::IdComponent numPoints, vtkm::IdComponent pointIndex, vtkm::Vec &pcoords, vtkm::CellShapeTagQuad, - const vtkm::exec::FunctorBase &worklet) + const vtkm::exec::FunctorBase &) { - VTKM_ASSERT_EXEC(numPoints == 4, worklet); + VTKM_ASSERT(numPoints == 4); + VTKM_ASSERT((pointIndex >= 0) && (pointIndex < numPoints)); switch (pointIndex) { @@ -353,10 +353,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 +363,10 @@ void ParametricCoordinatesPoint(vtkm::IdComponent numPoints, vtkm::IdComponent pointIndex, vtkm::Vec &pcoords, vtkm::CellShapeTagTetra, - const vtkm::exec::FunctorBase &worklet) + const vtkm::exec::FunctorBase &) { - VTKM_ASSERT_EXEC(numPoints == 4, worklet); + VTKM_ASSERT(numPoints == 4); + VTKM_ASSERT((pointIndex >= 0) && (pointIndex < numPoints)); switch (pointIndex) { @@ -377,10 +374,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 +383,10 @@ void ParametricCoordinatesPoint(vtkm::IdComponent numPoints, vtkm::IdComponent pointIndex, vtkm::Vec &pcoords, vtkm::CellShapeTagHexahedron, - const vtkm::exec::FunctorBase &worklet) + const vtkm::exec::FunctorBase &) { - VTKM_ASSERT_EXEC(numPoints == 8, worklet); + VTKM_ASSERT(numPoints == 8); + VTKM_ASSERT((pointIndex >= 0) && (pointIndex < numPoints)); switch (pointIndex) { @@ -404,10 +398,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 +407,10 @@ void ParametricCoordinatesPoint(vtkm::IdComponent numPoints, vtkm::IdComponent pointIndex, vtkm::Vec &pcoords, vtkm::CellShapeTagWedge, - const vtkm::exec::FunctorBase &worklet) + const vtkm::exec::FunctorBase &) { - VTKM_ASSERT_EXEC(numPoints == 6, worklet); + VTKM_ASSERT(numPoints == 6); + VTKM_ASSERT((pointIndex >= 0) && (pointIndex < numPoints)); switch (pointIndex) { @@ -429,10 +420,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 +429,10 @@ void ParametricCoordinatesPoint(vtkm::IdComponent numPoints, vtkm::IdComponent pointIndex, vtkm::Vec &pcoords, vtkm::CellShapeTagPyramid, - const vtkm::exec::FunctorBase &worklet) + const vtkm::exec::FunctorBase &) { - VTKM_ASSERT_EXEC(numPoints == 5, worklet); + VTKM_ASSERT(numPoints == 5); + VTKM_ASSERT((pointIndex >= 0) && (pointIndex < numPoints)); switch (pointIndex) { @@ -453,10 +441,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; } } @@ -700,9 +684,9 @@ 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); + VTKM_ASSERT(pointWCoords.GetNumberOfComponents() == 1); return typename WorldCoordVector::ComponentType(0, 0, 0); } @@ -713,9 +697,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 +738,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 @@ -770,7 +754,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 +889,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 Vector2; @@ -944,9 +928,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 +986,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 +1012,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 +1028,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); diff --git a/vtkm/filter/internal/ResolveFieldTypeAndExecute.h b/vtkm/filter/internal/ResolveFieldTypeAndExecute.h index 98c5bf70d..5577d5a62 100644 --- a/vtkm/filter/internal/ResolveFieldTypeAndExecute.h +++ b/vtkm/filter/internal/ResolveFieldTypeAndExecute.h @@ -150,13 +150,6 @@ struct CanExecute //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 //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. diff --git a/vtkm/filter/internal/ResolveFieldTypeAndMap.h b/vtkm/filter/internal/ResolveFieldTypeAndMap.h index 42dbb0486..c255d1f7e 100644 --- a/vtkm/filter/internal/ResolveFieldTypeAndMap.h +++ b/vtkm/filter/internal/ResolveFieldTypeAndMap.h @@ -126,13 +126,6 @@ struct CanMap //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. diff --git a/vtkm/internal/ArrayPortalUniformPointCoordinates.h b/vtkm/internal/ArrayPortalUniformPointCoordinates.h index e05e5d64b..079d3bcba 100644 --- a/vtkm/internal/ArrayPortalUniformPointCoordinates.h +++ b/vtkm/internal/ArrayPortalUniformPointCoordinates.h @@ -20,6 +20,7 @@ #ifndef vtk_m_internal_ArrayPortalUniformPointCoordinates_h #define vtk_m_internal_ArrayPortalUniformPointCoordinates_h +#include #include 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(index[0]), this->Origin[1] + this->Spacing[1] * static_cast(index[1]), this->Origin[2] + this->Spacing[2] * static_cast(index[2])); diff --git a/vtkm/interop/cuda/internal/TransferToOpenGL.h b/vtkm/interop/cuda/internal/TransferToOpenGL.h index 0335228b4..79ccf92f2 100644 --- a/vtkm/interop/cuda/internal/TransferToOpenGL.h +++ b/vtkm/interop/cuda/internal/TransferToOpenGL.h @@ -113,7 +113,7 @@ public: } //assert that cuda_size is the same size as the buffer we created in OpenGL - VTKM_ASSERT_CONT(cuda_size >= desiredSize); + VTKM_ASSERT(cuda_size >= desiredSize); return pointer; } diff --git a/vtkm/io/writer/VTKDataSetWriter.h b/vtkm/io/writer/VTKDataSetWriter.h index 4d86abd53..08fccb17d 100644 --- a/vtkm/io/writer/VTKDataSetWriter.h +++ b/vtkm/io/writer/VTKDataSetWriter.h @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -329,7 +330,7 @@ private: vtkm::cont::DataSet dataSet, vtkm::Id csindex=0) { - VTKM_ASSERT_CONT(csindex < dataSet.GetNumberOfCellSets()); + VTKM_ASSERT(csindex < dataSet.GetNumberOfCellSets()); out << "# vtk DataFile Version 3.0" << std::endl; out << "vtk output" << std::endl; @@ -370,7 +371,8 @@ private: } else { - VTKM_ASSERT_CONT(false); + throw vtkm::cont::ErrorControlBadType( + "Could not determine type to write out."); } WritePointFields(out, dataSet); diff --git a/vtkm/worklet/VertexClustering.h b/vtkm/worklet/VertexClustering.h index 7d59b59cc..8de73448f 100644 --- a/vtkm/worklet/VertexClustering.h +++ b/vtkm/worklet/VertexClustering.h @@ -22,8 +22,6 @@ #include -#include - #include #include #include @@ -142,7 +140,7 @@ struct VertexClustering void operator()(const PointType &point, vtkm::Id &cid) const { cid = this->GetClusterId(point); - VTKM_ASSERT_EXEC(cid>=0, *this); // the id could overflow if too many cells + VTKM_ASSERT(cid>=0); // the id could overflow if too many cells } };