mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-10-05 01:49:02 +00:00
Merge topic 'delete-create-result-vec-coords'
19f752960 Remove Filter::CreateResult that takes a vector of CoordinateSystems Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Li-Ta Lo <ollie@lanl.gov> Merge-request: !2934
This commit is contained in:
commit
3716f920e6
@ -412,41 +412,6 @@ protected:
|
||||
return outDataSet;
|
||||
}
|
||||
|
||||
/// \brief Create the output data set for `DoExecute`.
|
||||
///
|
||||
/// This form of `CreateResult` will create an output data set with the given `CellSet`
|
||||
/// and set of `CoordinateSystem`s. You must also provide a field mapper function, which
|
||||
/// is a function that takes the output `DataSet` being created and a `Field` from the
|
||||
/// input and then applies any necessary transformations to the field array and adds it
|
||||
/// to the `DataSet`.
|
||||
///
|
||||
/// \param[in] inDataSet The input data set being modified (usually the one passed
|
||||
/// into `DoExecute`). The returned `DataSet` is filled with fields of `inDataSet`
|
||||
/// (as selected by the `FieldsToPass` state of the filter).
|
||||
/// \param[in] resultCellSet The `CellSet` of the output will be set to this.
|
||||
/// \param[in] resultCoordSystems These `CoordinateSystem`s will be added to the output.
|
||||
/// \param[in] fieldMapper A function or functor that takes a `DataSet` as its first
|
||||
/// argument and a `Field` as its second argument. The `DataSet` is the data being
|
||||
/// created and will eventually be returned by `CreateResult`. The `Field` comes from
|
||||
/// `inDataSet`. The function should map the `Field` to match `resultCellSet` and then
|
||||
/// add the resulting field to the `DataSet`. If the mapping is not possible, then
|
||||
/// the function should do nothing.
|
||||
///
|
||||
template <typename FieldMapper>
|
||||
VTKM_CONT vtkm::cont::DataSet CreateResult(
|
||||
const vtkm::cont::DataSet& inDataSet,
|
||||
const vtkm::cont::UnknownCellSet& resultCellSet,
|
||||
const std::vector<vtkm::cont::CoordinateSystem>& resultCoordSystems,
|
||||
FieldMapper&& fieldMapper) const
|
||||
{
|
||||
vtkm::cont::DataSet outDataSet = this->CreateResult(inDataSet, resultCellSet, fieldMapper);
|
||||
for (auto&& cs : resultCoordSystems)
|
||||
{
|
||||
outDataSet.AddCoordinateSystem(cs);
|
||||
}
|
||||
return outDataSet;
|
||||
}
|
||||
|
||||
///@{
|
||||
/// \brief Create the output data set for `DoExecute`.
|
||||
///
|
||||
|
@ -98,16 +98,9 @@ vtkm::cont::DataSet CleanGrid::GenerateOutput(const vtkm::cont::DataSet& inData,
|
||||
{
|
||||
using VecId = std::size_t;
|
||||
const auto activeCoordIndex = static_cast<VecId>(this->GetActiveCoordinateSystemIndex());
|
||||
const auto numCoordSystems = static_cast<VecId>(inData.GetNumberOfCoordinateSystems());
|
||||
|
||||
std::vector<vtkm::cont::CoordinateSystem> outputCoordinateSystems(numCoordSystems);
|
||||
|
||||
// Start with a shallow copy of the coordinate systems
|
||||
for (VecId coordSystemIndex = 0; coordSystemIndex < numCoordSystems; ++coordSystemIndex)
|
||||
{
|
||||
outputCoordinateSystems[coordSystemIndex] =
|
||||
inData.GetCoordinateSystem(static_cast<vtkm::IdComponent>(coordSystemIndex));
|
||||
}
|
||||
vtkm::cont::CoordinateSystem activeCoordSystem = inData.GetCoordinateSystem(activeCoordIndex);
|
||||
|
||||
// Optionally adjust the cell set indices to remove all unused points
|
||||
if (this->GetCompactPointFields())
|
||||
@ -118,19 +111,14 @@ vtkm::cont::DataSet CleanGrid::GenerateOutput(const vtkm::cont::DataSet& inData,
|
||||
|
||||
outputCellSet = worklets.PointCompactor.MapCellSet(outputCellSet);
|
||||
|
||||
for (VecId coordSystemIndex = 0; coordSystemIndex < numCoordSystems; ++coordSystemIndex)
|
||||
{
|
||||
outputCoordinateSystems[coordSystemIndex] =
|
||||
vtkm::cont::CoordinateSystem(outputCoordinateSystems[coordSystemIndex].GetName(),
|
||||
worklets.PointCompactor.MapPointFieldDeep(
|
||||
outputCoordinateSystems[coordSystemIndex].GetData()));
|
||||
}
|
||||
activeCoordSystem = vtkm::cont::CoordinateSystem(
|
||||
activeCoordSystem.GetName(),
|
||||
worklets.PointCompactor.MapPointFieldDeep(activeCoordSystem.GetData()));
|
||||
}
|
||||
|
||||
// Optionally find and merge coincident points
|
||||
if (this->GetMergePoints())
|
||||
{
|
||||
vtkm::cont::CoordinateSystem activeCoordSystem = outputCoordinateSystems[activeCoordIndex];
|
||||
vtkm::Bounds bounds = activeCoordSystem.GetBounds();
|
||||
|
||||
vtkm::Float64 delta = this->GetTolerance();
|
||||
@ -144,20 +132,6 @@ vtkm::cont::DataSet CleanGrid::GenerateOutput(const vtkm::cont::DataSet& inData,
|
||||
worklets.PointMerger.Run(delta, this->GetFastMerge(), bounds, coordArray);
|
||||
activeCoordSystem = vtkm::cont::CoordinateSystem(activeCoordSystem.GetName(), coordArray);
|
||||
|
||||
for (VecId coordSystemIndex = 0; coordSystemIndex < numCoordSystems; ++coordSystemIndex)
|
||||
{
|
||||
if (coordSystemIndex == activeCoordIndex)
|
||||
{
|
||||
outputCoordinateSystems[coordSystemIndex] = activeCoordSystem;
|
||||
}
|
||||
else
|
||||
{
|
||||
outputCoordinateSystems[coordSystemIndex] = vtkm::cont::CoordinateSystem(
|
||||
outputCoordinateSystems[coordSystemIndex].GetName(),
|
||||
worklets.PointMerger.MapPointField(outputCoordinateSystems[coordSystemIndex].GetData()));
|
||||
}
|
||||
}
|
||||
|
||||
outputCellSet = worklets.PointMerger.MapCellSet(outputCellSet);
|
||||
}
|
||||
|
||||
@ -178,7 +152,7 @@ vtkm::cont::DataSet CleanGrid::GenerateOutput(const vtkm::cont::DataSet& inData,
|
||||
auto mapper = [&](auto& outDataSet, const auto& f) {
|
||||
DoMapField(outDataSet, f, *this, worklets);
|
||||
};
|
||||
return this->CreateResult(inData, outputCellSet, outputCoordinateSystems, mapper);
|
||||
return this->CreateResultCoordinateSystem(inData, outputCellSet, activeCoordSystem, mapper);
|
||||
}
|
||||
|
||||
vtkm::cont::DataSet CleanGrid::DoExecute(const vtkm::cont::DataSet& inData)
|
||||
|
Loading…
Reference in New Issue
Block a user