mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-16 17:22:55 +00:00
formatting suggestions from KMorel
This commit is contained in:
parent
f4edb6a8ed
commit
e040ea05e1
@ -79,7 +79,7 @@ public:
|
||||
using SupportedTypes = vtkm::TypeListTagFieldVec3;
|
||||
|
||||
VTKM_CONT MeshQuality(CellMetric);
|
||||
void SetOutputName(const std::string& s) { outputName = s; };
|
||||
void SetOutputName(const std::string& s) { this->OutputName = s; };
|
||||
|
||||
template <typename T, typename StorageType, typename DerivedPolicy>
|
||||
VTKM_CONT vtkm::cont::DataSet DoExecute(
|
||||
@ -89,8 +89,8 @@ public:
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy);
|
||||
|
||||
private:
|
||||
CellMetric myMetric;
|
||||
std::string outputName;
|
||||
CellMetric MyMetric;
|
||||
std::string OutputName;
|
||||
};
|
||||
|
||||
} // namespace filter
|
||||
|
113
vtkm/filter/MeshQuality.h.hrc
Normal file
113
vtkm/filter/MeshQuality.h.hrc
Normal file
@ -0,0 +1,113 @@
|
||||
//============================================================================
|
||||
// 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_MeshQuality_h
|
||||
#define vtk_m_filter_MeshQuality_h
|
||||
|
||||
#include <vtkm/CellShape.h>
|
||||
#include <vtkm/filter/FilterCell.h>
|
||||
#include <vtkm/worklet/FieldStatistics.h>
|
||||
#include <vtkm/worklet/MeshQuality.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
|
||||
//Names of the available cell metrics, for use in
|
||||
//the output dataset fields
|
||||
static const std::string MetricNames[] = { "area",
|
||||
"aspectGamma",
|
||||
"aspectRatio",
|
||||
"condition",
|
||||
"diagonalRatio",
|
||||
"jacobian",
|
||||
"minAngle",
|
||||
"maxAngle",
|
||||
"oddy",
|
||||
"relativeSize",
|
||||
"scaledJacobian",
|
||||
"shape",
|
||||
"shear",
|
||||
"skew",
|
||||
"stretch",
|
||||
"taper",
|
||||
"volume",
|
||||
"warpage"
|
||||
};
|
||||
|
||||
//Different cell metrics available to use
|
||||
enum class CellMetric
|
||||
{
|
||||
AREA,
|
||||
ASPECT_GAMMA,
|
||||
ASPECT_RATIO,
|
||||
CONDITION,
|
||||
DIAGONAL_RATIO,
|
||||
JACOBIAN,
|
||||
MIN_ANGLE,
|
||||
MAX_ANGLE,
|
||||
ODDY,
|
||||
RELATIVE_SIZE,
|
||||
SCALED_JACOBIAN,
|
||||
SHAPE,
|
||||
SHEAR,
|
||||
SKEW,
|
||||
STRETCH,
|
||||
TAPER,
|
||||
VOLUME,
|
||||
WARPAGE,
|
||||
NUMBER_OF_CELL_METRICS,
|
||||
EMPTY
|
||||
};
|
||||
|
||||
/** \brief Computes the quality of an unstructured cell-based mesh. The quality is defined in terms of the
|
||||
* summary statistics (frequency, mean, variance, min, max) of metrics computed over the mesh
|
||||
* cells. One of several different metrics can be specified for a given cell type, and the mesh
|
||||
* can consist of one or more different cell types. The resulting mesh quality is stored as one
|
||||
* or more new fields in the output dataset of this filter, with a separate field for each cell type.
|
||||
* Each field contains the metric summary statistics for the cell type.
|
||||
* Summary statists with all 0 values imply that the specified metric does not support the cell type.
|
||||
*/
|
||||
class MeshQuality : public vtkm::filter::FilterCell<MeshQuality>
|
||||
{
|
||||
public:
|
||||
using SupportedTypes = vtkm::TypeListTagFieldVec3;
|
||||
|
||||
VTKM_CONT MeshQuality(CellMetric);
|
||||
|
||||
template <typename T, typename StorageType, typename DerivedPolicy>
|
||||
VTKM_CONT vtkm::cont::DataSet DoExecute(
|
||||
const vtkm::cont::DataSet& input,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>, StorageType>& points,
|
||||
const vtkm::filter::FieldMetadata& fieldMeta,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy);
|
||||
|
||||
private:
|
||||
//A user-assigned cell metric per shape/cell type
|
||||
CellMetric myMetric;
|
||||
};
|
||||
|
||||
} // namespace filter
|
||||
} // namespace vtkm
|
||||
|
||||
#include <vtkm/filter/MeshQuality.hxx>
|
||||
|
||||
#endif // vtk_m_filter_MeshQuality_h
|
@ -60,12 +60,12 @@ inline VTKM_CONT MeshQuality::MeshQuality(CellMetric metric)
|
||||
: vtkm::filter::FilterCell<MeshQuality>()
|
||||
{
|
||||
this->SetUseCoordinateSystemAsField(true);
|
||||
myMetric = metric;
|
||||
if (myMetric < CellMetric::AREA || myMetric >= CellMetric::NUMBER_OF_CELL_METRICS)
|
||||
this->MyMetric = metric;
|
||||
if (this->MyMetric < CellMetric::AREA || this->MyMetric >= CellMetric::NUMBER_OF_CELL_METRICS)
|
||||
{
|
||||
VTKM_ASSERT(true);
|
||||
}
|
||||
outputName = MetricNames[(int)myMetric];
|
||||
this->OutputName = MetricNames[(int)this->MyMetric];
|
||||
}
|
||||
|
||||
template <typename T, typename StorageType, typename DerivedPolicy>
|
||||
@ -77,13 +77,14 @@ inline VTKM_CONT vtkm::cont::DataSet MeshQuality::DoExecute(
|
||||
{
|
||||
VTKM_ASSERT(fieldMeta.IsPointField());
|
||||
|
||||
//TODO: Should other cellset types be supported?
|
||||
vtkm::cont::CellSetExplicit<> cellSet;
|
||||
input.GetCellSet().CopyTo(cellSet);
|
||||
|
||||
//Invoke the MeshQuality worklet
|
||||
vtkm::cont::ArrayHandle<T> outArray;
|
||||
vtkm::worklet::MeshQuality<CellMetric> qualityWorklet;
|
||||
qualityWorklet.SetMetric(myMetric);
|
||||
qualityWorklet.SetMetric(this->MyMetric);
|
||||
this->Invoke(qualityWorklet, vtkm::filter::ApplyPolicyCellSet(cellSet, policy), points, outArray);
|
||||
|
||||
vtkm::cont::DataSet result;
|
||||
@ -91,7 +92,7 @@ inline VTKM_CONT vtkm::cont::DataSet MeshQuality::DoExecute(
|
||||
|
||||
//Append the metric values of all cells into the output
|
||||
//dataset as a new field
|
||||
result.AddField(vtkm::cont::make_FieldCell(outputName, outArray));
|
||||
result.AddField(vtkm::cont::make_FieldCell(this->OutputName, outArray));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user