From 3006e4cc6c03c18e3a49b559d349d0101640c5a7 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 2 Mar 2010 22:02:41 +0000 Subject: [PATCH] One more test. git-svn-id: https://svn.dealii.org/trunk@20726 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/multigrid/transfer_system_03.cc | 141 ++++++++++++++++++ .../multigrid/transfer_system_03/cmp/generic | 73 +++++++++ 2 files changed, 214 insertions(+) create mode 100644 tests/multigrid/transfer_system_03.cc create mode 100644 tests/multigrid/transfer_system_03/cmp/generic diff --git a/tests/multigrid/transfer_system_03.cc b/tests/multigrid/transfer_system_03.cc new file mode 100644 index 0000000000..4e1705fb4e --- /dev/null +++ b/tests/multigrid/transfer_system_03.cc @@ -0,0 +1,141 @@ +//---------------------------------------------------------------------------- +// transfer.cc,v 1.13 2005/12/30 16:07:03 guido Exp +// Version: +// +// Copyright (C) 2000 - 2007, 2009, 2010 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//---------------------------------------------------------------------------- + +// like _02, but with a TransferSelect that selects only the first vector component + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +using namespace std; + +template +void +reinit_vector (const dealii::MGDoFHandler &mg_dof, + MGLevelObject > &v) +{ + for (unsigned int level=v.get_minlevel(); + level<=v.get_maxlevel();++level) + { + unsigned int n = mg_dof.n_dofs (level); + v[level].reinit(n); + } + +} + + +template +void +make_matrix (const Transfer &transfer, + const unsigned int high_level, + FullMatrix &matrix) +{ + Vector src (matrix.n()); + Vector dst (matrix.m()); + for (unsigned int i=0; i &m) +{ + for (unsigned int i=0; i +void check (const FiniteElement& fe) +{ + deallog << fe.get_name() << std::endl; + + Triangulation tr; + GridGenerator::hyper_cube(tr); + tr.refine_global(2); + + MGDoFHandler mg_dof_handler(tr); + mg_dof_handler.distribute_dofs(fe); + + DoFRenumbering::component_wise (mg_dof_handler); + for (unsigned int level=0; level transfer; + + std::vector mask (2); + mask[0] = 0; + mask[1] = 1; + transfer.build_matrices(mg_dof_handler, mg_dof_handler, + 0, 0, + mask, mask); + + // use only the first half of all + // components + FullMatrix prolong_0_1 (mg_dof_handler.n_dofs(1)/2, + mg_dof_handler.n_dofs(0)/2); + FullMatrix prolong_1_2 (mg_dof_handler.n_dofs(2)/2, + mg_dof_handler.n_dofs(1)/2); + + deallog << "Level 0->1" << std::endl; + make_matrix (transfer, 1, prolong_0_1); + print_matrix (prolong_0_1); + + deallog << std::endl; + + deallog << "Level 1->2" << std::endl; + make_matrix (transfer, 2, prolong_1_2); + print_matrix (prolong_1_2); +} + + +int main() +{ + std::ofstream logfile("transfer_system_03/output"); + deallog << std::setprecision(4); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + +//TODO: do in 1d + check (FESystem<2>(FE_Q<2>(1),2)); +} diff --git a/tests/multigrid/transfer_system_03/cmp/generic b/tests/multigrid/transfer_system_03/cmp/generic new file mode 100644 index 0000000000..40097b80da --- /dev/null +++ b/tests/multigrid/transfer_system_03/cmp/generic @@ -0,0 +1,73 @@ + +DEAL::FESystem<2>[FE_Q<2>(1)^2] +DEAL::Level 0->1 +DEAL::1.000 0 0 0 0 0 0 0 +DEAL::0.5000 0.5000 0 0 0 0 0 0 +DEAL::0.5000 0 0.5000 0 0 0 0 0 +DEAL::0.2500 0.2500 0.2500 0.2500 0 0 0 0 +DEAL::0 1.000 0 0 0 0 0 0 +DEAL::0 0.5000 0 0.5000 0 0 0 0 +DEAL::0 0 1.000 0 0 0 0 0 +DEAL::0 0 0.5000 0.5000 0 0 0 0 +DEAL::0 0 0 1.000 0 0 0 0 +DEAL::0 0 0 0 1.000 0 0 0 +DEAL::0 0 0 0 0.5000 0.5000 0 0 +DEAL::0 0 0 0 0.5000 0 0.5000 0 +DEAL::0 0 0 0 0.2500 0.2500 0.2500 0.2500 +DEAL::0 0 0 0 0 1.000 0 0 +DEAL::0 0 0 0 0 0.5000 0 0.5000 +DEAL::0 0 0 0 0 0 1.000 0 +DEAL::0 0 0 0 0 0 0.5000 0.5000 +DEAL::0 0 0 0 0 0 0 1.000 +DEAL:: +DEAL::Level 1->2 +DEAL::1.000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +DEAL::0.5000 0.5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +DEAL::0.5000 0 0.5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +DEAL::0.2500 0.2500 0.2500 0.2500 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +DEAL::0 1.000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +DEAL::0 0.5000 0 0.5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +DEAL::0 0 1.000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +DEAL::0 0 0.5000 0.5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +DEAL::0 0 0 1.000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +DEAL::0 0.5000 0 0 0.5000 0 0 0 0 0 0 0 0 0 0 0 0 0 +DEAL::0 0.2500 0 0.2500 0.2500 0.2500 0 0 0 0 0 0 0 0 0 0 0 0 +DEAL::0 0 0 0 1.000 0 0 0 0 0 0 0 0 0 0 0 0 0 +DEAL::0 0 0 0 0.5000 0.5000 0 0 0 0 0 0 0 0 0 0 0 0 +DEAL::0 0 0 0.5000 0 0.5000 0 0 0 0 0 0 0 0 0 0 0 0 +DEAL::0 0 0 0 0 1.000 0 0 0 0 0 0 0 0 0 0 0 0 +DEAL::0 0 0.5000 0 0 0 0.5000 0 0 0 0 0 0 0 0 0 0 0 +DEAL::0 0 0.2500 0.2500 0 0 0.2500 0.2500 0 0 0 0 0 0 0 0 0 0 +DEAL::0 0 0 0.5000 0 0 0 0.5000 0 0 0 0 0 0 0 0 0 0 +DEAL::0 0 0 0 0 0 1.000 0 0 0 0 0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 0 0 0 0 0 0.5000 0 0 0 0.5000 0 0 +DEAL::0 0 0 0 0 0 0 0 0 0 0 0.2500 0.2500 0 0 0.2500 0.2500 0 +DEAL::0 0 0 0 0 0 0 0 0 0 0 0 0.5000 0 0 0 0.5000 0 +DEAL::0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.000 0 0 +DEAL::0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5000 0.5000 0 +DEAL::0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.000 0 +DEAL::0 0 0 0 0 0 0 0 0 0 0 0 0.2500 0 0.2500 0 0.2500 0.2500 +DEAL::0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5000 0 0 0.5000 +DEAL::0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5000 0.5000 +DEAL::0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.000 -- 2.39.5