vtk-m/vtkm/filter/mesh_info/CellMeasures.h
Kenneth Moreland 405643ddbb Rename NewFilter base classes to Filter
During the VTK-m 1.8 and 1.9 development, the filter infrastructure was
overhauled. Part of this created a completely new set of base classes. To
avoid confusion with the original filter base classes and ease transition,
the new filter base classes were named `NewFilter*`. Eventually after all
filters were transitioned, the old filter base classes were deprecated.

With the release of VTK-m 2.0, the old filter base classes are removed. The
"new" filter base classes are no longer new. Thus, they have been renamed
simply `Filter` (and `FilterField`).
2022-12-01 13:07:56 -07:00

70 lines
2.3 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.
//============================================================================
#ifndef vtk_m_filter_mesh_info_CellMeasures_h
#define vtk_m_filter_mesh_info_CellMeasures_h
#include <vtkm/filter/FilterField.h>
#include <vtkm/filter/mesh_info/vtkm_filter_mesh_info_export.h>
namespace vtkm
{
namespace filter
{
namespace mesh_info
{
/// \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
/// specified per cell) holding the signed measure of the cell
/// or 0 (if measure is not well defined or the cell type is unsupported).
///
/// By default, the new cell-data array is named "measure".
class VTKM_FILTER_MESH_INFO_EXPORT CellMeasures : public vtkm::filter::FilterField
{
public:
VTKM_CONT
explicit CellMeasures(IntegrationType);
/// Set/Get the name of the cell measure field. If not set, "measure" is used.
void SetCellMeasureName(const std::string& name) { this->SetOutputFieldName(name); }
const std::string& GetCellMeasureName() const { return this->GetOutputFieldName(); }
private:
VTKM_CONT vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input) override;
IntegrationType measure;
};
} // namespace mesh_info
} // namespace filter
} // namespace vtkm
#endif // vtk_m_filter_mesh_info_CellMeasures_h