Commit 6a6ac7cd authored by Kenneth Moreland's avatar Kenneth Moreland
Browse files

Change filter to pass all fields by default

You can still select independent fields with a FieldSelection object if
desired.
parent 89b46e95
...@@ -62,25 +62,33 @@ public: ...@@ -62,25 +62,33 @@ public:
/// ///
/// On success, this the dataset produced. On error, vtkm::cont::ErrorExecution will be thrown. /// On success, this the dataset produced. On error, vtkm::cont::ErrorExecution will be thrown.
VTKM_CONT VTKM_CONT
vtkm::cont::DataSet Execute(const vtkm::cont::DataSet& input, vtkm::cont::DataSet Execute(
const FieldSelection& fieldSelection = FieldSelection()); const vtkm::cont::DataSet& input,
const vtkm::filter::FieldSelection& fieldSelection =
vtkm::filter::FieldSelection(vtkm::filter::FieldSelection::MODE_ALL));
template <typename DerivedPolicy> template <typename DerivedPolicy>
VTKM_CONT vtkm::cont::DataSet Execute(const vtkm::cont::DataSet& input, VTKM_CONT vtkm::cont::DataSet Execute(
const vtkm::filter::PolicyBase<DerivedPolicy>& policy, const vtkm::cont::DataSet& input,
const FieldSelection& fieldSelection = FieldSelection()); const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
const vtkm::filter::FieldSelection& fieldSelection =
vtkm::filter::FieldSelection(vtkm::filter::FieldSelection::MODE_ALL));
//@} //@}
//@{ //@{
/// MultiBlock variants of execute. /// MultiBlock variants of execute.
VTKM_CONT VTKM_CONT
vtkm::cont::MultiBlock Execute(const vtkm::cont::MultiBlock& input, vtkm::cont::MultiBlock Execute(
const FieldSelection& fieldSelection = FieldSelection()); const vtkm::cont::MultiBlock& input,
const vtkm::filter::FieldSelection& fieldSelection =
vtkm::filter::FieldSelection(vtkm::filter::FieldSelection::MODE_ALL));
template <typename DerivedPolicy> template <typename DerivedPolicy>
VTKM_CONT vtkm::cont::MultiBlock Execute(const vtkm::cont::MultiBlock& input, VTKM_CONT vtkm::cont::MultiBlock Execute(
const vtkm::filter::PolicyBase<DerivedPolicy>& policy, const vtkm::cont::MultiBlock& input,
const FieldSelection& fieldSelection = FieldSelection()); const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
const vtkm::filter::FieldSelection& fieldSelection =
vtkm::filter::FieldSelection(vtkm::filter::FieldSelection::MODE_ALL));
//@} //@}
private: private:
......
...@@ -54,8 +54,9 @@ inline VTKM_CONT Filter<Derived>::~Filter() ...@@ -54,8 +54,9 @@ inline VTKM_CONT Filter<Derived>::~Filter()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
template <typename Derived> template <typename Derived>
inline VTKM_CONT vtkm::cont::DataSet Filter<Derived>::Execute(const vtkm::cont::DataSet& input, inline VTKM_CONT vtkm::cont::DataSet Filter<Derived>::Execute(
const FieldSelection& fieldSelection) const vtkm::cont::DataSet& input,
const vtkm::filter::FieldSelection& fieldSelection)
{ {
return this->Execute(input, vtkm::filter::PolicyDefault(), fieldSelection); return this->Execute(input, vtkm::filter::PolicyDefault(), fieldSelection);
} }
...@@ -66,7 +67,7 @@ template <typename DerivedPolicy> ...@@ -66,7 +67,7 @@ template <typename DerivedPolicy>
inline VTKM_CONT vtkm::cont::DataSet Filter<Derived>::Execute( inline VTKM_CONT vtkm::cont::DataSet Filter<Derived>::Execute(
const vtkm::cont::DataSet& input, const vtkm::cont::DataSet& input,
const vtkm::filter::PolicyBase<DerivedPolicy>& policy, const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
const FieldSelection& fieldSelection) const vtkm::filter::FieldSelection& fieldSelection)
{ {
Derived* self = static_cast<Derived*>(this); Derived* self = static_cast<Derived*>(this);
//self->DoPreExecute(input, policy, fieldSelection); //self->DoPreExecute(input, policy, fieldSelection);
...@@ -93,7 +94,7 @@ inline VTKM_CONT vtkm::cont::DataSet Filter<Derived>::Execute( ...@@ -93,7 +94,7 @@ inline VTKM_CONT vtkm::cont::DataSet Filter<Derived>::Execute(
template <typename Derived> template <typename Derived>
inline VTKM_CONT vtkm::cont::MultiBlock Filter<Derived>::Execute( inline VTKM_CONT vtkm::cont::MultiBlock Filter<Derived>::Execute(
const vtkm::cont::MultiBlock& input, const vtkm::cont::MultiBlock& input,
const FieldSelection& fieldSelection) const vtkm::filter::FieldSelection& fieldSelection)
{ {
return this->Execute(input, vtkm::filter::PolicyDefault(), fieldSelection); return this->Execute(input, vtkm::filter::PolicyDefault(), fieldSelection);
} }
...@@ -104,7 +105,7 @@ template <typename DerivedPolicy> ...@@ -104,7 +105,7 @@ template <typename DerivedPolicy>
inline VTKM_CONT vtkm::cont::MultiBlock Filter<Derived>::Execute( inline VTKM_CONT vtkm::cont::MultiBlock Filter<Derived>::Execute(
const vtkm::cont::MultiBlock& input, const vtkm::cont::MultiBlock& input,
const vtkm::filter::PolicyBase<DerivedPolicy>& policy, const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
const FieldSelection& fieldSelection) const vtkm::filter::FieldSelection& fieldSelection)
{ {
// Derived* self = static_cast<Derived*>(this); // Derived* self = static_cast<Derived*>(this);
//self->DoPreExecute(input, policy, fieldSelection); //self->DoPreExecute(input, policy, fieldSelection);
......
...@@ -35,7 +35,7 @@ vtkm::cont::DataSet MakeDataTestSet1() ...@@ -35,7 +35,7 @@ vtkm::cont::DataSet MakeDataTestSet1()
vtkm::cont::DataSet ds = MakeTestDataSet().Make3DUniformDataSet1(); vtkm::cont::DataSet ds = MakeTestDataSet().Make3DUniformDataSet1();
vtkm::filter::CleanGrid clean; vtkm::filter::CleanGrid clean;
return clean.Execute(ds, vtkm::filter::FieldSelection::MODE_ALL); return clean.Execute(ds);
} }
vtkm::cont::DataSet MakeDataTestSet2() vtkm::cont::DataSet MakeDataTestSet2()
...@@ -68,7 +68,7 @@ void TestExternalFacesExplicitGrid(const vtkm::cont::DataSet& ds, ...@@ -68,7 +68,7 @@ void TestExternalFacesExplicitGrid(const vtkm::cont::DataSet& ds,
vtkm::filter::ExternalFaces externalFaces; vtkm::filter::ExternalFaces externalFaces;
externalFaces.SetCompactPoints(compactPoints); externalFaces.SetCompactPoints(compactPoints);
externalFaces.SetPassPolyData(passPolyData); externalFaces.SetPassPolyData(passPolyData);
vtkm::cont::DataSet resultds = externalFaces.Execute(ds, vtkm::filter::FieldSelection::MODE_ALL); vtkm::cont::DataSet resultds = externalFaces.Execute(ds);
// verify cellset // verify cellset
vtkm::cont::CellSetExplicit<>& new_cellSet = vtkm::cont::CellSetExplicit<>& new_cellSet =
......
...@@ -48,8 +48,7 @@ public: ...@@ -48,8 +48,7 @@ public:
extractGeometry.SetExtractBoundaryCells(false); extractGeometry.SetExtractBoundaryCells(false);
extractGeometry.SetExtractOnlyBoundaryCells(false); extractGeometry.SetExtractOnlyBoundaryCells(false);
vtkm::cont::DataSet output = vtkm::cont::DataSet output = extractGeometry.Execute(dataset);
extractGeometry.Execute(dataset, vtkm::filter::FieldSelection::MODE_ALL);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 8), VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 8),
"Wrong result for ExtractGeometry"); "Wrong result for ExtractGeometry");
...@@ -77,8 +76,7 @@ public: ...@@ -77,8 +76,7 @@ public:
extractGeometry.SetExtractBoundaryCells(false); extractGeometry.SetExtractBoundaryCells(false);
extractGeometry.SetExtractOnlyBoundaryCells(false); extractGeometry.SetExtractOnlyBoundaryCells(false);
vtkm::cont::DataSet output = vtkm::cont::DataSet output = extractGeometry.Execute(dataset);
extractGeometry.Execute(dataset, vtkm::filter::FieldSelection::MODE_ALL);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 56), VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 56),
"Wrong result for ExtractGeometry"); "Wrong result for ExtractGeometry");
...@@ -106,8 +104,7 @@ public: ...@@ -106,8 +104,7 @@ public:
extractGeometry.SetExtractBoundaryCells(true); extractGeometry.SetExtractBoundaryCells(true);
extractGeometry.SetExtractOnlyBoundaryCells(false); extractGeometry.SetExtractOnlyBoundaryCells(false);
vtkm::cont::DataSet output = vtkm::cont::DataSet output = extractGeometry.Execute(dataset);
extractGeometry.Execute(dataset, vtkm::filter::FieldSelection::MODE_ALL);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 64), VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 64),
"Wrong result for ExtractGeometry"); "Wrong result for ExtractGeometry");
...@@ -134,8 +131,7 @@ public: ...@@ -134,8 +131,7 @@ public:
extractGeometry.SetExtractBoundaryCells(true); extractGeometry.SetExtractBoundaryCells(true);
extractGeometry.SetExtractOnlyBoundaryCells(true); extractGeometry.SetExtractOnlyBoundaryCells(true);
vtkm::cont::DataSet output = vtkm::cont::DataSet output = extractGeometry.Execute(dataset);
extractGeometry.Execute(dataset, vtkm::filter::FieldSelection::MODE_ALL);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 56), VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 56),
"Wrong result for ExtractGeometry"); "Wrong result for ExtractGeometry");
......
...@@ -47,8 +47,7 @@ public: ...@@ -47,8 +47,7 @@ public:
extractPoints.SetExtractInside(true); extractPoints.SetExtractInside(true);
extractPoints.SetCompactPoints(true); extractPoints.SetCompactPoints(true);
vtkm::cont::DataSet output = vtkm::cont::DataSet output = extractPoints.Execute(dataset);
extractPoints.Execute(dataset, vtkm::filter::FieldSelection::MODE_ALL);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 27), VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 27),
"Wrong result for ExtractPoints"); "Wrong result for ExtractPoints");
...@@ -81,8 +80,7 @@ public: ...@@ -81,8 +80,7 @@ public:
extractPoints.SetExtractInside(false); extractPoints.SetExtractInside(false);
extractPoints.SetCompactPoints(true); extractPoints.SetCompactPoints(true);
vtkm::cont::DataSet output = vtkm::cont::DataSet output = extractPoints.Execute(dataset);
extractPoints.Execute(dataset, vtkm::filter::FieldSelection::MODE_ALL);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 98), VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 98),
"Wrong result for ExtractPoints"); "Wrong result for ExtractPoints");
...@@ -115,8 +113,7 @@ public: ...@@ -115,8 +113,7 @@ public:
extractPoints.SetImplicitFunction(sphere); extractPoints.SetImplicitFunction(sphere);
extractPoints.SetExtractInside(true); extractPoints.SetExtractInside(true);
vtkm::cont::DataSet output = vtkm::cont::DataSet output = extractPoints.Execute(dataset);
extractPoints.Execute(dataset, vtkm::filter::FieldSelection::MODE_ALL);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 27), VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 27),
"Wrong result for ExtractPoints"); "Wrong result for ExtractPoints");
} }
...@@ -136,8 +133,7 @@ public: ...@@ -136,8 +133,7 @@ public:
extractPoints.SetImplicitFunction(box); extractPoints.SetImplicitFunction(box);
extractPoints.SetExtractInside(true); extractPoints.SetExtractInside(true);
vtkm::cont::DataSet output = vtkm::cont::DataSet output = extractPoints.Execute(dataset);
extractPoints.Execute(dataset, vtkm::filter::FieldSelection::MODE_ALL);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 8), VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 8),
"Wrong result for ExtractPoints"); "Wrong result for ExtractPoints");
} }
...@@ -157,8 +153,7 @@ public: ...@@ -157,8 +153,7 @@ public:
extractPoints.SetImplicitFunction(box); extractPoints.SetImplicitFunction(box);
extractPoints.SetExtractInside(false); extractPoints.SetExtractInside(false);
vtkm::cont::DataSet output = vtkm::cont::DataSet output = extractPoints.Execute(dataset);
extractPoints.Execute(dataset, vtkm::filter::FieldSelection::MODE_ALL);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 3), VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 3),
"Wrong result for ExtractPoints"); "Wrong result for ExtractPoints");
} }
......
...@@ -34,7 +34,7 @@ void TestFieldSelection() ...@@ -34,7 +34,7 @@ void TestFieldSelection()
} }
{ {
// field selection with select all, everything should be false. // field selection with select all, everything should be true.
vtkm::filter::FieldSelection selection(vtkm::filter::FieldSelection::MODE_ALL); vtkm::filter::FieldSelection selection(vtkm::filter::FieldSelection::MODE_ALL);
VTKM_TEST_ASSERT(selection.IsFieldSelected("foo") == true, "field selection failed."); VTKM_TEST_ASSERT(selection.IsFieldSelected("foo") == true, "field selection failed.");
VTKM_TEST_ASSERT(selection.IsFieldSelected("bar", vtkm::cont::Field::ASSOC_POINTS) == true, VTKM_TEST_ASSERT(selection.IsFieldSelected("bar", vtkm::cont::Field::ASSOC_POINTS) == true,
......
...@@ -41,7 +41,7 @@ public: ...@@ -41,7 +41,7 @@ public:
vtkm::Id stride = 2; vtkm::Id stride = 2;
mask.SetStride(stride); mask.SetStride(stride);
vtkm::cont::DataSet output = mask.Execute(dataset, vtkm::filter::FieldSelection::MODE_ALL); vtkm::cont::DataSet output = mask.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 8), VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 8),
"Wrong result for Mask"); "Wrong result for Mask");
...@@ -65,7 +65,7 @@ public: ...@@ -65,7 +65,7 @@ public:
vtkm::Id stride = 9; vtkm::Id stride = 9;
mask.SetStride(stride); mask.SetStride(stride);
vtkm::cont::DataSet output = mask.Execute(dataset, vtkm::filter::FieldSelection::MODE_ALL); vtkm::cont::DataSet output = mask.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 7), VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 7),
"Wrong result for Mask"); "Wrong result for Mask");
...@@ -87,7 +87,7 @@ public: ...@@ -87,7 +87,7 @@ public:
vtkm::Id stride = 2; vtkm::Id stride = 2;
mask.SetStride(stride); mask.SetStride(stride);
vtkm::cont::DataSet output = mask.Execute(dataset, vtkm::filter::FieldSelection::MODE_ALL); vtkm::cont::DataSet output = mask.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 2), VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 2),
"Wrong result for Mask"); "Wrong result for Mask");
......
...@@ -390,8 +390,7 @@ void MapperWireframer::RenderCells(const vtkm::cont::DynamicCellSet& inCellSet, ...@@ -390,8 +390,7 @@ void MapperWireframer::RenderCells(const vtkm::cont::DynamicCellSet& inCellSet,
vtkm::filter::ExternalFaces externalFaces; vtkm::filter::ExternalFaces externalFaces;
externalFaces.SetCompactPoints(false); externalFaces.SetCompactPoints(false);
externalFaces.SetPassPolyData(true); externalFaces.SetPassPolyData(true);
vtkm::cont::DataSet output = vtkm::cont::DataSet output = externalFaces.Execute(dataSet);
externalFaces.Execute(dataSet, vtkm::filter::FieldSelection::MODE_ALL);
cellSet = output.GetCellSet(); cellSet = output.GetCellSet();
actualField = output.GetField(0); actualField = output.GetField(0);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment