From: Guido Kanschat Date: Mon, 24 Jun 2013 09:00:31 +0000 (+0000) Subject: start new test for parallel meshworker; results are not verified yet X-Git-Tag: v8.0.0~257 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3c68a141e254e21e67e287e3bdbf53da7be48d31;p=dealii.git start new test for parallel meshworker; results are not verified yet git-svn-id: https://svn.dealii.org/trunk@29861 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/mpi/mesh_worker_matrix_01.cc b/tests/mpi/mesh_worker_matrix_01.cc new file mode 100644 index 0000000000..3521bc0b1a --- /dev/null +++ b/tests/mpi/mesh_worker_matrix_01.cc @@ -0,0 +1,215 @@ +//---------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 2000, 2001, 2003, 2004, 2007, 2008, 2009, 2010, 2012, 2013 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. +// +//---------------------------------------------------------------------- + +// Test whether the various assember classes put the right data in the +// right place. + +// This test is a modification of the test with the same name in ../integrators + +#include "../tests.h" +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +using namespace dealii; + + +// Define a class that fills all available entries in the info objects +// with recognizable numbers. +template +class Local : public Subscriptor +{ + public: + typedef MeshWorker::IntegrationInfo CellInfo; + + void cell(MeshWorker::DoFInfo& dinfo, CellInfo& info) const; + void bdry(MeshWorker::DoFInfo& dinfo, CellInfo& info) const; + void face(MeshWorker::DoFInfo& dinfo1, MeshWorker::DoFInfo& dinfo2, + CellInfo& info1, CellInfo& info2) const; + + bool cells; + bool faces; +}; + +template +void +Local::cell(MeshWorker::DoFInfo& info, CellInfo&) const +{ + if (!cells) return; + for (unsigned int k=0;k& M1 = info.matrix(k).matrix; + if (block_row == block_col) + for (unsigned int i=0;i +void +Local::bdry(MeshWorker::DoFInfo& info, CellInfo&) const +{ + if (!faces) return; + for (unsigned int k=0;k& M1 = info.matrix(k).matrix; + if (block_row == block_col) + for (unsigned int i=0;i +void +Local::face(MeshWorker::DoFInfo& info1, MeshWorker::DoFInfo& info2, + CellInfo&, CellInfo&) const +{ + if (!faces) return; + for (unsigned int k=0;k& M1 = info1.matrix(k).matrix; + if (block_row == block_col) + for (unsigned int i=0;i +void +test_simple(MGDoFHandler& mgdofs, bool faces) +{ + TrilinosWrappers::SparsityPattern pattern; + TrilinosWrappers::SparseMatrix matrix; + + const DoFHandler& dofs = mgdofs; + const FiniteElement& fe = dofs.get_fe(); + pattern.reinit (dofs.n_dofs(), dofs.n_dofs(), + (GeometryInfo::faces_per_cell + *GeometryInfo::max_children_per_face+1)*fe.dofs_per_cell); + DoFTools::make_flux_sparsity_pattern (dofs, pattern); + pattern.compress(); + matrix.reinit (pattern); + + Local local; + local.cells = true; + local.faces = faces; + + MappingQ1 mapping; + + MeshWorker::IntegrationInfoBox info_box; + info_box.initialize_gauss_quadrature(1, 1, 1); + info_box.initialize_update_flags(); + info_box.initialize(fe, mapping); + + MeshWorker::DoFInfo dof_info(dofs.block_info()); + + MeshWorker::Assembler::MatrixSimple assembler; + assembler.initialize(matrix); + + MeshWorker::loop, MeshWorker::IntegrationInfoBox > + (dofs.begin_active(), dofs.end(), + dof_info, info_box, + std_cxx1x::bind (&Local::cell, local, std_cxx1x::_1, std_cxx1x::_2), + std_cxx1x::bind (&Local::bdry, local, std_cxx1x::_1, std_cxx1x::_2), + std_cxx1x::bind (&Local::face, local, std_cxx1x::_1, std_cxx1x::_2, std_cxx1x::_3, std_cxx1x::_4), + assembler, true); + + matrix.print(deallog.get_file_stream()); +} + + +template +void +test(const FiniteElement& fe) +{ + Triangulation tr; + GridGenerator::hyper_cube(tr); + tr.refine_global(2); + // tr.begin(1)->set_refine_flag(); + // tr.execute_coarsening_and_refinement(); + // tr.begin(2)->set_refine_flag(); + // tr.execute_coarsening_and_refinement(); +// tr.refine_global(1); + deallog << "Triangulation levels"; + for (unsigned int l=0;l::cell_iterator cell = tr.begin(); + cell != tr.end(); ++cell, ++cn) + cell->set_user_index(cn); + + MGDoFHandler dofs(tr); + dofs.distribute_dofs(fe); + dofs.initialize_local_block_info(); + deallog << "DoFHandler " << dofs.n_dofs() << " levels"; + for (unsigned int l=0;l p0(0); + FE_Q<2> q1(1); + FESystem<2,2> sys1(p0,1,q1,1); + std::vector*> fe2; + fe2.push_back(&p0); + fe2.push_back(&q1); + fe2.push_back(&sys1); + + for (unsigned int i=0;i