]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Additional tests that currently fail as MappingQ does not care about non-standard...
authorleicht <leicht@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 11 Jun 2008 09:10:33 +0000 (09:10 +0000)
committerleicht <leicht@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 11 Jun 2008 09:10:33 +0000 (09:10 +0000)
git-svn-id: https://svn.dealii.org/trunk@16294 0785d39b-7218-0410-832d-ea1e28bc413d

tests/fail/mesh_3d_25.cc [new file with mode: 0644]
tests/fail/mesh_3d_25/cmp/generic [new file with mode: 0644]
tests/fail/mesh_3d_26.cc [new file with mode: 0644]
tests/fail/mesh_3d_26/cmp/generic [new file with mode: 0644]

diff --git a/tests/fail/mesh_3d_25.cc b/tests/fail/mesh_3d_25.cc
new file mode 100644 (file)
index 0000000..e4e8c4e
--- /dev/null
@@ -0,0 +1,120 @@
+//----------------------------  mesh_3d_25.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2006, 2008 by Timo Heister and 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.
+//
+//----------------------------  mesh_3d_25.cc  ---------------------------
+
+
+// an adaptation of the mesh_3d_22 test.  check that
+// VectorTools::interpolate works for FE_Q(p) elements correctly on a mesh
+// with a cell that has a wrong face rotation. when using a MappingQ(3), we
+// calculated interpolation points wrongly
+
+#include "../tests.h"
+#include "../bits/mesh_3d.h"
+
+#include <grid/tria.h>
+#include <grid/tria_accessor.h>
+#include <grid/tria_iterator.h>
+#include <lac/vector.h>
+#include <numerics/data_out.h>
+#include <base/quadrature_lib.h>
+#include <fe/mapping_q.h>
+#include <fe/fe_q.h>
+#include <base/function.h>
+#include <base/logstream.h>
+#include <lac/vector.h>
+
+#include <dofs/dof_handler.h>
+#include <dofs/dof_accessor.h>
+#include <dofs/dof_tools.h>
+#include <numerics/vectors.h>
+
+#include <fstream>
+#include <cmath>
+#include <vector>
+
+using namespace dealii;
+using namespace std;
+
+template <int dim>
+class F :  public Function<dim>
+{
+  public:
+    F (const unsigned int q) : q(q) {}
+
+    virtual double value (const Point<dim> &p,
+                         const unsigned int) const
+      {
+       double v=0;
+       for (unsigned int d=0; d<dim; ++d)
+         for (unsigned int i=0; i<=q; ++i)
+           v += (d+1)*(i+1)*std::pow (p[d], 1.*i);
+       return v;
+      }
+
+  private:
+    const unsigned int q;
+};
+
+
+
+template <int dim>
+void test (Triangulation<dim>& triangulation)
+{
+  MappingQ<3> mapping(3);
+  for (unsigned int p=1; p<7-dim; ++p)
+    {
+      FE_Q<dim>              fe(p);
+      DoFHandler<dim>        dof_handler(triangulation);
+      dof_handler.distribute_dofs (fe);
+
+      Vector<double> interpolant (dof_handler.n_dofs());
+      Vector<float>  error (triangulation.n_active_cells());
+      for (unsigned int q=0; q<=p+2; ++q)
+       {
+                                          // interpolate the function
+         VectorTools::interpolate (mapping, dof_handler,
+                                   F<dim> (q),
+                                   interpolant);
+
+                                          // then compute the interpolation error
+         VectorTools::integrate_difference (mapping, dof_handler,
+                                            interpolant,
+                                            F<dim> (q),
+                                            error,
+                                            QGauss<dim>(q+2),
+                                            VectorTools::L2_norm);
+         deallog << fe.get_name() << ", P_" << q
+                 << ", rel. error=" << error.l2_norm() / interpolant.l2_norm()
+                 << std::endl;
+         if (q<=p)
+           Assert (error.l2_norm() < 1e-12*interpolant.l2_norm(),
+                   ExcInternalError());
+       }
+    }
+}
+
+
+
+
+int main ()
+{
+  std::ofstream logfile ("mesh_3d_25/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.0e-10);
+
+  Triangulation<3> triangulation;
+
+  create_two_cubes_rotation(triangulation,1);
+  test<3>(triangulation);
+}
+
diff --git a/tests/fail/mesh_3d_25/cmp/generic b/tests/fail/mesh_3d_25/cmp/generic
new file mode 100644 (file)
index 0000000..53ab098
--- /dev/null
@@ -0,0 +1,16 @@
+
+DEAL::FE_Q<3>(1), P_0, rel. error=0
+DEAL::FE_Q<3>(1), P_1, rel. error=0
+DEAL::FE_Q<3>(1), P_2, rel. error=0.0597945
+DEAL::FE_Q<3>(1), P_3, rel. error=0.0498625
+DEAL::FE_Q<3>(2), P_0, rel. error=0
+DEAL::FE_Q<3>(2), P_1, rel. error=0
+DEAL::FE_Q<3>(2), P_2, rel. error=0
+DEAL::FE_Q<3>(2), P_3, rel. error=0.00331875
+DEAL::FE_Q<3>(2), P_4, rel. error=0.00412760
+DEAL::FE_Q<3>(3), P_0, rel. error=0
+DEAL::FE_Q<3>(3), P_1, rel. error=0
+DEAL::FE_Q<3>(3), P_2, rel. error=0
+DEAL::FE_Q<3>(3), P_3, rel. error=0
+DEAL::FE_Q<3>(3), P_4, rel. error=0.000321938
+DEAL::FE_Q<3>(3), P_5, rel. error=0.000423313
diff --git a/tests/fail/mesh_3d_26.cc b/tests/fail/mesh_3d_26.cc
new file mode 100644 (file)
index 0000000..babae54
--- /dev/null
@@ -0,0 +1,122 @@
+//----------------------------  mesh_3d_26.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2006, 2008 by Timo Heister and 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.
+//
+//----------------------------  mesh_3d_26.cc  ---------------------------
+
+
+// an adaptation of the mesh_3d_22 test.  check that VectorTools::interpolate
+// works for FE_Q(p) elements correctly on a mesh with a cell that has a wrong
+// face orientation in the interior of the domain. when using a MappingQ(3), we
+// calculated interpolation points wrongly
+
+#include "../tests.h"
+
+#include <grid/tria.h>
+#include <grid/tria_accessor.h>
+#include <grid/tria_iterator.h>
+#include <grid/grid_generator.h>
+#include <lac/vector.h>
+#include <numerics/data_out.h>
+#include <base/quadrature_lib.h>
+#include <fe/mapping_q.h>
+#include <fe/fe_q.h>
+#include <base/function.h>
+#include <base/logstream.h>
+#include <lac/vector.h>
+
+#include <dofs/dof_handler.h>
+#include <dofs/dof_accessor.h>
+#include <dofs/dof_tools.h>
+#include <numerics/vectors.h>
+
+#include <fstream>
+#include <cmath>
+#include <vector>
+
+using namespace dealii;
+using namespace std;
+
+template <int dim>
+class F :  public Function<dim>
+{
+  public:
+    F (const unsigned int q) : q(q) {}
+
+    virtual double value (const Point<dim> &p,
+                         const unsigned int) const
+      {
+       double v=0;
+       for (unsigned int d=0; d<dim; ++d)
+         for (unsigned int i=0; i<=q; ++i)
+           v += (d+1)*(i+1)*std::pow (p[d], 1.*i);
+       return v;
+      }
+
+  private:
+    const unsigned int q;
+};
+
+
+
+template <int dim>
+void test (Triangulation<dim>& triangulation)
+{
+                                  // create a MappingQ(3) which is used on ALL
+                                  // cells
+  MappingQ<3> mapping(3, true);
+  for (unsigned int p=1; p<7-dim; ++p)
+    {
+      FE_Q<dim>              fe(p);
+      DoFHandler<dim>        dof_handler(triangulation);
+      dof_handler.distribute_dofs (fe);
+
+      Vector<double> interpolant (dof_handler.n_dofs());
+      Vector<float>  error (triangulation.n_active_cells());
+      for (unsigned int q=0; q<=p+2; ++q)
+       {
+                                          // interpolate the function
+         VectorTools::interpolate (mapping, dof_handler,
+                                   F<dim> (q),
+                                   interpolant);
+
+                                          // then compute the interpolation error
+         VectorTools::integrate_difference (mapping, dof_handler,
+                                            interpolant,
+                                            F<dim> (q),
+                                            error,
+                                            QGauss<dim>(q+2),
+                                            VectorTools::L2_norm);
+         deallog << fe.get_name() << ", P_" << q
+                 << ", rel. error=" << error.l2_norm() / interpolant.l2_norm()
+                 << std::endl;
+         if (q<=p)
+           Assert (error.l2_norm() < 1e-12*interpolant.l2_norm(),
+                   ExcInternalError());
+       }
+    }
+}
+
+
+
+
+int main ()
+{
+  std::ofstream logfile ("mesh_3d_26/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.0e-10);
+
+  Triangulation<3> triangulation;
+  GridGenerator::hyper_ball(triangulation);
+  triangulation.refine_global(1);
+  test<3>(triangulation);
+}
+
diff --git a/tests/fail/mesh_3d_26/cmp/generic b/tests/fail/mesh_3d_26/cmp/generic
new file mode 100644 (file)
index 0000000..caf98c4
--- /dev/null
@@ -0,0 +1,16 @@
+
+DEAL::FE_Q<3>(1), P_0, rel. error=0
+DEAL::FE_Q<3>(1), P_1, rel. error=0
+DEAL::FE_Q<3>(1), P_2, rel. error=0.00836936
+DEAL::FE_Q<3>(1), P_3, rel. error=0.0101346
+DEAL::FE_Q<3>(2), P_0, rel. error=0
+DEAL::FE_Q<3>(2), P_1, rel. error=0
+DEAL::FE_Q<3>(2), P_2, rel. error=0
+DEAL::FE_Q<3>(2), P_3, rel. error=0.000301004
+DEAL::FE_Q<3>(2), P_4, rel. error=0.000466547
+DEAL::FE_Q<3>(3), P_0, rel. error=0
+DEAL::FE_Q<3>(3), P_1, rel. error=0
+DEAL::FE_Q<3>(3), P_2, rel. error=0
+DEAL::FE_Q<3>(3), P_3, rel. error=0
+DEAL::FE_Q<3>(3), P_4, rel. error=2.53469e-05
+DEAL::FE_Q<3>(3), P_5, rel. error=4.45045e-05

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.