mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-16 17:22:55 +00:00
Improve deprecation support of CellMeasures
Moved deprecated class to new headers (so that indirect includes still work). Changed vtkm::filter::mesh_info::IntegrationType to a scoped enum (which we favor in VTK-m). Correct the implementation of the deprecated integration types (which would not have actually compiled anyway).
This commit is contained in:
parent
5b7893a3f7
commit
b2947a1d78
@ -13,68 +13,6 @@
|
||||
#include <vtkm/Deprecated.h>
|
||||
#include <vtkm/filter/mesh_info/CellMeasures.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
|
||||
struct VTKM_DEPRECATED(1.8, "IntegrateOver is no longer supported") IntegrateOver
|
||||
{
|
||||
};
|
||||
struct VTKM_DEPRECATED(1.8, "IntegrateOverCurve is no longer supported") IntegrateOverCurve
|
||||
: IntegrateOver
|
||||
{
|
||||
static constexpr IntegrationType value = ArcLength;
|
||||
};
|
||||
struct VTKM_DEPRECATED(1.8, "IntegrateOverSurface is no longer supported") IntegrateOverSurface
|
||||
: IntegrateOver
|
||||
{
|
||||
static constexpr IntegrationType value = Area;
|
||||
};
|
||||
struct VTKM_DEPRECATED(1.8, "IntegrateOverSurface is no longer supported") IntegrateOverSolid
|
||||
: IntegrateOver
|
||||
{
|
||||
static constexpr IntegrationType value = Volume;
|
||||
};
|
||||
|
||||
// Lists of acceptable types of integration
|
||||
using ArcLength VTKM_DEPRECATED(1.8, "Use vtkm::filter::mesh_info::IntegrationType::ArcLength") =
|
||||
vtkm::List<IntegrateOverCurve>;
|
||||
using Area VTKM_DEPRECATED(1.8, "Use vtkm::filter::mesh_info::IntegrationType::Area") =
|
||||
vtkm::List<IntegrateOverSurface>;
|
||||
using Volume VTKM_DEPRECATED(1.8, "Use vtkm::filter::mesh_info::IntegrationType::Volume") =
|
||||
vtkm::List<IntegrateOverSolid>;
|
||||
using AllMeasures VTKM_DEPRECATED(1.8,
|
||||
"Use vtkm::filter::mesh_info::IntegrationType::AllMeasures") =
|
||||
vtkm::List<IntegrateOverSolid, IntegrateOverSurface, IntegrateOverCurve>;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
IntegrationType OldToNewIntegrationType(vtkm::List<>)
|
||||
{
|
||||
return static_cast<IntegrationType>(0);
|
||||
}
|
||||
|
||||
template <typename T, typename... Ts>
|
||||
IntegrationType OldToNewIntegrationType(vtkm::List<T, Ts...>)
|
||||
{
|
||||
return T::value | OldToNewIntegrationType(vtkm::List<Ts...>{});
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
namespace filter
|
||||
{
|
||||
template <typename IntegrationTypeList>
|
||||
class VTKM_DEPRECATED(1.8, "Use vtkm::filter::mesh_info::CellMeasures.") CellMeasures
|
||||
: public vtkm::filter::mesh_info::CellMeasures
|
||||
{
|
||||
public:
|
||||
CellMeasures()
|
||||
: vtkm::filter::mesh_info::CellMeasures(vtkm::detail::OldToNewIntegrationType(IntegrationTypeList{})
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
VTKM_DEPRECATED(1.8,
|
||||
"Use vtkm/filter/mesh_info/CellMeasures.h instead of vtkm/filter/CellMeasures.h.")
|
||||
inline void CellMeasures_deprecated() {}
|
||||
@ -83,7 +21,4 @@ inline void CellMeasures_deprecated_warning()
|
||||
{
|
||||
CellMeasures_deprecated();
|
||||
}
|
||||
|
||||
} // namespace filter
|
||||
} // namespace vtkm
|
||||
#endif //vtk_m_filter_CellMeasures_h
|
||||
|
@ -8,8 +8,8 @@
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#ifndef vtk_m_filter_mesh_info_CellMeasure_h
|
||||
#define vtk_m_filter_mesh_info_CellMeasure_h
|
||||
#ifndef vtk_m_filter_mesh_info_CellMeasures_h
|
||||
#define vtk_m_filter_mesh_info_CellMeasures_h
|
||||
|
||||
#include <vtkm/filter/NewFilterField.h>
|
||||
#include <vtkm/filter/mesh_info/vtkm_filter_mesh_info_export.h>
|
||||
@ -20,14 +20,26 @@ namespace filter
|
||||
{
|
||||
namespace mesh_info
|
||||
{
|
||||
enum IntegrationType
|
||||
|
||||
/// \brief Specifies over what types of mesh elements CellMeasures will operate.
|
||||
enum struct IntegrationType
|
||||
{
|
||||
None = 0x00,
|
||||
ArcLength = 0x01,
|
||||
Area = 0x02,
|
||||
Volume = 0x04,
|
||||
AllMeasures = ArcLength | Area | Volume
|
||||
};
|
||||
|
||||
VTKM_EXEC_CONT inline IntegrationType operator&(IntegrationType left, IntegrationType right)
|
||||
{
|
||||
return static_cast<IntegrationType>(static_cast<int>(left) & static_cast<int>(right));
|
||||
}
|
||||
VTKM_EXEC_CONT inline IntegrationType operator|(IntegrationType left, IntegrationType right)
|
||||
{
|
||||
return static_cast<IntegrationType>(static_cast<int>(left) | static_cast<int>(right));
|
||||
}
|
||||
|
||||
/// \brief Compute the measure of each (3D) cell in a dataset.
|
||||
///
|
||||
/// CellMeasures is a filter that generates a new cell data array (i.e., one value
|
||||
@ -54,4 +66,83 @@ private:
|
||||
} // namespace filter
|
||||
} // namespace vtkm
|
||||
|
||||
#endif // vtk_m_filter_mesh_info_CellMeasure_h
|
||||
// Implement the deprecated functionality of vtkm::filter::CellMeasures, which was moved into the
|
||||
// mesh_info namespace (along with some other API changes). Everything below this line (up to the
|
||||
// #endif for the include guard) can be deleted once the deprecated functionality is removed.
|
||||
|
||||
// Don't warn about deprecation while implementing deprecated functionality.
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
|
||||
struct VTKM_DEPRECATED(1.8, "IntegrateOver is no longer supported") IntegrateOver
|
||||
{
|
||||
};
|
||||
struct VTKM_DEPRECATED(1.8, "IntegrateOverCurve is no longer supported") IntegrateOverCurve
|
||||
: IntegrateOver
|
||||
{
|
||||
static constexpr vtkm::filter::mesh_info::IntegrationType value =
|
||||
vtkm::filter::mesh_info::IntegrationType::ArcLength;
|
||||
};
|
||||
struct VTKM_DEPRECATED(1.8, "IntegrateOverSurface is no longer supported") IntegrateOverSurface
|
||||
: IntegrateOver
|
||||
{
|
||||
static constexpr vtkm::filter::mesh_info::IntegrationType value =
|
||||
vtkm::filter::mesh_info::IntegrationType::Area;
|
||||
};
|
||||
struct VTKM_DEPRECATED(1.8, "IntegrateOverSurface is no longer supported") IntegrateOverSolid
|
||||
: IntegrateOver
|
||||
{
|
||||
static constexpr vtkm::filter::mesh_info::IntegrationType value =
|
||||
vtkm::filter::mesh_info::IntegrationType::Volume;
|
||||
};
|
||||
|
||||
// Lists of acceptable types of integration
|
||||
using ArcLength VTKM_DEPRECATED(1.8, "Use vtkm::filter::mesh_info::IntegrationType::ArcLength") =
|
||||
vtkm::List<IntegrateOverCurve>;
|
||||
using Area VTKM_DEPRECATED(1.8, "Use vtkm::filter::mesh_info::IntegrationType::Area") =
|
||||
vtkm::List<IntegrateOverSurface>;
|
||||
using Volume VTKM_DEPRECATED(1.8, "Use vtkm::filter::mesh_info::IntegrationType::Volume") =
|
||||
vtkm::List<IntegrateOverSolid>;
|
||||
using AllMeasures VTKM_DEPRECATED(1.8,
|
||||
"Use vtkm::filter::mesh_info::IntegrationType::AllMeasures") =
|
||||
vtkm::List<IntegrateOverSolid, IntegrateOverSurface, IntegrateOverCurve>;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
inline vtkm::filter::mesh_info::IntegrationType OldToNewIntegrationType(vtkm::List<>)
|
||||
{
|
||||
return vtkm::filter::mesh_info::IntegrationType::None;
|
||||
}
|
||||
|
||||
template <typename T, typename... Ts>
|
||||
inline vtkm::filter::mesh_info::IntegrationType OldToNewIntegrationType(vtkm::List<T, Ts...>)
|
||||
{
|
||||
return T::value | OldToNewIntegrationType(vtkm::List<Ts...>{});
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
namespace filter
|
||||
{
|
||||
|
||||
template <typename IntegrationTypeList>
|
||||
class VTKM_DEPRECATED(1.8, "Use vtkm::filter::mesh_info::CellMeasures.") CellMeasures
|
||||
: public vtkm::filter::mesh_info::CellMeasures
|
||||
{
|
||||
public:
|
||||
CellMeasures()
|
||||
: vtkm::filter::mesh_info::CellMeasures(
|
||||
vtkm::detail::OldToNewIntegrationType(IntegrationTypeList{}))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace filter
|
||||
} // namespace vtkm
|
||||
|
||||
VTKM_DEPRECATED_SUPPRESS_END
|
||||
|
||||
#endif // vtk_m_filter_mesh_info_CellMeasures_h
|
||||
|
@ -84,19 +84,19 @@ private:
|
||||
// Fall through to return 0 measure.
|
||||
break;
|
||||
case 1:
|
||||
if (this->measure & IntegrationType::ArcLength)
|
||||
if ((this->measure & IntegrationType::ArcLength) == IntegrationType::ArcLength)
|
||||
{
|
||||
return vtkm::exec::CellMeasure<OutType>(numPts, pts, CellShapeType(), ec);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (this->measure & IntegrationType::Area)
|
||||
if ((this->measure & IntegrationType::Area) == IntegrationType::Area)
|
||||
{
|
||||
return vtkm::exec::CellMeasure<OutType>(numPts, pts, CellShapeType(), ec);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (this->measure & IntegrationType::Volume)
|
||||
if ((this->measure & IntegrationType::Volume) == IntegrationType::Volume)
|
||||
{
|
||||
return vtkm::exec::CellMeasure<OutType>(numPts, pts, CellShapeType(), ec);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user