From: Martin Kronbichler Date: Mon, 28 May 2018 16:52:31 +0000 (+0200) Subject: Test on a simple geometry. X-Git-Tag: v9.1.0-rc1~1066^2~4 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b25f367df47efde499746a789490c5d34178f13;p=dealii.git Test on a simple geometry. --- diff --git a/tests/grid/find_all_active_cells_around_point_01.cc b/tests/grid/find_all_active_cells_around_point_01.cc new file mode 100644 index 0000000000..c6828adfe5 --- /dev/null +++ b/tests/grid/find_all_active_cells_around_point_01.cc @@ -0,0 +1,94 @@ +// --------------------------------------------------------------------- +// +// 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 +#include + +#include + +#include +#include + +#include "../tests.h" + + + +template +void +print_result(const Mapping & mapping, + const Triangulation &tria, + const Point 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 +void +test(unsigned int n_ref) +{ + Triangulation tria; + GridGenerator::hyper_cube(tria); + tria.refine_global(n_ref); + MappingQGeneric mapping(3); + + Point 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); +} diff --git a/tests/grid/find_all_active_cells_around_point_01.output b/tests/grid/find_all_active_cells_around_point_01.output new file mode 100644 index 0000000000..2f8d92a67a --- /dev/null +++ b/tests/grid/find_all_active_cells_around_point_01.output @@ -0,0 +1,138 @@ + +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::