From 4a524ab98d614277505a1ce7d87769fa2acd3401 Mon Sep 17 00:00:00 2001 From: wolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d> Date: Wed, 17 Nov 2004 03:37:48 +0000 Subject: [PATCH] Add a test that checks that the now on-the-fly computed interface constraint matrices for FE_Q<3> for q=1,2 are the same as the previously precomputed ones. git-svn-id: https://svn.dealii.org/trunk@9779 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/bits/fe_q_3d_01.cc | 124 ++++++++++ .../bits/fe_q_3d_01.output | 213 ++++++++++++++++++ 2 files changed, 337 insertions(+) create mode 100644 tests/bits/fe_q_3d_01.cc create mode 100644 tests/results/i686-pc-linux-gnu+gcc3.2/bits/fe_q_3d_01.output diff --git a/tests/bits/fe_q_3d_01.cc b/tests/bits/fe_q_3d_01.cc new file mode 100644 index 0000000000..a84fe2b298 --- /dev/null +++ b/tests/bits/fe_q_3d_01.cc @@ -0,0 +1,124 @@ +//---------------------------- fe_q_3d_01.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 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 +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//---------------------------- fe_q_3d_01.cc --------------------------- + + +// we used to have constraint matrices for the FE_Q elements precomputed and +// stored, but later moved to compute them on the fly. make sure these +// correspond to the previously available precomputed ones for 3d and q=1,2 + + +#include "../tests.h" +#include <fe/fe_q.h> + +#include <fstream> +#include <iostream> + + +// matrices taken from the old file deal.II/source/fe/fe_q_3d.cc +namespace FE_Q_3d +{ + static const double constraint_q1[] = + { + .25,.25,.25,.25, + .5,.5,0.,0., + 0.,.5,.5,0., + 0.,0.,.5,.5, + .5,0.,0.,.5 + }; + + static const double constraint_q2[] = + { + 0,0,0,0,0,0,0,0,1, + 0,0,0,0,1,0,0,0,0, + 0,0,0,0,0,1,0,0,0, + 0,0,0,0,0,0,1,0,0, + 0,0,0,0,0,0,0,1,0, + 0,0,0,0,.375,0,-.125,0,.75, + 0,0,0,0,0,.375,0,-.125,.75, + 0,0,0,0,-.125,0,.375,0,.75, + 0,0,0,0,0,-.125,0,.375,.75, + .375,-.125,0,0,.75,0,0,0,0, + -.125,.375,0,0,.75,0,0,0,0, + 0,.375,-.125,0,0,.75,0,0,0, + 0,-.125,.375,0,0,.75,0,0,0, + 0,0,-.125,.375,0,0,.75,0,0, + 0,0,.375,-.125,0,0,.75,0,0, + .375,0,0,-.125,0,0,0,.75,0, + -.125,0,0,.375,0,0,0,.75,0, + .140625,-.046875,.015625,-.046875,.28125,-.09375,-.09375,.28125,.5625, + -.046875,.140625,-.046875,.015625,.28125,.28125,-.09375,-.09375,.5625, + .015625,-.046875,.140625,-.046875,-.09375,.28125,.28125,-.09375,.5625, + -.046875,.015625,-.046875,.140625,-.09375,-.09375,.28125,.28125,.5625 + }; +} + + +namespace Matrices +{ + const double * const + constraint_matrices[] = + { + FE_Q_3d::constraint_q1, + FE_Q_3d::constraint_q2 + }; + + const unsigned int + n_constraint_matrices + = sizeof(constraint_matrices) / + sizeof(constraint_matrices[0]); +} + + + +void check () +{ + // check for q=1,2 + for (unsigned int q=1; q<=2; ++q) + { + deallog << "q=" << q << std::endl; + + FE_Q<3> fe(q); + + FullMatrix<double> x(fe.constraints().m(), + fe.constraints().n()); + + Assert (q<=Matrices::n_constraint_matrices, + ExcInternalError()); + x.fill (Matrices::constraint_matrices[q-1]); + + for (unsigned int i=0; i<x.m(); ++i) + for (unsigned int j=0; j<x.n(); ++j) + { + deallog << i << ' ' << j << ' ' + << x(i,j) << ' ' + << fe.constraints()(i,j) + << std::endl; + Assert (std::fabs (x(i,j) - fe.constraints()(i,j)) + < + 1e-14, + ExcInternalError()); + } + } + deallog << "OK" << std::endl; +} + + +int main () +{ + std::ofstream logfile("fe_q_3d_01.output"); + deallog.attach(logfile); + deallog.depth_console(0); + + check (); +} + diff --git a/tests/results/i686-pc-linux-gnu+gcc3.2/bits/fe_q_3d_01.output b/tests/results/i686-pc-linux-gnu+gcc3.2/bits/fe_q_3d_01.output new file mode 100644 index 0000000000..03a1bb7c6b --- /dev/null +++ b/tests/results/i686-pc-linux-gnu+gcc3.2/bits/fe_q_3d_01.output @@ -0,0 +1,213 @@ + +DEAL::q=1 +DEAL::0 0 0.250000 0.250000 +DEAL::0 1 0.250000 0.250000 +DEAL::0 2 0.250000 0.250000 +DEAL::0 3 0.250000 0.250000 +DEAL::1 0 0.500000 0.500000 +DEAL::1 1 0.500000 0.500000 +DEAL::1 2 0.00000 0.00000 +DEAL::1 3 0.00000 0.00000 +DEAL::2 0 0.00000 0.00000 +DEAL::2 1 0.500000 0.500000 +DEAL::2 2 0.500000 0.500000 +DEAL::2 3 0.00000 0.00000 +DEAL::3 0 0.00000 0.00000 +DEAL::3 1 0.00000 0.00000 +DEAL::3 2 0.500000 0.500000 +DEAL::3 3 0.500000 0.500000 +DEAL::4 0 0.500000 0.500000 +DEAL::4 1 0.00000 0.00000 +DEAL::4 2 0.00000 0.00000 +DEAL::4 3 0.500000 0.500000 +DEAL::q=2 +DEAL::0 0 0.00000 0.00000 +DEAL::0 1 0.00000 0.00000 +DEAL::0 2 0.00000 0.00000 +DEAL::0 3 0.00000 0.00000 +DEAL::0 4 0.00000 0.00000 +DEAL::0 5 0.00000 0.00000 +DEAL::0 6 0.00000 0.00000 +DEAL::0 7 0.00000 0.00000 +DEAL::0 8 1.00000 1.00000 +DEAL::1 0 0.00000 0.00000 +DEAL::1 1 0.00000 0.00000 +DEAL::1 2 0.00000 0.00000 +DEAL::1 3 0.00000 0.00000 +DEAL::1 4 1.00000 1.00000 +DEAL::1 5 0.00000 0.00000 +DEAL::1 6 0.00000 0.00000 +DEAL::1 7 0.00000 0.00000 +DEAL::1 8 0.00000 0.00000 +DEAL::2 0 0.00000 0.00000 +DEAL::2 1 0.00000 0.00000 +DEAL::2 2 0.00000 0.00000 +DEAL::2 3 0.00000 0.00000 +DEAL::2 4 0.00000 0.00000 +DEAL::2 5 1.00000 1.00000 +DEAL::2 6 0.00000 0.00000 +DEAL::2 7 0.00000 0.00000 +DEAL::2 8 0.00000 0.00000 +DEAL::3 0 0.00000 0.00000 +DEAL::3 1 0.00000 0.00000 +DEAL::3 2 0.00000 0.00000 +DEAL::3 3 0.00000 0.00000 +DEAL::3 4 0.00000 0.00000 +DEAL::3 5 0.00000 0.00000 +DEAL::3 6 1.00000 1.00000 +DEAL::3 7 0.00000 0.00000 +DEAL::3 8 0.00000 0.00000 +DEAL::4 0 0.00000 0.00000 +DEAL::4 1 0.00000 0.00000 +DEAL::4 2 0.00000 0.00000 +DEAL::4 3 0.00000 0.00000 +DEAL::4 4 0.00000 0.00000 +DEAL::4 5 0.00000 0.00000 +DEAL::4 6 0.00000 0.00000 +DEAL::4 7 1.00000 1.00000 +DEAL::4 8 0.00000 0.00000 +DEAL::5 0 0.00000 0.00000 +DEAL::5 1 0.00000 0.00000 +DEAL::5 2 0.00000 0.00000 +DEAL::5 3 0.00000 0.00000 +DEAL::5 4 0.375000 0.375000 +DEAL::5 5 0.00000 0.00000 +DEAL::5 6 -0.125000 -0.125000 +DEAL::5 7 0.00000 0.00000 +DEAL::5 8 0.750000 0.750000 +DEAL::6 0 0.00000 0.00000 +DEAL::6 1 0.00000 0.00000 +DEAL::6 2 0.00000 0.00000 +DEAL::6 3 0.00000 0.00000 +DEAL::6 4 0.00000 0.00000 +DEAL::6 5 0.375000 0.375000 +DEAL::6 6 0.00000 0.00000 +DEAL::6 7 -0.125000 -0.125000 +DEAL::6 8 0.750000 0.750000 +DEAL::7 0 0.00000 0.00000 +DEAL::7 1 0.00000 0.00000 +DEAL::7 2 0.00000 0.00000 +DEAL::7 3 0.00000 0.00000 +DEAL::7 4 -0.125000 -0.125000 +DEAL::7 5 0.00000 0.00000 +DEAL::7 6 0.375000 0.375000 +DEAL::7 7 0.00000 0.00000 +DEAL::7 8 0.750000 0.750000 +DEAL::8 0 0.00000 0.00000 +DEAL::8 1 0.00000 0.00000 +DEAL::8 2 0.00000 0.00000 +DEAL::8 3 0.00000 0.00000 +DEAL::8 4 0.00000 0.00000 +DEAL::8 5 -0.125000 -0.125000 +DEAL::8 6 0.00000 0.00000 +DEAL::8 7 0.375000 0.375000 +DEAL::8 8 0.750000 0.750000 +DEAL::9 0 0.375000 0.375000 +DEAL::9 1 -0.125000 -0.125000 +DEAL::9 2 0.00000 0.00000 +DEAL::9 3 0.00000 0.00000 +DEAL::9 4 0.750000 0.750000 +DEAL::9 5 0.00000 0.00000 +DEAL::9 6 0.00000 0.00000 +DEAL::9 7 0.00000 0.00000 +DEAL::9 8 0.00000 0.00000 +DEAL::10 0 -0.125000 -0.125000 +DEAL::10 1 0.375000 0.375000 +DEAL::10 2 0.00000 0.00000 +DEAL::10 3 0.00000 0.00000 +DEAL::10 4 0.750000 0.750000 +DEAL::10 5 0.00000 0.00000 +DEAL::10 6 0.00000 0.00000 +DEAL::10 7 0.00000 0.00000 +DEAL::10 8 0.00000 0.00000 +DEAL::11 0 0.00000 0.00000 +DEAL::11 1 0.375000 0.375000 +DEAL::11 2 -0.125000 -0.125000 +DEAL::11 3 0.00000 0.00000 +DEAL::11 4 0.00000 0.00000 +DEAL::11 5 0.750000 0.750000 +DEAL::11 6 0.00000 0.00000 +DEAL::11 7 0.00000 0.00000 +DEAL::11 8 0.00000 0.00000 +DEAL::12 0 0.00000 0.00000 +DEAL::12 1 -0.125000 -0.125000 +DEAL::12 2 0.375000 0.375000 +DEAL::12 3 0.00000 0.00000 +DEAL::12 4 0.00000 0.00000 +DEAL::12 5 0.750000 0.750000 +DEAL::12 6 0.00000 0.00000 +DEAL::12 7 0.00000 0.00000 +DEAL::12 8 0.00000 0.00000 +DEAL::13 0 0.00000 0.00000 +DEAL::13 1 0.00000 0.00000 +DEAL::13 2 -0.125000 -0.125000 +DEAL::13 3 0.375000 0.375000 +DEAL::13 4 0.00000 0.00000 +DEAL::13 5 0.00000 0.00000 +DEAL::13 6 0.750000 0.750000 +DEAL::13 7 0.00000 0.00000 +DEAL::13 8 0.00000 0.00000 +DEAL::14 0 0.00000 0.00000 +DEAL::14 1 0.00000 0.00000 +DEAL::14 2 0.375000 0.375000 +DEAL::14 3 -0.125000 -0.125000 +DEAL::14 4 0.00000 0.00000 +DEAL::14 5 0.00000 0.00000 +DEAL::14 6 0.750000 0.750000 +DEAL::14 7 0.00000 0.00000 +DEAL::14 8 0.00000 0.00000 +DEAL::15 0 0.375000 0.375000 +DEAL::15 1 0.00000 0.00000 +DEAL::15 2 0.00000 0.00000 +DEAL::15 3 -0.125000 -0.125000 +DEAL::15 4 0.00000 0.00000 +DEAL::15 5 0.00000 0.00000 +DEAL::15 6 0.00000 0.00000 +DEAL::15 7 0.750000 0.750000 +DEAL::15 8 0.00000 0.00000 +DEAL::16 0 -0.125000 -0.125000 +DEAL::16 1 0.00000 0.00000 +DEAL::16 2 0.00000 0.00000 +DEAL::16 3 0.375000 0.375000 +DEAL::16 4 0.00000 0.00000 +DEAL::16 5 0.00000 0.00000 +DEAL::16 6 0.00000 0.00000 +DEAL::16 7 0.750000 0.750000 +DEAL::16 8 0.00000 0.00000 +DEAL::17 0 0.140625 0.140625 +DEAL::17 1 -0.0468750 -0.0468750 +DEAL::17 2 0.0156250 0.0156250 +DEAL::17 3 -0.0468750 -0.0468750 +DEAL::17 4 0.281250 0.281250 +DEAL::17 5 -0.0937500 -0.0937500 +DEAL::17 6 -0.0937500 -0.0937500 +DEAL::17 7 0.281250 0.281250 +DEAL::17 8 0.562500 0.562500 +DEAL::18 0 -0.0468750 -0.0468750 +DEAL::18 1 0.140625 0.140625 +DEAL::18 2 -0.0468750 -0.0468750 +DEAL::18 3 0.0156250 0.0156250 +DEAL::18 4 0.281250 0.281250 +DEAL::18 5 0.281250 0.281250 +DEAL::18 6 -0.0937500 -0.0937500 +DEAL::18 7 -0.0937500 -0.0937500 +DEAL::18 8 0.562500 0.562500 +DEAL::19 0 0.0156250 0.0156250 +DEAL::19 1 -0.0468750 -0.0468750 +DEAL::19 2 0.140625 0.140625 +DEAL::19 3 -0.0468750 -0.0468750 +DEAL::19 4 -0.0937500 -0.0937500 +DEAL::19 5 0.281250 0.281250 +DEAL::19 6 0.281250 0.281250 +DEAL::19 7 -0.0937500 -0.0937500 +DEAL::19 8 0.562500 0.562500 +DEAL::20 0 -0.0468750 -0.0468750 +DEAL::20 1 0.0156250 0.0156250 +DEAL::20 2 -0.0468750 -0.0468750 +DEAL::20 3 0.140625 0.140625 +DEAL::20 4 -0.0937500 -0.0937500 +DEAL::20 5 -0.0937500 -0.0937500 +DEAL::20 6 0.281250 0.281250 +DEAL::20 7 0.281250 0.281250 +DEAL::20 8 0.562500 0.562500 +DEAL::OK -- 2.39.5