]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 13 Oct 2010 21:05:34 +0000 (21:05 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 13 Oct 2010 21:05:34 +0000 (21:05 +0000)
git-svn-id: https://svn.dealii.org/trunk@22338 0785d39b-7218-0410-832d-ea1e28bc413d

tests/deal.II/fe_values_view_10_single_04.cc [new file with mode: 0644]
tests/deal.II/fe_values_view_10_single_04/cmp/generic [new file with mode: 0644]

diff --git a/tests/deal.II/fe_values_view_10_single_04.cc b/tests/deal.II/fe_values_view_10_single_04.cc
new file mode 100644 (file)
index 0000000..2543902
--- /dev/null
@@ -0,0 +1,115 @@
+//----------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2007, 2008, 2010 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 the FEValues views and extractor classes. this test is for
+// get_function_hessians for a scalar component and a non-primitive element
+//
+// like _10, but use the values not the hessians. this test exists for
+// an attempt at finding out why results for fe_values_view_10 on
+// branch_distributed_grids at the time of writing differ from those
+// on mainline.
+
+#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_dgq.h>
+#include <fe/fe_nedelec.h>
+#include <fe/fe_raviart_thomas.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 | update_hessians);
+  fe_values.reinit (dof.begin_active());
+
+  std::vector<double> scalar_values (quadrature.n_quadrature_points);
+  std::vector<Vector<double> >
+    vector_values (quadrature.n_quadrature_points,
+                  Vector<double>(fe.n_components()));
+
+  fe_values.get_function_values (fe_function, vector_values);
+  
+  for (unsigned int c=0; c<fe.n_components(); ++c)
+    {
+      FEValuesExtractors::Scalar single_component (c);
+      fe_values[single_component].get_function_values (fe_function,
+                                                      scalar_values);
+      deallog << "component=" << c << std::endl;
+      
+      for (unsigned int q=0; q<fe_values.n_quadrature_points; ++q)
+       {
+         deallog << scalar_values[q] << std::endl;
+         Assert (std::fabs(scalar_values[q] - vector_values[q](c))
+                 <= 1e-12 * std::fabs(scalar_values[q]),
+                 ExcInternalError());
+       }
+    }
+}
+
+
+
+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), 1,
+                   FE_RaviartThomas<dim>(1), 1,
+                   FE_Nedelec<dim>(0), 1);
+  test(tr, fe);
+}
+
+
+int main()
+{
+  std::ofstream logfile ("fe_values_view_10_single_04/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>();
+}
diff --git a/tests/deal.II/fe_values_view_10_single_04/cmp/generic b/tests/deal.II/fe_values_view_10_single_04/cmp/generic
new file mode 100644 (file)
index 0000000..a978ab9
--- /dev/null
@@ -0,0 +1,91 @@
+
+DEAL::FE=FESystem<2>[FE_Q<2>(1)-FE_RaviartThomas<2>(1)-FE_Nedelec<2>(0)]
+DEAL::component=0
+DEAL::1.63
+DEAL::2.21
+DEAL::2.79
+DEAL::3.37
+DEAL::component=1
+DEAL::-5.76
+DEAL::-21.7
+DEAL::81.2
+DEAL::60.9
+DEAL::component=2
+DEAL::-1.61
+DEAL::29.3
+DEAL::-2.63
+DEAL::52.2
+DEAL::component=3
+DEAL::11.0
+DEAL::11.0
+DEAL::20.2
+DEAL::20.2
+DEAL::component=4
+DEAL::12.1
+DEAL::29.0
+DEAL::6.77
+DEAL::34.3
+DEAL::FE=FESystem<3>[FE_Q<3>(1)-FE_RaviartThomas<3>(1)-FE_Nedelec<3>(0)]
+DEAL::component=0
+DEAL::2.48
+DEAL::3.06
+DEAL::3.63
+DEAL::4.21
+DEAL::4.79
+DEAL::5.37
+DEAL::5.94
+DEAL::6.52
+DEAL::component=1
+DEAL::0
+DEAL::0
+DEAL::-67.2
+DEAL::-67.2
+DEAL::-33.6
+DEAL::-33.6
+DEAL::1.08e+03
+DEAL::1.13e+03
+DEAL::component=2
+DEAL::0
+DEAL::-67.2
+DEAL::0
+DEAL::-67.2
+DEAL::-33.6
+DEAL::1.10e+03
+DEAL::-33.6
+DEAL::1.16e+03
+DEAL::component=3
+DEAL::0
+DEAL::-67.2
+DEAL::-33.6
+DEAL::1.13e+03
+DEAL::0
+DEAL::-67.2
+DEAL::-33.6
+DEAL::1.18e+03
+DEAL::component=4
+DEAL::28.5
+DEAL::28.5
+DEAL::29.9
+DEAL::29.9
+DEAL::34.0
+DEAL::34.0
+DEAL::35.4
+DEAL::35.4
+DEAL::component=5
+DEAL::23.8
+DEAL::25.2
+DEAL::23.8
+DEAL::25.2
+DEAL::29.3
+DEAL::30.6
+DEAL::29.3
+DEAL::30.6
+DEAL::component=6
+DEAL::41.7
+DEAL::43.1
+DEAL::44.5
+DEAL::45.8
+DEAL::41.7
+DEAL::43.1
+DEAL::44.5
+DEAL::45.8

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.