changes typechecks for execution objects

In order to make the change from the current way execution obejcts are utilized to the new proposed executionObjectFactory process type checks now has to look for the new execution object factory class to check against.
This commit is contained in:
Matthew Letter 2018-02-21 15:55:02 -07:00 committed by Matthew Letter
parent 9ac466edf7
commit 7e5a55881b
21 changed files with 81 additions and 39 deletions

@ -78,6 +78,7 @@ set(headers
ErrorFilterExecution.h
ErrorExecution.h
ErrorInternal.h
ExecutionObjectFactoryBase.h
Field.h
FieldRangeCompute.h
FieldRangeGlobalCompute.h

@ -606,7 +606,7 @@ public:
}
template <typename DeviceAdapter>
struct TwoLevelUniformGridExecution : public vtkm::exec::ExecutionObjectBase
struct TwoLevelUniformGridExecution : public vtkm::cont::ExecutionObjectFactoryBase
{
template <typename T>
using ArrayPortalConst =

@ -0,0 +1,40 @@
//============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//
// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
// Copyright 2014 UT-Battelle, LLC.
// Copyright 2014 Los Alamos National Security.
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// the U.S. Government retains certain rights in this software.
//
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
// Laboratory (LANL), the U.S. Government retains certain rights in
// this software.
//============================================================================
#ifndef vtk_m_cont_ExecutionObjectFactoryBase_h
#define vtk_m_cont_ExecutionObjectFactoryBase_h
#include <vtkm/Types.h>
#include <vtkm/exec/ExecutionObjectBase.h>
namespace vtkm
{
namespace cont
{
/// Base \c ExecutionObjectFactoryBase for execution objects to inherit from so that
/// you can use an arbitrary object as a parameter in an execution environment
/// function. Any method you want to use on the execution side must have the
/// VTKM_EXEC modifier.
/// \tparam Device
class ExecutionObjectFactoryBase
{
};
}
} // namespace vtkm::cont
#endif //vtk_m_cont_ExecutionObjectFactoryBase_h

@ -24,7 +24,7 @@
#include <vtkm/cont/arg/Transport.h>
#include <vtkm/exec/ExecutionObjectBase.h>
#include <vtkm/cont/ExecutionObjectFactoryBase.h>
namespace vtkm
{
@ -50,7 +50,7 @@ struct Transport<vtkm::cont::arg::TransportTagExecObject, ContObjectType, Device
// execution objects are expected to inherit from
// vtkm::exec::ExecutionObjectBase.
VTKM_STATIC_ASSERT_MSG(
(std::is_base_of<vtkm::exec::ExecutionObjectBase, ContObjectType>::value),
(std::is_base_of<vtkm::cont::ExecutionObjectFactoryBase, ContObjectType>::value),
"All execution objects are expected to inherit from vtkm::exec::ExecutionObjectBase");
using ExecObjectType = ContObjectType;

@ -24,7 +24,7 @@
#include <vtkm/cont/arg/TypeCheck.h>
#include <vtkm/exec/ExecutionObjectBase.h>
#include <vtkm/cont/ExecutionObjectFactoryBase.h>
#include <type_traits>
@ -36,7 +36,7 @@ namespace arg
{
/// The ExecObject type check passes for any object that inherits from \c
/// ExecutionObjectBase. This is supposed to signify that the object can be
/// ExecutionObjectFactoryBase. This is supposed to signify that the object can be
/// used in the execution environment although there is no way to verify that.
///
struct TypeCheckTagExecObject
@ -46,7 +46,8 @@ struct TypeCheckTagExecObject
template <typename Type>
struct TypeCheck<TypeCheckTagExecObject, Type>
{
static constexpr bool value = std::is_base_of<vtkm::exec::ExecutionObjectBase, Type>::value;
static constexpr bool value =
std::is_base_of<vtkm::cont::ExecutionObjectFactoryBase, Type>::value;
};
}
}

@ -20,7 +20,7 @@
#include <vtkm/cont/arg/TransportTagExecObject.h>
#include <vtkm/exec/ExecutionObjectBase.h>
#include <vtkm/cont/ExecutionObjectFactoryBase.h>
#include <vtkm/exec/FunctorBase.h>
#include <vtkm/cont/serial/DeviceAdapterSerial.h>
@ -32,7 +32,7 @@
namespace
{
struct TestExecutionObject : public vtkm::exec::ExecutionObjectBase
struct TestExecutionObject : public vtkm::cont::ExecutionObjectFactoryBase
{
vtkm::Int32 Number;
};

@ -27,7 +27,7 @@
namespace
{
struct TestExecutionObject : vtkm::exec::ExecutionObjectBase
struct TestExecutionObject : vtkm::cont::ExecutionObjectFactoryBase
{
};
struct TestNotExecutionObject

@ -23,7 +23,7 @@
#include <vtkm/ListTag.h>
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/DeviceAdapter.h>
#include <vtkm/exec/ExecutionObjectBase.h>
#include <vtkm/cont/ExecutionObjectFactoryBase.h>
namespace vtkm
{
@ -51,7 +51,7 @@ struct AtomicArrayTypeListTag : vtkm::ListTagBase<vtkm::Int32, vtkm::Int64>
///
///
template <typename T, typename DeviceAdapterTag>
class AtomicArray : public vtkm::exec::ExecutionObjectBase
class AtomicArray : public vtkm::cont::ExecutionObjectFactoryBase
{
public:
using ValueType = T;

@ -22,7 +22,7 @@
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/DeviceAdapter.h>
#include <vtkm/exec/ExecutionObjectBase.h>
#include <vtkm/cont/ExecutionObjectFactoryBase.h>
namespace vtkm
{
@ -39,7 +39,7 @@ namespace exec
/// structure.
///
template <typename T, typename StorageTag, typename DeviceAdapterTag>
class ExecutionWholeArray : public vtkm::exec::ExecutionObjectBase
class ExecutionWholeArray : public vtkm::cont::ExecutionObjectFactoryBase
{
public:
using ValueType = T;
@ -89,7 +89,7 @@ private:
/// structure
///
template <typename T, typename StorageTag, typename DeviceAdapterTag>
class ExecutionWholeArrayConst : public vtkm::exec::ExecutionObjectBase
class ExecutionWholeArrayConst : public vtkm::cont::ExecutionObjectFactoryBase
{
public:
using ValueType = T;
@ -126,4 +126,4 @@ private:
}
} // namespace vtkm::exec
#endif //vtk_m_exec_ExecutionObjectBase_h
#endif //vtk_m_exec_ExecutionObjectFactoryBase_h

@ -23,7 +23,7 @@
#include <vtkm/exec/arg/AspectTagDefault.h>
#include <vtkm/exec/arg/Fetch.h>
#include <vtkm/exec/ExecutionObjectBase.h>
#include <vtkm/cont/ExecutionObjectFactoryBase.h>
#include <type_traits>
@ -54,10 +54,10 @@ struct Fetch<vtkm::exec::arg::FetchTagExecObject,
// If you get a compile error here, it means you tried to use an object that
// is not an execution object as an argument that is expected to be one. All
// execution objects are expected to inherit from
// vtkm::exec::ExecutionObjectBase.
// vtkm::exec::ExecutionObjectFactoryBase.
static_assert(
std::is_base_of<vtkm::exec::ExecutionObjectBase, ExecObjectType>::value,
"All execution objects are expected to inherit from vtkm::exec::ExecutionObjectBase");
std::is_base_of<vtkm::cont::ExecutionObjectFactoryBase, ExecObjectType>::value,
"All execution objects are expected to inherit from vtkm::cont::ExecutionObjectFactoryBase");
using ValueType = ExecObjectType;

@ -23,7 +23,7 @@
#include <vtkm/exec/arg/AspectTagDefault.h>
#include <vtkm/exec/arg/Fetch.h>
#include <vtkm/exec/ExecutionObjectBase.h>
#include <vtkm/cont/ExecutionObjectFactoryBase.h>
#include <type_traits>

@ -22,7 +22,7 @@
#include <vtkm/exec/arg/testing/ThreadIndicesTesting.h>
#include <vtkm/exec/ExecutionObjectBase.h>
#include <vtkm/cont/ExecutionObjectFactoryBase.h>
#include <vtkm/testing/Testing.h>
@ -31,7 +31,7 @@
namespace
{
struct TestExecutionObject : public vtkm::exec::ExecutionObjectBase
struct TestExecutionObject : public vtkm::cont::ExecutionObjectFactoryBase
{
TestExecutionObject()
: Number(static_cast<vtkm::Int32>(0xDEADDEAD))

@ -20,7 +20,7 @@
#ifndef vtk_m_exec_internal_ReduceByKeyLookup_h
#define vtk_m_exec_internal_ReduceByKeyLookup_h
#include <vtkm/exec/ExecutionObjectBase.h>
#include <vtkm/cont/ExecutionObjectFactoryBase.h>
#include <vtkm/StaticAssert.h>
#include <vtkm/Types.h>
@ -41,7 +41,7 @@ namespace internal
/// state.
///
template <typename KeyPortalType, typename IdPortalType, typename IdComponentPortalType>
struct ReduceByKeyLookup : vtkm::exec::ExecutionObjectBase
struct ReduceByKeyLookup : vtkm::cont::ExecutionObjectFactoryBase
{
using KeyType = typename KeyPortalType::ValueType;

@ -25,7 +25,7 @@
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/DeviceAdapter.h>
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
#include <vtkm/exec/ExecutionObjectBase.h>
#include <vtkm/cont/ExecutionObjectFactoryBase.h>
namespace vtkm
{
@ -102,7 +102,7 @@ public:
}
template <typename DeviceTag>
class Texture2DSampler : public vtkm::exec::ExecutionObjectBase
class Texture2DSampler : public vtkm::cont::ExecutionObjectFactoryBase
{
public:
using TextureExecPortal =

@ -67,7 +67,7 @@ VTKM_EXEC_CONT vtkm::Vec<T, NumComponents> Scale(const vtkm::Vec<T, NumComponent
}
template <typename DeviceAdapter>
class ExecutionConnectivityExplicit : vtkm::exec::ExecutionObjectBase
class ExecutionConnectivityExplicit : vtkm::cont::ExecutionObjectFactoryBase
{
private:
using UInt8Portal =

@ -120,7 +120,7 @@ private:
} //namespace gradient
template <typename T>
struct GradientOutputFields : public vtkm::exec::ExecutionObjectBase
struct GradientOutputFields : public vtkm::cont::ExecutionObjectFactoryBase
{
using ValueType = T;

@ -26,7 +26,7 @@
#include <vtkm/cont/arg/TransportTagArrayOut.h>
#include <vtkm/cont/arg/TransportTagExecObject.h>
#include <vtkm/exec/ExecutionObjectBase.h>
#include <vtkm/cont/ExecutionObjectFactoryBase.h>
#include <vtkm/exec/arg/FetchTagArrayDirectOut.h>
#include <vtkm/worklet/gradient/Divergence.h>
@ -39,7 +39,7 @@ namespace exec
{
template <typename T, typename DeviceAdapter>
struct GradientScalarOutput : public vtkm::exec::ExecutionObjectBase
struct GradientScalarOutput : public vtkm::cont::ExecutionObjectFactoryBase
{
using ValueType = vtkm::Vec<T, 3>;
using BaseTType = typename vtkm::BaseComponent<T>::Type;
@ -77,7 +77,7 @@ struct GradientScalarOutput : public vtkm::exec::ExecutionObjectBase
};
template <typename T, typename DeviceAdapter>
struct GradientVecOutput : public vtkm::exec::ExecutionObjectBase
struct GradientVecOutput : public vtkm::cont::ExecutionObjectFactoryBase
{
using ValueType = vtkm::Vec<T, 3>;
using BaseTType = typename vtkm::BaseComponent<T>::Type;

@ -23,7 +23,7 @@
#include <vtkm/CellShape.h>
#include <vtkm/Types.h>
#include <vtkm/exec/ExecutionObjectBase.h>
#include <vtkm/cont/ExecutionObjectFactoryBase.h>
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/StorageBasic.h>
@ -89,7 +89,7 @@ static vtkm::IdComponent TriangleIndexData[] = {
};
template <typename Device>
class TriangulateTablesExecutionObject : public vtkm::exec::ExecutionObjectBase
class TriangulateTablesExecutionObject : public vtkm::cont::ExecutionObjectFactoryBase
{
public:
using PortalType = typename TriangulateArrayHandle::ExecutionTypes<Device>::PortalConst;
@ -262,7 +262,7 @@ static vtkm::IdComponent TetrahedronIndexData[] = {
};
template <typename Device>
class TetrahedralizeTablesExecutionObject : public vtkm::exec::ExecutionObjectBase
class TetrahedralizeTablesExecutionObject : public vtkm::cont::ExecutionObjectFactoryBase
{
public:
using PortalType = typename TriangulateArrayHandle::ExecutionTypes<Device>::PortalConst;

@ -50,7 +50,7 @@ struct TestExecObject
vtkm::Id* Array;
};
struct TestExecObjectType : vtkm::exec::ExecutionObjectBase
struct TestExecObjectType : vtkm::cont::ExecutionObjectFactoryBase
{
template <typename Functor, typename... Args>
void CastAndCall(Functor f, Args&&... args) const
@ -61,7 +61,7 @@ struct TestExecObjectType : vtkm::exec::ExecutionObjectBase
};
struct TestExecObjectTypeBad
{ //this will fail as it doesn't inherit from vtkm::exec::ExecutionObjectBase
{ //this will fail as it doesn't inherit from vtkm::cont::ExecutionObjectFactoryBase
template <typename Functor, typename... Args>
void CastAndCall(Functor f, Args&&... args) const
{

@ -26,7 +26,7 @@
#include <vtkm/cont/ArrayHandleCast.h>
#include <vtkm/cont/ArrayHandleCounting.h>
#include <vtkm/cont/CellSetExplicit.h>
#include <vtkm/exec/ExecutionObjectBase.h>
#include <vtkm/cont/ExecutionObjectFactoryBase.h>
#include <vtkm/worklet/DispatcherMapField.h>
#include <vtkm/worklet/particleadvection/Particles.h>

@ -23,7 +23,7 @@
#include <vtkm/Types.h>
#include <vtkm/cont/DeviceAdapter.h>
#include <vtkm/exec/ExecutionObjectBase.h>
#include <vtkm/cont/ExecutionObjectFactoryBase.h>
namespace vtkm
{
@ -44,7 +44,7 @@ enum ParticleStatus
};
template <typename T, typename DeviceAdapterTag>
class Particles : public vtkm::exec::ExecutionObjectBase
class Particles : public vtkm::cont::ExecutionObjectFactoryBase
{
private: