--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2017 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+
+// find_all_active_cells_around_point for a simple cube mesh
+
+#include <deal.II/base/logstream.h>
+#include <deal.II/base/utilities.h>
+
+#include <deal.II/fe/mapping_q_generic.h>
+
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/grid_tools.h>
+
+#include "../tests.h"
+
+
+
+template <int dim, int spacedim>
+void
+print_result(const Mapping<dim, spacedim> & mapping,
+ const Triangulation<dim, spacedim> &tria,
+ const Point<dim> p,
+ const double tolerance)
+{
+ deallog << "Testing " << dim << "D with point " << p << " tolerance "
+ << tolerance << std::endl;
+ auto c_p =
+ GridTools::find_all_active_cells_around_point(mapping, tria, p, tolerance);
+ for (auto i : c_p)
+ deallog << "Cell: " << i.first->id() << " unit point " << i.second
+ << std::endl;
+ deallog << std::endl;
+}
+
+
+
+template <int dim, int spacedim>
+void
+test(unsigned int n_ref)
+{
+ Triangulation<dim, spacedim> tria;
+ GridGenerator::hyper_cube(tria);
+ tria.refine_global(n_ref);
+ MappingQGeneric<dim, spacedim> mapping(3);
+
+ Point<dim> p;
+ {
+ for (unsigned int d = 0; d < dim; ++d)
+ p[d] = 0.5;
+ print_result(mapping, tria, p, 1e-8);
+ }
+ {
+ for (unsigned int d = 0; d < dim; ++d)
+ p[d] = 0.5 + 1e-6;
+ print_result(mapping, tria, p, 1e-12);
+ print_result(mapping, tria, p, 1e-4);
+ }
+ for (unsigned int c = 0; c < dim; ++c)
+ for (unsigned int e = 0; e < dim; ++e)
+ {
+ for (unsigned int d = 0; d < dim; ++d)
+ p[d] = 0.5;
+ p[c] = 0.45;
+ p[e] = 0.45;
+ print_result(mapping, tria, p, 1e-12);
+ }
+}
+
+
+
+int
+main()
+{
+ initlog();
+ deallog << std::setprecision(10);
+
+ test<1, 1>(4);
+ test<2, 2>(4);
+ test<2, 2>(5);
+ test<3, 3>(3);
+}
--- /dev/null
+
+DEAL::Testing 1D with point 0.5000000000 tolerance 1.000000000e-08
+DEAL::Cell: 0_4:0111 unit point 1.000000000
+DEAL::Cell: 0_4:1000 unit point 0.000000000
+DEAL::
+DEAL::Testing 1D with point 0.5000010000 tolerance 1.000000000e-12
+DEAL::Cell: 0_4:1000 unit point 1.600000000e-05
+DEAL::
+DEAL::Testing 1D with point 0.5000010000 tolerance 0.0001000000000
+DEAL::Cell: 0_4:0111 unit point 1.000016000
+DEAL::Cell: 0_4:1000 unit point 1.600000000e-05
+DEAL::
+DEAL::Testing 1D with point 0.4500000000 tolerance 1.000000000e-12
+DEAL::Cell: 0_4:0111 unit point 0.2000000000
+DEAL::
+DEAL::Testing 2D with point 0.5000000000 0.5000000000 tolerance 1.000000000e-08
+DEAL::Cell: 0_4:0333 unit point 1.000000000 1.000000000
+DEAL::Cell: 0_4:1222 unit point 0.000000000 1.000000000
+DEAL::Cell: 0_4:2111 unit point 1.000000000 0.000000000
+DEAL::Cell: 0_4:3000 unit point 0.000000000 0.000000000
+DEAL::
+DEAL::Testing 2D with point 0.5000010000 0.5000010000 tolerance 1.000000000e-12
+DEAL::Cell: 0_4:3000 unit point 1.600000000e-05 1.600000000e-05
+DEAL::
+DEAL::Testing 2D with point 0.5000010000 0.5000010000 tolerance 0.0001000000000
+DEAL::Cell: 0_4:0333 unit point 1.000016000 1.000016000
+DEAL::Cell: 0_4:1222 unit point 1.600000000e-05 1.000016000
+DEAL::Cell: 0_4:2111 unit point 1.000016000 1.600000000e-05
+DEAL::Cell: 0_4:3000 unit point 1.600000000e-05 1.600000000e-05
+DEAL::
+DEAL::Testing 2D with point 0.4500000000 0.5000000000 tolerance 1.000000000e-12
+DEAL::Cell: 0_4:0333 unit point 0.2000000000 1.000000000
+DEAL::Cell: 0_4:2111 unit point 0.2000000000 0.000000000
+DEAL::
+DEAL::Testing 2D with point 0.4500000000 0.4500000000 tolerance 1.000000000e-12
+DEAL::Cell: 0_4:0333 unit point 0.2000000000 0.2000000000
+DEAL::
+DEAL::Testing 2D with point 0.4500000000 0.4500000000 tolerance 1.000000000e-12
+DEAL::Cell: 0_4:0333 unit point 0.2000000000 0.2000000000
+DEAL::
+DEAL::Testing 2D with point 0.5000000000 0.4500000000 tolerance 1.000000000e-12
+DEAL::Cell: 0_4:0333 unit point 1.000000000 0.2000000000
+DEAL::Cell: 0_4:1222 unit point 0.000000000 0.2000000000
+DEAL::
+DEAL::Testing 2D with point 0.5000000000 0.5000000000 tolerance 1.000000000e-08
+DEAL::Cell: 0_5:03333 unit point 1.000000000 1.000000000
+DEAL::Cell: 0_5:12222 unit point 0.000000000 1.000000000
+DEAL::Cell: 0_5:21111 unit point 1.000000000 0.000000000
+DEAL::Cell: 0_5:30000 unit point 0.000000000 0.000000000
+DEAL::
+DEAL::Testing 2D with point 0.5000010000 0.5000010000 tolerance 1.000000000e-12
+DEAL::Cell: 0_5:30000 unit point 3.200000000e-05 3.200000000e-05
+DEAL::
+DEAL::Testing 2D with point 0.5000010000 0.5000010000 tolerance 0.0001000000000
+DEAL::Cell: 0_5:03333 unit point 1.000032000 1.000032000
+DEAL::Cell: 0_5:12222 unit point 3.200000000e-05 1.000032000
+DEAL::Cell: 0_5:21111 unit point 1.000032000 3.200000000e-05
+DEAL::Cell: 0_5:30000 unit point 3.200000000e-05 3.200000000e-05
+DEAL::
+DEAL::Testing 2D with point 0.4500000000 0.5000000000 tolerance 1.000000000e-12
+DEAL::Cell: 0_5:03332 unit point 0.4000000000 1.000000000
+DEAL::Cell: 0_5:21110 unit point 0.4000000000 0.000000000
+DEAL::
+DEAL::Testing 2D with point 0.4500000000 0.4500000000 tolerance 1.000000000e-12
+DEAL::Cell: 0_5:03330 unit point 0.4000000000 0.4000000000
+DEAL::
+DEAL::Testing 2D with point 0.4500000000 0.4500000000 tolerance 1.000000000e-12
+DEAL::Cell: 0_5:03330 unit point 0.4000000000 0.4000000000
+DEAL::
+DEAL::Testing 2D with point 0.5000000000 0.4500000000 tolerance 1.000000000e-12
+DEAL::Cell: 0_5:03331 unit point 1.000000000 0.4000000000
+DEAL::Cell: 0_5:12220 unit point 0.000000000 0.4000000000
+DEAL::
+DEAL::Testing 3D with point 0.5000000000 0.5000000000 0.5000000000 tolerance 1.000000000e-08
+DEAL::Cell: 0_3:077 unit point 1.000000000 1.000000000 1.000000000
+DEAL::Cell: 0_3:166 unit point 0.000000000 1.000000000 1.000000000
+DEAL::Cell: 0_3:255 unit point 1.000000000 0.000000000 1.000000000
+DEAL::Cell: 0_3:344 unit point 0.000000000 0.000000000 1.000000000
+DEAL::Cell: 0_3:433 unit point 1.000000000 1.000000000 0.000000000
+DEAL::Cell: 0_3:522 unit point 0.000000000 1.000000000 0.000000000
+DEAL::Cell: 0_3:611 unit point 1.000000000 0.000000000 0.000000000
+DEAL::Cell: 0_3:700 unit point 0.000000000 0.000000000 0.000000000
+DEAL::
+DEAL::Testing 3D with point 0.5000010000 0.5000010000 0.5000010000 tolerance 1.000000000e-12
+DEAL::Cell: 0_3:700 unit point 8.000000000e-06 8.000000000e-06 8.000000000e-06
+DEAL::
+DEAL::Testing 3D with point 0.5000010000 0.5000010000 0.5000010000 tolerance 0.0001000000000
+DEAL::Cell: 0_3:077 unit point 1.000008000 1.000008000 1.000008000
+DEAL::Cell: 0_3:166 unit point 8.000000000e-06 1.000008000 1.000008000
+DEAL::Cell: 0_3:255 unit point 1.000008000 8.000000000e-06 1.000008000
+DEAL::Cell: 0_3:344 unit point 8.000000000e-06 8.000000000e-06 1.000008000
+DEAL::Cell: 0_3:433 unit point 1.000008000 1.000008000 8.000000000e-06
+DEAL::Cell: 0_3:522 unit point 8.000000000e-06 1.000008000 8.000000000e-06
+DEAL::Cell: 0_3:611 unit point 1.000008000 8.000000000e-06 8.000000000e-06
+DEAL::Cell: 0_3:700 unit point 8.000000000e-06 8.000000000e-06 8.000000000e-06
+DEAL::
+DEAL::Testing 3D with point 0.4500000000 0.5000000000 0.5000000000 tolerance 1.000000000e-12
+DEAL::Cell: 0_3:077 unit point 0.6000000000 1.000000000 1.000000000
+DEAL::Cell: 0_3:255 unit point 0.6000000000 0.000000000 1.000000000
+DEAL::Cell: 0_3:433 unit point 0.6000000000 1.000000000 0.000000000
+DEAL::Cell: 0_3:611 unit point 0.6000000000 0.000000000 0.000000000
+DEAL::
+DEAL::Testing 3D with point 0.4500000000 0.4500000000 0.5000000000 tolerance 1.000000000e-12
+DEAL::Cell: 0_3:077 unit point 0.6000000000 0.6000000000 1.000000000
+DEAL::Cell: 0_3:433 unit point 0.6000000000 0.6000000000 0.000000000
+DEAL::
+DEAL::Testing 3D with point 0.4500000000 0.5000000000 0.4500000000 tolerance 1.000000000e-12
+DEAL::Cell: 0_3:077 unit point 0.6000000000 1.000000000 0.6000000000
+DEAL::Cell: 0_3:255 unit point 0.6000000000 0.000000000 0.6000000000
+DEAL::
+DEAL::Testing 3D with point 0.4500000000 0.4500000000 0.5000000000 tolerance 1.000000000e-12
+DEAL::Cell: 0_3:077 unit point 0.6000000000 0.6000000000 1.000000000
+DEAL::Cell: 0_3:433 unit point 0.6000000000 0.6000000000 0.000000000
+DEAL::
+DEAL::Testing 3D with point 0.5000000000 0.4500000000 0.5000000000 tolerance 1.000000000e-12
+DEAL::Cell: 0_3:077 unit point 1.000000000 0.6000000000 1.000000000
+DEAL::Cell: 0_3:166 unit point 0.000000000 0.6000000000 1.000000000
+DEAL::Cell: 0_3:433 unit point 1.000000000 0.6000000000 0.000000000
+DEAL::Cell: 0_3:522 unit point 0.000000000 0.6000000000 0.000000000
+DEAL::
+DEAL::Testing 3D with point 0.5000000000 0.4500000000 0.4500000000 tolerance 1.000000000e-12
+DEAL::Cell: 0_3:077 unit point 1.000000000 0.6000000000 0.6000000000
+DEAL::Cell: 0_3:166 unit point 0.000000000 0.6000000000 0.6000000000
+DEAL::
+DEAL::Testing 3D with point 0.4500000000 0.5000000000 0.4500000000 tolerance 1.000000000e-12
+DEAL::Cell: 0_3:077 unit point 0.6000000000 1.000000000 0.6000000000
+DEAL::Cell: 0_3:255 unit point 0.6000000000 0.000000000 0.6000000000
+DEAL::
+DEAL::Testing 3D with point 0.5000000000 0.4500000000 0.4500000000 tolerance 1.000000000e-12
+DEAL::Cell: 0_3:077 unit point 1.000000000 0.6000000000 0.6000000000
+DEAL::Cell: 0_3:166 unit point 0.000000000 0.6000000000 0.6000000000
+DEAL::
+DEAL::Testing 3D with point 0.5000000000 0.5000000000 0.4500000000 tolerance 1.000000000e-12
+DEAL::Cell: 0_3:077 unit point 1.000000000 1.000000000 0.6000000000
+DEAL::Cell: 0_3:166 unit point 0.000000000 1.000000000 0.6000000000
+DEAL::Cell: 0_3:255 unit point 1.000000000 0.000000000 0.6000000000
+DEAL::Cell: 0_3:344 unit point 0.000000000 0.000000000 0.6000000000
+DEAL::