Skip to content
Snippets Groups Projects
Commit d4951a5d authored by Mickael PHILIT's avatar Mickael PHILIT
Browse files

Improve high order testing

parent b6e9b16f
Loading
Pipeline #441451 waiting for manual action
......@@ -9,8 +9,12 @@
#include "vtkMultiBlockDataSet.h"
#include "vtkNew.h"
#include "vtkPointData.h"
#include "vtkCellData.h"
#include "vtkTestUtilities.h"
#include "vtkUnstructuredGrid.h"
#include "vtkCellSizeFilter.h"
#define compare_double(x, y, e) ((x) - (y) < (e) && (x) - (y) > -(e))
int TestCGNSReaderHOElements(int argc, char* argv[])
{
......@@ -73,5 +77,30 @@ int TestCGNSReaderHOElements(int argc, char* argv[])
return EXIT_FAILURE;
}
// To check the point ordering, just compute the cell volume...
// It could also be possible to do an image comparison.
vtkNew<vtkCellSizeFilter> checkerSize;
checkerSize->SetInputData(internal_hexa_125);
checkerSize->ComputeVolumeOn();
checkerSize->Update();
auto res = vtkDataSet::SafeDownCast(checkerSize->GetOutputDataObject(0));
auto cdata = res->GetCellData();
auto volume = vtk::DataArrayValueRange<1>(cdata->GetArray("Volume"));
if (!compare_double(volume[0], 2000., 1.0e-6)) {
return EXIT_FAILURE;
}
checkerSize->SetInputData(internal_hexa_64);
checkerSize->ComputeVolumeOn();
checkerSize->Update();
auto res_2 = vtkDataSet::SafeDownCast(checkerSize->GetOutputDataObject(0));
auto cdata_2 = res_2->GetCellData();
auto volume_2 = vtk::DataArrayValueRange<1>(cdata_2->GetArray("Volume"));
if (!compare_double(volume_2[0], 216., 1.0e-6)) {
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
......@@ -26,3 +26,5 @@ TEST_DEPENDS
VTK::InteractionStyle
VTK::TestingCore
VTK::TestingRendering
VTK::FiltersGeneral
VTK::FiltersVerdict
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment