diff --git a/vtkm/filter/mesh_info/CMakeLists.txt b/vtkm/filter/mesh_info/CMakeLists.txt index 10a7bfd52..9ec5e0393 100644 --- a/vtkm/filter/mesh_info/CMakeLists.txt +++ b/vtkm/filter/mesh_info/CMakeLists.txt @@ -12,6 +12,7 @@ set(mesh_info_headers GhostCellClassify.h MeshQuality.h MeshQualityArea.h + MeshQualityShear.h MeshQualitySkew.h MeshQualityStretch.h MeshQualityTaper.h @@ -24,6 +25,7 @@ set(mesh_info_sources GhostCellClassify.cxx MeshQuality.cxx MeshQualityArea.cxx + MeshQualityShear.cxx MeshQualitySkew.cxx MeshQualityStretch.cxx MeshQualityTaper.cxx diff --git a/vtkm/filter/mesh_info/MeshQuality.cxx b/vtkm/filter/mesh_info/MeshQuality.cxx index abb13b9a0..e4d26fa37 100644 --- a/vtkm/filter/mesh_info/MeshQuality.cxx +++ b/vtkm/filter/mesh_info/MeshQuality.cxx @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -80,6 +81,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::Shear: + implementation.reset(new vtkm::filter::mesh_info::MeshQualityShear); + break; case vtkm::filter::mesh_info::CellMetric::Skew: implementation.reset(new vtkm::filter::mesh_info::MeshQualitySkew); break; diff --git a/vtkm/filter/mesh_info/MeshQualityShear.cxx b/vtkm/filter/mesh_info/MeshQualityShear.cxx new file mode 100644 index 000000000..1c9dd9b75 --- /dev/null +++ b/vtkm/filter/mesh_info/MeshQualityShear.cxx @@ -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 + +#include +#include + +namespace +{ + +struct ShearWorklet : MeshQualityWorklet +{ + template + VTKM_EXEC OutType ComputeMetric(const vtkm::IdComponent& numPts, + const PointCoordVecType& pts, + CellShapeType shape, + vtkm::ErrorCode& ec) const + { + return vtkm::worklet::cellmetrics::CellShearMetric(numPts, pts, shape, ec); + } +}; + +} // anonymous namespace + +namespace vtkm +{ +namespace filter +{ +namespace mesh_info +{ + +MeshQualityShear::MeshQualityShear() +{ + this->SetUseCoordinateSystemAsField(true); + this->SetOutputFieldName("shear"); +} + +vtkm::cont::DataSet MeshQualityShear::DoExecute(const vtkm::cont::DataSet& input) +{ + vtkm::cont::UnknownArrayHandle outArray = + ShearWorklet::Run(input, this->GetFieldFromDataSet(input)); + + return this->CreateResultFieldCell(input, this->GetOutputFieldName(), outArray); +} + +} // namespace mesh_info +} // namespace filter +} // namespace vtkm diff --git a/vtkm/filter/mesh_info/MeshQualityShear.h b/vtkm/filter/mesh_info/MeshQualityShear.h new file mode 100644 index 000000000..4bb7b417a --- /dev/null +++ b/vtkm/filter/mesh_info/MeshQualityShear.h @@ -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_MeshQualityShear_h +#define vtk_m_filter_mesh_info_MeshQualityShear_h + +#include +#include + +namespace vtkm +{ +namespace filter +{ +namespace mesh_info +{ + +class VTKM_FILTER_MESH_INFO_EXPORT MeshQualityShear : public vtkm::filter::NewFilterField +{ +public: + MeshQualityShear(); + +private: + vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input) override; +}; + +} // namespace mesh_info +} // namespace filter +} // namespace vtkm + +#endif //vtk_m_filter_mesh_info_MeshQualityShear_h diff --git a/vtkm/filter/mesh_info/worklet/MeshQuality.h b/vtkm/filter/mesh_info/worklet/MeshQuality.h index f7e0039ec..340f94ab4 100644 --- a/vtkm/filter/mesh_info/worklet/MeshQuality.h +++ b/vtkm/filter/mesh_info/worklet/MeshQuality.h @@ -39,7 +39,6 @@ #include #include #include -#include #include namespace vtkm @@ -170,9 +169,6 @@ private: case vtkm::filter::mesh_info::CellMetric::Shape: metricValue = vtkm::worklet::cellmetrics::CellShapeMetric(numPts, pts, tag, ec); break; - case vtkm::filter::mesh_info::CellMetric::Shear: - metricValue = vtkm::worklet::cellmetrics::CellShearMetric(numPts, pts, tag, ec); - break; case vtkm::filter::mesh_info::CellMetric::None: break; default: diff --git a/vtkm/filter/mesh_info/worklet/cellmetrics/CellShearMetric.h b/vtkm/filter/mesh_info/worklet/cellmetrics/CellShearMetric.h index 514bf8934..9e20dad04 100644 --- a/vtkm/filter/mesh_info/worklet/cellmetrics/CellShearMetric.h +++ b/vtkm/filter/mesh_info/worklet/cellmetrics/CellShearMetric.h @@ -36,11 +36,11 @@ #include "TypeOfCellHexahedral.h" #include "TypeOfCellQuadrilateral.h" -#include "vtkm/CellShape.h" -#include "vtkm/CellTraits.h" -#include "vtkm/VecTraits.h" -#include "vtkm/VectorAnalysis.h" -#include "vtkm/exec/FunctorBase.h" +#include +#include +#include +#include +#include #define UNUSED(expr) (void)(expr);