Move MeshQualityDiagonalRatio to its own filter

This commit is contained in:
Kenneth Moreland 2022-06-22 09:13:55 -06:00
parent 0adf88fbd3
commit 86c0e1a960
6 changed files with 123 additions and 10 deletions

@ -12,6 +12,7 @@ set(mesh_info_headers
GhostCellClassify.h GhostCellClassify.h
MeshQuality.h MeshQuality.h
MeshQualityArea.h MeshQualityArea.h
MeshQualityDiagonalRatio.h
MeshQualityDimension.h MeshQualityDimension.h
MeshQualityJacobian.h MeshQualityJacobian.h
MeshQualityMaxAngle.h MeshQualityMaxAngle.h
@ -36,6 +37,7 @@ set(mesh_info_sources
GhostCellClassify.cxx GhostCellClassify.cxx
MeshQuality.cxx MeshQuality.cxx
MeshQualityArea.cxx MeshQualityArea.cxx
MeshQualityDiagonalRatio.cxx
MeshQualityDimension.cxx MeshQualityDimension.cxx
MeshQualityJacobian.cxx MeshQualityJacobian.cxx
MeshQualityMaxAngle.cxx MeshQualityMaxAngle.cxx

@ -22,6 +22,7 @@
#include <vtkm/cont/ErrorFilterExecution.h> #include <vtkm/cont/ErrorFilterExecution.h>
#include <vtkm/filter/mesh_info/MeshQuality.h> #include <vtkm/filter/mesh_info/MeshQuality.h>
#include <vtkm/filter/mesh_info/MeshQualityArea.h> #include <vtkm/filter/mesh_info/MeshQualityArea.h>
#include <vtkm/filter/mesh_info/MeshQualityDiagonalRatio.h>
#include <vtkm/filter/mesh_info/MeshQualityDimension.h> #include <vtkm/filter/mesh_info/MeshQualityDimension.h>
#include <vtkm/filter/mesh_info/MeshQualityJacobian.h> #include <vtkm/filter/mesh_info/MeshQualityJacobian.h>
#include <vtkm/filter/mesh_info/MeshQualityMaxAngle.h> #include <vtkm/filter/mesh_info/MeshQualityMaxAngle.h>
@ -92,6 +93,9 @@ VTKM_CONT vtkm::cont::DataSet MeshQuality::DoExecute(const vtkm::cont::DataSet&
case vtkm::filter::mesh_info::CellMetric::Area: case vtkm::filter::mesh_info::CellMetric::Area:
implementation.reset(new vtkm::filter::mesh_info::MeshQualityArea); implementation.reset(new vtkm::filter::mesh_info::MeshQualityArea);
break; break;
case vtkm::filter::mesh_info::CellMetric::DiagonalRatio:
implementation.reset(new vtkm::filter::mesh_info::MeshQualityDiagonalRatio);
break;
case vtkm::filter::mesh_info::CellMetric::Dimension: case vtkm::filter::mesh_info::CellMetric::Dimension:
implementation.reset(new vtkm::filter::mesh_info::MeshQualityDimension); implementation.reset(new vtkm::filter::mesh_info::MeshQualityDimension);
break; break;

@ -0,0 +1,66 @@
//============================================================================
// 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 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
// Copyright 2014 UT-Battelle, LLC.
// Copyright 2014 Los Alamos National Security.
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// 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.
//=========================================================================
#include <vtkm/filter/mesh_info/MeshQualityDiagonalRatio.h>
#include <vtkm/filter/mesh_info/worklet/MeshQualityWorklet.h>
#include <vtkm/filter/mesh_info/worklet/cellmetrics/CellDiagonalRatioMetric.h>
namespace
{
struct DiagonalRatioWorklet : MeshQualityWorklet<DiagonalRatioWorklet>
{
template <typename OutType, typename PointCoordVecType, typename CellShapeType>
VTKM_EXEC OutType ComputeMetric(const vtkm::IdComponent& numPts,
const PointCoordVecType& pts,
CellShapeType shape,
vtkm::ErrorCode& ec) const
{
return vtkm::worklet::cellmetrics::CellDiagonalRatioMetric<OutType>(numPts, pts, shape, ec);
}
};
} // anonymous namespace
namespace vtkm
{
namespace filter
{
namespace mesh_info
{
MeshQualityDiagonalRatio::MeshQualityDiagonalRatio()
{
this->SetUseCoordinateSystemAsField(true);
this->SetOutputFieldName("diagonalRatio");
}
vtkm::cont::DataSet MeshQualityDiagonalRatio::DoExecute(const vtkm::cont::DataSet& input)
{
vtkm::cont::UnknownArrayHandle outArray =
DiagonalRatioWorklet{}.Run(input, this->GetFieldFromDataSet(input));
return this->CreateResultFieldCell(input, this->GetOutputFieldName(), outArray);
}
} // namespace mesh_info
} // namespace filter
} // namespace vtkm

@ -0,0 +1,46 @@
//============================================================================
// 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 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
// Copyright 2014 UT-Battelle, LLC.
// Copyright 2014 Los Alamos National Security.
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// 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_filter_mesh_info_MeshQualityDiagonalRatio_h
#define vtk_m_filter_mesh_info_MeshQualityDiagonalRatio_h
#include <vtkm/filter/NewFilterField.h>
#include <vtkm/filter/mesh_info/vtkm_filter_mesh_info_export.h>
namespace vtkm
{
namespace filter
{
namespace mesh_info
{
class VTKM_FILTER_MESH_INFO_EXPORT MeshQualityDiagonalRatio : public vtkm::filter::NewFilterField
{
public:
MeshQualityDiagonalRatio();
private:
vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input) override;
};
} // namespace mesh_info
} // namespace filter
} // namespace vtkm
#endif //vtk_m_filter_mesh_info_MeshQualityDiagonalRatio_h

@ -27,7 +27,6 @@
#include <vtkm/filter/mesh_info/worklet/cellmetrics/CellAspectGammaMetric.h> #include <vtkm/filter/mesh_info/worklet/cellmetrics/CellAspectGammaMetric.h>
#include <vtkm/filter/mesh_info/worklet/cellmetrics/CellAspectRatioMetric.h> #include <vtkm/filter/mesh_info/worklet/cellmetrics/CellAspectRatioMetric.h>
#include <vtkm/filter/mesh_info/worklet/cellmetrics/CellConditionMetric.h> #include <vtkm/filter/mesh_info/worklet/cellmetrics/CellConditionMetric.h>
#include <vtkm/filter/mesh_info/worklet/cellmetrics/CellDiagonalRatioMetric.h>
#include <vtkm/worklet/WorkletMapTopology.h> #include <vtkm/worklet/WorkletMapTopology.h>
namespace vtkm namespace vtkm
@ -111,10 +110,6 @@ private:
metricValue = metricValue =
vtkm::worklet::cellmetrics::CellConditionMetric<OutType>(numPts, pts, tag, ec); vtkm::worklet::cellmetrics::CellConditionMetric<OutType>(numPts, pts, tag, ec);
break; break;
case vtkm::filter::mesh_info::CellMetric::DiagonalRatio:
metricValue =
vtkm::worklet::cellmetrics::CellDiagonalRatioMetric<OutType>(numPts, pts, tag, ec);
break;
case vtkm::filter::mesh_info::CellMetric::None: case vtkm::filter::mesh_info::CellMetric::None:
break; break;
default: default:

@ -33,11 +33,11 @@
* See: vtk/ThirdParty/verdict/vtkverdict (for VTK code implementation of this metric) * See: vtk/ThirdParty/verdict/vtkverdict (for VTK code implementation of this metric)
*/ */
#include "vtkm/CellShape.h" #include <vtkm/CellShape.h>
#include "vtkm/CellTraits.h" #include <vtkm/CellTraits.h>
#include "vtkm/VecTraits.h" #include <vtkm/ErrorCode.h>
#include "vtkm/VectorAnalysis.h" #include <vtkm/VecTraits.h>
#include "vtkm/exec/FunctorBase.h" #include <vtkm/VectorAnalysis.h>
#define UNUSED(expr) (void)(expr); #define UNUSED(expr) (void)(expr);