From 1ed86f65e947f16f2c2b5d8d4c0d73a34a1307fa Mon Sep 17 00:00:00 2001 From: Dmitri Naumov <dmitri.naumov@ufz.de> Date: Fri, 10 Jul 2015 16:04:56 +0200 Subject: [PATCH] [MaL] Abort if LisMatrix is not assembled. --- MathLib/LinAlg/Lis/LisMatrix.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/MathLib/LinAlg/Lis/LisMatrix.cpp b/MathLib/LinAlg/Lis/LisMatrix.cpp index a6e2a8a8d22..5d7788ab09b 100644 --- a/MathLib/LinAlg/Lis/LisMatrix.cpp +++ b/MathLib/LinAlg/Lis/LisMatrix.cpp @@ -15,7 +15,9 @@ #include "LisMatrix.h" #include <cmath> -#include <cassert> +#include <cstdlib> + +#include <logog/include/logog.hpp> #include "LisVector.h" #include "LisCheck.h" @@ -79,7 +81,11 @@ int LisMatrix::add(std::size_t rowId, std::size_t colId, double v) void LisMatrix::write(const std::string &filename) const { - assert(_is_assembled); + if (!_is_assembled) + { + ERR("LisMatrix::write(): matrix not assembled."); + std::abort(); + } lis_output_matrix(_AA, LIS_FMT_MM, const_cast<char*>(filename.c_str())); } @@ -103,7 +109,11 @@ double LisMatrix::getMaxDiagCoeff() void LisMatrix::multiply(const LisVector &x, LisVector &y) const { - assert(_is_assembled); + if (!_is_assembled) + { + ERR("LisMatrix::multiply(): matrix not assembled."); + std::abort(); + } int ierr = lis_matvec(_AA, const_cast<LisVector*>(&x)->getRawVector(), y.getRawVector()); checkLisError(ierr); } -- GitLab