Skip to content
Snippets Groups Projects
Commit 7d72b25f authored by Tom Fischer's avatar Tom Fischer
Browse files

Merge pull request #669 from rinkk/VtuReaderChecks

[Fix] Added checks for VTU reader
parents 955ddcd6 67432d8a
No related branches found
No related tags found
No related merge requests found
......@@ -43,13 +43,17 @@ VtuInterface::~VtuInterface()
MeshLib::Mesh* VtuInterface::readVTUFile(std::string const &file_name)
{
if (!BaseLib::IsFileExisting(file_name))
return nullptr;
vtkSmartPointer<vtkXMLUnstructuredGridReader> reader =
vtkSmartPointer<vtkXMLUnstructuredGridReader>::New();
reader->SetFileName(file_name.c_str());
reader->Update();
vtkUnstructuredGrid* vtkGrid = reader->GetOutput();
if (vtkGrid->GetNumberOfPoints() == 0)
return nullptr;
std::string const mesh_name (BaseLib::extractBaseNameWithoutExtension(file_name));
return MeshLib::VtkMeshConverter::convertUnstructuredGrid(vtkGrid, mesh_name);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment