mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-16 17:22:55 +00:00
minor changes based on code review
This commit is contained in:
parent
aecdd77053
commit
daaac78f15
@ -14,6 +14,8 @@
|
||||
|
||||
#include <vtkm/internal/Meta.h>
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
|
||||
|
@ -419,6 +419,7 @@ protected:
|
||||
VTKM_CONT virtual vtkm::cont::PartitionedDataSet DoExecutePartitions(
|
||||
const vtkm::cont::PartitionedDataSet& inData);
|
||||
|
||||
private:
|
||||
template <typename FieldMapper>
|
||||
VTKM_CONT void MapFieldsOntoOutput(const vtkm::cont::DataSet& input,
|
||||
vtkm::cont::DataSet& output,
|
||||
@ -434,7 +435,6 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
VTKM_CONT
|
||||
virtual vtkm::Id DetermineNumberOfThreads(const vtkm::cont::PartitionedDataSet& input);
|
||||
|
||||
|
@ -26,15 +26,12 @@ vtkm::cont::DataSet Probe::DoExecute(const vtkm::cont::DataSet& input)
|
||||
input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()),
|
||||
this->Geometry.GetCoordinateSystem().GetData());
|
||||
|
||||
auto output = this->Geometry;
|
||||
auto hpf = worklet.GetHiddenPointsField();
|
||||
auto hcf = worklet.GetHiddenCellsField(output.GetCellSet());
|
||||
|
||||
output.AddField(vtkm::cont::make_FieldPoint("HIDDEN", hpf));
|
||||
output.AddField(vtkm::cont::make_FieldCell("HIDDEN", hcf));
|
||||
|
||||
auto mapper = [&](auto& outDataSet, const auto& f) { this->DoMapField(outDataSet, f, worklet); };
|
||||
this->MapFieldsOntoOutput(input, output, mapper);
|
||||
auto output = this->CreateResult(
|
||||
input, this->Geometry.GetCellSet(), this->Geometry.GetCoordinateSystems(), mapper);
|
||||
output.AddField(vtkm::cont::make_FieldPoint("HIDDEN", worklet.GetHiddenPointsField()));
|
||||
output.AddField(
|
||||
vtkm::cont::make_FieldCell("HIDDEN", worklet.GetHiddenCellsField(output.GetCellSet())));
|
||||
|
||||
return output;
|
||||
}
|
||||
@ -52,8 +49,9 @@ bool Probe::DoMapField(vtkm::cont::DataSet& result,
|
||||
concrete, vtkm::cont::internal::CastInvalidValue<T>(this->InvalidValue));
|
||||
result.AddPointField(field.GetName(), outputArray);
|
||||
};
|
||||
// FIXME: what kind of CastAndCall do we need?
|
||||
CastAndCall(field.GetData(), resolve);
|
||||
field.GetData()
|
||||
.CastAndCallForTypesWithFloatFallback<vtkm::TypeListField, VTKM_DEFAULT_STORAGE_LIST>(
|
||||
resolve);
|
||||
return true;
|
||||
}
|
||||
else if (field.IsFieldCell())
|
||||
|
@ -31,8 +31,7 @@ public:
|
||||
void SetGeometry(const vtkm::cont::DataSet& geometry)
|
||||
{
|
||||
this->Geometry = vtkm::cont::DataSet();
|
||||
this->Geometry.SetCellSet(geometry.GetCellSet());
|
||||
this->Geometry.AddCoordinateSystem(geometry.GetCoordinateSystem());
|
||||
this->Geometry.CopyStructure(geometry);
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
|
@ -13,6 +13,7 @@ set(unit_tests
|
||||
)
|
||||
|
||||
set(libraries
|
||||
vtkm_filter_clean_grid
|
||||
vtkm_filter_resampling
|
||||
)
|
||||
|
||||
@ -20,5 +21,4 @@ vtkm_unit_tests(
|
||||
SOURCES ${unit_tests}
|
||||
LIBRARIES ${libraries}
|
||||
USE_VTKM_JOB_POOL
|
||||
ALL_BACKENDS # uses CellDeepCopy
|
||||
)
|
||||
|
@ -7,12 +7,13 @@
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
#include <vtkm/filter/resampling/Probe.h>
|
||||
|
||||
#include <vtkm/cont/ArrayCopy.h>
|
||||
#include <vtkm/cont/DataSetBuilderUniform.h>
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
|
||||
#include <vtkm/filter/clean_grid/CleanGrid.h>
|
||||
#include <vtkm/filter/resampling/Probe.h>
|
||||
|
||||
#include <vtkm/worklet/CellDeepCopy.h>
|
||||
|
||||
namespace
|
||||
@ -46,22 +47,9 @@ vtkm::cont::DataSet MakeGeometryDataSet()
|
||||
|
||||
vtkm::cont::DataSet ConvertDataSetUniformToExplicit(const vtkm::cont::DataSet& uds)
|
||||
{
|
||||
vtkm::cont::DataSet eds;
|
||||
vtkm::cont::CellSetExplicit<> cs;
|
||||
vtkm::worklet::CellDeepCopy::Run(uds.GetCellSet(), cs);
|
||||
eds.SetCellSet(cs);
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec3f> points;
|
||||
vtkm::cont::ArrayCopy(uds.GetCoordinateSystem().GetData(), points);
|
||||
eds.AddCoordinateSystem(
|
||||
vtkm::cont::CoordinateSystem(uds.GetCoordinateSystem().GetName(), points));
|
||||
|
||||
for (vtkm::IdComponent i = 0; i < uds.GetNumberOfFields(); ++i)
|
||||
{
|
||||
eds.AddField(uds.GetField(i));
|
||||
}
|
||||
|
||||
return eds;
|
||||
vtkm::filter::clean_grid::CleanGrid toUnstructured;
|
||||
toUnstructured.SetMergePoints(true);
|
||||
return toUnstructured.Execute(uds);
|
||||
}
|
||||
|
||||
const std::vector<vtkm::Float32>& GetExpectedPointData()
|
||||
|
Loading…
Reference in New Issue
Block a user