From b50ef1f8400d56f468b934e0f67ba17c65ab1597 Mon Sep 17 00:00:00 2001 From: kanschat Date: Fri, 20 Oct 2006 15:55:53 +0000 Subject: [PATCH] new test for FETools::get_fe_by_name git-svn-id: https://svn.dealii.org/trunk@14035 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/fe/Makefile | 2 +- tests/fe/fe_tools_01.cc | 79 ++++++++++++++++++++++++++++++++ tests/fe/fe_tools_01/cmp/generic | 27 +++++++++++ 3 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 tests/fe/fe_tools_01.cc create mode 100644 tests/fe/fe_tools_01/cmp/generic diff --git a/tests/fe/Makefile b/tests/fe/Makefile index 6289213fcd..8c60260ac1 100644 --- a/tests/fe/Makefile +++ b/tests/fe/Makefile @@ -21,7 +21,7 @@ default: run-tests ############################################################ -tests_x=fe_data_test traits fe_tools fe_tools_test mapping \ +tests_x=fe_data_test traits fe_tools fe_tools_* mapping \ mapping_c1 shapes derivatives function numbering mapping_q1_eulerian \ transfer internals derivatives_face \ dgq_1 \ diff --git a/tests/fe/fe_tools_01.cc b/tests/fe/fe_tools_01.cc new file mode 100644 index 0000000000..5db5f8cedb --- /dev/null +++ b/tests/fe/fe_tools_01.cc @@ -0,0 +1,79 @@ +//-------------------------------------------------------------------------- +// fe_tools.cc,v 1.1 2003/11/28 15:03:26 guido Exp +// Version: +// +// Copyright (C) 2006 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 FETools::get_fe_by_name + +#include "../tests.h" +#include +#include +#include +#include + +#include +#include +#include + +template +void test_fe(const char* name) +{ + FiniteElement* fe = FETools::get_fe_from_name(std::string(name)); + + deallog << fe->get_name() << std::endl + << '\t' << fe->dofs_per_cell + << '\t' << fe->dofs_per_vertex + << '\t' << fe->dofs_per_line + << '\t' << fe->dofs_per_quad + << '\t' << fe->dofs_per_hex + << std::endl; +} + + +int +main() +{ + std::ofstream logfile("fe_tools_01/output"); + deallog.attach(logfile); + deallog.depth_console(0); + + // These names are all correct. + test_fe<1>("FE_Q(1)"); + test_fe<1>("FE_Q(2)"); + test_fe<1>("FE_Q<1>(2)"); + test_fe<2>("FE_Q(1)"); + test_fe<2>("FE_Q<2>(2)"); + test_fe<2>("FE_Q(2)"); + test_fe<2>("FE_DGQ(1)"); + test_fe<2>("FE_RaviartThomas(1)"); + test_fe<3>("FE_Q(1)"); + test_fe<1>("FESystem<1>[FE_Q(2)^dim-FE_DGQ(1)]"); + test_fe<2>("FESystem<2>[FE_Q<2>(2)^dim-FE_DGQ<2>(1)]"); + test_fe<2>("FESystem[FESystem<2>[FE_Q<2>(2)^2-FE_DGQ<2>(1)]^2-FE_Q(1)]"); + test_fe<2>("FESystem[FESystem[FESystem[FE_Q(1)^2-FE_Q(1)]^2]-FESystem[FE_Q(1)^2]-FESystem[FE_Q(1)-FE_DGP(0)]]"); + + // Now set up a list of malformed + // names + std::vector names; +// names.push_back("FE_Q[2]"); + + for(unsigned int i=0;i(names[i]); + } + catch(ExceptionBase& e) + { + logfile << e.what(); + } + } +} diff --git a/tests/fe/fe_tools_01/cmp/generic b/tests/fe/fe_tools_01/cmp/generic new file mode 100644 index 0000000000..e17791ec26 --- /dev/null +++ b/tests/fe/fe_tools_01/cmp/generic @@ -0,0 +1,27 @@ + +DEAL::FE_Q<1>(1) +DEAL:: 2 1 0 0 0 +DEAL::FE_Q<1>(2) +DEAL:: 3 1 1 0 0 +DEAL::FE_Q<1>(2) +DEAL:: 3 1 1 0 0 +DEAL::FE_Q<2>(1) +DEAL:: 4 1 0 0 0 +DEAL::FE_Q<2>(2) +DEAL:: 9 1 1 1 0 +DEAL::FE_Q<2>(2) +DEAL:: 9 1 1 1 0 +DEAL::FE_DGQ<2>(1) +DEAL:: 4 0 0 4 0 +DEAL::FE_RaviartThomas<2>(1) +DEAL:: 12 0 2 4 0 +DEAL::FE_Q<3>(1) +DEAL:: 8 1 0 0 0 +DEAL::FESystem<1>[FE_Q<1>(2)-FE_DGQ<1>(1)] +DEAL:: 5 1 3 0 0 +DEAL::FESystem<2>[FE_Q<2>(2)^2-FE_DGQ<2>(1)] +DEAL:: 22 2 2 6 0 +DEAL::FESystem<2>[FESystem<2>[FE_Q<2>(2)^2-FE_DGQ<2>(1)]^2-FE_Q<2>(1)] +DEAL:: 48 5 4 12 0 +DEAL::FESystem<2>[FESystem<2>[FESystem<2>[FE_Q<2>(1)^2-FE_Q<2>(1)]^2]-FESystem<2>[FE_Q<2>(1)^2]-FESystem<2>[FE_Q<2>(1)-FE_DGP<2>(0)]] +DEAL:: 37 9 0 1 0 -- 2.39.5