Commit 7d769a8f authored by Kenneth Moreland's avatar Kenneth Moreland

Add classes to manage point coordinates.

Each type of point coordinates has its own class with the name
PointCoordinates*. Currently there is a PointCoordiantesArray that contains
an ArrayHandle holding the point coordinates and a PointCoordinatesUniform
that takes the standard extent, origin, and spacing for a uniform rectilinear
grid and defines point coordiantes for that. Creating new PointCoordinates
arrays is pretty easy, and we will almost definitely add more. For example,
we should have an elevation version that takes uniform coordinates for
a 2D grid and then an elevation in the third dimension. We can probably
also use a basic composite point coordinates that can build them from
other coordinates.

There is also a DynamicPointCoordinates class that polymorphically stores
an instance of a PointCoordinates class. It has a CastAndCall method that
behaves like DynamicArrayHandle; it can call a functor with an array handle
(possible implicit) that holds the point coordinates.
parent ff31afca
......@@ -26,6 +26,8 @@ namespace vtkm {
namespace detail {
struct ListEmpty { };
template<typename T>
struct ListBase { };
......@@ -45,6 +47,12 @@ struct ListJoin { };
template<typename T> struct ListTagBase;
/// A special tag for an empty list.
///
struct ListTagEmpty {
typedef detail::ListEmpty List;
};
/// A basic tag for a list of one typename. This struct can be subclassed
/// and still behave like a list tag.
template<typename T>
......@@ -90,6 +98,13 @@ void ListForEach(const Functor &f, ListTag);
namespace detail {
template<typename Functor>
VTKM_CONT_EXPORT
void ListForEachImpl(Functor, ListEmpty)
{
// Nothing to do for empty list
}
template<typename Functor, typename T>
VTKM_CONT_EXPORT
void ListForEachImpl(Functor &f, ListBase<T>)
......
......@@ -34,6 +34,7 @@ set(headers
DeviceAdapter.h
DeviceAdapterSerial.h
DynamicArrayHandle.h
DynamicPointCoordinates.h
Error.h
ErrorControl.h
ErrorControlAssert.h
......@@ -41,6 +42,9 @@ set(headers
ErrorControlInternal.h
ErrorControlOutOfMemory.h
ErrorExecution.h
PointCoordinatesArray.h
PointCoordinatesListTag.h
PointCoordinatesUniform.h
)
#-----------------------------------------------------------------------------
......
......@@ -27,6 +27,7 @@
#include <vtkm/ListTag.h>
#include <vtkm/cont/ArrayContainerControl.h>
#include <vtkm/cont/ArrayContainerControlBasic.h>
namespace vtkm {
namespace cont {
......
......@@ -46,6 +46,33 @@ class DynamicArrayHandleCast;
} // namespace internal
/// \brief Holds an array handle without having to specify template parameters.
///
/// \c DynamicArrayHandle holds an \c ArrayHandle object using runtime
/// polymorphism to manage different value types and storage rather than
/// compile-time templates. This adds a programming convienience that helps
/// avoid a proliferation of templates. It also provides the management
/// necessary to interface VTK-m with data sources where types will not be
/// known until runtime.
///
/// To interface between the runtime polymorphism and the templated algorithms
/// in VTK-m, \c DynamicArrayHandle contains a method named \c CastAndCall that
/// will determine the correct type from some known list of types and
/// containers. This mechanism is used internally by VTK-m's worklet invocation
/// mechanism to determine the type when running algorithms.
///
/// By default, \c DynamicArrayHandle will assume that the value type in the
/// array matches one of the types specified by \c VTKM_DEFAULT_TYPE_LIST_TAG
/// and the container matches one of the tags specified by \c
/// VTKM_DEFAULT_CONTAINER_LIST_TAG. These lists can be changed by using the \c
/// ResetTypeList and \c ResetContainerList methods, respectively. It is
/// worthwhile to match these lists closely to the possible types that might be
/// used. If a type is missing you will get a runtime error. If there are more
/// types than necessary, then the template mechanism will create a lot of
/// object code that is never used, and keep in mind that the number of
/// combinations grows exponentally when using multiple \c DynamicArrayHandle
/// objects.
///
class DynamicArrayHandle
{
public:
......@@ -86,9 +113,9 @@ public:
vtkm::cont::ArrayHandle<Type,Container> > *container =
this->TryCastArrayContainer<Type,Container>();
if (container == NULL)
{
{
throw vtkm::cont::ErrorControlBadValue("Bad cast of dynamic array.");
}
}
return container->Item;
}
......@@ -237,7 +264,7 @@ void DynamicArrayHandle::CastAndCall(const Functor &f,
if (!tryType.FoundCast)
{
throw vtkm::cont::ErrorControlBadValue(
"Could not find appropriate cast in CastAndCall.");
"Could not find appropriate cast for array in CastAndCall.");
}
}
......
This diff is collapsed.
//============================================================================
// 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_PointCoordinatesArray_h
#define vtk_m_cont_PointCoordinatesArray_h
#include <vtkm/TypeListTag.h>
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/DynamicArrayHandle.h>
#include <vtkm/cont/internal/PointCoordinatesBase.h>
namespace vtkm {
namespace cont {
/// \brief Point coordinates stored in a \c Vector3 array.
///
/// The \c PointCoordinatesArray class is a simple PointCoordinates class
/// that stores the point coordinates in a single array. The array is managed
/// by a \c DynamicArrayHandle.
///
/// Like other PointCoordinates classes, \c PointCoordinatesArray is intended
/// to be used in conjunction with \c DynamicPointCoordinates.
///
class PointCoordinatesArray : public internal::PointCoordinatesBase
{
public:
VTKM_CONT_EXPORT
PointCoordinatesArray() { }
VTKM_CONT_EXPORT
PointCoordinatesArray(const vtkm::cont::DynamicArrayHandle &array)
: Array(array) { }
template<typename Container>
VTKM_CONT_EXPORT
PointCoordinatesArray(
const vtkm::cont::ArrayHandle<vtkm::Vector3,Container> &array)
: Array(array) { }
/// In this \c CastAndCall, \c TypeList is ignored. All point coordinates are
/// expressed as Vector3, so that must be how the array is represented.
///
template<typename Functor, typename TypeList, typename ContainerList>
VTKM_CONT_EXPORT
void CastAndCall(const Functor &f, TypeList, ContainerList) const
{
this->Array.CastAndCall(f, vtkm::TypeListTagVector3(), ContainerList());
}
private:
vtkm::cont::DynamicArrayHandle Array;
};
}
} // namespace vtkm::cont
#endif //vtk_m_cont_PointCoordinatesArray_h
//============================================================================
// 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_PointCoordinatesListTag_h
#define vtk_m_cont_PointCoordinatesListTag_h
#ifndef VTKM_DEFAULT_POINT_COORDINATES_LIST_TAG
#define VTKM_DEFAULT_POINT_COORDINATES_LIST_TAG \
::vtkm::cont::PointCoordinatesListTagCommon
#endif
#include <vtkm/ListTag.h>
#include <vtkm/cont/PointCoordinatesArray.h>
#include <vtkm/cont/PointCoordinatesUniform.h>
namespace vtkm {
namespace cont {
struct PointCoordinatesListTagArray :
vtkm::ListTagBase<vtkm::cont::PointCoordinatesArray> { };
struct PointCoordinatesListTagUniform :
vtkm::ListTagBase<vtkm::cont::PointCoordinatesUniform> { };
/// A list of the most commonly used point coordinate types. Includes \c
/// PointCoordinatesArray.
///
struct PointCoordinatesListTagCommon
: vtkm::ListTagBase2<
vtkm::cont::PointCoordinatesArray,
vtkm::cont::PointCoordinatesUniform>
{ };
}
} // namespace vtkm::cont
#endif //vtk_m_cont_PointCoordinatesListTag_h
//============================================================================
// 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_PointCoordinatesUniform_h
#define vtk_m_cont_PointCoordinatesUniform_h
#include <vtkm/cont/ArrayHandleUniformPointCoordinates.h>
#include <vtkm/cont/internal/PointCoordinatesBase.h>
namespace vtkm {
namespace cont {
/// \brief Implicitly defined uniform point coordinates.
///
/// The \c PointCoordinatesUniform class is a PointCoordinates class that
/// implicitly defines the points for a uniform rectilinear grid of data
/// (defined by an extent, an origin, and spacing in each dimension).
///
/// Like other PointCoordinates classes, \c PointCoordinatesArray is intended
/// to be used in conjunction with \c DynamicPointCoordinates.
///
class PointCoordinatesUniform : public internal::PointCoordinatesBase
{
public:
VTKM_CONT_EXPORT
PointCoordinatesUniform() { }
VTKM_CONT_EXPORT
PointCoordinatesUniform(const vtkm::Extent3 &extent,
const vtkm::Vector3 &origin,
const vtkm::Vector3 &spacing)
: Array(extent, origin, spacing)
{ }
/// In this \c CastAndCall, both \c TypeList and \c ContainerList are
/// ignored. All point coordinates are expressed as Vector3, so that must be
/// how the array is represented.
///
template<typename Functor, typename TypeList, typename ContainerList>
VTKM_CONT_EXPORT
void CastAndCall(const Functor &f, TypeList, ContainerList) const
{
f(this->Array);
}
private:
vtkm::cont::ArrayHandleUniformPointCoordinates Array;
};
}
} // namespace vtkm::cont
#endif //vtk_m_cont_PointCoordinatesUniform_h
......@@ -34,6 +34,7 @@ set(headers
DeviceAdapterTagSerial.h
DynamicTransform.h
IteratorFromArrayPortal.h
PointCoordinatesBase.h
SimplePolymorphicContainer.h
)
......
//============================================================================
// 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_internal_PointCoordinatesBase_h
#define vtk_m_cont_internal_PointCoordinatesBase_h
#include <vtkm/Types.h>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_base_of.hpp>
/// Checks that the argument is a proper \c PointCoordinates class. This is a
/// handy concept check for functions and classes to make sure that a template
/// argument is actually point coordinates. (You can get weird errors elsewhere
/// in the code when a mistake is made.)
#define VTKM_IS_POINT_COORDINATES(pctype) \
BOOST_STATIC_ASSERT_MSG( \
::vtkm::cont::internal::IsValidPointCoordinates<pctype>::type::value, \
"Provided type is not a valid VTK-m PointCoordinates type.")
namespace vtkm {
namespace cont {
namespace internal {
/// \brief Superclass for point coordinates classes.
///
/// \c PointCoordinatesBase is a simple superclass for all point coordinates
/// classes (by convention named \c PointCoordinates___).
///
/// The most important feature of this base class is to provide a common class
/// to perform a compile-time check to make sure a templated class is in fact
/// supposed to be a point coordinate class. (It is assumed that the subclass
/// will implement the expected methods.)
///
/// The second feature of this base class is to provide a type to perform safe
/// up and down casts, although this is easy to get around.
///
class PointCoordinatesBase
{
public:
// It is important to declare the destructor virtual so that subclasses will
// be properly destroyed.
virtual ~PointCoordinatesBase() { }
};
/// Checks to see if the given type is a valid point coordinates class. This
/// check is compatable with the Boost meta-template programming library (MPL).
/// It contains a typedef named type that is either boost::mpl::true_ or
/// boost::mpl::false_. Both of these have a typedef named value with the
/// respective boolean value.
///
template<typename Type>
struct IsValidPointCoordinates {
typedef typename boost::is_base_of<
vtkm::cont::internal::PointCoordinatesBase,Type>::type type;
};
}
}
} // namespace vtkm::cont::internal
#endif //vtk_m_cont_internal_PointCoordinatesBase_h
......@@ -22,6 +22,7 @@
#include "vtkm/cont/ArrayHandle.h"
#include "vtkm/cont/DynamicArrayHandle.h"
#include "vtkm/cont/DynamicPointCoordinates.h"
#include "vtkm/internal/FunctionInterface.h"
......@@ -72,7 +73,8 @@ struct FunctionInterfaceFunctor {
const vtkm::internal::FunctionInterface<
void(vtkm::cont::ArrayHandle<vtkm::Scalar>,
vtkm::cont::ArrayHandle<vtkm::Scalar>,
vtkm::cont::ArrayHandle<std::string>)> &) const {
vtkm::cont::ArrayHandle<std::string>,
vtkm::cont::ArrayHandleUniformPointCoordinates)> &) const {
std::cout << " In FunctionInterface<...> functor." << std::endl;
g_FunctionCalls++;
}
......@@ -107,20 +109,24 @@ void TestFunctionTransform()
vtkm::cont::ArrayHandle<vtkm::Scalar> scalarArray;
vtkm::cont::ArrayHandle<std::string> stringArray;
vtkm::cont::ArrayHandleUniformPointCoordinates pointCoordinatesArray;
std::cout << " Trying basic functor call w/o transform (make sure it works)."
<< std::endl;
TRY_TRANSFORM(FunctionInterfaceFunctor()(
vtkm::internal::make_FunctionInterface<void>(scalarArray,
scalarArray,
stringArray)));
vtkm::internal::make_FunctionInterface<void>(
scalarArray,
scalarArray,
stringArray,
pointCoordinatesArray)));
std::cout << " Trying dynamic cast" << std::endl;
TRY_TRANSFORM(
vtkm::internal::make_FunctionInterface<void>(
scalarArray,
vtkm::cont::DynamicArrayHandle(scalarArray),
vtkm::cont::DynamicArrayHandle(stringArray).ResetTypeList(TypeListTagString()))
vtkm::cont::DynamicArrayHandle(stringArray).ResetTypeList(TypeListTagString()),
vtkm::cont::DynamicPointCoordinates(vtkm::cont::PointCoordinatesUniform()))
.DynamicTransformCont(vtkm::cont::internal::DynamicTransform(),
FunctionInterfaceFunctor()));
}
......
......@@ -38,6 +38,8 @@ set(unit_tests
UnitTestDeviceAdapterAlgorithmGeneral.cxx
UnitTestDeviceAdapterSerial.cxx
UnitTestDynamicArrayHandle.cxx
UnitTestDynamicPointCoordinates.cxx
UnitTestPointCoordinates.cxx
)
vtkm_unit_tests(SOURCES ${unit_tests})
......
//============================================================================
// 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.
//============================================================================
#include <vtkm/cont/DynamicPointCoordinates.h>
#include <vtkm/cont/ArrayContainerControlImplicit.h>
#include <vtkm/cont/ContainerListTag.h>
#include <vtkm/cont/internal/IteratorFromArrayPortal.h>
#include <vtkm/cont/testing/Testing.h>
#include <vector>
namespace {
const vtkm::Extent3 EXTENT = vtkm::Extent3(vtkm::Id3(0,0,0), vtkm::Id3(9,9,9));
const vtkm::Vector3 ORIGIN = vtkm::Vector3(0, 0, 0);
const vtkm::Vector3 SPACING = vtkm::Vector3(1, 1, 1);
const vtkm::Id3 DIMENSION = vtkm::ExtentPointDimensions(EXTENT);
const vtkm::Id ARRAY_SIZE = DIMENSION[0]*DIMENSION[1]*DIMENSION[2];
vtkm::Vector3 TestValue(vtkm::Id index)
{
vtkm::Id3 index3d = vtkm::ExtentPointFlatIndexToTopologyIndex(index, EXTENT);
return vtkm::Vector3(index3d[0], index3d[1], index3d[2]);
}
int g_CheckArrayInvocations;
struct CheckArray
{
CheckArray() {
g_CheckArrayInvocations = 0;
}
template<typename Container>
void operator()(
const vtkm::cont::ArrayHandle<vtkm::Vector3,Container> &array) const
{
std::cout << " In CastAndCall functor" << std::endl;
g_CheckArrayInvocations++;
typename vtkm::cont::ArrayHandle<vtkm::Vector3,Container>::PortalConstControl portal =
array.GetPortalConstControl();
VTKM_TEST_ASSERT(portal.GetNumberOfValues() == ARRAY_SIZE,
"Array has wrong number of values.");
for (vtkm::Id index = 0; index < ARRAY_SIZE; index++)
{
const vtkm::Vector3 receivedValue = portal.Get(index);
const vtkm::Vector3 expectedValue = TestValue(index);
VTKM_TEST_ASSERT(receivedValue == expectedValue,
"Got bad value in array.");
}
}
};
struct UnusualPortal
{
typedef vtkm::Vector3 ValueType;
VTKM_EXEC_CONT_EXPORT
vtkm::Id GetNumberOfValues() const { return ARRAY_SIZE; }
VTKM_EXEC_CONT_EXPORT
ValueType Get(vtkm::Id index) const { return TestValue(index); }
typedef vtkm::cont::internal::IteratorFromArrayPortal<UnusualPortal>
IteratorType;
VTKM_CONT_EXPORT
IteratorType GetIteratorBegin() const {
return IteratorType(*this);
}
VTKM_CONT_EXPORT
IteratorType GetIteratorEnd() const {
return IteratorType(*this, this->GetNumberOfValues());
}
};
class ArrayHandleWithUnusualContainer
: public vtkm::cont::ArrayHandle<vtkm::Vector3, vtkm::cont::ArrayContainerControlTagImplicit<UnusualPortal> >
{
typedef vtkm::cont::ArrayHandle<vtkm::Vector3, vtkm::cont::ArrayContainerControlTagImplicit<UnusualPortal> >
Superclass;
public:
VTKM_CONT_EXPORT
ArrayHandleWithUnusualContainer()
: Superclass(Superclass::PortalConstControl()) { }
};
struct ContainerListTagUnusual :
vtkm::ListTagBase<ArrayHandleWithUnusualContainer::ArrayContainerControlTag>
{ };
struct PointCoordinatesUnusual : vtkm::cont::internal::PointCoordinatesBase
{
template<typename Functor, typename TypeList, typename ContainerList>
void CastAndCall(const Functor &f, TypeList, ContainerList) const
{
f(ArrayHandleWithUnusualContainer());
}
};
struct PointCoordinatesListUnusual
: vtkm::ListTagBase<PointCoordinatesUnusual> { };
void TryDefaultArray()
{
std::cout << "Trying a basic point coordinates array with a default container."
<< std::endl;
std::vector<vtkm::Vector3> buffer(ARRAY_SIZE);
for (vtkm::Id index = 0; index < ARRAY_SIZE; index++)
{
buffer[index] = TestValue(index);
}
vtkm::cont::DynamicPointCoordinates pointCoordinates =
vtkm::cont::DynamicPointCoordinates(
vtkm::cont::make_ArrayHandle(buffer));
pointCoordinates.CastAndCall(CheckArray());
VTKM_TEST_ASSERT(g_CheckArrayInvocations == 1,
"CastAndCall functor not called expected number of times.");
}
void TryUnusualContainer()
{
std::cout << "Trying a basic point coordinates array with an unusual container."
<< std::endl;
vtkm::cont::DynamicPointCoordinates pointCoordinates =
vtkm::cont::DynamicPointCoordinates(
vtkm::cont::PointCoordinatesArray(ArrayHandleWithUnusualContainer()));
std::cout << " Make sure we get an exception when we can't find the type."
<< std::endl;
try
{
pointCoordinates.CastAndCall(CheckArray());
VTKM_TEST_FAIL("CastAndCall failed to error for unrecognized container.");
}
catch (vtkm::cont::ErrorControlBadValue error)
{
std::cout << " Caught expected exception for unrecognized container: "
<< std::endl << " " << error.GetMessage() << std::endl;
}
std::cout << " Recast containers and try again." << std::endl;
pointCoordinates.ResetContainerList(ContainerListTagUnusual())
.CastAndCall(CheckArray());
VTKM_TEST_ASSERT(g_CheckArrayInvocations == 1,
"CastAndCall functor not called expected number of times.");
}
void TryUniformPointCoordinates()
{
std::cout << "Trying uniform point coordinates." << std::endl;
vtkm::cont::DynamicPointCoordinates pointCoordinates =
vtkm::cont::DynamicPointCoordinates(
vtkm::cont::PointCoordinatesUniform(EXTENT, ORIGIN, SPACING));
pointCoordinates.CastAndCall(CheckArray());
VTKM_TEST_ASSERT(g_CheckArrayInvocations == 1,
"CastAndCall functor not called expected number of times.");
}
void TryUnusualPointCoordinates()
{
std::cout << "Trying an unusual point coordinates object." << std::endl;
vtkm::cont::DynamicPointCoordinates pointCoordinates =
vtkm::cont::DynamicPointCoordinates(PointCoordinatesUnusual());
std::cout << " Make sure we get an exception when we can't find the type."
<< std::endl;
try
{
pointCoordinates.CastAndCall(CheckArray());
VTKM_TEST_FAIL("CastAndCall failed to error for unrecognized container.");
}
catch (vtkm::cont::ErrorControlBadValue error)
{
std::cout << " Caught expected exception for unrecognized point coordinates: "
<< std::endl << " " << error.GetMessage() << std::endl;
}
std::cout << " Recast containers and try again." << std::endl;
pointCoordinates.ResetPointCoordinatesList(PointCoordinatesListUnusual())
.CastAndCall(CheckArray());
VTKM_TEST_ASSERT(g_CheckArrayInvocations == 1,
"CastAndCall functor not called expected number of times.");
}
void DynamicPointCoordiantesTest()
{
TryDefaultArray();
TryUnusualContainer();
TryUniformPointCoordinates();
TryUnusualPointCoordinates();
}
} // anonymous namespace
int UnitTestDynamicPointCoordinates(int, char *[])
{
return vtkm::cont::testing::Testing::Run(DynamicPointCoordiantesTest);
}
//============================================================================
// 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.
//============================================================================
// Make sure nothing relies on default container or device adapter.
#define VTKM_ARRAY_CONTAINER_CONTROL VTKM_ARRAY_CONTAINER_CONTROL_ERROR
#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR
// Make sure nothing relies on default lists.
#define VTKM_DEFAULT_TYPE_LIST_TAG ::vtkm::ListTagEmpty
#define VTKM_DEFAULT_CONTAINER_LIST_TAG ::vtkm::ListTagEmpty
#include <vtkm/cont/PointCoordinatesArray.h>
#include <vtkm/cont/PointCoordinatesUniform.h>
#include <vtkm/Extent.h>
#include <vtkm/TypeListTag.h>
#include <vtkm/cont/ArrayContainerControlBasic.h>
#include <vtkm/cont/DeviceAdapterSerial.h>