mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
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.
This commit is contained in:
parent
2ddad8bcc5
commit
cc497e6a1b
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -300,7 +300,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,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<std::size_t>(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<std::size_t>(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<std::size_t>(index)];
|
||||
}
|
||||
|
@ -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>
|
||||
|
||||
@ -215,9 +214,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);
|
||||
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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<
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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
|
||||
|
@ -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,10 @@ 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);
|
||||
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 +682,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 +709,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 +728,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 +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<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 +925,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 +956,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 +1024,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 +1041,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 +1076,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 +1096,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,11 +20,11 @@
|
||||
#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/exec/CellDerivative.h>
|
||||
#include <vtkm/exec/CellInterpolate.h>
|
||||
#include <vtkm/exec/FunctorBase.h>
|
||||
@ -38,9 +38,9 @@ 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);
|
||||
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<ParametricCoordType,3> &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<ParametricCoordType,3> &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<ParametricCoordType,3> &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<ParametricCoordType>(1.0/3.0);
|
||||
pcoords[1] = static_cast<ParametricCoordType>(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<ParametricCoordType,3> &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<ParametricCoordType,3> &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<ParametricCoordType,3> &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<ParametricCoordType,3> &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<ParametricCoordType>(1.0/3.0);
|
||||
pcoords[1] = static_cast<ParametricCoordType>(1.0/3.0);
|
||||
pcoords[2] = 0.5;
|
||||
@ -172,9 +172,9 @@ 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);
|
||||
VTKM_ASSERT(numPoints == 5);
|
||||
pcoords[0] = 0.5;
|
||||
pcoords[1] = 0.5;
|
||||
pcoords[2] = static_cast<ParametricCoordType>(0.2);
|
||||
@ -238,10 +238,10 @@ 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);
|
||||
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<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);
|
||||
VTKM_ASSERT(numPoints == 2);
|
||||
VTKM_ASSERT((pointIndex >= 0) && (pointIndex < numPoints));
|
||||
|
||||
pcoords[0] = static_cast<ParametricCoordType>(pointIndex);
|
||||
pcoords[1] = 0;
|
||||
@ -269,18 +269,16 @@ 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);
|
||||
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<ParametricCoordType,3> &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<ParametricCoordType,3> &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<ParametricCoordType,3> &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<ParametricCoordType,3> &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<ParametricCoordType,3> &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<typename WorldCoordVector>
|
||||
@ -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<T,2> 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);
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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]));
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <vtkm/cont/CellSetStructured.h>
|
||||
#include <vtkm/cont/CellSetSingleType.h>
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/cont/ErrorControlBadType.h>
|
||||
#include <vtkm/cont/ErrorControlBadValue.h>
|
||||
#include <vtkm/cont/Field.h>
|
||||
|
||||
@ -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);
|
||||
|
@ -22,8 +22,6 @@
|
||||
|
||||
#include <vtkm/Types.h>
|
||||
|
||||
#include <vtkm/exec/Assert.h>
|
||||
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ArrayHandleConstant.h>
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
@ -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
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user