/*========================================================================= Program: Visualization Toolkit Module: TestIOSSExodus.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 #include #include #include #include #include #include #include #include #include #include #include static std::string GetFileName(int argc, char* argv[], const std::string& fnameC) { char* fileNameC = vtkTestUtilities::ExpandDataFileName(argc, argv, fnameC.c_str()); std::string fname(fileNameC); delete[] fileNameC; return fname; } int TestIOSSExodus(int argc, char* argv[]) { vtkNew reader; auto fname = GetFileName(argc, argv, std::string("Data/Exodus/can.e.4/can.e.4.0")); reader->AddFileName(fname.c_str()); vtkNew surface; vtkNew mapper; vtkNew actor; vtkNew renWin; vtkNew ren; vtkNew iren; surface->SetInputConnection(reader->GetOutputPort()); mapper->SetInputConnection(surface->GetOutputPort()); actor->SetMapper(mapper); renWin->AddRenderer(ren); iren->SetRenderWindow(renWin); ren->AddActor(actor); renWin->SetSize(300, 300); auto cam = ren->GetActiveCamera(); cam->SetPosition(10., 10., 5.); cam->SetViewUp(0., 0.4, 1.); ren->ResetCamera(); renWin->Render(); // let verify id maps are built properly auto& elementMap = reader->GetElementBlockIdMap(); auto& nodeSetMap = reader->GetNodeSetIdMap(); auto& sideSetMap = reader->GetSideSetIdMap(); if (elementMap.at("block_1") != 1 || elementMap.at("block_2") != 2 || nodeSetMap.at("nodelist_1") != 1 || nodeSetMap.at("nodelist_100") != 100 || sideSetMap.at("surface_4") != 4) { vtkLogF(ERROR, "id map mismatch!"); } int retVal = vtkRegressionTestImage(renWin); if (retVal == vtkRegressionTester::DO_INTERACTOR) { iren->Start(); } return !retVal; }