Skip to content

Commit

Permalink
Merge branch 'DisableFpeForVtuReader' into 'master'
Browse files Browse the repository at this point in the history
Disable FPE for reading vtu files

See merge request ogs/ogs!4855
  • Loading branch information
bilke committed Jan 5, 2024
2 parents a53b0e7 + 5f0e151 commit dcd4f8d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion MeshLib/IO/VtkIO/VtuInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include <boost/algorithm/string/erase.hpp>

#include "BaseLib/DisableFPE.h"
#include "BaseLib/Logging.h"

#ifdef USE_PETSC
Expand Down Expand Up @@ -62,7 +63,14 @@ MeshLib::Mesh* VtuInterface::readVTUFile(std::string const& file_name)
vtkSmartPointer<vtkXMLUnstructuredGridReader> reader =
vtkSmartPointer<vtkXMLUnstructuredGridReader>::New();
reader->SetFileName(file_name.c_str());
reader->Update();
{
// Reading the VTU files can trigger floating point exceptions. Because
// we are not debugging VTK (or other libraries) at this point, the
// floating point exceptions are temporarily disabled and are restored
// at the end of the scope.
[[maybe_unused]] DisableFPE disable_fpe;
reader->Update();
}

vtkUnstructuredGrid* vtkGrid = reader->GetOutput();
if (vtkGrid->GetNumberOfPoints() == 0)
Expand Down

0 comments on commit dcd4f8d

Please sign in to comment.