--- /dev/null
+//-------------------------------------------------------
+// $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;
+}
+
--- /dev/null
+//-------------------------------------------------------
+// $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;
+}
+