From d652abdb7c95418c68dea47c83eccc1e38ec6522 Mon Sep 17 00:00:00 2001 From: heister Date: Fri, 11 Apr 2014 11:40:23 +0000 Subject: [PATCH] add failing test git-svn-id: https://svn.dealii.org/trunk@32762 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/bits/find_cell_12.cc | 105 +++++++++++++++++++++++++++++++++ tests/bits/find_cell_12.output | 3 + 2 files changed, 108 insertions(+) create mode 100644 tests/bits/find_cell_12.cc create mode 100644 tests/bits/find_cell_12.output diff --git a/tests/bits/find_cell_12.cc b/tests/bits/find_cell_12.cc new file mode 100644 index 0000000000..cc8ee77dfc --- /dev/null +++ b/tests/bits/find_cell_12.cc @@ -0,0 +1,105 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 2003 - 2013 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_active_cell_around_point goes into an endless loop, reported +// on the mailing list by Giorgos Kourakos (2014-04-10). + +#include "../tests.h" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include +#include +#include +#include +#include +#include + +using namespace dealii; + +void test() +{ + Triangulation<2> triangulation; + + Point<2> left_bottom(0,-270); + Point<2> right_top(5000,30); + std::vector n_cells; + n_cells.push_back(10); + n_cells.push_back(2); + + + GridGenerator::subdivided_hyper_rectangle(triangulation, + n_cells, + left_bottom, + right_top, + true); + + typename Triangulation<2>::active_cell_iterator + cell = triangulation.begin_active(), + endc = triangulation.end(); + for (; cell!=endc; ++cell){ + Point<2> cell_center = cell->center(); + if (abs(cell_center(0) - 1500) < 550){ + cell->set_refine_flag (); + } + } + + triangulation.execute_coarsening_and_refinement (); + + Point<2> test_point(250, 195); + std::cout << "Checking Point " << test_point << std::endl; + try + { + std::pair::active_cell_iterator, Point<2> > current_cell = + GridTools::find_active_cell_around_point(MappingQ1<2>(), triangulation, test_point); + + deallog << "cell: index = " << current_cell.first->index() + << " level = " << current_cell.first->level() << std::endl; + deallog << " pos: " << current_cell.second << std::endl; + } + catch (GridTools::ExcPointNotFound<2> &e) + { + deallog << "outside" << std::endl; + } + deallog << "done" << std::endl; +} + +int main (int argc, char **argv) +{ + initlog(); + + test(); + + return 0; +} diff --git a/tests/bits/find_cell_12.output b/tests/bits/find_cell_12.output new file mode 100644 index 0000000000..9ae336e2b7 --- /dev/null +++ b/tests/bits/find_cell_12.output @@ -0,0 +1,3 @@ + +DEAL::outside +DEAL::done -- 2.39.5