From dfed303ac0678b4290d0f885541deabff42a3b43 Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Wed, 4 Dec 2013 17:41:33 +0000 Subject: [PATCH] Test one more aspect: resolving large chains of constraints git-svn-id: https://svn.dealii.org/trunk@31883 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/deal.II/assemble_matrix_parallel_04.cc | 66 +++++++++++++------ .../assemble_matrix_parallel_04.output | 12 ++-- 2 files changed, 51 insertions(+), 27 deletions(-) diff --git a/tests/deal.II/assemble_matrix_parallel_04.cc b/tests/deal.II/assemble_matrix_parallel_04.cc index 148cdc137a..f3f13286ee 100644 --- a/tests/deal.II/assemble_matrix_parallel_04.cc +++ b/tests/deal.II/assemble_matrix_parallel_04.cc @@ -89,20 +89,20 @@ namespace Assembly { struct Data { - Data (bool second_test = false) + Data (const unsigned int test_variant) : - second_test (second_test) + test_variant (test_variant) {} Data (const Data &data) : - second_test (data.second_test) + test_variant (data.test_variant) {} std::vector local_dof_indices; FullMatrix local_matrix; Vector local_rhs; - const bool second_test; + const unsigned int test_variant; }; } } @@ -291,7 +291,7 @@ void LaplaceProblem::setup_system () CompressedSimpleSparsityPattern csp (dof_handler.n_dofs(), dof_handler.n_dofs()); DoFTools::make_sparsity_pattern (dof_handler, csp, - constraints, false); + constraints, true); sparsity_pattern.copy_from (csp); reference_matrix.reinit (sparsity_pattern); @@ -325,7 +325,7 @@ LaplaceProblem::local_assemble (const typename hp::DoFHandler::active_ q_point void LaplaceProblem::copy_local_to_global (const Assembly::Copy::Data &data) { - if (data.second_test) + if (data.test_variant == 2) constraints.distribute_local_to_global(data.local_matrix, data.local_rhs, data.local_dof_indices, test_matrix_2, test_rhs_2); - else + else if (data.test_variant == 1) constraints.distribute_local_to_global(data.local_matrix, data.local_rhs, data.local_dof_indices, test_matrix, test_rhs); + else + { + for (unsigned int i=0; i::copy_local_to_global (const Assembly::Copy::Data &data) template void LaplaceProblem::assemble_reference () { - test_matrix = 0; - test_rhs = 0; + reference_matrix = 0; + reference_rhs = 0; - Assembly::Copy::Data copy_data; + Assembly::Copy::Data copy_data (0); Assembly::Scratch::Data assembly_data(fe_collection, quadrature_collection); for (unsigned int color=0; color::assemble_reference () local_assemble(*p, assembly_data, copy_data); copy_local_to_global(copy_data); } + constraints.condense(reference_matrix, reference_rhs); - reference_matrix.add(1., test_matrix); - reference_rhs = test_rhs; + // since constrained diagonal entries might be different, zero them out here + for (unsigned int i=0; i::assemble_test_1 () this, std_cxx1x::_1), Assembly::Scratch::Data(fe_collection, quadrature_collection), - Assembly::Copy::Data (), + Assembly::Copy::Data (1), 1); + for (unsigned int i=0; i::assemble_test_2 () this, std_cxx1x::_1), Assembly::Scratch::Data(fe_collection, quadrature_collection), - Assembly::Copy::Data (true), + Assembly::Copy::Data (2), 1); + for (unsigned int i=0; i @@ -446,13 +474,9 @@ void LaplaceProblem::assemble_test() test_matrix.add(-1, reference_matrix); const double frobenius_norm = test_matrix.frobenius_norm(); - - // the data should add up exactly (unfortunately, there is some roundoff due - // to the cell similarity detection, but there should not be any similarity - // for the hypershell geometry) - deallog << "log error in matrix norm: " << std::log(frobenius_norm) << std::endl; + deallog << "absolute error in matrix norm: " << frobenius_norm << std::endl; test_rhs.add(-1., reference_rhs); - deallog << "log error in vector norm: " << std::log(test_rhs.l2_norm()) << std::endl; + deallog << "absolute error in vector norm: " << test_rhs.l2_norm() << std::endl; test_matrix_2.add(-numbers::PI, reference_matrix); deallog << "absolute error matrix assembly 2: " << test_matrix_2.frobenius_norm() << std::endl; diff --git a/tests/deal.II/assemble_matrix_parallel_04.output b/tests/deal.II/assemble_matrix_parallel_04.output index 627a39f770..f35ca9c7fc 100644 --- a/tests/deal.II/assemble_matrix_parallel_04.output +++ b/tests/deal.II/assemble_matrix_parallel_04.output @@ -1,13 +1,13 @@ -DEAL:2d::log error in matrix norm: -inf -DEAL:2d::log error in vector norm: -inf +DEAL:2d::absolute error in matrix norm: 0 +DEAL:2d::absolute error in vector norm: 0 DEAL:2d::absolute error matrix assembly 2: 0 DEAL:2d::absolute error vector assembly 2: 0 -DEAL:2d::log error in matrix norm: -inf -DEAL:2d::log error in vector norm: -inf +DEAL:2d::absolute error in matrix norm: 0 +DEAL:2d::absolute error in vector norm: 0 DEAL:2d::absolute error matrix assembly 2: 0 DEAL:2d::absolute error vector assembly 2: 0 -DEAL:2d::log error in matrix norm: -inf -DEAL:2d::log error in vector norm: -inf +DEAL:2d::absolute error in matrix norm: 0 +DEAL:2d::absolute error in vector norm: 0 DEAL:2d::absolute error matrix assembly 2: 0 DEAL:2d::absolute error vector assembly 2: 0 -- 2.39.5