From: Martin Kronbichler Date: Wed, 31 Aug 2016 16:37:25 +0000 (+0200) Subject: Add test X-Git-Tag: v8.5.0-rc1~720^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c7e847a7b600aed546ff4599e619bcf794483f25;p=dealii.git Add test --- diff --git a/tests/sparsity/sparsity_pattern_copy_from.cc b/tests/sparsity/sparsity_pattern_copy_from_01.cc similarity index 100% rename from tests/sparsity/sparsity_pattern_copy_from.cc rename to tests/sparsity/sparsity_pattern_copy_from_01.cc diff --git a/tests/sparsity/sparsity_pattern_copy_from.output b/tests/sparsity/sparsity_pattern_copy_from_01.output similarity index 100% rename from tests/sparsity/sparsity_pattern_copy_from.output rename to tests/sparsity/sparsity_pattern_copy_from_01.output diff --git a/tests/sparsity/sparsity_pattern_copy_from_02.cc b/tests/sparsity/sparsity_pattern_copy_from_02.cc new file mode 100644 index 0000000000..ca99f09656 --- /dev/null +++ b/tests/sparsity/sparsity_pattern_copy_from_02.cc @@ -0,0 +1,50 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2016 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. +// +// --------------------------------------------------------------------- + + + +// SparsityPattern::copy_from used to be of quadratic complexity for +// DynamicSparsityPattern arguments with many empty rows. Create a big +// sparsity pattern of 10m elements and only put an entry into the last +// row. The old code would time out. + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include + + +int +main () +{ + std::ofstream logfile("output"); + logfile.setf(std::ios::fixed); + deallog << std::setprecision(3); + deallog.attach(logfile); + deallog.threshold_double(1.e-10); + + DynamicSparsityPattern csp (10000000, 100); + csp.add(9999999, 1); + + SparsityPattern sp; + sp.copy_from (csp); + + deallog << "OK" << std::endl; +} diff --git a/tests/sparsity/sparsity_pattern_copy_from_02.output b/tests/sparsity/sparsity_pattern_copy_from_02.output new file mode 100644 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/sparsity/sparsity_pattern_copy_from_02.output @@ -0,0 +1,2 @@ + +DEAL::OK