Commit d1da71f0 authored by Oliver Sander's avatar Oliver Sander Committed by Steffen Müthing

Make sure the vectors x and b handed to the 'apply' method have the correct size

This avoids strange bugs when using the setSubMatrix method: that method
automatically removes rows and columns from the matrix, and expects _the user_
to do the same for the x and b vectors.

(cherry picked from commit e8d16384)
Signed-off-by: Steffen Müthing's avatarSteffen Müthing <muething@dune-project.org>
parent cf48329c
...@@ -314,6 +314,11 @@ namespace Dune { ...@@ -314,6 +314,11 @@ namespace Dune {
*/ */
virtual void apply(domain_type& x, range_type& b, InverseOperatorResult& res) virtual void apply(domain_type& x, range_type& b, InverseOperatorResult& res)
{ {
if (umfpackMatrix_.N() != b.size())
DUNE_THROW(Dune::ISTLError, "Size of right-hand-side vector b does not match the number of matrix rows!");
if (umfpackMatrix_.M() != x.size())
DUNE_THROW(Dune::ISTLError, "Size of solution vector x does not match the number of matrix columns!");
double UMF_Apply_Info[UMFPACK_INFO]; double UMF_Apply_Info[UMFPACK_INFO];
Caller::solve(UMFPACK_A, Caller::solve(UMFPACK_A,
umfpackMatrix_.getColStart(), umfpackMatrix_.getColStart(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment