2014-05-14 21:05:38 +00:00
|
|
|
//============================================================================
|
|
|
|
// 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.
|
2015-05-21 12:09:22 +00:00
|
|
|
// Copyright 2014 Los Alamos National Security.
|
2014-05-14 21:05:38 +00:00
|
|
|
//
|
|
|
|
// 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
|
|
|
|
|
2015-09-17 19:45:35 +00:00
|
|
|
#include <vtkm/StaticAssert.h>
|
2014-05-14 21:05:38 +00:00
|
|
|
#include <vtkm/Types.h>
|
|
|
|
|
2015-08-12 19:08:45 +00:00
|
|
|
VTKM_THIRDPARTY_PRE_INCLUDE
|
2014-05-14 21:05:38 +00:00
|
|
|
#include <boost/type_traits/is_base_of.hpp>
|
2015-08-12 19:08:45 +00:00
|
|
|
VTKM_THIRDPARTY_POST_INCLUDE
|
2014-05-14 21:05:38 +00:00
|
|
|
|
|
|
|
/// 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) \
|
2015-09-17 19:45:35 +00:00
|
|
|
VTKM_STATIC_ASSERT_MSG( \
|
2014-05-14 21:05:38 +00:00
|
|
|
::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
|