]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
New tests.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 4 Jul 2012 10:36:06 +0000 (10:36 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 4 Jul 2012 10:36:06 +0000 (10:36 +0000)
git-svn-id: https://svn.dealii.org/trunk@25676 0785d39b-7218-0410-832d-ea1e28bc413d

tests/bits/fe_field_function_04.cc [new file with mode: 0644]
tests/bits/fe_field_function_04/cmp/generic [new file with mode: 0644]
tests/bits/fe_field_function_05.cc [new file with mode: 0644]
tests/bits/fe_field_function_05/cmp/generic [new file with mode: 0644]

diff --git a/tests/bits/fe_field_function_04.cc b/tests/bits/fe_field_function_04.cc
new file mode 100644 (file)
index 0000000..b54a7fa
--- /dev/null
@@ -0,0 +1,87 @@
+//-------------------------------------------------------
+//    $Id: fe_field_function_04.cc $
+//    Version: $Name$
+//
+//    Copyright (C) 2005, 2011, 2012 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.
+//
+//-------------------------------------------------------
+
+
+// FEFieldFunction ran into an assertion after
+// Mapping::transform_real_to_unit_cell started throwing exceptions
+// when it couldn't find the point on the reference cell that belongs
+// to a given point, rather than just silently giving up
+
+#include "../tests.h"
+
+#include <deal.II/base/utilities.h>
+#include <deal.II/grid/tria.h>
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/fe/mapping_q1.h>
+#include <deal.II/grid/tria_boundary_lib.h>
+#include <deal.II/fe/fe_q.h>
+#include <deal.II/numerics/fe_field_function.h>
+
+
+template<int dim>
+void test()
+{
+  const HyperBallBoundary<dim> boundary_description;
+
+  Triangulation<dim>   triangulation;
+  GridGenerator::hyper_ball (triangulation);
+  triangulation.set_boundary (0, boundary_description);
+  triangulation.refine_global (1);
+
+  FE_Q<dim> fe(2);
+  DoFHandler<dim> dof_handler(triangulation);
+  dof_handler.distribute_dofs(fe);
+
+  Vector<double> solution(dof_handler.n_dofs());
+
+  Functions::FEFieldFunction<2> fe_function (dof_handler, solution);
+  std::vector<Point<dim> > points;
+
+                                  // add a bunch of points. all
+                                  // points are inside the circle.
+                                  // the problem happens because we
+                                  // walk over a bunch of cells in
+                                  // the process of finding all of
+                                  // these points and then realize
+                                  // when we get to the one at the
+                                  // end that the coordinates for
+                                  // this point can't be found in the
+                                  // cell we have touched last (it's
+                                  // too far away from that cell, and
+                                  // the inverse mapping does not
+                                  // converge
+  for (unsigned int i=0; i<20; ++i)
+    for (unsigned int j=0; j<20; ++j)
+      points.push_back (Point<dim>(-0.7+i*0.07,-0.7+j*0.07));
+  points.push_back (Point<dim>(-0.27999999999999992, -0.62999999999999989));
+
+  std::vector<double> m (points.size());
+  fe_function.value_list (points, m);
+
+  triangulation.set_boundary (0);
+
+  deallog << "OK" << std::endl;
+}
+
+
+int main ()
+{
+  std::ofstream logfile("fe_field_function_04/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  test<2>();
+
+  return 0;
+}
+
diff --git a/tests/bits/fe_field_function_04/cmp/generic b/tests/bits/fe_field_function_04/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/fe_field_function_05.cc b/tests/bits/fe_field_function_05.cc
new file mode 100644 (file)
index 0000000..d87f45b
--- /dev/null
@@ -0,0 +1,94 @@
+//-------------------------------------------------------
+//    $Id: fe_field_function_05.cc $
+//    Version: $Name$
+//
+//    Copyright (C) 2005, 2011, 2012 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.
+//
+//-------------------------------------------------------
+
+
+// FEFieldFunction ran into an assertion after
+// Mapping::transform_real_to_unit_cell started throwing exceptions
+// when it couldn't find the point on the reference cell that belongs
+// to a given point, rather than just silently giving up
+//
+// this is a variant of _04 found by inspecting the code in
+// FEFieldFunction but the (same) exception is triggered in a
+// different place
+
+#include "../tests.h"
+
+#include <deal.II/base/utilities.h>
+#include <deal.II/grid/tria.h>
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/fe/mapping_q1.h>
+#include <deal.II/grid/tria_boundary_lib.h>
+#include <deal.II/fe/fe_q.h>
+#include <deal.II/numerics/fe_field_function.h>
+
+
+template<int dim>
+void test()
+{
+  const HyperBallBoundary<dim> boundary_description;
+
+  Triangulation<dim>   triangulation;
+  GridGenerator::hyper_ball (triangulation);
+  triangulation.set_boundary (0, boundary_description);
+  triangulation.refine_global (1);
+
+  FE_Q<dim> fe(2);
+  DoFHandler<dim> dof_handler(triangulation);
+  dof_handler.distribute_dofs(fe);
+
+  Vector<double> solution(dof_handler.n_dofs());
+
+  Functions::FEFieldFunction<2> fe_function (dof_handler, solution);
+  std::vector<Point<dim> > points;
+
+                                  // add only one points but also set
+                                  // the active cell to one that
+                                  // doesn't contain the current
+                                  // point.  the problem happens
+                                  // because we walk over a bunch of
+                                  // cells in the process of finding
+                                  // all of these points and then
+                                  // realize when we get to the one
+                                  // at the end that the coordinates
+                                  // for this point can't be found in
+                                  // the cell we have touched last
+                                  // (it's too far away from that
+                                  // cell, and the inverse mapping
+                                  // does not converge
+  points.push_back (Point<dim>(-0.27999999999999992, -0.62999999999999989));
+  fe_function.set_active_cell (typename DoFHandler<dim>::active_cell_iterator
+                              (&triangulation,
+                               1,
+                               4,
+                               &dof_handler));
+
+  std::vector<double> m (points.size());
+  fe_function.value_list (points, m);
+
+  triangulation.set_boundary (0);
+
+  deallog << "OK" << std::endl;
+}
+
+
+int main ()
+{
+  std::ofstream logfile("fe_field_function_05/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  test<2>();
+
+  return 0;
+}
+
diff --git a/tests/bits/fe_field_function_05/cmp/generic b/tests/bits/fe_field_function_05/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK

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.