From: Guido Kanschat Date: Tue, 25 May 2004 12:41:18 +0000 (+0000) Subject: new tests for FETools and FEValues X-Git-Tag: v8.0.0~15126 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9de3cbb19c90bd682c6731798b74afdedeb69dae;p=dealii.git new tests for FETools and FEValues git-svn-id: https://svn.dealii.org/trunk@9319 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/fe/Makefile b/tests/fe/Makefile index f9bb3af031..8a70014ed7 100644 --- a/tests/fe/Makefile +++ b/tests/fe/Makefile @@ -26,6 +26,7 @@ derivatives.exe : derivatives.g.$(OBJEXT) $(libraries) fe_data_test.exe : fe_data_test.g.$(OBJEXT) $(libraries) fe_tools.exe : fe_tools.g.$(OBJEXT) $(libraries) fe_tools_test.exe : fe_tools_test.g.$(OBJEXT) $(libraries) +function.exe : function.g.$(OBJEXT) $(libraries) traits.exe : traits.g.$(OBJEXT) $(libraries) internals.exe : internals.g.$(OBJEXT) $(libraries) mapping.exe : mapping.g.$(OBJEXT) $(libraries) @@ -56,7 +57,7 @@ transfer.exe : transfer.g.$(OBJEXT) $(libraries) up_and_down.exe : up_and_down.g.$(OBJEXT) $(libraries) tests = fe_data_test traits fe_tools fe_tools_test mapping \ - mapping_c1 shapes derivatives numbering mapping_q1_eulerian \ + mapping_c1 shapes derivatives function numbering mapping_q1_eulerian \ transfer internals \ dgq_1 \ q_1 q_2 q_3 q_4 \ diff --git a/tests/fe/fe_tools.cc b/tests/fe/fe_tools.cc index ccc34c7b26..639dcba9bc 100644 --- a/tests/fe/fe_tools.cc +++ b/tests/fe/fe_tools.cc @@ -2,7 +2,7 @@ // fe_tools.cc,v 1.1 2003/11/28 15:03:26 guido Exp // Version: // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 by the deal.II authors +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -11,7 +11,7 @@ // //-------------------------------------------------------------------------- -// Test the cell matrices generated in FETools. +// Test the cell matrices generated in FETools and the local renumbering vector. #include "../tests.h" #include @@ -83,11 +83,60 @@ void test_projection (std::ostream& out) } +template +void test_renumbering(const FiniteElement& fe) +{ + std::vector v(fe.dofs_per_cell); + std::vector > start; + FETools::compute_component_wise(fe, v, start); + + deallog << fe.get_name() << std::endl << '['; + for (unsigned int i=0;i +void test_renumbering() +{ + deallog.push("Renumber"); + + FE_Q q1(1); + FE_Q q3(3); +//Todo:[GK] Test Raviart-Thomas and Nedelec? + + FESystem q1_3(q1,3); + test_renumbering(q1_3); + FESystem q3_3(q3,3); + test_renumbering(q3_3); + FESystem q3_2_q1_3(q3, 2, q1, 3); + test_renumbering(q3_2_q1_3); + + deallog.pop(); +} + + int main() { std::ofstream logfile("fe_tools.output"); + deallog.attach(logfile); + deallog.depth_console(0); test_projection<1>(logfile); test_projection<2>(logfile); test_projection<3>(logfile); + + test_renumbering<1>(); + test_renumbering<2>(); + test_renumbering<3>(); } diff --git a/tests/fe/function.cc b/tests/fe/function.cc new file mode 100644 index 0000000000..48d27686ec --- /dev/null +++ b/tests/fe/function.cc @@ -0,0 +1,93 @@ +// shapes.cc,v 1.18 2003/04/09 15:49:55 wolf Exp +// (c) Guido Kanschat + +// Test the different FEValuesBase::get_function_values + +#include + +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include + +#include + + +// Call this function with a system consisting of several copies of +// the SAME element +template +void vector_values(const FiniteElement& fe) +{ + Assert(fe.n_base_elements() == 1, ExcNotImplemented()); + deallog.push(fe.get_name()); + + QTrapez quadrature; + std::vector renumbering(fe.dofs_per_cell); + std::vector > component_start; + FETools::compute_component_wise(fe, renumbering, component_start); + + Triangulation tr; + GridGenerator::hyper_cube(tr); + tr.refine_global(1); + + DoFHandler dof(tr); + dof.distribute_dofs(fe); + DoFRenumbering::component_wise(dof); + + Vector v(dof.n_dofs()); + for (unsigned int i=0;i feval(fe, quadrature, update_values); + std::vector > local(quadrature.n_quadrature_points, + Vector(fe.n_components())); + + typename DoFHandler::active_cell_iterator cell = dof.begin_active(); + const typename DoFHandler::active_cell_iterator end = dof.end(); + + unsigned int cell_no = 0; + while (cell != end) + { + deallog << "Cell " << cell_no++ << std::endl; + feval.reinit(cell); + feval.get_function_values(v, local); + for (unsigned int c=0;c +void test_vectors() +{ + FE_Q q1(1); + + FESystem q1_3(q1,3); + vector_values(q1_3); +} + + +int main() +{ + std::ofstream logfile("function.output"); + deallog.attach(logfile); +// deallog.depth_console(0); + + test_vectors<2>(); + + return 0; +}