From: David Wells Date: Wed, 27 May 2020 20:47:15 +0000 (-0400) Subject: Augment a test to also check sparse vanka. X-Git-Tag: v9.3.0-rc1~1533^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F10396%2Fhead;p=dealii.git Augment a test to also check sparse vanka. --- diff --git a/tests/lac/sparse_matrices.cc b/tests/lac/sparse_matrices.cc index 73b91514ad..f05f2c8aa6 100644 --- a/tests/lac/sparse_matrices.cc +++ b/tests/lac/sparse_matrices.cc @@ -25,6 +25,7 @@ #include #include #include +#include #include #include "../tests.h" @@ -122,6 +123,45 @@ check_vmult_quadratic(std::vector &residuals, PREC_CHECK(prich, Tsolve, block_ssor); PREC_CHECK(prich, Tsolve, block_sor); PREC_CHECK(prich, Tsolve, block_psor); + + // vanka needs to match the type + using value_type = typename MatrixType::value_type; + if (std::is_same>::value) + { + deallog << "Vanka" << std::endl; + const SparseMatrix &B = + reinterpret_cast &>(A); + + std::vector selected_dofs(B.m(), false); + // tag every third dof for vanka + for (unsigned int i = 0; i < B.m(); i += 3) + selected_dofs[i] = true; + SparseVanka vanka; + vanka.initialize( + B, typename SparseVanka::AdditionalData(selected_dofs)); + + SparseBlockVanka block_vanka_1( + B, + selected_dofs, + n_blocks, + SparseBlockVanka::index_intervals); + SparseBlockVanka block_vanka_2( + B, selected_dofs, n_blocks, SparseBlockVanka::adaptive); + + PREC_CHECK(prich, solve, vanka); + PREC_CHECK(prich, solve, block_vanka_1); + PREC_CHECK(prich, solve, block_vanka_2); + + // since SparseMatrixEZ doesn't support this format remove it from the + // residuals: + deallog << "vanka residual: " << residuals.back() << std::endl; + residuals.pop_back(); + deallog << "vanka residual: " << residuals.back() << std::endl; + residuals.pop_back(); + deallog << "vanka residual: " << residuals.back() << std::endl; + residuals.pop_back(); + } + deallog.pop(); } diff --git a/tests/lac/sparse_matrices.output b/tests/lac/sparse_matrices.output index 338d0d7d3a..05f28facd3 100644 --- a/tests/lac/sparse_matrices.output +++ b/tests/lac/sparse_matrices.output @@ -97,6 +97,16 @@ DEAL:5-SparseMatrix:block_sor:RichardsonT::Starting value 4.00 DEAL:5-SparseMatrix:block_sor:RichardsonT::Failure step 10 value 1.07e-06 DEAL:5-SparseMatrix:block_psor:RichardsonT::Starting value 4.00 DEAL:5-SparseMatrix:block_psor:RichardsonT::Failure step 10 value 8.62e-07 +DEAL:5-SparseMatrix::Vanka +DEAL:5-SparseMatrix:vanka:Richardson::Starting value 4.00 +DEAL:5-SparseMatrix:vanka:Richardson::Failure step 10 value 0.000523 +DEAL:5-SparseMatrix:block_vanka_1:Richardson::Starting value 4.00 +DEAL:5-SparseMatrix:block_vanka_1:Richardson::Failure step 10 value 6.00 +DEAL:5-SparseMatrix:block_vanka_2:Richardson::Starting value 4.00 +DEAL:5-SparseMatrix:block_vanka_2:Richardson::Failure step 10 value 0.0179 +DEAL:5-SparseMatrix::vanka residual: 0.0179 +DEAL:5-SparseMatrix::vanka residual: 6.00 +DEAL:5-SparseMatrix::vanka residual: 0.000523 DEAL:: 0 0 5.00 DEAL:: 0 1 -2.00 DEAL:: 0 4 -1.00 @@ -395,6 +405,16 @@ DEAL:9-SparseMatrix:block_sor:RichardsonT::Starting value 4.00 DEAL:9-SparseMatrix:block_sor:RichardsonT::Failure step 10 value 2.94e-06 DEAL:9-SparseMatrix:block_psor:RichardsonT::Starting value 4.00 DEAL:9-SparseMatrix:block_psor:RichardsonT::Failure step 10 value 1.86e-06 +DEAL:9-SparseMatrix::Vanka +DEAL:9-SparseMatrix:vanka:Richardson::Starting value 4.00 +DEAL:9-SparseMatrix:vanka:Richardson::Failure step 10 value 1.75e-10 +DEAL:9-SparseMatrix:block_vanka_1:Richardson::Starting value 4.00 +DEAL:9-SparseMatrix:block_vanka_1:Richardson::Failure step 10 value 5.61 +DEAL:9-SparseMatrix:block_vanka_2:Richardson::Starting value 4.00 +DEAL:9-SparseMatrix:block_vanka_2:Richardson::Failure step 10 value 0.00189 +DEAL:9-SparseMatrix::vanka residual: 0.00189 +DEAL:9-SparseMatrix::vanka residual: 5.61 +DEAL:9-SparseMatrix::vanka residual: 1.75e-10 DEAL::Assemble DEAL:9-SparseMatrixEZ:identity:Richardson::Starting value 4.00 DEAL:9-SparseMatrixEZ:identity:Richardson::Failure step 10 value 2.41