From: Wolfgang Bangerth Date: Tue, 31 Oct 2023 19:09:47 +0000 (-0600) Subject: Add a test. X-Git-Tag: relicensing~333^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=81a82a0c5e048dcbbc31d01a2367b7a1b807d680;p=dealii.git Add a test. --- diff --git a/tests/lac/block_matrices_07.cc b/tests/lac/block_matrices_07.cc new file mode 100644 index 0000000000..cf4776998e --- /dev/null +++ b/tests/lac/block_matrices_07.cc @@ -0,0 +1,56 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2000 - 2021 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.md at +// the top level directory of deal.II. +// +// --------------------------------------------------------------------- + +// It was not possible to compare non-const iterators into block +// sparse matrices because we declared the wrong class as a +// friend. This test checks that this is fixed. + +#include +#include + +#include + +#include "../tests.h" + +#include "../testmatrix.h" + + +dealii::BlockSparseMatrix systemMatrix; +int +main() +{ + initlog(); + + const unsigned int size = 5; + unsigned int dim = (size - 1) * (size - 1); + + FDMatrix testproblem(size, size); + + BlockSparsityPattern block_structure(1, 1); + block_structure.block(0, 0).reinit(dim, dim, 5); + block_structure.collect_sizes(); + testproblem.five_point_structure(block_structure.block(0, 0)); + block_structure.compress(); + BlockSparseMatrix block_A(block_structure); + + auto block_AIteratorEnd = block_A.end(0); + + auto block_AIteratorBegin = block_A.begin(0); + + if (block_AIteratorBegin != block_AIteratorEnd) + deallog << "Not equal" << std::endl; + + deallog << "OK." << std::endl; +} diff --git a/tests/lac/block_matrices_07.output b/tests/lac/block_matrices_07.output new file mode 100644 index 0000000000..39300ad8de --- /dev/null +++ b/tests/lac/block_matrices_07.output @@ -0,0 +1,3 @@ + +DEAL::Not equal +DEAL::OK.