vtk-m/vtkm/cont/CoordinateSystem.cxx
Kenneth Moreland 63ef84ed78 Optionally remove all use of ArrayHandleVirtual
As we remove more and more virtual methods from VTK-m, I expect several
users will be interested in completely removing them from the build for
several reasons.

1. They may be compiling for hardware that does not support virtual
methods.
2. They may need to compile for CUDA but need shared libraries.
3. It should go a bit faster.

To enable this, a CMake option named `VTKm_NO_DEPRECATED_VIRTUAL` is
added. It defaults to `OFF`. But when it is `ON`, none of the code that
both uses virtuals and is deprecated will be built.

Currently, only `ArrayHandleVirtual` is deprecated, so the rest of the
virtual classes will still be built. As we move forward, more will be
removed until all virtual method functionality is removed.
2020-09-04 22:52:45 -06:00

127 lines
4.5 KiB
C++

//============================================================================
// 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.
//============================================================================
#include <vtkm/cont/ArrayHandleUniformPointCoordinates.h>
#include <vtkm/cont/CoordinateSystem.h>
namespace vtkm
{
namespace cont
{
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
namespace detail
{
VTKM_DEPRECATED_SUPPRESS_BEGIN
vtkm::cont::ArrayHandleVirtualCoordinates CoordDataDepWrapper::ToArray() const
{
return this->Cast<vtkm::cont::ArrayHandleVirtualCoordinates>();
}
VTKM_DEPRECATED_SUPPRESS_END
} // namespace detail
#endif //VTKM_NO_DEPRECATED_VIRTUAL
VTKM_CONT CoordinateSystem::CoordinateSystem()
: Superclass()
{
}
VTKM_CONT CoordinateSystem::CoordinateSystem(std::string name,
const vtkm::cont::VariantArrayHandleCommon& data)
: Superclass(name, Association::POINTS, vtkm::cont::VariantArrayHandle{ data })
{
}
/// This constructor of coordinate system sets up a regular grid of points.
///
VTKM_CONT
CoordinateSystem::CoordinateSystem(std::string name,
vtkm::Id3 dimensions,
vtkm::Vec3f origin,
vtkm::Vec3f spacing)
: Superclass(name,
Association::POINTS,
vtkm::cont::ArrayHandleUniformPointCoordinates(dimensions, origin, spacing))
{
}
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
VTKM_CONT vtkm::cont::detail::CoordDataDepWrapper CoordinateSystem::GetData() const
{
return vtkm::cont::detail::CoordDataDepWrapper(this->Superclass::GetData());
}
#else //!VTKM_NO_DEPRECATED_VIRTUAL
VTKM_CONT vtkm::cont::VariantArrayHandleBase<vtkm::TypeListFieldVec3> CoordinateSystem::GetData()
const
{
return vtkm::cont::VariantArrayHandleBase<vtkm::TypeListFieldVec3>(this->Superclass::GetData());
}
#endif //!VTKM_NO_DEPRECATED_VIRTUAL
VTKM_CONT vtkm::cont::CoordinateSystem::MultiplexerArrayType
CoordinateSystem::GetDataAsMultiplexer() const
{
return this->GetData().AsMultiplexer<MultiplexerArrayType>();
}
VTKM_CONT
void CoordinateSystem::PrintSummary(std::ostream& out) const
{
out << " Coordinate System ";
this->Superclass::PrintSummary(out);
}
template VTKM_CONT_EXPORT CoordinateSystem::CoordinateSystem(
std::string name,
const vtkm::cont::ArrayHandle<vtkm::Vec<float, 3>>&);
template VTKM_CONT_EXPORT CoordinateSystem::CoordinateSystem(
std::string name,
const vtkm::cont::ArrayHandle<vtkm::Vec<double, 3>>&);
template VTKM_CONT_EXPORT CoordinateSystem::CoordinateSystem(
std::string name,
const vtkm::cont::ArrayHandle<
vtkm::Vec3f,
vtkm::cont::StorageTagImplicit<vtkm::internal::ArrayPortalUniformPointCoordinates>>&);
template VTKM_CONT_EXPORT CoordinateSystem::CoordinateSystem(
std::string name,
const vtkm::cont::ArrayHandle<
vtkm::Vec3f_32,
vtkm::cont::StorageTagCartesianProduct<vtkm::cont::StorageTagBasic,
vtkm::cont::StorageTagBasic,
vtkm::cont::StorageTagBasic>>&);
template VTKM_CONT_EXPORT CoordinateSystem::CoordinateSystem(
std::string name,
const vtkm::cont::ArrayHandle<
vtkm::Vec3f_64,
vtkm::cont::StorageTagCartesianProduct<vtkm::cont::StorageTagBasic,
vtkm::cont::StorageTagBasic,
vtkm::cont::StorageTagBasic>>&);
template VTKM_CONT_EXPORT CoordinateSystem::CoordinateSystem(
std::string name,
const vtkm::cont::ArrayHandle<
vtkm::Vec3f_32,
typename vtkm::cont::ArrayHandleCompositeVector<
vtkm::cont::ArrayHandle<vtkm::Float32, vtkm::cont::StorageTagBasic>,
vtkm::cont::ArrayHandle<vtkm::Float32, vtkm::cont::StorageTagBasic>,
vtkm::cont::ArrayHandle<vtkm::Float32, vtkm::cont::StorageTagBasic>>::StorageTag>&);
template VTKM_CONT_EXPORT CoordinateSystem::CoordinateSystem(
std::string name,
const vtkm::cont::ArrayHandle<
vtkm::Vec3f_64,
typename vtkm::cont::ArrayHandleCompositeVector<
vtkm::cont::ArrayHandle<vtkm::Float64, vtkm::cont::StorageTagBasic>,
vtkm::cont::ArrayHandle<vtkm::Float64, vtkm::cont::StorageTagBasic>,
vtkm::cont::ArrayHandle<vtkm::Float64, vtkm::cont::StorageTagBasic>>::StorageTag>&);
}
} // namespace vtkm::cont