Commit 9c51de8d authored by Kenneth Moreland's avatar Kenneth Moreland
Browse files

Add MODE_NONE to FieldSelection

This mode forces the selection to be empty. Although there is no
practical difference between having MODE_NONE and having MODE_SELECTED
with nothing selected (which is the default), this is a semantically
nicer way to say you don't want any fields.

Since we have changed the default behavior of Filter::Execute to be
MODE_ALL, this is a nice addition so that you can clearly specify you
don't want to pass any fields by adding
vtkm::filter::FieldSelection::MODE_NONE as the second argument. (Making
it MODE_SELECTED is not clear that you want none.)
parent a4aa42c0
......@@ -39,8 +39,9 @@ class FieldSelection
enum ModeEnum
......@@ -96,6 +97,9 @@ public:
switch (this->Mode)
return false;
case MODE_ALL:
return true;
......@@ -41,6 +41,14 @@ void TestFieldSelection()
"field selection failed.");
// field selection with select none, everything should be false no matter what.
vtkm::filter::FieldSelection selection(vtkm::filter::FieldSelection::MODE_NONE);
VTKM_TEST_ASSERT(selection.IsFieldSelected("foo") == false, "field selection failed.");
VTKM_TEST_ASSERT(selection.IsFieldSelected("bar", vtkm::cont::Field::ASSOC_POINTS) == false,
"field selection failed.");
// field selection with specific fields selected.
vtkm::filter::FieldSelection selection;
......@@ -303,7 +303,7 @@ void TestMarchingCubesUniformGrid()
mc.SetIsoValue(0, 0.5);
auto result = mc.Execute(dataSet);
auto result = mc.Execute(dataSet, vtkm::filter::FieldSelection::MODE_NONE);
VTKM_TEST_ASSERT(result.GetNumberOfCellSets() == 1,
"Wrong number of cellsets in the output dataset");
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