Commit 827d361f authored by Kenneth Moreland's avatar Kenneth Moreland Committed by Kitware Robot

Merge topic 'fix-cross-product-interface'

9fb64808 Fix cross product filter interface
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Haocheng LIU's avatarHaocheng LIU <haocheng.liu@kitware.com>
Merge-request: !1266
parents d5c0c8f2 9fb64808
......@@ -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