Updates will be applied April 15th at 12pm EDT (UTC-0400). GitLab could be a little slow between 12 - 12:45pm EDT.

Commit 6739833c authored by Mathieu Westphal's avatar Mathieu Westphal

Adding a Test for large number of arrays in Calculator

parent 738ae5a9
......@@ -6,7 +6,8 @@ vtk_module_test_data(
Data/cow.vtp
Data/delaunay3d.vtu
Data/disk_out_ref_surface.vtp
Data/explicitStructuredGrid.vtu)
Data/explicitStructuredGrid.vtu
Data/wavelet300Arrays.vti)
add_subdirectory(Cxx)
......
......@@ -14,11 +14,13 @@
=========================================================================*/
#include <vtkArrayCalculator.h>
#include <vtkImageData.h>
#include <vtkNew.h>
#include <vtkPointData.h>
#include <vtkPolyData.h>
#include <vtkSmartPointer.h>
#include <vtkTestUtilities.h>
#include <vtkXMLImageDataReader.h>
#include <vtkXMLPolyDataReader.h>
int TestArrayCalculator(int argc, char *argv[])
......@@ -121,5 +123,36 @@ int TestArrayCalculator(int argc, char *argv[])
return EXIT_FAILURE;
}
char* filename2 =
vtkTestUtilities::ExpandDataFileName(argc, argv, "Data/wavelet300Arrays.vti");
vtkNew<vtkXMLImageDataReader> reader2;
reader2->SetFileName(filename2);
delete[] filename2;
reader2->Update();
//finally, check that a dataset with a lot of arrays is supported
vtkNew<vtkArrayCalculator> calc6;
calc6->SetInputConnection( reader2->GetOutputPort() );
calc6->SetAttributeTypeToPointData();
for (int i = 0; i < reader2->GetNumberOfPointArrays(); i++)
{
calc6->AddScalarArrayName(reader2->GetPointArrayName(i));
}
calc6->SetFunction("Result224");
calc6->SetResultArrayName("Result");
calc6->Update();
vtkImageData* resultImage = vtkImageData::SafeDownCast(calc6->GetOutput());
if (!resultImage->GetPointData()->HasArray("Result"))
{
std::cerr << "Output from calc6 has no array named 'Result'" << std::endl;
return EXIT_FAILURE;
}
if (resultImage->GetPointData()->GetArray("Result")->GetTuple1(0) != 224)
{
std::cerr << "Output from calc6 has an unexpected value" << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
68f41755c355f432aa88b76312cc5e26556f4b9fc0e3929ae3c7d5538a062299e5a20180116c314c162a24ab4b8cd391376408cea9ddf5e56f9ce01f3c09d1ee
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