From 358719093a9185c1665e13fdc177577074b51d06 Mon Sep 17 00:00:00 2001 From: Timo Koch <timo.koch@iws.uni-stuttgart.de> Date: Mon, 18 Jun 2018 18:07:33 +0200 Subject: [PATCH] [io] Improve and streamline error messages in vtk function --- dumux/io/vtkfunction.hh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/dumux/io/vtkfunction.hh b/dumux/io/vtkfunction.hh index 885ffa7e0a..e5fc35902c 100644 --- a/dumux/io/vtkfunction.hh +++ b/dumux/io/vtkfunction.hh @@ -65,8 +65,9 @@ public: VectorP0VTKFunction(const GridView& gridView, const Mapper& mapper, const F& field, const std::string& name, int nComps) : field_(field), name_(name), nComps_(nComps), mapper_(mapper) { - if (field.size()!=(unsigned int)( gridView.size(/*codim*/0)) ) - DUNE_THROW(Dune::IOError, "VectorP0VTKFunction: size mismatch"); + if (field.size()!=(unsigned int)(mapper.size())) + DUNE_THROW(Dune::IOError, "VectorP0VTKFunction: size mismatch between field " + << name << " (" << field.size() << ") and mapper (" << mapper.size() << ")"); } private: @@ -131,7 +132,8 @@ public: : field_(field), name_(name), nComps_(nComps), mapper_(mapper) { if (field.size()!=(unsigned int)( mapper.size() )) - DUNE_THROW(Dune::IOError, "VectorP1VTKFunction: size mismatch"); + DUNE_THROW(Dune::IOError, "VectorP1VTKFunction: size mismatch between field " + << name << " (" << field.size() << ") and mapper (" << mapper.size() << ")"); } private: @@ -198,8 +200,9 @@ public: VectorP1NonConformingVTKFunction(const GridView& gridView, const Mapper& mapper, const F& field, const std::string& name, int nComps) : field_(field), name_(name), nComps_(nComps), mapper_(mapper) { - if (field.size()!=(unsigned int)( gridView.size(/*codim*/0)) ) - DUNE_THROW(Dune::IOError, "VectorP1NonConformingVTKFunction: size mismatch"); + if (field.size()!=(unsigned int)(mapper.size())) + DUNE_THROW(Dune::IOError, "VectorP1NonConformingVTKFunction: size mismatch between field " + << name << " (" << field.size() << ") and mapper (" << mapper.size() << ")"); } private: -- GitLab