Commit 6285f4f3 authored by Andy Cedilnik's avatar Andy Cedilnik
Browse files

More elaborate test

parent 92354b44
......@@ -28,8 +28,7 @@ IF (VTK_FOUND)
ADD_LIBRARY(vtk${PROJECT_NAME}Python SHARED ${XdmfPython_SRCS} ${Xdmf_SRCS})
TARGET_LINK_LIBRARIES(vtk${PROJECT_NAME}Python vtkIOPython Xdmf)
ENDIF(VTK_WRAP_PYTHON)
ADD_EXECUTABLE(VTKTest VTKTest.cxx)
TARGET_LINK_LIBRARIES(VTKTest vtkXdmfTCL)
ADD_TEST(VTKTest ${EXECUTABLE_OUTPUT_PATH}/VTKTest)
IF(XDMF_BUILD_TESTING)
SUBDIRS(Testing)
ENDIF(XDMF_BUILD_TESTING)
ENDIF (VTK_FOUND)
ADD_EXECUTABLE(VTKTest VTKTest.cxx)
TARGET_LINK_LIBRARIES(VTKTest vtkXdmfTCL)
ADD_TEST(VTKTest ${EXECUTABLE_OUTPUT_PATH}/VTKTest ${Xdmf_SOURCE_DIR}/Data/Test1.xmf)
#include "vtkMyXdmfReader.h"
#include "vtkDataSet.h"
#include "vtkRectilinearGrid.h"
#include "vtkCellData.h"
#include "vtkDataArray.h"
#include "vtkDataArraySelection.h"
int main(int argc, char* argv[])
{
if ( argc == 1 )
{
cout << "Usage: " << argv[0] << " <filename>" << endl;
return 1;
}
vtkMyXdmfReader* vr = vtkMyXdmfReader::New();
vr->SetFileName(argv[1]);
cout << "------------- UpdateInformation --------" << endl;
vr->UpdateInformation();
vtkDataArraySelection* ds = vr->GetCellDataArraySelection();
ds->DisableAllArrays();
ds->EnableArray(ds->GetArrayName(0));
vr->SetStride(2, 3, 4);
cout << "------------- Update -------------------" << endl;
vr->Update();
cout << "------------- Reader: ------------------" << endl;
//vr->Print(cout);
cout << "------------- Output: ------------------" << endl;
cout << "Number of cells: " << vr->GetOutput()->GetNumberOfCells() << endl;
//vr->GetOutput()->Print(cout);
vtkRectilinearGrid* rg = vtkRectilinearGrid::SafeDownCast( vr->GetOutput() );
if ( rg )
{
vtkDataArray* array = rg->GetCellData()->GetArray(0);
//array->Print(cout);
cout << "Number of tuples of array: " << array->GetNumberOfTuples() << endl;
cout << "Number of X coords: " << rg->GetXCoordinates()->GetNumberOfTuples() << endl;
cout << "Number of y coords: " << rg->GetYCoordinates()->GetNumberOfTuples() << endl;
cout << "Number of z coords: " << rg->GetZCoordinates()->GetNumberOfTuples() << endl;
}
cout << "------------- Delete ------------------" << endl;
vr->Delete();
return 0;
}
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