Move MeshQualitySkew to its own filter

This commit is contained in:
Kenneth Moreland 2022-06-21 12:43:58 -06:00
parent 6e4228cf23
commit 97af85ba7b
6 changed files with 123 additions and 9 deletions

@ -12,6 +12,7 @@ set(mesh_info_headers
GhostCellClassify.h
MeshQuality.h
MeshQualityArea.h
MeshQualitySkew.h
MeshQualityStretch.h
MeshQualityTaper.h
MeshQualityVolume.h
@ -23,6 +24,7 @@ set(mesh_info_sources
GhostCellClassify.cxx
MeshQuality.cxx
MeshQualityArea.cxx
MeshQualitySkew.cxx
MeshQualityStretch.cxx
MeshQualityTaper.cxx
MeshQualityVolume.cxx

@ -22,6 +22,7 @@
#include <vtkm/cont/ErrorFilterExecution.h>
#include <vtkm/filter/mesh_info/MeshQuality.h>
#include <vtkm/filter/mesh_info/MeshQualityArea.h>
#include <vtkm/filter/mesh_info/MeshQualitySkew.h>
#include <vtkm/filter/mesh_info/MeshQualityStretch.h>
#include <vtkm/filter/mesh_info/MeshQualityTaper.h>
#include <vtkm/filter/mesh_info/MeshQualityVolume.h>
@ -79,6 +80,9 @@ VTKM_CONT vtkm::cont::DataSet MeshQuality::DoExecute(const vtkm::cont::DataSet&
case vtkm::filter::mesh_info::CellMetric::Area:
implementation.reset(new vtkm::filter::mesh_info::MeshQualityArea);
break;
case vtkm::filter::mesh_info::CellMetric::Skew:
implementation.reset(new vtkm::filter::mesh_info::MeshQualitySkew);
break;
case vtkm::filter::mesh_info::CellMetric::Stretch:
implementation.reset(new vtkm::filter::mesh_info::MeshQualityStretch);
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/MeshQualitySkew.h>
#include <vtkm/filter/mesh_info/worklet/MeshQualityWorklet.h>
#include <vtkm/filter/mesh_info/worklet/cellmetrics/CellSkewMetric.h>
namespace
{
struct SkewWorklet : MeshQualityWorklet<SkewWorklet>
{
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::CellSkewMetric<OutType>(numPts, pts, shape, ec);
}
};
} // anonymous namespace
namespace vtkm
{
namespace filter
{
namespace mesh_info
{
MeshQualitySkew::MeshQualitySkew()
{
this->SetUseCoordinateSystemAsField(true);
this->SetOutputFieldName("skew");
}
vtkm::cont::DataSet MeshQualitySkew::DoExecute(const vtkm::cont::DataSet& input)
{
vtkm::cont::UnknownArrayHandle outArray =
SkewWorklet::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_MeshQualitySkew_h
#define vtk_m_filter_mesh_info_MeshQualitySkew_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 MeshQualitySkew : public vtkm::filter::NewFilterField
{
public:
MeshQualitySkew();
private:
vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input) override;
};
} // namespace mesh_info
} // namespace filter
} // namespace vtkm
#endif //vtk_m_filter_mesh_info_MeshQualitySkew_h

@ -40,7 +40,6 @@
#include <vtkm/filter/mesh_info/worklet/cellmetrics/CellShapeAndSizeMetric.h>
#include <vtkm/filter/mesh_info/worklet/cellmetrics/CellShapeMetric.h>
#include <vtkm/filter/mesh_info/worklet/cellmetrics/CellShearMetric.h>
#include <vtkm/filter/mesh_info/worklet/cellmetrics/CellSkewMetric.h>
#include <vtkm/worklet/WorkletMapTopology.h>
namespace vtkm
@ -174,9 +173,6 @@ private:
case vtkm::filter::mesh_info::CellMetric::Shear:
metricValue = vtkm::worklet::cellmetrics::CellShearMetric<OutType>(numPts, pts, tag, ec);
break;
case vtkm::filter::mesh_info::CellMetric::Skew:
metricValue = vtkm::worklet::cellmetrics::CellSkewMetric<OutType>(numPts, pts, tag, ec);
break;
case vtkm::filter::mesh_info::CellMetric::None:
break;
default:

@ -27,11 +27,11 @@
#include "TypeOfCellQuadrilateral.h"
#include "TypeOfCellTetrahedral.h"
#include "TypeOfCellTriangle.h"
#include "vtkm/CellShape.h"
#include "vtkm/CellTraits.h"
#include "vtkm/VecTraits.h"
#include "vtkm/VectorAnalysis.h"
#include "vtkm/exec/FunctorBase.h"
#include <vtkm/CellShape.h>
#include <vtkm/CellTraits.h>
#include <vtkm/ErrorCode.h>
#include <vtkm/VecTraits.h>
#include <vtkm/VectorAnalysis.h>
namespace vtkm
{