Commit b2a0fc91 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit Committed by Ben Boeckel

vtkIOAMR: update to the new module system

parent c695d4e9
set(Module_SRCS
vtkAMRBaseParticlesReader.cxx
vtkAMRBaseReader.cxx
vtkAMRDataSetCache.cxx
vtkAMREnzoParticlesReader.cxx
vtkAMREnzoReader.cxx
set(classes
vtkAMRBaseParticlesReader
vtkAMRBaseReader
vtkAMRDataSetCache
vtkAMREnzoParticlesReader
vtkAMREnzoReader
vtkAMRFlashParticlesReader
vtkAMRFlashReader
vtkAMReXParticlesReader)
set(sources
vtkAMREnzoReaderInternal.cxx
vtkAMReXParticlesReader.cxx
vtkAMRFlashParticlesReader.cxx
vtkAMRFlashReader.cxx
vtkAMRFlashReaderInternal.cxx
)
vtkAMRFlashReaderInternal.cxx)
set(private_headers
vtkAMREnzoReaderInternal.h
vtkAMRFlashReaderInternal.h)
vtk_module_library(vtkIOAMR ${Module_SRCS})
vtk_module_add_module(VTK::IOAMR
CLASSES ${classes}
SOURCES ${sources}
PRIVATE_HEADERS ${private_headers})
vtk_module_test_data(
Data/AMR/Enzo/DD0010/,REGEX:.*)
add_subdirectory(Cxx)
# Tests with data
ExternalData_Expand_Arguments(VTKData _
"DATA{${VTK_TEST_INPUT_DIR}/AMReX/MFIX-Exa/,RECURSE:,REGEX:.*}"
"DATA{${_vtk_build_TEST_INPUT_DATA_DIRECTORY}/Data/AMReX/MFIX-Exa/,RECURSE:,REGEX:.*}"
)
vtk_add_test_cxx(vtkIOAMRCxxTests tests
NO_VALID NO_OUTPUT
# TestFlashReader.cxx there is not data for this test
TestAMReXParticlesReader.cxx
TestEnzoReader.cxx
)
......
/*=========================================================================
Program: Visualization Toolkit
Module: TestFlashReader.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm 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 <iostream>
#include <string>
#include "vtkAMRFlashReader.h"
#include "vtkSetGet.h"
#include "vtkTestUtilities.h"
#include "vtkOverlappingAMR.h"
#include "vtkUniformGridAMRDataIterator.h"
namespace FlashReaderTest {
//------------------------------------------------------------------------------
template<class T>
int CheckValue( const std::string &name, T actualValue, T expectedValue )
{
if( actualValue != expectedValue )
{
std::cerr << "ERROR: " << name << " value mismatch! ";
std::cerr << "Expected: " << expectedValue << " Actual: " << actualValue;
std::cerr << std::endl;
return 1;
}
return 0;
}
int ComputeMaxNonEmptyLevel(vtkOverlappingAMR* amr)
{
vtkUniformGridAMRDataIterator* iter = vtkUniformGridAMRDataIterator::SafeDownCast(amr->NewIterator());
iter->SetSkipEmptyNodes(true);
int maxLevel(-1);
for(iter->InitTraversal(); !iter->IsDoneWithTraversal(); iter->GoToNextItem())
{
int level = iter->GetCurrentLevel();
if(level>maxLevel)
{
maxLevel = level;
}
}
iter->Delete();
return maxLevel+1;
}
} // END namespace
int TestFlashReader( int argc, char *argv[] )
{
int rc = 0;
int NumBlocksPerLevel[] = {1,8,64,512,3456,15344,78208};
vtkAMRFlashReader *flashReader = vtkAMRFlashReader::New();
char *fileName =
vtkTestUtilities::ExpandDataFileName(argc,argv,
"Data/AMR/Flash/smooth/smooth.flash");
std::cout << "Filename: " << fileName << std::endl;
std::cout.flush();
vtkOverlappingAMR *amr = nullptr;
flashReader->SetFileName( fileName );
for(int level = 0; level < flashReader->GetNumberOfLevels(); ++level )
{
flashReader->SetMaxLevel( level );
flashReader->Update();
rc+=FlashReaderTest::CheckValue("LEVEL",flashReader->GetNumberOfLevels(),7);
rc+=FlashReaderTest::CheckValue("BLOCKS",flashReader->GetNumberOfBlocks(),97593);
amr = flashReader->GetOutput();
if( amr != nullptr )
{
rc+=FlashReaderTest::CheckValue(
"OUTPUT LEVELS",static_cast<int>(FlashReaderTest::ComputeMaxNonEmptyLevel(amr)),level+1);
rc+=FlashReaderTest::CheckValue(
"NUMBER OF BLOCKS AT LEVEL",
static_cast<int>(amr->GetNumberOfDataSets(level)),
NumBlocksPerLevel[level]
);
}
else
{
std::cerr << "ERROR: output AMR dataset is nullptr!";
return 1;
}
} // END for all levels
flashReader->Delete();
delete [] fileName;
return( rc );
}
vtk_module(vtkIOAMR
GROUPS
StandAlone
TEST_DEPENDS
vtkIOXML
vtkTestingCore
vtkTestingRendering
KIT
vtkParallel
DEPENDS
vtkCommonCore
vtkCommonDataModel
vtkCommonExecutionModel
PRIVATE_DEPENDS
vtkCommonSystem
vtkFiltersAMR
vtkParallelCore
vtkhdf5
vtksys
)
\ No newline at end of file
NAME
VTK::IOAMR
LIBRARY_NAME
vtkIOAMR
KIT
VTK::Parallel
GROUPS
StandAlone
DEPENDS
VTK::CommonCore
VTK::CommonDataModel
VTK::CommonExecutionModel
PRIVATE_DEPENDS
VTK::CommonSystem
VTK::FiltersAMR
VTK::ParallelCore
VTK::hdf5
VTK::vtksys
TEST_DEPENDS
VTK::IOXML
VTK::TestingCore
VTK::TestingRendering
......@@ -24,7 +24,6 @@
#ifndef vtkAMREnzoReaderInternal_h
#define vtkAMREnzoReaderInternal_h
#ifndef __VTK_WRAP__
#include "vtksys/SystemTools.hxx"
......@@ -164,6 +163,5 @@ public:
// Class vtkEnzoReaderInternal ( end )
// ----------------------------------------------------------------------------
#endif
#endif /* vtkAMREnzoReaderInternal_h */
// VTK-HeaderTest-Exclude: vtkAMREnzoReaderInternal.h
......@@ -24,7 +24,6 @@
#ifndef vtkAMRFlashReaderInternal_h
#define vtkAMRFlashReaderInternal_h
#ifndef __VTK_WRAP__
#include <cassert>
#include <vector>
......@@ -210,6 +209,5 @@ public:
// ----------------------------------------------------------------------------
// Class vtkFlashReaderInternal ( end )
// ----------------------------------------------------------------------------
#endif
#endif /* vtkAMRFlashReaderInternal_h */
// VTK-HeaderTest-Exclude: vtkAMRFlashReaderInternal.h
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