Commit 39a2dce0 authored by Roxana Bujack's avatar Roxana Bujack
Browse files

add testing

parent 3894dbf1
version https://git-lfs.github.com/spec/v1
oid sha256:0994e1747beaddba1ab6e97a48e17956e64a12ebfdffac1c2ae8734f3578956f
size 20716
version https://git-lfs.github.com/spec/v1
oid sha256:6a610fe2de049c6a2402f7b19ea5a03f2e637e90d62a6df38832e62b89a691bb
size 25953
......@@ -125,3 +125,8 @@ if(VTKm_ENABLE_TESTING)
)
vtkm_unit_tests(MPI SOURCES ${mpi_unit_tests} DEFINES VTKM_NO_ERROR_ON_MIXED_CUDA_CXX_TAG)
endif()
#-----------------------------------------------------------------------------
if(VTKm_ENABLE_RENDERING)
add_subdirectory(regressionTesting)
endif()
\ No newline at end of file
##============================================================================
## Copyright (c) Kitware, Inc.
## All rights reserved.
## See LICENSE.txt for details.
##
## This software is distributed WITHOUT ANY WARRANTY; without even
## the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
## PURPOSE. See the above copyright notice for more information.
##============================================================================
set(unit_tests
RegressionTestAmrDataset.cxx
)
set(libraries
vtkm_filter
vtkm_io
vtkm_source
vtkm_rendering
)
vtkm_unit_tests(SOURCES ${unit_tests} LIBRARIES ${libraries})
//============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
//
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#include <vtkm/cont/MergePartitionedDataSet.h>
#include <vtkm/filter/ExternalFaces.h>
#include <vtkm/filter/Threshold.h>
#include <vtkm/source/Amr.h>
#include <vtkm/rendering/CanvasRayTracer.h>
#include <vtkm/rendering/MapperRayTracer.h>
#include <vtkm/rendering/View3D.h>
#include <vtkm/rendering/testing/RenderTest.h>
#include <vtkm/rendering/testing/Testing.h>
namespace
{
void TestAmrDatasetExecute(int dim, int numberOfLevels, int cellsPerDimension)
{
std::cout << "Generate Image for AMR" << std::endl;
using M = vtkm::rendering::MapperRayTracer;
using C = vtkm::rendering::CanvasRayTracer;
using V3 = vtkm::rendering::View3D;
// Generate AMR
vtkm::source::Amr source(dim, cellsPerDimension, numberOfLevels);
vtkm::cont::AmrDataSet amrDataSet = source.Execute();
// Remove blanked cells
vtkm::filter::Threshold threshold;
threshold.SetLowerThreshold(0);
threshold.SetUpperThreshold(1);
threshold.SetActiveField("vtkGhostType");
vtkm::cont::PartitionedDataSet derivedDataSet = threshold.Execute(amrDataSet);
// Extract surface for efficient 3D pipeline
vtkm::filter::ExternalFaces surface;
derivedDataSet = surface.Execute(derivedDataSet);
// Merge dataset
vtkm::cont::DataSet result = vtkm::cont::MergePartitionedDataSet(derivedDataSet);
result.PrintSummary(std::cout);
vtkm::rendering::testing::RenderAndRegressionTest<M, C, V3>(result,
"RTDataCells",
vtkm::cont::ColorTable("inferno"),
"cont/amr" + std::to_string(dim) +
"D.png",
false);
}
void TestAmrDataset()
{
int numberOfLevels = 5;
int cellsPerDimension = 6;
TestAmrDatasetExecute(2, numberOfLevels, cellsPerDimension);
TestAmrDatasetExecute(3, numberOfLevels, cellsPerDimension);
}
} // namespace
int RegressionTestAmrDataset(int argc, char* argv[])
{
return vtkm::cont::testing::Testing::Run(TestAmrDataset, argc, argv);
}
Supports Markdown
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