mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Split CoordinateSystemTransform.h
This header file contained two filters: `CylindricalCoordinateTransform` and `SphericalCoordinateTransform`. By convention, each header (and source) file should contain one filter. Now that filters are split into separate libraries, there is little reason to combine things into header files.
This commit is contained in:
parent
c238cfea50
commit
d22a509b52
@ -11,7 +11,8 @@
|
||||
#define vtk_m_filter_CoordinateSystemTransform_h
|
||||
|
||||
#include <vtkm/Deprecated.h>
|
||||
#include <vtkm/filter/field_transform/CoordinateSystemTransform.h>
|
||||
#include <vtkm/filter/field_transform/CylindricalCoordinateTransform.h>
|
||||
#include <vtkm/filter/field_transform/SphericalCoordinateTransform.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
@ -19,7 +20,8 @@ namespace filter
|
||||
{
|
||||
|
||||
VTKM_DEPRECATED(1.8,
|
||||
"Use vtkm/filter/field_transform/CoordinateSystemTransform.h instead of "
|
||||
"Use vtkm/filter/field_transform/CylindricalCoordinateTransform.h or "
|
||||
"vtkm/filter/field_transform/SphericalCoordinateTransform.h instead of "
|
||||
"vtkm/filter/CoordinateSystemTransform.h.")
|
||||
inline void CoordinateSystemTransform_deprecated() {}
|
||||
|
||||
|
@ -8,21 +8,23 @@
|
||||
## PURPOSE. See the above copyright notice for more information.
|
||||
##============================================================================
|
||||
set(field_transform_headers
|
||||
CoordinateSystemTransform.h
|
||||
CylindricalCoordinateTransform.h
|
||||
FieldToColors.h
|
||||
GenerateIds.h
|
||||
PointElevation.h
|
||||
PointTransform.h
|
||||
SphericalCoordinateTransform.h
|
||||
WarpScalar.h
|
||||
WarpVector.h
|
||||
)
|
||||
|
||||
set(field_transform_sources
|
||||
CoordinateSystemTransform.cxx
|
||||
CylindricalCoordinateTransform.cxx
|
||||
FieldToColors.cxx
|
||||
GenerateIds.cxx
|
||||
PointElevation.cxx
|
||||
PointTransform.cxx
|
||||
SphericalCoordinateTransform.cxx
|
||||
WarpScalar.cxx
|
||||
WarpVector.cxx
|
||||
)
|
||||
|
@ -8,7 +8,7 @@
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#include <vtkm/filter/field_transform/CoordinateSystemTransform.h>
|
||||
#include <vtkm/filter/field_transform/CylindricalCoordinateTransform.h>
|
||||
#include <vtkm/filter/field_transform/worklet/CoordinateSystemTransform.h>
|
||||
|
||||
namespace vtkm
|
||||
@ -17,7 +17,7 @@ namespace filter
|
||||
{
|
||||
namespace field_transform
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
vtkm::cont::DataSet CylindricalCoordinateTransform::DoExecute(const vtkm::cont::DataSet& inDataSet)
|
||||
{
|
||||
vtkm::cont::UnknownArrayHandle outArray;
|
||||
@ -42,30 +42,6 @@ vtkm::cont::DataSet CylindricalCoordinateTransform::DoExecute(const vtkm::cont::
|
||||
return outDataSet;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
vtkm::cont::DataSet SphericalCoordinateTransform::DoExecute(const vtkm::cont::DataSet& inDataSet)
|
||||
{
|
||||
vtkm::cont::UnknownArrayHandle outArray;
|
||||
|
||||
auto resolveType = [&](const auto& concrete) {
|
||||
// use std::decay to remove const ref from the decltype of concrete.
|
||||
using T = typename std::decay_t<decltype(concrete)>::ValueType;
|
||||
vtkm::cont::ArrayHandle<T> result;
|
||||
vtkm::worklet::SphericalCoordinateTransform worklet{ this->CartesianToSpherical };
|
||||
worklet.Run(concrete, result);
|
||||
outArray = result;
|
||||
};
|
||||
this->CastAndCallVecField<3>(this->GetFieldFromDataSet(inDataSet), resolveType);
|
||||
|
||||
vtkm::cont::DataSet outDataSet =
|
||||
this->CreateResult(inDataSet,
|
||||
inDataSet.GetCellSet(),
|
||||
vtkm::cont::CoordinateSystem("coordinates", outArray),
|
||||
[](vtkm::cont::DataSet& out, const vtkm::cont::Field& fieldToPass) {
|
||||
out.AddField(fieldToPass);
|
||||
});
|
||||
return outDataSet;
|
||||
}
|
||||
} // namespace field_transform
|
||||
} // namespace filter
|
||||
} // namespace vtkm
|
@ -8,8 +8,8 @@
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#ifndef vtk_m_filter_field_transform_CoordinateSystemTransform_h
|
||||
#define vtk_m_filter_field_transform_CoordinateSystemTransform_h
|
||||
#ifndef vtk_m_filter_field_transform_CylindricalCoordinateTransform_h
|
||||
#define vtk_m_filter_field_transform_CylindricalCoordinateTransform_h
|
||||
|
||||
#include <vtkm/filter/NewFilterField.h>
|
||||
#include <vtkm/filter/field_transform/vtkm_filter_field_transform_export.h>
|
||||
@ -35,19 +35,6 @@ private:
|
||||
|
||||
bool CartesianToCylindrical = true;
|
||||
};
|
||||
|
||||
class VTKM_FILTER_FIELD_TRANSFORM_EXPORT SphericalCoordinateTransform
|
||||
: public vtkm::filter::NewFilterField
|
||||
{
|
||||
public:
|
||||
VTKM_CONT void SetCartesianToSpherical() { CartesianToSpherical = true; }
|
||||
VTKM_CONT void SetSphericalToCartesian() { CartesianToSpherical = false; }
|
||||
|
||||
private:
|
||||
VTKM_CONT vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input) override;
|
||||
|
||||
bool CartesianToSpherical = true;
|
||||
};
|
||||
} // namespace field_transform
|
||||
class VTKM_DEPRECATED(1.8, "Use vtkm::filter::field_transform::CylindricalCoordinateTransform.")
|
||||
CylindricalCoordinateTransform
|
||||
@ -55,12 +42,7 @@ class VTKM_DEPRECATED(1.8, "Use vtkm::filter::field_transform::CylindricalCoordi
|
||||
{
|
||||
using field_transform::CylindricalCoordinateTransform::CylindricalCoordinateTransform;
|
||||
};
|
||||
class VTKM_DEPRECATED(1.8, "Use vtkm::filter::field_transform::SphericalCoordinateTransform.")
|
||||
SphericalCoordinateTransform : public vtkm::filter::field_transform::SphericalCoordinateTransform
|
||||
{
|
||||
using field_transform::SphericalCoordinateTransform::SphericalCoordinateTransform;
|
||||
};
|
||||
} // namespace filter
|
||||
} // namespace vtkm
|
||||
|
||||
#endif // vtk_m_filter_field_transform_CoordinateSystemTransform_h
|
||||
#endif //vtk_m_filter_field_transform_CylindricalCoordinateTransform_h
|
45
vtkm/filter/field_transform/SphericalCoordinateTransform.cxx
Normal file
45
vtkm/filter/field_transform/SphericalCoordinateTransform.cxx
Normal file
@ -0,0 +1,45 @@
|
||||
//============================================================================
|
||||
// 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/filter/field_transform/SphericalCoordinateTransform.h>
|
||||
#include <vtkm/filter/field_transform/worklet/CoordinateSystemTransform.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
namespace field_transform
|
||||
{
|
||||
vtkm::cont::DataSet SphericalCoordinateTransform::DoExecute(const vtkm::cont::DataSet& inDataSet)
|
||||
{
|
||||
vtkm::cont::UnknownArrayHandle outArray;
|
||||
|
||||
auto resolveType = [&](const auto& concrete) {
|
||||
// use std::decay to remove const ref from the decltype of concrete.
|
||||
using T = typename std::decay_t<decltype(concrete)>::ValueType;
|
||||
vtkm::cont::ArrayHandle<T> result;
|
||||
vtkm::worklet::SphericalCoordinateTransform worklet{ this->CartesianToSpherical };
|
||||
worklet.Run(concrete, result);
|
||||
outArray = result;
|
||||
};
|
||||
this->CastAndCallVecField<3>(this->GetFieldFromDataSet(inDataSet), resolveType);
|
||||
|
||||
vtkm::cont::DataSet outDataSet =
|
||||
this->CreateResult(inDataSet,
|
||||
inDataSet.GetCellSet(),
|
||||
vtkm::cont::CoordinateSystem("coordinates", outArray),
|
||||
[](vtkm::cont::DataSet& out, const vtkm::cont::Field& fieldToPass) {
|
||||
out.AddField(fieldToPass);
|
||||
});
|
||||
return outDataSet;
|
||||
}
|
||||
} // namespace field_transform
|
||||
} // namespace filter
|
||||
} // namespace vtkm
|
45
vtkm/filter/field_transform/SphericalCoordinateTransform.h
Normal file
45
vtkm/filter/field_transform/SphericalCoordinateTransform.h
Normal file
@ -0,0 +1,45 @@
|
||||
//============================================================================
|
||||
// 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.
|
||||
//============================================================================
|
||||
|
||||
#ifndef vtk_m_filter_field_transform_SphericalCoordinateTransform_h
|
||||
#define vtk_m_filter_field_transform_SphericalCoordinateTransform_h
|
||||
|
||||
#include <vtkm/filter/NewFilterField.h>
|
||||
#include <vtkm/filter/field_transform/vtkm_filter_field_transform_export.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
namespace field_transform
|
||||
{
|
||||
|
||||
class VTKM_FILTER_FIELD_TRANSFORM_EXPORT SphericalCoordinateTransform
|
||||
: public vtkm::filter::NewFilterField
|
||||
{
|
||||
public:
|
||||
VTKM_CONT void SetCartesianToSpherical() { CartesianToSpherical = true; }
|
||||
VTKM_CONT void SetSphericalToCartesian() { CartesianToSpherical = false; }
|
||||
|
||||
private:
|
||||
VTKM_CONT vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input) override;
|
||||
|
||||
bool CartesianToSpherical = true;
|
||||
};
|
||||
} // namespace field_transform
|
||||
class VTKM_DEPRECATED(1.8, "Use vtkm::filter::field_transform::SphericalCoordinateTransform.")
|
||||
SphericalCoordinateTransform : public vtkm::filter::field_transform::SphericalCoordinateTransform
|
||||
{
|
||||
using field_transform::SphericalCoordinateTransform::SphericalCoordinateTransform;
|
||||
};
|
||||
} // namespace filter
|
||||
} // namespace vtkm
|
||||
|
||||
#endif // vtk_m_filter_field_transform_SphericalCoordinateTransform_h
|
@ -9,7 +9,8 @@
|
||||
//============================================================================
|
||||
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
#include <vtkm/filter/field_transform/CoordinateSystemTransform.h>
|
||||
#include <vtkm/filter/field_transform/CylindricalCoordinateTransform.h>
|
||||
#include <vtkm/filter/field_transform/SphericalCoordinateTransform.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user