From 43b77c19c16c3420468de4fdf65c22b24ef9801a Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 21 Mar 2018 14:09:26 -0600 Subject: [PATCH] Add another test. --- .../sparsity_pattern_full_matrix_02.cc | 53 +++++++++++++++++++ .../sparsity_pattern_full_matrix_02.output | 2 + 2 files changed, 55 insertions(+) create mode 100644 tests/sparsity/sparsity_pattern_full_matrix_02.cc create mode 100644 tests/sparsity/sparsity_pattern_full_matrix_02.output diff --git a/tests/sparsity/sparsity_pattern_full_matrix_02.cc b/tests/sparsity/sparsity_pattern_full_matrix_02.cc new file mode 100644 index 0000000000..9d1f173ab5 --- /dev/null +++ b/tests/sparsity/sparsity_pattern_full_matrix_02.cc @@ -0,0 +1,53 @@ + +// --------------------------------------------------------------------- +// +// Copyright (C) 2004 - 2017 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + + +// Check SparsityPattern::copy_from(FullMatrix). The peer review of +// the original patch uncovered a case where we would segfault with +// empty matrices. Cover this in a testcase as well. + +#include "../tests.h" +#include +#include + + +void test (const unsigned int M, + const unsigned int N) +{ + SparsityPattern sp (M,N); + + // fill a full matrix completely + FullMatrix mat(M,N); + for (unsigned int m=0; m