Vector<double> fe_function(dof.n_dofs());
for (unsigned int i=0; i<dof.n_dofs(); ++i)
- fe_function(i) = i+1;
+ fe_function(i) = (i+1)*(i+2);
const QGauss<dim> quadrature(2);
FEValues<dim> fe_values (fe, quadrature,
DEAL::FE=FESystem<2>[FE_Q<2>(1)^3]
DEAL::q_point=0
-DEAL:: method 1: 15.5 15.5
-DEAL:: method 2: 15.5 15.5
+DEAL:: method 1: 210. 193.
+DEAL:: method 2: 210. 193.
DEAL::
DEAL::q_point=1
-DEAL:: method 1: 18.3 18.3
-DEAL:: method 2: 18.3 18.3
+DEAL:: method 1: 295. 273.
+DEAL:: method 2: 295. 273.
DEAL::
DEAL::q_point=2
-DEAL:: method 1: 16.2 16.2
-DEAL:: method 2: 16.2 16.2
+DEAL:: method 1: 223. 215.
+DEAL:: method 2: 223. 215.
DEAL::
DEAL::q_point=3
-DEAL:: method 1: 20.7 20.7
-DEAL:: method 2: 20.7 20.7
+DEAL:: method 1: 362. 344.
+DEAL:: method 2: 362. 344.
DEAL::
DEAL::FE=FESystem<3>[FE_Q<3>(1)^6]
DEAL::q_point=0
-DEAL:: method 1: 99.4 99.4 99.4
-DEAL:: method 2: 99.4 99.4 99.4
+DEAL:: method 1: 3.72e+03 3.80e+03 3.72e+03
+DEAL:: method 2: 3.72e+03 3.80e+03 3.72e+03
DEAL::
DEAL::q_point=1
-DEAL:: method 1: 99.4 99.4 99.4
-DEAL:: method 2: 99.4 99.4 99.4
+DEAL:: method 1: 4.31e+03 4.39e+03 4.31e+03
+DEAL:: method 2: 4.31e+03 4.39e+03 4.31e+03
DEAL::
DEAL::q_point=2
-DEAL:: method 1: 99.4 99.4 99.4
-DEAL:: method 2: 99.4 99.4 99.4
+DEAL:: method 1: 4.70e+03 4.79e+03 4.70e+03
+DEAL:: method 2: 4.70e+03 4.79e+03 4.70e+03
DEAL::
DEAL::q_point=3
-DEAL:: method 1: 99.4 99.4 99.4
-DEAL:: method 2: 99.4 99.4 99.4
+DEAL:: method 1: 5.29e+03 5.38e+03 5.29e+03
+DEAL:: method 2: 5.29e+03 5.38e+03 5.29e+03
DEAL::
DEAL::q_point=4
-DEAL:: method 1: 99.4 99.4 99.4
-DEAL:: method 2: 99.4 99.4 99.4
+DEAL:: method 1: 4.90e+03 4.98e+03 4.90e+03
+DEAL:: method 2: 4.90e+03 4.98e+03 4.90e+03
DEAL::
DEAL::q_point=5
-DEAL:: method 1: 99.4 99.4 99.4
-DEAL:: method 2: 99.4 99.4 99.4
+DEAL:: method 1: 5.49e+03 5.58e+03 5.49e+03
+DEAL:: method 2: 5.49e+03 5.58e+03 5.49e+03
DEAL::
DEAL::q_point=6
-DEAL:: method 1: 99.4 99.4 99.4
-DEAL:: method 2: 99.4 99.4 99.4
+DEAL:: method 1: 5.88e+03 5.97e+03 5.88e+03
+DEAL:: method 2: 5.88e+03 5.97e+03 5.88e+03
DEAL::
DEAL::q_point=7
-DEAL:: method 1: 99.4 99.4 99.4
-DEAL:: method 2: 99.4 99.4 99.4
+DEAL:: method 1: 6.47e+03 6.56e+03 6.47e+03
+DEAL:: method 2: 6.47e+03 6.56e+03 6.47e+03
DEAL::
--- /dev/null
+//----------------------------------------------------------------------
+// $Id$
+// Version: $Name$
+//
+// Copyright (C) 2007, 2008, 2010, 2011 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.
+//
+//----------------------------------------------------------------------
+
+
+// there was a bug in getting the divergence of shape functions for the
+// SymmetricTensor extractors. test that it is fixed by comparing with
+// get_function_divergences
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <base/function.h>
+#include <base/quadrature_lib.h>
+#include <lac/vector.h>
+#include <grid/grid_generator.h>
+#include <grid/tria_boundary_lib.h>
+#include <dofs/dof_handler.h>
+#include <fe/fe_q.h>
+#include <fe/fe_system.h>
+#include <fe/fe_values.h>
+#include <fe/mapping_q1.h>
+
+#include <fstream>
+
+
+
+template<int dim>
+void test (const Triangulation<dim>& tr,
+ const FiniteElement<dim>& fe)
+{
+ deallog << "FE=" << fe.get_name()
+ << std::endl;
+
+ DoFHandler<dim> dof(tr);
+ dof.distribute_dofs(fe);
+
+ Vector<double> fe_function(dof.n_dofs());
+ for (unsigned int i=0; i<dof.n_dofs(); ++i)
+ fe_function(i) = i+1;
+
+ const QGauss<dim> quadrature(2);
+ FEValues<dim> fe_values (fe, quadrature,
+ update_values | update_gradients);
+ fe_values.reinit (dof.begin_active());
+
+ // let the FEValues object compute the
+ // divergences at quadrature points
+ std::vector<Tensor<1,dim> > divergences (quadrature.size());
+ FEValuesExtractors::SymmetricTensor<2> extractor(0);
+ fe_values[extractor]
+ .get_function_divergences (fe_function, divergences);
+
+ // now do the same "by hand"
+ std::vector<unsigned int> local_dof_indices (fe.dofs_per_cell);
+ dof.begin_active()->get_dof_indices (local_dof_indices);
+
+ for (unsigned int i=0; i<fe.dofs_per_cell; ++i)
+ {
+ deallog << "i=" << i << std::endl;
+
+ for (unsigned int q=0; q<quadrature.size(); ++q)
+ deallog << " q_point=" << q << std::endl
+ << " div= " << fe_values[extractor].divergence (i,q) << std::endl;
+ }
+}
+
+
+
+template<int dim>
+void test_hyper_sphere()
+{
+ Triangulation<dim> tr;
+ GridGenerator::hyper_ball(tr);
+
+ static const HyperBallBoundary<dim> boundary;
+ tr.set_boundary (0, boundary);
+
+ FESystem<dim> fe (FE_Q<dim>(1),
+ SymmetricTensor<2,dim>::n_independent_components);
+ test(tr, fe);
+}
+
+
+int main()
+{
+ std::ofstream logfile ("fe_values_view_24/output");
+ deallog << std::setprecision (3);
+
+ deallog.attach(logfile);
+ deallog.depth_console (0);
+ deallog.threshold_double(1.e-7);
+
+ test_hyper_sphere<2>();
+ test_hyper_sphere<3>();
+}
--- /dev/null
+
+DEAL::FE=FESystem<2>[FE_Q<2>(1)^3]
+DEAL::q_point=0
+DEAL:: method 1: 15.5 15.5
+DEAL:: method 2: 15.5 15.5
+DEAL::
+DEAL::q_point=1
+DEAL:: method 1: 18.3 18.3
+DEAL:: method 2: 18.3 18.3
+DEAL::
+DEAL::q_point=2
+DEAL:: method 1: 16.2 16.2
+DEAL:: method 2: 16.2 16.2
+DEAL::
+DEAL::q_point=3
+DEAL:: method 1: 20.7 20.7
+DEAL:: method 2: 20.7 20.7
+DEAL::
+DEAL::FE=FESystem<3>[FE_Q<3>(1)^6]
+DEAL::q_point=0
+DEAL:: method 1: 99.4 99.4 99.4
+DEAL:: method 2: 99.4 99.4 99.4
+DEAL::
+DEAL::q_point=1
+DEAL:: method 1: 99.4 99.4 99.4
+DEAL:: method 2: 99.4 99.4 99.4
+DEAL::
+DEAL::q_point=2
+DEAL:: method 1: 99.4 99.4 99.4
+DEAL:: method 2: 99.4 99.4 99.4
+DEAL::
+DEAL::q_point=3
+DEAL:: method 1: 99.4 99.4 99.4
+DEAL:: method 2: 99.4 99.4 99.4
+DEAL::
+DEAL::q_point=4
+DEAL:: method 1: 99.4 99.4 99.4
+DEAL:: method 2: 99.4 99.4 99.4
+DEAL::
+DEAL::q_point=5
+DEAL:: method 1: 99.4 99.4 99.4
+DEAL:: method 2: 99.4 99.4 99.4
+DEAL::
+DEAL::q_point=6
+DEAL:: method 1: 99.4 99.4 99.4
+DEAL:: method 2: 99.4 99.4 99.4
+DEAL::
+DEAL::q_point=7
+DEAL:: method 1: 99.4 99.4 99.4
+DEAL:: method 2: 99.4 99.4 99.4
+DEAL::
--- /dev/null
+
+DEAL::FE=FESystem<2>[FE_Q<2>(1)-FE_RaviartThomas<2>(1)-FE_Nedelec<2>(1)]
+DEAL::component=0
+DEAL::0.807 4.36
+DEAL::0.807 5.29
+DEAL::1.31 4.07
+DEAL::1.31 5.59
+DEAL::component=1
+DEAL::18.2 352.
+DEAL::-18.2 337.
+DEAL::333. 180.
+DEAL::-295. 296.
+DEAL::component=2
+DEAL::43.2 -31.7
+DEAL::43.2 118.
+DEAL::125. -61.1
+DEAL::125. -40.8
+DEAL::component=3
+DEAL::2.58e-16 5.84
+DEAL::2.58e-16 5.84
+DEAL::3.58e-16 9.52
+DEAL::3.58e-16 9.52
+DEAL::component=4
+DEAL::5.84 -6.75
+DEAL::5.84 6.75
+DEAL::9.52 -11.0
+DEAL::9.52 11.0
+DEAL::FE=FESystem<3>[FE_Q<3>(1)-FE_RaviartThomas<3>(1)-FE_Nedelec<3>(1)]
+DEAL::component=0
+DEAL::2.37 4.73 9.46
+DEAL::2.37 4.73 9.46
+DEAL::2.37 4.73 9.46
+DEAL::2.37 4.73 9.46
+DEAL::2.37 4.73 9.46
+DEAL::2.37 4.73 9.46
+DEAL::2.37 4.73 9.46
+DEAL::2.37 4.73 9.46
+DEAL::component=1
+DEAL::8.18e-13 -275. -138.
+DEAL::-5.71e-13 -275. -138.
+DEAL::-367. -275. 4.71e+03
+DEAL::367. -275. 4.92e+03
+DEAL::-184. 4.57e+03 -138.
+DEAL::184. 4.79e+03 -138.
+DEAL::4.80e+03 4.57e+03 4.71e+03
+DEAL::-4.38e+03 4.79e+03 4.92e+03
+DEAL::component=2
+DEAL::-275. 1.30e-12 -138.
+DEAL::-275. -459. 4.80e+03
+DEAL::-275. -1.40e-12 -138.
+DEAL::-275. 459. 5.02e+03
+DEAL::4.67e+03 -91.8 -138.
+DEAL::4.67e+03 3.52e+03 4.80e+03
+DEAL::4.88e+03 91.8 -138.
+DEAL::4.88e+03 -3.09e+03 5.02e+03
+DEAL::component=3
+DEAL::-275. -138. 1.36e-12
+DEAL::-275. 4.90e+03 -367.
+DEAL::4.76e+03 -138. -184.
+DEAL::4.76e+03 4.90e+03 2.23e+03
+DEAL::-275. -138. -3.64e-12
+DEAL::-275. 5.11e+03 367.
+DEAL::4.97e+03 -138. 184.
+DEAL::4.97e+03 5.11e+03 -1.81e+03
+DEAL::component=4
+DEAL::-7.70e-16 5.60 22.4
+DEAL::-7.70e-16 5.60 22.4
+DEAL::-6.69e-16 5.60 22.4
+DEAL::-6.69e-16 5.60 22.4
+DEAL::1.58e-16 5.60 22.4
+DEAL::1.58e-16 5.60 22.4
+DEAL::9.52e-16 5.60 22.4
+DEAL::9.52e-16 5.60 22.4
+DEAL::component=5
+DEAL::5.60 5.78e-16 22.4
+DEAL::5.60 -1.39e-15 22.4
+DEAL::5.60 5.78e-16 22.4
+DEAL::5.60 -1.39e-15 22.4
+DEAL::5.60 -6.60e-16 22.4
+DEAL::5.60 3.53e-16 22.4
+DEAL::5.60 -6.60e-16 22.4
+DEAL::5.60 3.53e-16 22.4
+DEAL::component=6
+DEAL::5.60 11.2 -1.38e-15
+DEAL::5.60 11.2 1.96e-16
+DEAL::5.60 11.2 1.23e-17
+DEAL::5.60 11.2 1.50e-15
+DEAL::5.60 11.2 -1.38e-15
+DEAL::5.60 11.2 1.96e-16
+DEAL::5.60 11.2 1.23e-17
+DEAL::5.60 11.2 1.50e-15