Skip to content
Snippets Groups Projects
Commit c644af08 authored by Carsten Gräser's avatar Carsten Gräser
Browse files

[bugfix] Avoid using non-official implementation details of DUNE_THROW

When throwing a `MatrixBlockError` the `DUNE_THROW` macro was
abused to also set the data members of `MatrixBlockError` by
referring e.g. to the local (in macro) variable name `th__ex`.
I consider this a bug, since these are undocumented implementation
details. Furthermore their use prohibits any change to `DUNE_THROW`
e.g. to make it `constexpr` friendly.
parent c9590c3b
No related branches found
No related tags found
1 merge request!595[bugfix] Avoid using non-official implementation details of DUNE_THROW
Pipeline #75156 failed
......@@ -9,6 +9,7 @@
#include <complex>
#include <map>
#include <vector>
#include <sstream>
#include <dune/common/fmatrix.hh>
#include <dune/common/scalarvectorview.hh>
......@@ -81,9 +82,13 @@ namespace Dune
}
catch (Dune::FMatrixError &e)
{
DUNE_THROW(MatrixBlockError, "DILU failed to invert matrix block D[" << row_i << "]"
<< e.what();
th__ex.r = row_i;);
std::ostringstream sstream;
sstream << THROWSPEC(MatrixBlockError)
<< "DILU failed to invert matrix block D[" << row_i << "]" << e.what();
MatrixBlockError ex;
ex.message(sstream.str());
ex.r = row_i;
throw ex;
}
}
}
......
......@@ -3,6 +3,8 @@
#ifndef DUNE_ISTL_ILDL_HH
#define DUNE_ISTL_ILDL_HH
#include <sstream>
#include <dune/common/scalarvectorview.hh>
#include <dune/common/scalarmatrixview.hh>
#include "ilu.hh"
......@@ -135,7 +137,14 @@ namespace Dune
}
catch( const Dune::FMatrixError &e )
{
DUNE_THROW( MatrixBlockError, "ILDL failed to invert matrix block A[" << i.index() << "][" << ij.index() << "]" << e.what(); th__ex.r = i.index(); th__ex.c = ij.index() );
std::ostringstream sstream;
sstream << THROWSPEC(MatrixBlockError)
<< "ILDL failed to invert matrix block A[" << i.index() << "][" << ij.index() << "]" << e.what();
MatrixBlockError ex;
ex.message(sstream.str());
ex.r = i.index();
ex.c = ij.index();
throw ex;
}
}
}
......
......@@ -5,6 +5,8 @@
#ifndef DUNE_ISTL_ILU_HH
#define DUNE_ISTL_ILU_HH
#include <sstream>
#include <cmath>
#include <complex>
#include <map>
......@@ -82,9 +84,16 @@ namespace Dune {
Impl::asMatrix(*ij).invert(); // compute inverse of diagonal block
}
catch (Dune::FMatrixError & e) {
DUNE_THROW(MatrixBlockError, "ILU failed to invert matrix block A["
<< i.index() << "][" << ij.index() << "]" << e.what();
th__ex.r=i.index(); th__ex.c=ij.index(););
std::ostringstream sstream;
sstream << THROWSPEC(MatrixBlockError)
<< THROWSPEC(MatrixBlockError)
<< "ILU failed to invert matrix block A["
<< i.index() << "][" << ij.index() << "]" << e.what();
MatrixBlockError ex;
ex.message(sstream.str());
ex.r = i.index();
ex.c = ij.index();
throw ex;
}
}
}
......
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