mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
update MeshQuality examples
This commit is contained in:
parent
308552bd62
commit
a2641282d2
@ -139,14 +139,11 @@ public:
|
|||||||
std::string getOption(const std::string& option) const
|
std::string getOption(const std::string& option) const
|
||||||
{
|
{
|
||||||
std::size_t index = static_cast<std::size_t>(this->findOption(option));
|
std::size_t index = static_cast<std::size_t>(this->findOption(option));
|
||||||
if (index >= 0)
|
std::string val = this->mCLOptions[index];
|
||||||
|
auto valPos = val.find("=");
|
||||||
|
if (valPos)
|
||||||
{
|
{
|
||||||
std::string val = this->mCLOptions[index];
|
return val.substr(valPos + 1);
|
||||||
auto valPos = val.find("=");
|
|
||||||
if (valPos)
|
|
||||||
{
|
|
||||||
return val.substr(valPos + 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return std::string("");
|
return std::string("");
|
||||||
}
|
}
|
||||||
|
@ -199,8 +199,9 @@ inline vtkm::cont::DataSet Make3DExplicitDataSet()
|
|||||||
return dataSet;
|
return dataSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
int TestMetrics(const char* outFileName,
|
||||||
int TestMetrics(const char* outFileName, vtkm::cont::DataSet data, T filter)
|
vtkm::cont::DataSet data,
|
||||||
|
vtkm::filter::MeshQuality& filter)
|
||||||
{
|
{
|
||||||
vtkm::cont::DataSet outputData;
|
vtkm::cont::DataSet outputData;
|
||||||
try
|
try
|
||||||
@ -255,22 +256,10 @@ int main(int argc, char* argv[])
|
|||||||
vtkm::io::reader::VTKDataSetReader reader(argv[1]);
|
vtkm::io::reader::VTKDataSetReader reader(argv[1]);
|
||||||
|
|
||||||
|
|
||||||
//Assign a cell metric to compute for each different
|
// A cell metric is now computed for every shape type that exists in the
|
||||||
//shape type that may exist in the input dataset. If no metric
|
// input dataset.
|
||||||
//is specified for a shape type, then it is assumed to be EMPTY
|
vtkm::filter::CellMetric shapeMetric = vtkm::filter::CellMetric::VOLUME;
|
||||||
//and no metric is computed.
|
|
||||||
std::vector<vtkm::Pair<vtkm::UInt8, vtkm::filter::CellMetric>> shapeMetrics{
|
|
||||||
vtkm::make_Pair(vtkm::CELL_SHAPE_LINE, vtkm::filter::CellMetric::VOLUME),
|
|
||||||
vtkm::make_Pair(vtkm::CELL_SHAPE_TRIANGLE, vtkm::filter::CellMetric::VOLUME),
|
|
||||||
vtkm::make_Pair(vtkm::CELL_SHAPE_POLYGON, vtkm::filter::CellMetric::VOLUME),
|
|
||||||
vtkm::make_Pair(vtkm::CELL_SHAPE_TETRA, vtkm::filter::CellMetric::VOLUME),
|
|
||||||
vtkm::make_Pair(vtkm::CELL_SHAPE_HEXAHEDRON, vtkm::filter::CellMetric::VOLUME),
|
|
||||||
vtkm::make_Pair(vtkm::CELL_SHAPE_WEDGE, vtkm::filter::CellMetric::VOLUME),
|
|
||||||
vtkm::make_Pair(vtkm::CELL_SHAPE_QUAD, vtkm::filter::CellMetric::VOLUME),
|
|
||||||
vtkm::make_Pair(vtkm::CELL_SHAPE_PYRAMID, vtkm::filter::CellMetric::VOLUME)
|
|
||||||
};
|
|
||||||
|
|
||||||
vtkm::filter::MeshQuality filter(shapeMetrics);
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
input = reader.ReadDataSet(); //FIELD not supported errors here, but doesnt affect data
|
input = reader.ReadDataSet(); //FIELD not supported errors here, but doesnt affect data
|
||||||
@ -281,6 +270,8 @@ int main(int argc, char* argv[])
|
|||||||
std::cerr << "Error occured while reading input. Exiting" << std::endl;
|
std::cerr << "Error occured while reading input. Exiting" << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vtkm::filter::MeshQuality filter(shapeMetric);
|
||||||
TestMetrics(outFileName, input, filter);
|
TestMetrics(outFileName, input, filter);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user