Merge branch 'master' into tetra_uniform

This commit is contained in:
Patricia Kroll Fasel - 090207 2015-09-21 09:07:05 -06:00
commit cbcb19a718
20 changed files with 117 additions and 55 deletions

@ -30,7 +30,7 @@ namespace vtkm {
// operation, and than casted back down to char's when return.
// This causes a false positive warning, even when the values is within
// the value types range
#if defined(VTKM_GCC)
#if defined(VTKM_GCC) || defined(VTKM_CLANG)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif // gcc || clang
@ -129,4 +129,4 @@ struct BitwiseXor
} // namespace vtkm
#endif //vtk_m_BinaryOperators_h
#endif //vtk_m_BinaryOperators_h

@ -30,6 +30,7 @@ set(headers
Math.h
Matrix.h
Pair.h
StaticAssert.h
TopologyElementTag.h
TypeListTag.h
Types.h

@ -20,10 +20,10 @@
#ifndef vtk_m_CellShape_h
#define vtk_m_CellShape_h
#include <vtkm/StaticAssert.h>
#include <vtkm/Types.h>
VTKM_THIRDPARTY_PRE_INCLUDE
#include <boost/static_assert.hpp>
#include <boost/type_traits/integral_constant.hpp>
VTKM_THIRDPARTY_POST_INCLUDE
@ -75,7 +75,7 @@ struct CellShapeTagCheck : boost::false_type { };
/// tag.
///
#define VTKM_IS_CELL_SHAPE_TAG(tag) \
BOOST_STATIC_ASSERT_MSG( \
VTKM_STATIC_ASSERT_MSG( \
::vtkm::internal::CellShapeTagCheck<tag>::value, \
"Provided type is not a valid VTK-m cell shape tag.")

@ -22,10 +22,10 @@
#include <vtkm/internal/ListTagDetail.h>
#include <vtkm/StaticAssert.h>
#include <vtkm/internal/ExportMacros.h>
VTKM_THIRDPARTY_PRE_INCLUDE
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_base_of.hpp>
VTKM_THIRDPARTY_POST_INCLUDE
@ -48,7 +48,7 @@ struct ListTagCheck
/// code when a mistake is made.)
///
#define VTKM_IS_LIST_TAG(tag) \
BOOST_STATIC_ASSERT_MSG( \
VTKM_STATIC_ASSERT_MSG( \
::vtkm::internal::ListTagCheck<tag>::Valid, \
"Provided type is not a valid VTK-m list tag.")

54
vtkm/StaticAssert.h Normal file

@ -0,0 +1,54 @@
//============================================================================
// 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_StaticAssert_h
#define vtk_m_StaticAssert_h
#include <vtkm/internal/Configure.h>
VTKM_THIRDPARTY_PRE_INCLUDE
#include <boost/static_assert.hpp>
VTKM_THIRDPARTY_POST_INCLUDE
// Newer versions of clang are causing the static assert to issue a warning
// about unused typedefs. In this case, we want to disable the warnings using
// pragmas. However, not all compiler support pragmas in code blocks (although
// fortunately clang does). Thus, only use these pragmas in the instance where
// we need it and know we can use it.
#if defined(VTKM_CLANG) && (__apple_build_version__ >= 7000072)
#define VTKM_STATIC_ASSERT(condition) \
VTKM_THIRDPARTY_PRE_INCLUDE \
BOOST_STATIC_ASSERT(condition) \
VTKM_THIRDPARTY_POST_INCLUDE
#define VTKM_STATIC_ASSERT_MSG(condition, message) \
VTKM_THIRDPARTY_PRE_INCLUDE \
BOOST_STATIC_ASSERT_MSG(condition, message) \
VTKM_THIRDPARTY_POST_INCLUDE
#else
#define VTKM_STATIC_ASSERT(condition) \
BOOST_STATIC_ASSERT(condition)
#define VTKM_STATIC_ASSERT_MSG(condition, message) \
BOOST_STATIC_ASSERT_MSG(condition, message)
#endif
#endif //vtk_m_StaticAssert_h

@ -676,7 +676,7 @@ struct BindRightBinaryOp
// operation, and than casted back down to char's when return.
// This causes a false positive warning, even when the values is within
// the value types range
#if defined(VTKM_GCC)
#if defined(VTKM_GCC) || defined(VTKM_CLANG)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif // gcc || clang

@ -24,14 +24,11 @@
#include <vtkm/cont/ErrorControlBadValue.h>
#include <vtkm/cont/ErrorControlInternal.h>
#include <vtkm/StaticAssert.h>
#include <vtkm/VecTraits.h>
#include <vtkm/internal/FunctionInterface.h>
VTKM_THIRDPARTY_PRE_INCLUDE
#include <boost/static_assert.hpp>
VTKM_THIRDPARTY_POST_INCLUDE
#include <sstream>
namespace vtkm {
@ -181,7 +178,7 @@ public:
static const vtkm::IdComponent NUM_COMPONENTS =
vtkm::VecTraits<ValueType>::NUM_COMPONENTS;
BOOST_STATIC_ASSERT(NUM_COMPONENTS == PortalTypes::ARITY);
VTKM_STATIC_ASSERT(NUM_COMPONENTS == PortalTypes::ARITY);
VTKM_EXEC_CONT_EXPORT
ArrayPortalCompositeVector() { }
@ -236,7 +233,7 @@ public:
// If you get a compile error here, it means you probably tried to create
// an ArrayHandleCompositeVector with a return type of a vector with a
// different number of components than the number of arrays given.
BOOST_STATIC_ASSERT(NUM_COMPONENTS == FunctionInterfaceArrays::ARITY);
VTKM_STATIC_ASSERT(NUM_COMPONENTS == FunctionInterfaceArrays::ARITY);
VTKM_CONT_EXPORT
ArrayPortalCompositeVectorCont() : NumberOfValues(0) { }

@ -20,6 +20,8 @@
#ifndef vtk_m_cont_CellSet_h
#define vtk_m_cont_CellSet_h
#include <vtkm/StaticAssert.h>
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/Field.h>
#include <vtkm/cont/LogicalStructure.h>
@ -27,7 +29,6 @@
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
VTKM_THIRDPARTY_PRE_INCLUDE
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_base_of.hpp>
VTKM_THIRDPARTY_POST_INCLUDE
@ -95,7 +96,7 @@ struct CellSetCheck
};
#define VTKM_IS_CELL_SET(T) \
BOOST_STATIC_ASSERT(::vtkm::cont::internal::CellSetCheck<T>::type::value)
VTKM_STATIC_ASSERT(::vtkm::cont::internal::CellSetCheck<T>::type::value)
} // namespace internal

@ -28,11 +28,9 @@
#define VTKM_STORAGE VTKM_STORAGE_BASIC
#endif
#include <vtkm/internal/ExportMacros.h>
VTKM_THIRDPARTY_PRE_INCLUDE
#include <boost/static_assert.hpp>
VTKM_THIRDPARTY_POST_INCLUDE
#include <vtkm/StaticAssert.h>
#include <vtkm/internal/ExportMacros.h>
namespace vtkm {
namespace cont {
@ -76,7 +74,7 @@ namespace detail {
// arguments.
template<typename T>
struct UndefinedArrayPortal {
BOOST_STATIC_ASSERT(sizeof(T) == static_cast<size_t>(-1));
VTKM_STATIC_ASSERT(sizeof(T) == static_cast<size_t>(-1));
};
} // namespace detail

@ -20,10 +20,10 @@
#ifndef vtk_m_cont_arg_ControlSignatureTagBase_h
#define vtk_m_cont_arg_ControlSignatureTagBase_h
#include <vtkm/StaticAssert.h>
#include <vtkm/internal/ExportMacros.h>
VTKM_THIRDPARTY_PRE_INCLUDE
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_base_of.hpp>
VTKM_THIRDPARTY_POST_INCLUDE
@ -62,7 +62,7 @@ struct ControlSignatureTagCheck
/// get weird errors elsewhere in the code when a mistake is made.)
///
#define VTKM_IS_CONTROL_SIGNATURE_TAG(tag) \
BOOST_STATIC_ASSERT_MSG( \
VTKM_STATIC_ASSERT_MSG( \
::vtkm::cont::arg::internal::ControlSignatureTagCheck<tag>::Valid, \
"Provided a type that is not a valid ControlSignature tag.")

@ -20,15 +20,12 @@
#ifndef vtk_m_cont_internal_DeviceAdapterTag_h
#define vtk_m_cont_internal_DeviceAdapterTag_h
#include <vtkm/StaticAssert.h>
#include <vtkm/internal/Configure.h>
#include <vtkm/internal/ExportMacros.h>
#include <string>
VTKM_THIRDPARTY_PRE_INCLUDE
#include <boost/static_assert.hpp>
VTKM_THIRDPARTY_POST_INCLUDE
#define VTKM_DEVICE_ADAPTER_ERROR -2
#define VTKM_DEVICE_ADAPTER_UNDEFINED -1
#define VTKM_DEVICE_ADAPTER_SERIAL 1
@ -112,7 +109,7 @@ struct DeviceAdapterTagCheck
/// elsewhere in the code when a mistake is made.)
///
#define VTKM_IS_DEVICE_ADAPTER_TAG(tag) \
BOOST_STATIC_ASSERT_MSG( \
VTKM_STATIC_ASSERT_MSG( \
::vtkm::cont::internal::DeviceAdapterTagCheck<tag>::Valid, \
"Provided type is not a valid VTK-m device adapter tag.")

@ -20,10 +20,10 @@
#ifndef vtk_m_cont_internal_PointCoordinatesBase_h
#define vtk_m_cont_internal_PointCoordinatesBase_h
#include <vtkm/StaticAssert.h>
#include <vtkm/Types.h>
VTKM_THIRDPARTY_PRE_INCLUDE
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_base_of.hpp>
VTKM_THIRDPARTY_POST_INCLUDE
@ -32,7 +32,7 @@ VTKM_THIRDPARTY_POST_INCLUDE
/// 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_STATIC_ASSERT_MSG( \
::vtkm::cont::internal::IsValidPointCoordinates<pctype>::type::value, \
"Provided type is not a valid VTK-m PointCoordinates type.")

@ -20,10 +20,10 @@
#ifndef vtk_m_exec_arg_ExecutionSignatureTagBase_h
#define vtk_m_exec_arg_ExecutionSignatureTagBase_h
#include <vtkm/StaticAssert.h>
#include <vtkm/internal/ExportMacros.h>
VTKM_THIRDPARTY_PRE_INCLUDE
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_base_of.hpp>
VTKM_THIRDPARTY_POST_INCLUDE
@ -64,7 +64,7 @@ struct ExecutionSignatureTagCheck
/// get weird errors elsewhere in the code when a mistake is made.)
///
#define VTKM_IS_EXECUTION_SIGNATURE_TAG(tag) \
BOOST_STATIC_ASSERT_MSG( \
VTKM_STATIC_ASSERT_MSG( \
::vtkm::exec::arg::internal::ExecutionSignatureTagCheck<tag>::Valid, \
"Provided a type that is not a valid ExecutionSignature tag.")

@ -22,12 +22,13 @@
#include <vtkm/exec/arg/BasicArg.h>
#include <vtkm/StaticAssert.h>
#include <vtkm/internal/FunctionInterface.h>
#include <vtkm/testing/Testing.h>
VTKM_THIRDPARTY_PRE_INCLUDE
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
VTKM_THIRDPARTY_POST_INCLUDE
@ -166,15 +167,15 @@ struct TestWorkletErrorProxy : vtkm::exec::FunctorBase
// Check behavior of InvocationToFetch helper class.
BOOST_STATIC_ASSERT(( boost::is_same<
VTKM_STATIC_ASSERT(( boost::is_same<
vtkm::exec::internal::detail::InvocationToFetch<InvocationType1,1>::type,
vtkm::exec::arg::Fetch<TestFetchTagInput,vtkm::exec::arg::AspectTagDefault,InvocationType1,1> >::type::value ));
BOOST_STATIC_ASSERT(( boost::is_same<
VTKM_STATIC_ASSERT(( boost::is_same<
vtkm::exec::internal::detail::InvocationToFetch<InvocationType1,2>::type,
vtkm::exec::arg::Fetch<TestFetchTagOutput,vtkm::exec::arg::AspectTagDefault,InvocationType1,2> >::type::value ));
BOOST_STATIC_ASSERT(( boost::is_same<
VTKM_STATIC_ASSERT(( boost::is_same<
vtkm::exec::internal::detail::InvocationToFetch<InvocationType2,0>::type,
vtkm::exec::arg::Fetch<TestFetchTagOutput,vtkm::exec::arg::AspectTagDefault,InvocationType2,2> >::type::value ));

@ -24,6 +24,7 @@
#include <vtkm/exec/internal/ErrorMessageBuffer.h>
#include <vtkm/CellTraits.h>
#include <vtkm/StaticAssert.h>
#include <vtkm/VecVariable.h>
#include <vtkm/testing/Testing.h>
@ -76,7 +77,7 @@ void GetMinMaxPoints(CellShapeTag,
{
// If this line fails, then MAX_POINTS is not large enough to support all
// cell shapes.
BOOST_STATIC_ASSERT((vtkm::CellTraits<CellShapeTag>::NUM_POINTS <= MAX_POINTS));
VTKM_STATIC_ASSERT((vtkm::CellTraits<CellShapeTag>::NUM_POINTS <= MAX_POINTS));
minPoints = maxPoints = vtkm::CellTraits<CellShapeTag>::NUM_POINTS;
}

@ -24,15 +24,12 @@
#include <vtkm/exec/internal/ErrorMessageBuffer.h>
#include <vtkm/CellTraits.h>
#include <vtkm/StaticAssert.h>
#include <vtkm/VecRectilinearPointCoordinates.h>
#include <vtkm/VecVariable.h>
#include <vtkm/testing/Testing.h>
VTKM_THIRDPARTY_PRE_INCLUDE
#include <boost/static_assert.hpp>
VTKM_THIRDPARTY_POST_INCLUDE
namespace {
static const vtkm::IdComponent MAX_POINTS = 8;
@ -45,7 +42,7 @@ void GetMinMaxPoints(CellShapeTag,
{
// If this line fails, then MAX_POINTS is not large enough to support all
// cell shapes.
BOOST_STATIC_ASSERT((vtkm::CellTraits<CellShapeTag>::NUM_POINTS <= MAX_POINTS));
VTKM_STATIC_ASSERT((vtkm::CellTraits<CellShapeTag>::NUM_POINTS <= MAX_POINTS));
minPoints = maxPoints = vtkm::CellTraits<CellShapeTag>::NUM_POINTS;
}

@ -22,6 +22,7 @@
#include <vtkm/exec/ParametricCoordinates.h>
#include <vtkm/CellTraits.h>
#include <vtkm/StaticAssert.h>
#include <vtkm/VecVariable.h>
#include <vtkm/testing/Testing.h>
@ -29,7 +30,6 @@
VTKM_THIRDPARTY_PRE_INCLUDE
#include <boost/random/mersenne_twister.hpp>
#include <boost/random/uniform_real_distribution.hpp>
#include <boost/static_assert.hpp>
VTKM_THIRDPARTY_POST_INCLUDE
#include <time.h>
@ -48,7 +48,7 @@ void GetMinMaxPoints(CellShapeTag,
{
// If this line fails, then MAX_POINTS is not large enough to support all
// cell shapes.
BOOST_STATIC_ASSERT((vtkm::CellTraits<CellShapeTag>::NUM_POINTS <= MAX_POINTS));
VTKM_STATIC_ASSERT((vtkm::CellTraits<CellShapeTag>::NUM_POINTS <= MAX_POINTS));
minPoints = maxPoints = vtkm::CellTraits<CellShapeTag>::NUM_POINTS;
}

@ -32,7 +32,7 @@
#define VTKM_MSVC
#endif
#ifdef ____clang__
#if defined(____clang__) || defined(__clang__)
#define VTKM_CLANG
#endif
@ -119,13 +119,30 @@
// this is used to set pragmas that dissable warnings that VTK-m checks for
// but boost and thrust does not.
#if (defined(VTKM_GCC) || defined(VTKM_CLANG)) && !defined(VTKM_PGI)
#define VTKM_THIRDPARTY_PRE_INCLUDE \
_Pragma("GCC diagnostic push") \
#define VTK_M_THIRDPARTY_GCC_WARNING_PRAGMAS \
_Pragma("GCC diagnostic ignored \"-Wconversion\"") \
_Pragma("GCC diagnostic ignored \"-Wshadow\"") \
_Pragma("GCC diagnostic ignored \"-Wunused-parameter\"")
// Newer versions of clang have an unused-local-typedef warning, but not older
// versions. This checks for the apple version of clang, which is different
// than other clang compiled versions. If using a non-apple version of clang,
// you might need to extend this condition.
#if defined(VTKM_CLANG) && (__apple_build_version__ >= 7000072)
#define VTK_M_THIRDPARTY_CLANG_WARNING_PRAGMAS \
_Pragma("GCC diagnostic ignored \"-Wunused-local-typedef\"")
#else
#define VTK_M_THIRDPARTY_CLANG_WARNING_PRAGMAS
#endif
#define VTKM_THIRDPARTY_PRE_INCLUDE \
_Pragma("GCC diagnostic push") \
VTK_M_THIRDPARTY_GCC_WARNING_PRAGMAS \
VTK_M_THIRDPARTY_CLANG_WARNING_PRAGMAS
#define VTKM_THIRDPARTY_POST_INCLUDE \
_Pragma("GCC diagnostic pop")
#else
#define VTKM_THIRDPARTY_PRE_INCLUDE
#define VTKM_THIRDPARTY_POST_INCLUDE

@ -22,14 +22,11 @@
#define vtk_m_internal_ConnectivityStructuredInternals_h
#include <vtkm/CellShape.h>
#include <vtkm/StaticAssert.h>
#include <vtkm/TopologyElementTag.h>
#include <vtkm/Types.h>
#include <vtkm/VecVariable.h>
VTKM_THIRDPARTY_PRE_INCLUDE
#include <boost/static_assert.hpp>
VTKM_THIRDPARTY_POST_INCLUDE
namespace vtkm {
namespace internal {
@ -526,8 +523,8 @@ struct ConnectivityStructuredIndexHelper
// instantiated, because it means someone missed a topology mapping type.
// We need to create a test which depends on the templated types so
// it doesn't get picked up without a concrete instantiation.
BOOST_STATIC_ASSERT_MSG(sizeof(To) == static_cast<size_t>(-1),
"Missing Specialization for Topologies");
VTKM_STATIC_ASSERT_MSG(sizeof(To) == static_cast<size_t>(-1),
"Missing Specialization for Topologies");
};
template<vtkm::IdComponent Dimension>

@ -20,6 +20,8 @@
#ifndef vtk_m_worklet_internal_DispatcherBase_h
#define vtk_m_worklet_internal_DispatcherBase_h
#include <vtkm/StaticAssert.h>
#include <vtkm/internal/FunctionInterface.h>
#include <vtkm/internal/Invocation.h>
@ -38,7 +40,6 @@
VTKM_THIRDPARTY_PRE_INCLUDE
#include <boost/mpl/assert.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_base_of.hpp>
#include <boost/utility/enable_if.hpp>
VTKM_THIRDPARTY_POST_INCLUDE
@ -264,8 +265,8 @@ private:
const vtkm::internal::FunctionInterface<Signature> &parameters) const
{
typedef vtkm::internal::FunctionInterface<Signature> ParameterInterface;
BOOST_STATIC_ASSERT_MSG(ParameterInterface::ARITY == NUM_INVOKE_PARAMS,
"Dispatcher Invoke called with wrong number of arguments.");
VTKM_STATIC_ASSERT_MSG(ParameterInterface::ARITY == NUM_INVOKE_PARAMS,
"Dispatcher Invoke called with wrong number of arguments.");
BOOST_MPL_ASSERT(( boost::is_base_of<BaseWorkletType,WorkletType> ));