mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Support deprecated MeshQuality features
Reenable the `vtkm::filter::CellMetric` class and `vtkm::filter::MetricNames` static variable for backward compatibility. (Both are of course marked deprecated.) Also, adjust names in the new `vtkm::filter::mesh_info::CellMetric` to conform with the rest of VTK-m style for scoped enums.
This commit is contained in:
parent
d22a509b52
commit
5b7893a3f7
@ -258,7 +258,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
// A cell metric is now computed for every shape type that exists in the
|
||||
// input dataset.
|
||||
vtkm::filter::mesh_info::CellMetric shapeMetric = vtkm::filter::mesh_info::CellMetric::VOLUME;
|
||||
vtkm::filter::mesh_info::CellMetric shapeMetric = vtkm::filter::mesh_info::CellMetric::Volume;
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -100,8 +100,8 @@ inline VTKM_CONT vtkm::cont::DataSet MIRFilter::DoExecute(
|
||||
input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex());
|
||||
vtkm::cont::ArrayHandle<vtkm::Float64> avgSizeTot;
|
||||
vtkm::worklet::MeshQuality getVol;
|
||||
getVol.SetMetric(c3 > 0 ? vtkm::filter::mesh_info::CellMetric::VOLUME
|
||||
: vtkm::filter::mesh_info::CellMetric::AREA);
|
||||
getVol.SetMetric(c3 > 0 ? vtkm::filter::mesh_info::CellMetric::Volume
|
||||
: vtkm::filter::mesh_info::CellMetric::Area);
|
||||
this->Invoke(getVol,
|
||||
vtkm::filter::ApplyPolicyCellSet(input.GetCellSet(), policy, *this),
|
||||
inputCoords.GetData(),
|
||||
|
@ -33,28 +33,28 @@ namespace
|
||||
//Names of the available cell metrics, for use in
|
||||
//the output dataset fields
|
||||
const std::map<CellMetric, std::string> MetricNames = {
|
||||
{ CellMetric::AREA, "area" },
|
||||
{ CellMetric::ASPECT_GAMMA, "aspectGamma" },
|
||||
{ CellMetric::ASPECT_RATIO, "aspectRatio" },
|
||||
{ CellMetric::CONDITION, "condition" },
|
||||
{ CellMetric::DIAGONAL_RATIO, "diagonalRatio" },
|
||||
{ CellMetric::DIMENSION, "dimension" },
|
||||
{ CellMetric::JACOBIAN, "jacobian" },
|
||||
{ CellMetric::MAX_ANGLE, "maxAngle" },
|
||||
{ CellMetric::MAX_DIAGONAL, "maxDiagonal" },
|
||||
{ CellMetric::MIN_ANGLE, "minAngle" },
|
||||
{ CellMetric::MIN_DIAGONAL, "minDiagonal" },
|
||||
{ CellMetric::ODDY, "oddy" },
|
||||
{ CellMetric::RELATIVE_SIZE_SQUARED, "relativeSizeSquared" },
|
||||
{ CellMetric::SCALED_JACOBIAN, "scaledJacobian" },
|
||||
{ CellMetric::SHAPE, "shape" },
|
||||
{ CellMetric::SHAPE_AND_SIZE, "shapeAndSize" },
|
||||
{ CellMetric::SHEAR, "shear" },
|
||||
{ CellMetric::SKEW, "skew" },
|
||||
{ CellMetric::STRETCH, "stretch" },
|
||||
{ CellMetric::TAPER, "taper" },
|
||||
{ CellMetric::VOLUME, "volume" },
|
||||
{ CellMetric::WARPAGE, "warpage" }
|
||||
{ CellMetric::Area, "area" },
|
||||
{ CellMetric::AspectGama, "aspectGamma" },
|
||||
{ CellMetric::AspectRatio, "aspectRatio" },
|
||||
{ CellMetric::Condition, "condition" },
|
||||
{ CellMetric::DiagonalRatio, "diagonalRatio" },
|
||||
{ CellMetric::Dimension, "dimension" },
|
||||
{ CellMetric::Jacobian, "jacobian" },
|
||||
{ CellMetric::MaxAngle, "maxAngle" },
|
||||
{ CellMetric::MaxDiagonal, "maxDiagonal" },
|
||||
{ CellMetric::MinAngle, "minAngle" },
|
||||
{ CellMetric::MinDiagonal, "minDiagonal" },
|
||||
{ CellMetric::Oddy, "oddy" },
|
||||
{ CellMetric::RelativeSizeSquared, "relativeSizeSquared" },
|
||||
{ CellMetric::ScaledJacobian, "scaledJacobian" },
|
||||
{ CellMetric::Shape, "shape" },
|
||||
{ CellMetric::ShapeAndSize, "shapeAndSize" },
|
||||
{ CellMetric::Shear, "shear" },
|
||||
{ CellMetric::Skew, "skew" },
|
||||
{ CellMetric::Stretch, "stretch" },
|
||||
{ CellMetric::Taper, "taper" },
|
||||
{ CellMetric::Volume, "volume" },
|
||||
{ CellMetric::Warpage, "warpage" }
|
||||
};
|
||||
} // anonymous namespace
|
||||
|
||||
@ -77,8 +77,8 @@ VTKM_CONT vtkm::cont::DataSet MeshQuality::DoExecute(const vtkm::cont::DataSet&
|
||||
vtkm::cont::UnknownCellSet inputCellSet = input.GetCellSet();
|
||||
vtkm::worklet::MeshQuality qualityWorklet;
|
||||
|
||||
if (this->MyMetric == CellMetric::RELATIVE_SIZE_SQUARED ||
|
||||
this->MyMetric == CellMetric::SHAPE_AND_SIZE)
|
||||
if (this->MyMetric == CellMetric::RelativeSizeSquared ||
|
||||
this->MyMetric == CellMetric::ShapeAndSize)
|
||||
{
|
||||
vtkm::worklet::MeshQuality subWorklet;
|
||||
vtkm::FloatDefault totalArea;
|
||||
@ -89,11 +89,11 @@ VTKM_CONT vtkm::cont::DataSet MeshQuality::DoExecute(const vtkm::cont::DataSet&
|
||||
using T = typename std::decay_t<decltype(concrete)>::ValueType::ComponentType;
|
||||
vtkm::cont::ArrayHandle<T> array;
|
||||
|
||||
subWorklet.SetMetric(CellMetric::AREA);
|
||||
subWorklet.SetMetric(CellMetric::Area);
|
||||
this->Invoke(subWorklet, inputCellSet, concrete, array);
|
||||
totalArea = (vtkm::FloatDefault)vtkm::cont::Algorithm::Reduce(array, T{});
|
||||
|
||||
subWorklet.SetMetric(CellMetric::VOLUME);
|
||||
subWorklet.SetMetric(CellMetric::Volume);
|
||||
this->Invoke(subWorklet, inputCellSet, concrete, array);
|
||||
totalVolume = (vtkm::FloatDefault)vtkm::cont::Algorithm::Reduce(array, T{});
|
||||
};
|
||||
@ -128,3 +128,69 @@ VTKM_CONT vtkm::cont::DataSet MeshQuality::DoExecute(const vtkm::cont::DataSet&
|
||||
} // namespace mesh_info
|
||||
} // namespace filter
|
||||
} // namespace vtkm
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
|
||||
vtkm::filter::mesh_info::CellMetric MeshQuality::ConvertCellMetric(
|
||||
vtkm::filter::CellMetric oldMetricEnum)
|
||||
{
|
||||
switch (oldMetricEnum)
|
||||
{
|
||||
case vtkm::filter::CellMetric::AREA:
|
||||
return vtkm::filter::mesh_info::CellMetric::Area;
|
||||
case vtkm::filter::CellMetric::ASPECT_GAMMA:
|
||||
return vtkm::filter::mesh_info::CellMetric::AspectGama;
|
||||
case vtkm::filter::CellMetric::ASPECT_RATIO:
|
||||
return vtkm::filter::mesh_info::CellMetric::AspectRatio;
|
||||
case vtkm::filter::CellMetric::CONDITION:
|
||||
return vtkm::filter::mesh_info::CellMetric::Condition;
|
||||
case vtkm::filter::CellMetric::DIAGONAL_RATIO:
|
||||
return vtkm::filter::mesh_info::CellMetric::DiagonalRatio;
|
||||
case vtkm::filter::CellMetric::DIMENSION:
|
||||
return vtkm::filter::mesh_info::CellMetric::Dimension;
|
||||
case vtkm::filter::CellMetric::JACOBIAN:
|
||||
return vtkm::filter::mesh_info::CellMetric::Jacobian;
|
||||
case vtkm::filter::CellMetric::MAX_ANGLE:
|
||||
return vtkm::filter::mesh_info::CellMetric::MaxAngle;
|
||||
case vtkm::filter::CellMetric::MAX_DIAGONAL:
|
||||
return vtkm::filter::mesh_info::CellMetric::MaxDiagonal;
|
||||
case vtkm::filter::CellMetric::MIN_ANGLE:
|
||||
return vtkm::filter::mesh_info::CellMetric::MinAngle;
|
||||
case vtkm::filter::CellMetric::MIN_DIAGONAL:
|
||||
return vtkm::filter::mesh_info::CellMetric::MinDiagonal;
|
||||
case vtkm::filter::CellMetric::ODDY:
|
||||
return vtkm::filter::mesh_info::CellMetric::Oddy;
|
||||
case vtkm::filter::CellMetric::RELATIVE_SIZE_SQUARED:
|
||||
return vtkm::filter::mesh_info::CellMetric::RelativeSizeSquared;
|
||||
case vtkm::filter::CellMetric::SCALED_JACOBIAN:
|
||||
return vtkm::filter::mesh_info::CellMetric::ScaledJacobian;
|
||||
case vtkm::filter::CellMetric::SHAPE:
|
||||
return vtkm::filter::mesh_info::CellMetric::Shape;
|
||||
case vtkm::filter::CellMetric::SHAPE_AND_SIZE:
|
||||
return vtkm::filter::mesh_info::CellMetric::ShapeAndSize;
|
||||
case vtkm::filter::CellMetric::SHEAR:
|
||||
return vtkm::filter::mesh_info::CellMetric::Shear;
|
||||
case vtkm::filter::CellMetric::SKEW:
|
||||
return vtkm::filter::mesh_info::CellMetric::Skew;
|
||||
case vtkm::filter::CellMetric::STRETCH:
|
||||
return vtkm::filter::mesh_info::CellMetric::Stretch;
|
||||
case vtkm::filter::CellMetric::TAPER:
|
||||
return vtkm::filter::mesh_info::CellMetric::Taper;
|
||||
case vtkm::filter::CellMetric::VOLUME:
|
||||
return vtkm::filter::mesh_info::CellMetric::Volume;
|
||||
case vtkm::filter::CellMetric::WARPAGE:
|
||||
return vtkm::filter::mesh_info::CellMetric::Warpage;
|
||||
default:
|
||||
throw vtkm::cont::ErrorBadValue("Invalid mesh quality metric.");
|
||||
}
|
||||
}
|
||||
|
||||
VTKM_DEPRECATED_SUPPRESS_END
|
||||
|
||||
} // namespace filter
|
||||
} // namespace vtkm
|
||||
|
@ -30,9 +30,81 @@ namespace filter
|
||||
{
|
||||
namespace mesh_info
|
||||
{
|
||||
//Different cell metrics available to use
|
||||
//This must follow the same order as the MetricNames above
|
||||
enum class CellMetric
|
||||
|
||||
enum struct CellMetric
|
||||
{
|
||||
Area,
|
||||
AspectGama,
|
||||
AspectRatio,
|
||||
Condition,
|
||||
DiagonalRatio,
|
||||
Dimension,
|
||||
Jacobian,
|
||||
MaxAngle,
|
||||
MaxDiagonal,
|
||||
MinAngle,
|
||||
MinDiagonal,
|
||||
Oddy,
|
||||
RelativeSizeSquared,
|
||||
ScaledJacobian,
|
||||
Shape,
|
||||
ShapeAndSize,
|
||||
Shear,
|
||||
Skew,
|
||||
Stretch,
|
||||
Taper,
|
||||
Volume,
|
||||
Warpage,
|
||||
None
|
||||
};
|
||||
|
||||
/** \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 VTKM_FILTER_MESH_INFO_EXPORT MeshQuality : public vtkm::filter::NewFilterField
|
||||
{
|
||||
public:
|
||||
VTKM_CONT explicit MeshQuality(CellMetric);
|
||||
|
||||
private:
|
||||
VTKM_CONT vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input) override;
|
||||
|
||||
CellMetric MyMetric;
|
||||
};
|
||||
} // namespace mesh_info
|
||||
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
VTKM_DEPRECATED(1.8)
|
||||
static const std::string MetricNames[] = { "area",
|
||||
"aspectGamma",
|
||||
"aspectRatio",
|
||||
"condition",
|
||||
"diagonalRatio",
|
||||
"dimension",
|
||||
"jacobian",
|
||||
"maxAngle",
|
||||
"maxDiagonal",
|
||||
"minAngle",
|
||||
"minDiagonal",
|
||||
"oddy",
|
||||
"relativeSizeSquared",
|
||||
"scaledJacobian",
|
||||
"shape",
|
||||
"shapeAndSize",
|
||||
"shear",
|
||||
"skew",
|
||||
"stretch",
|
||||
"taper",
|
||||
"volume",
|
||||
"warpage" };
|
||||
VTKM_DEPRECATED_SUPPRESS_END
|
||||
|
||||
enum struct VTKM_DEPRECATED(1.8 "Use vtkm::filter::mesh_info::CellMetric.") CellMetric
|
||||
{
|
||||
AREA,
|
||||
ASPECT_GAMMA,
|
||||
@ -60,29 +132,23 @@ enum class CellMetric
|
||||
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 VTKM_FILTER_MESH_INFO_EXPORT MeshQuality : public vtkm::filter::NewFilterField
|
||||
{
|
||||
public:
|
||||
VTKM_CONT explicit MeshQuality(CellMetric);
|
||||
|
||||
private:
|
||||
VTKM_CONT vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input) override;
|
||||
|
||||
CellMetric MyMetric;
|
||||
};
|
||||
} // namespace mesh_info
|
||||
class VTKM_DEPRECATED(1.8, "Use vtkm::filter::mesh_info::MeshQuality.") MeshQuality
|
||||
: public vtkm::filter::mesh_info::MeshQuality
|
||||
{
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
static vtkm::filter::mesh_info::CellMetric ConvertCellMetric(
|
||||
vtkm::filter::CellMetric oldMetricEnum);
|
||||
VTKM_DEPRECATED_SUPPRESS_END
|
||||
|
||||
public:
|
||||
using mesh_info::MeshQuality::MeshQuality;
|
||||
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
MeshQuality(vtkm::filter::CellMetric oldMetric)
|
||||
: mesh_info::MeshQuality(ConvertCellMetric(oldMetric))
|
||||
{
|
||||
}
|
||||
VTKM_DEPRECATED_SUPPRESS_END
|
||||
};
|
||||
} // namespace filter
|
||||
} // namespace vtkm
|
||||
|
@ -196,157 +196,157 @@ int TestMeshQuality()
|
||||
std::vector<vtkm::cont::DataSet> inputs;
|
||||
|
||||
expectedValues.push_back(FloatVec{ 0, 0, 1, 1.333333333f, 4, 4 });
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::VOLUME);
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::Volume);
|
||||
metricName.emplace_back("volume");
|
||||
inputs.push_back(explicitInput);
|
||||
|
||||
expectedValues.push_back(FloatVec{ 3, 4, 0, 0, 0, 0 });
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::AREA);
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::Area);
|
||||
metricName.emplace_back("area");
|
||||
inputs.push_back(explicitInput);
|
||||
|
||||
expectedValues.push_back(FloatVec{ 3, 1 });
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::AREA);
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::Area);
|
||||
metricName.emplace_back("area");
|
||||
inputs.push_back(singleTypeInput);
|
||||
|
||||
expectedValues.push_back(FloatVec{ 1.164010f, 1.118034f, 1.648938f, 0, 0, 1.1547f });
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::ASPECT_RATIO);
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::AspectRatio);
|
||||
metricName.emplace_back("aspectRatio");
|
||||
inputs.push_back(explicitInput);
|
||||
|
||||
expectedValues.push_back(FloatVec{ 1.164010f, 2.47582f });
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::ASPECT_RATIO);
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::AspectRatio);
|
||||
metricName.emplace_back("aspectRatio");
|
||||
inputs.push_back(singleTypeInput);
|
||||
|
||||
expectedValues.push_back(FloatVec{ 0, 0, 1.52012f, 0, 0, 0 });
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::ASPECT_GAMMA);
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::AspectGama);
|
||||
metricName.emplace_back("aspectGamma");
|
||||
inputs.push_back(explicitInput);
|
||||
|
||||
expectedValues.push_back(FloatVec{ 1.058475f, 2.25f, 1.354007f, 0, 0, 1.563472f });
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::CONDITION);
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::Condition);
|
||||
metricName.emplace_back("condition");
|
||||
inputs.push_back(explicitInput);
|
||||
|
||||
expectedValues.push_back(FloatVec{ 1.058475f, 2.02073f });
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::CONDITION);
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::Condition);
|
||||
metricName.emplace_back("condition");
|
||||
inputs.push_back(singleTypeInput);
|
||||
|
||||
expectedValues.push_back(FloatVec{ 45, 45, -1, -1, -1, -1 });
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::MIN_ANGLE);
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::MinAngle);
|
||||
metricName.emplace_back("minAngle");
|
||||
inputs.push_back(explicitInput);
|
||||
|
||||
expectedValues.push_back(FloatVec{ 45, 18.4348f });
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::MIN_ANGLE);
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::MinAngle);
|
||||
metricName.emplace_back("minAngle");
|
||||
inputs.push_back(singleTypeInput);
|
||||
|
||||
expectedValues.push_back(FloatVec{ 71.56505f, 135, -1, -1, -1, -1 });
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::MAX_ANGLE);
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::MaxAngle);
|
||||
metricName.emplace_back("maxAngle");
|
||||
inputs.push_back(explicitInput);
|
||||
|
||||
expectedValues.push_back(FloatVec{ 71.56505f, 116.565f });
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::MAX_ANGLE);
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::MaxAngle);
|
||||
metricName.emplace_back("maxAngle");
|
||||
inputs.push_back(singleTypeInput);
|
||||
|
||||
expectedValues.push_back(FloatVec{ -1, -1, -1, -1, -1, 1.73205f });
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::MIN_DIAGONAL);
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::MinDiagonal);
|
||||
metricName.emplace_back("minDiagonal");
|
||||
inputs.push_back(explicitInput);
|
||||
|
||||
expectedValues.push_back(FloatVec{ -1, -1, -1, -1, -1, 4.3589f });
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::MAX_DIAGONAL);
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::MaxDiagonal);
|
||||
metricName.emplace_back("maxDiagonal");
|
||||
inputs.push_back(explicitInput);
|
||||
|
||||
expectedValues.push_back(FloatVec{ 0, 2, 6, 0, 0, 4 });
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::JACOBIAN);
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::Jacobian);
|
||||
metricName.emplace_back("jacobian");
|
||||
inputs.push_back(explicitInput);
|
||||
|
||||
expectedValues.push_back(FloatVec{ 0.816497f, 0.707107f, 0.408248f, -2, -2, 0.57735f });
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::SCALED_JACOBIAN);
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::ScaledJacobian);
|
||||
metricName.emplace_back("scaledJacobian");
|
||||
inputs.push_back(explicitInput);
|
||||
|
||||
expectedValues.push_back(FloatVec{ 0.816497f, 0.365148f });
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::SCALED_JACOBIAN);
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::ScaledJacobian);
|
||||
metricName.emplace_back("scaledJacobian");
|
||||
inputs.push_back(singleTypeInput);
|
||||
|
||||
expectedValues.push_back(FloatVec{ -1, 8.125f, -1, -1, -1, 2.62484f });
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::ODDY);
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::Oddy);
|
||||
metricName.emplace_back("oddy");
|
||||
inputs.push_back(explicitInput);
|
||||
|
||||
expectedValues.push_back(FloatVec{ -1, 0.620174f, -1, -1, -1, 0.397360f });
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::DIAGONAL_RATIO);
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::DiagonalRatio);
|
||||
metricName.emplace_back("diagonalRatio");
|
||||
inputs.push_back(explicitInput);
|
||||
|
||||
expectedValues.push_back(FloatVec{ 0.944755f, 0.444444f, 0.756394f, -1, -1, 0.68723f });
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::SHAPE);
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::Shape);
|
||||
metricName.emplace_back("shape");
|
||||
inputs.push_back(explicitInput);
|
||||
|
||||
expectedValues.push_back(FloatVec{ 0.944755f, 0.494872f });
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::SHAPE);
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::Shape);
|
||||
metricName.emplace_back("shape");
|
||||
inputs.push_back(singleTypeInput);
|
||||
|
||||
expectedValues.push_back(FloatVec{ -1, 0.707107f, -1, -1, -1, 0.57735f });
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::SHEAR);
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::Shear);
|
||||
metricName.emplace_back("shear");
|
||||
inputs.push_back(explicitInput);
|
||||
|
||||
expectedValues.push_back(FloatVec{ -1, 0.447214f, -1, -1, -1, 0.57735f });
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::SKEW);
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::Skew);
|
||||
metricName.emplace_back("skew");
|
||||
inputs.push_back(explicitInput);
|
||||
|
||||
expectedValues.push_back(FloatVec{ -1, (float)0.392232, -1, -1, -1, (float)0.688247 });
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::STRETCH);
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::Stretch);
|
||||
metricName.emplace_back("stretch");
|
||||
inputs.push_back(explicitInput);
|
||||
|
||||
expectedValues.push_back(FloatVec{ -1, 0.5, -1, -1, -1, 0 });
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::TAPER);
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::Taper);
|
||||
metricName.emplace_back("taper");
|
||||
inputs.push_back(explicitInput);
|
||||
|
||||
expectedValues.push_back(FloatVec{ -1, 1, -1, -1, -1, -1 });
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::WARPAGE);
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::Warpage);
|
||||
metricName.emplace_back("warpage");
|
||||
inputs.push_back(explicitInput);
|
||||
|
||||
expectedValues.push_back(FloatVec{ -1, -1, -1, -1, -1, 0.707107f });
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::DIMENSION);
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::Dimension);
|
||||
metricName.emplace_back("dimension");
|
||||
inputs.push_back(explicitInput);
|
||||
|
||||
expectedValues.push_back(FloatVec{ 0.151235f, 0.085069f, 0.337149f, -1, -1, 0.185378f });
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::RELATIVE_SIZE_SQUARED);
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::RelativeSizeSquared);
|
||||
metricName.emplace_back("relativeSizeSquared");
|
||||
inputs.push_back(explicitInput);
|
||||
|
||||
expectedValues.push_back(FloatVec{ 0.444444f, 0.25f });
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::RELATIVE_SIZE_SQUARED);
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::RelativeSizeSquared);
|
||||
metricName.emplace_back("relativeSizeSquared");
|
||||
inputs.push_back(singleTypeInput);
|
||||
|
||||
expectedValues.push_back(FloatVec{ 0.142880f, 0.037809f, 0.255017f, -1, -1, 0.127397f });
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::SHAPE_AND_SIZE);
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::ShapeAndSize);
|
||||
metricName.emplace_back("shapeAndSize");
|
||||
inputs.push_back(explicitInput);
|
||||
|
||||
expectedValues.push_back(FloatVec{ 0.419891f, 0.123718f });
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::SHAPE_AND_SIZE);
|
||||
metrics.push_back(vtkm::filter::mesh_info::CellMetric::ShapeAndSize);
|
||||
metricName.emplace_back("shapeAndSize");
|
||||
inputs.push_back(singleTypeInput);
|
||||
|
||||
|
@ -96,7 +96,7 @@ public:
|
||||
|
||||
private:
|
||||
// data member
|
||||
vtkm::filter::mesh_info::CellMetric Metric{ vtkm::filter::mesh_info::CellMetric::EMPTY };
|
||||
vtkm::filter::mesh_info::CellMetric Metric{ vtkm::filter::mesh_info::CellMetric::None };
|
||||
vtkm::FloatDefault AverageArea{};
|
||||
vtkm::FloatDefault AverageVolume{};
|
||||
|
||||
@ -116,92 +116,92 @@ private:
|
||||
vtkm::ErrorCode ec{ vtkm::ErrorCode::Success };
|
||||
switch (this->Metric)
|
||||
{
|
||||
case vtkm::filter::mesh_info::CellMetric::AREA:
|
||||
case vtkm::filter::mesh_info::CellMetric::Area:
|
||||
metricValue = vtkm::exec::CellMeasure<OutType>(numPts, pts, tag, ec);
|
||||
if (dims != 2)
|
||||
metricValue = 0.;
|
||||
break;
|
||||
case vtkm::filter::mesh_info::CellMetric::ASPECT_GAMMA:
|
||||
case vtkm::filter::mesh_info::CellMetric::AspectGama:
|
||||
metricValue =
|
||||
vtkm::worklet::cellmetrics::CellAspectGammaMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case vtkm::filter::mesh_info::CellMetric::ASPECT_RATIO:
|
||||
case vtkm::filter::mesh_info::CellMetric::AspectRatio:
|
||||
metricValue =
|
||||
vtkm::worklet::cellmetrics::CellAspectRatioMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case vtkm::filter::mesh_info::CellMetric::CONDITION:
|
||||
case vtkm::filter::mesh_info::CellMetric::Condition:
|
||||
metricValue =
|
||||
vtkm::worklet::cellmetrics::CellConditionMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case vtkm::filter::mesh_info::CellMetric::DIAGONAL_RATIO:
|
||||
case vtkm::filter::mesh_info::CellMetric::DiagonalRatio:
|
||||
metricValue =
|
||||
vtkm::worklet::cellmetrics::CellDiagonalRatioMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case vtkm::filter::mesh_info::CellMetric::DIMENSION:
|
||||
case vtkm::filter::mesh_info::CellMetric::Dimension:
|
||||
metricValue =
|
||||
vtkm::worklet::cellmetrics::CellDimensionMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case vtkm::filter::mesh_info::CellMetric::JACOBIAN:
|
||||
case vtkm::filter::mesh_info::CellMetric::Jacobian:
|
||||
metricValue =
|
||||
vtkm::worklet::cellmetrics::CellJacobianMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case vtkm::filter::mesh_info::CellMetric::MAX_ANGLE:
|
||||
case vtkm::filter::mesh_info::CellMetric::MaxAngle:
|
||||
metricValue =
|
||||
vtkm::worklet::cellmetrics::CellMaxAngleMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case vtkm::filter::mesh_info::CellMetric::MAX_DIAGONAL:
|
||||
case vtkm::filter::mesh_info::CellMetric::MaxDiagonal:
|
||||
metricValue =
|
||||
vtkm::worklet::cellmetrics::CellMaxDiagonalMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case vtkm::filter::mesh_info::CellMetric::MIN_ANGLE:
|
||||
case vtkm::filter::mesh_info::CellMetric::MinAngle:
|
||||
metricValue =
|
||||
vtkm::worklet::cellmetrics::CellMinAngleMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case vtkm::filter::mesh_info::CellMetric::MIN_DIAGONAL:
|
||||
case vtkm::filter::mesh_info::CellMetric::MinDiagonal:
|
||||
metricValue =
|
||||
vtkm::worklet::cellmetrics::CellMinDiagonalMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case vtkm::filter::mesh_info::CellMetric::ODDY:
|
||||
case vtkm::filter::mesh_info::CellMetric::Oddy:
|
||||
metricValue = vtkm::worklet::cellmetrics::CellOddyMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case vtkm::filter::mesh_info::CellMetric::RELATIVE_SIZE_SQUARED:
|
||||
case vtkm::filter::mesh_info::CellMetric::RelativeSizeSquared:
|
||||
metricValue = vtkm::worklet::cellmetrics::CellRelativeSizeSquaredMetric<OutType>(
|
||||
numPts, pts, static_cast<OutType>(average), tag, ec);
|
||||
break;
|
||||
case vtkm::filter::mesh_info::CellMetric::SHAPE_AND_SIZE:
|
||||
case vtkm::filter::mesh_info::CellMetric::ShapeAndSize:
|
||||
metricValue = vtkm::worklet::cellmetrics::CellShapeAndSizeMetric<OutType>(
|
||||
numPts, pts, static_cast<OutType>(average), tag, ec);
|
||||
break;
|
||||
case vtkm::filter::mesh_info::CellMetric::SCALED_JACOBIAN:
|
||||
case vtkm::filter::mesh_info::CellMetric::ScaledJacobian:
|
||||
metricValue =
|
||||
vtkm::worklet::cellmetrics::CellScaledJacobianMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case vtkm::filter::mesh_info::CellMetric::SHAPE:
|
||||
case vtkm::filter::mesh_info::CellMetric::Shape:
|
||||
metricValue = vtkm::worklet::cellmetrics::CellShapeMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case vtkm::filter::mesh_info::CellMetric::SHEAR:
|
||||
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:
|
||||
case vtkm::filter::mesh_info::CellMetric::Skew:
|
||||
metricValue = vtkm::worklet::cellmetrics::CellSkewMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case vtkm::filter::mesh_info::CellMetric::STRETCH:
|
||||
case vtkm::filter::mesh_info::CellMetric::Stretch:
|
||||
metricValue =
|
||||
vtkm::worklet::cellmetrics::CellStretchMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case vtkm::filter::mesh_info::CellMetric::TAPER:
|
||||
case vtkm::filter::mesh_info::CellMetric::Taper:
|
||||
metricValue = vtkm::worklet::cellmetrics::CellTaperMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case vtkm::filter::mesh_info::CellMetric::VOLUME:
|
||||
case vtkm::filter::mesh_info::CellMetric::Volume:
|
||||
metricValue = vtkm::exec::CellMeasure<OutType>(numPts, pts, tag, ec);
|
||||
if (dims != 3)
|
||||
metricValue = 0.;
|
||||
break;
|
||||
case vtkm::filter::mesh_info::CellMetric::WARPAGE:
|
||||
case vtkm::filter::mesh_info::CellMetric::Warpage:
|
||||
metricValue =
|
||||
vtkm::worklet::cellmetrics::CellWarpageMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case vtkm::filter::mesh_info::CellMetric::EMPTY:
|
||||
case vtkm::filter::mesh_info::CellMetric::None:
|
||||
break;
|
||||
default:
|
||||
//Only call metric function if a metric is specified for this shape type
|
||||
|
Loading…
Reference in New Issue
Block a user