From: goll Date: Tue, 17 Jul 2012 09:19:21 +0000 (+0000) Subject: New test for find_active_cell_around_point. At the time of writing, this test fails... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c9625156d0b6e66baa6d5d3d97f09271f0f994d5;p=dealii-svn.git New test for find_active_cell_around_point. At the time of writing, this test fails, but the problem is identified and worked on. git-svn-id: https://svn.dealii.org/trunk@25705 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/bits/find_cell_8.cc b/tests/bits/find_cell_8.cc new file mode 100644 index 0000000000..b5c9525803 --- /dev/null +++ b/tests/bits/find_cell_8.cc @@ -0,0 +1,103 @@ +//---------------------------- find_cell_8.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2003, 2004, 2005 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. +// +//---------------------------- find_cell_8.cc --------------------------- + + +// take a 2d mesh and check that we can find an arbitrary point's cell +// in it. We consider a special triangulation, where the point p does not lie +// in a cell adjacent to the vertex with minimal distance to p. The test should +// fail for all revisions <= 25704M. + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include + +#include + +void create_coarse_grid(Triangulation<2>& coarse_grid) +{ + + static const Point<2> vertices_1[] + = { Point<2> (0., 0.),//0 + Point<2> (1., 0.),//1 + Point<2> (1., 1.),//2 + Point<2> (0., 1.),//3 + Point<2> (1.3, 0.),//4 + Point<2> (1.3, 1./2.),//5 + }; + const unsigned int + n_vertices = sizeof(vertices_1) / sizeof(vertices_1[0]); + + const std::vector > vertices (&vertices_1[0], + &vertices_1[n_vertices]); + + static const int cell_vertices[][GeometryInfo<2>::vertices_per_cell] + = {{0, 1, 3, 2}, + {1, 4, 2, 5}, + }; + const unsigned int + n_cells = sizeof(cell_vertices) / sizeof(cell_vertices[0]); + + std::vector > cells (n_cells, CellData<2>()); + for (unsigned int i=0; i::vertices_per_cell; + ++j) + cells[i].vertices[j] = cell_vertices[i][j]; + cells[i].material_id = 0; + } + + coarse_grid.create_triangulation (vertices, + cells, + SubCellData()); +} + + +void check (Triangulation<2> &tria) +{ + Point<2> p (0.99, 1./2.); + + Triangulation<2>::active_cell_iterator cell + = GridTools::find_active_cell_around_point (tria, p); + + deallog << cell << std::endl; + for (unsigned int v=0; v::vertices_per_cell; ++v) + deallog << "<" << cell->vertex(v) << "> "; + deallog << std::endl; + + Assert (p.distance (cell->center()) < cell->diameter()/2, + ExcInternalError()); +} + + +int main () +{ + std::ofstream logfile("find_cell_8/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + { + Triangulation<2> coarse_grid; + create_coarse_grid(coarse_grid); + check (coarse_grid); + } +} + + + diff --git a/tests/bits/find_cell_8/cmp/generic b/tests/bits/find_cell_8/cmp/generic new file mode 100644 index 0000000000..2cf448db5a --- /dev/null +++ b/tests/bits/find_cell_8/cmp/generic @@ -0,0 +1,5 @@ + +DEAL::2.3 +DEAL::<0.250000 0.250000> <0.500000 0.250000> <0.250000 0.500000> <0.500000 0.500000> +DEAL::2.78 +DEAL::<0.250000 0.573223> <0.198223 0.433058> <0.500000 0.500000> <0.396447 0.396447>