Commit 9fb64808 authored by Kenneth Moreland's avatar Kenneth Moreland

Fix cross product filter interface

The GetPrimaryFieldName and GetPrimaryFieldAssociation methods were
returning values for the secondary field and vice versa. Correct that.
parent d5c0c8f2
......@@ -46,10 +46,10 @@ public:
this->SetActiveField(name, association);
}
VTKM_CONT const std::string& GetPrimaryFieldName() const { return this->SecondaryFieldName; }
VTKM_CONT const std::string& GetPrimaryFieldName() const { return this->GetActiveFieldName(); }
VTKM_CONT vtkm::cont::Field::Association GetPrimaryFieldAssociation() const
{
return this->SecondaryFieldAssociation;
return this->GetActiveFieldAssociation();
}
//@}
......@@ -92,10 +92,10 @@ public:
this->SecondaryFieldAssociation = association;
}
VTKM_CONT const std::string& GetSecondaryFieldName() const { return this->GetActiveFieldName(); }
VTKM_CONT const std::string& GetSecondaryFieldName() const { return this->SecondaryFieldName; }
VTKM_CONT vtkm::cont::Field::Association GetSecondaryFieldAssociation() const
{
return this->GetActiveFieldAssociation();
return this->SecondaryFieldAssociation;
}
//@}
......
......@@ -156,7 +156,22 @@ void TestCrossProduct()
std::cout << " Both vectors as normal fields" << std::endl;
vtkm::filter::CrossProduct filter;
filter.SetPrimaryField("vec1");
filter.SetSecondaryField("vec2");
filter.SetSecondaryField("vec2", vtkm::cont::Field::Association::POINTS);
// Check to make sure the fields are reported as correct.
VTKM_TEST_ASSERT(filter.GetPrimaryFieldName() == "vec1", "Bad field name.");
VTKM_TEST_ASSERT(filter.GetPrimaryFieldAssociation() == vtkm::cont::Field::Association::ANY,
"Bad field association.");
VTKM_TEST_ASSERT(filter.GetUseCoordinateSystemAsPrimaryField() == false,
"Bad use coordinates.");
VTKM_TEST_ASSERT(filter.GetSecondaryFieldName() == "vec2", "Bad field name.");
VTKM_TEST_ASSERT(filter.GetSecondaryFieldAssociation() ==
vtkm::cont::Field::Association::POINTS,
"Bad field association.");
VTKM_TEST_ASSERT(filter.GetUseCoordinateSystemAsSecondaryField() == false,
"Bad use coordinates.");
vtkm::cont::DataSet result = filter.Execute(dataSet);
CheckResult(field1, field2, result);
}
......@@ -167,6 +182,17 @@ void TestCrossProduct()
filter.SetUseCoordinateSystemAsPrimaryField(true);
filter.SetPrimaryCoordinateSystem(1);
filter.SetSecondaryField("vec2");
// Check to make sure the fields are reported as correct.
VTKM_TEST_ASSERT(filter.GetUseCoordinateSystemAsPrimaryField() == true,
"Bad use coordinates.");
VTKM_TEST_ASSERT(filter.GetSecondaryFieldName() == "vec2", "Bad field name.");
VTKM_TEST_ASSERT(filter.GetSecondaryFieldAssociation() == vtkm::cont::Field::Association::ANY,
"Bad field association.");
VTKM_TEST_ASSERT(filter.GetUseCoordinateSystemAsSecondaryField() == false,
"Bad use coordinates.");
vtkm::cont::DataSet result = filter.Execute(dataSet);
CheckResult(field1, field2, result);
}
......@@ -177,6 +203,17 @@ void TestCrossProduct()
filter.SetPrimaryField("vec1");
filter.SetUseCoordinateSystemAsSecondaryField(true);
filter.SetSecondaryCoordinateSystem(2);
// Check to make sure the fields are reported as correct.
VTKM_TEST_ASSERT(filter.GetPrimaryFieldName() == "vec1", "Bad field name.");
VTKM_TEST_ASSERT(filter.GetPrimaryFieldAssociation() == vtkm::cont::Field::Association::ANY,
"Bad field association.");
VTKM_TEST_ASSERT(filter.GetUseCoordinateSystemAsPrimaryField() == false,
"Bad use coordinates.");
VTKM_TEST_ASSERT(filter.GetUseCoordinateSystemAsSecondaryField() == true,
"Bad use coordinates.");
vtkm::cont::DataSet result = filter.Execute(dataSet);
CheckResult(field1, field2, result);
}
......
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