From a2f72fc1a351a78bf3bb1c4624c0be8352bbf2f3 Mon Sep 17 00:00:00 2001
From: Dmitri Naumov <dmitri.naumov@ufz.de>
Date: Wed, 21 Jun 2017 11:28:10 +0200
Subject: [PATCH] [T] Initialize needed global vectors.

---
 Tests/MathLib/TestGlobalVectorInterface.cpp | 1 +
 Tests/MathLib/TestLinearSolver.cpp          | 2 ++
 Tests/NumLib/TestSerialLinearSolver.cpp     | 3 ++-
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/Tests/MathLib/TestGlobalVectorInterface.cpp b/Tests/MathLib/TestGlobalVectorInterface.cpp
index 51582e59f1a..17c699a838f 100644
--- a/Tests/MathLib/TestGlobalVectorInterface.cpp
+++ b/Tests/MathLib/TestGlobalVectorInterface.cpp
@@ -36,6 +36,7 @@ template <class T_VECTOR>
 void checkGlobalVectorInterface()
 {
     T_VECTOR x(10);
+    x.setZero();
 
     ASSERT_EQ(10u, x.size());
     ASSERT_EQ(0u, x.getRangeBegin());
diff --git a/Tests/MathLib/TestLinearSolver.cpp b/Tests/MathLib/TestLinearSolver.cpp
index 387dcbbef85..23f69595d56 100644
--- a/Tests/MathLib/TestLinearSolver.cpp
+++ b/Tests/MathLib/TestLinearSolver.cpp
@@ -117,7 +117,9 @@ void checkLinearSolverInterface(T_MATRIX &A, BaseLib::ConfigTree const& ls_optio
 
     // set RHS and solution vectors
     T_VECTOR rhs(ex1.dim_eqs);
+    rhs.setZero();
     T_VECTOR x(ex1.dim_eqs);
+    x.setZero();
 
     // apply BC
     MathLib::applyKnownSolution(A, rhs, x, ex1.vec_dirichlet_bc_id, ex1.vec_dirichlet_bc_value);
diff --git a/Tests/NumLib/TestSerialLinearSolver.cpp b/Tests/NumLib/TestSerialLinearSolver.cpp
index d929a3f0f83..cb97f08ba8b 100644
--- a/Tests/NumLib/TestSerialLinearSolver.cpp
+++ b/Tests/NumLib/TestSerialLinearSolver.cpp
@@ -69,8 +69,9 @@ TEST(NumLibSerialLinearSolver, Steady2DdiffusionQuadElem)
     auto A = MathLib::MatrixVectorTraits<GlobalMatrix>::newInstance(ms);
     A->setZero();
     auto rhs = MathLib::MatrixVectorTraits<GlobalVector>::newInstance(ms);
+    rhs->setZero();
     auto x = MathLib::MatrixVectorTraits<GlobalVector>::newInstance(ms);
-    // TODO no setZero() for rhs, x?
+    x->setZero();
 
     using LocalAssembler = Example::LocalAssemblerData;
     // Initializer of the local assembler data.
-- 
GitLab