From 94e2f3b5eab0c1c1531c08ad57be606daba4c26b Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Tue, 12 Nov 2013 16:06:11 +0000 Subject: [PATCH] simplify test find_cell_10 git-svn-id: https://svn.dealii.org/trunk@31636 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/bits/find_cell_10a.cc | 122 ++++++++++++++++++++++++++ tests/bits/find_cell_10a.debug.output | 16 ++++ 2 files changed, 138 insertions(+) create mode 100644 tests/bits/find_cell_10a.cc create mode 100644 tests/bits/find_cell_10a.debug.output diff --git a/tests/bits/find_cell_10a.cc b/tests/bits/find_cell_10a.cc new file mode 100644 index 0000000000..4412b5932d --- /dev/null +++ b/tests/bits/find_cell_10a.cc @@ -0,0 +1,122 @@ +// --------------------------------------------------------------------- +// $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. +// +// --------------------------------------------------------------------- + + + +// transform_real_to_unit_cell works for MappingQ(1) but fails for MappingQ1. + +#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 create_coarse_grid(Triangulation<2> &coarse_grid) +{ + + static const Point<2> vertices_1[] + = { Point<2> (9.6982181981258408e-02, 1.1255621492491609e+03),//0 + Point<2> (6.1219285295807092e-02, 1.1256062663438720e+03),//1 + Point<2> (0.00000, 1.1255179557007179e+03),//2 + Point<2> (0.00000, 1.1255994426210491e+03),//3 + }; + 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, 2, 3} + }; + 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 test() +{ + deallog << std::scientific; + deallog.precision(16); + + Point< 2 > ePos; + ePos(0) = 0.0653630060373507487669897386695; + ePos(1) = 1125.59175030825804242340382189; + + MappingQ<2> mapping(1); + MappingQ1<2> &mapping2 = StaticMappingQ1< 2 >::mapping; + + Triangulation<2> triangulation; + create_coarse_grid(triangulation); // first Tria with just one cell + + Triangulation<2>::active_cell_iterator it = triangulation.begin(); + + Point<2> p; + p = mapping.transform_real_to_unit_cell(it, ePos); + deallog << "A: " << p << std::endl; + + // throws: + p = mapping2.transform_real_to_unit_cell(it, ePos); + deallog << "B: " << p << std::endl; + + deallog << "done" << std::endl; +} + +int main (int argc, char **argv) +{ + initlog(); + + test(); + + return 0; +} diff --git a/tests/bits/find_cell_10a.debug.output b/tests/bits/find_cell_10a.debug.output new file mode 100644 index 0000000000..d6d313c0bd --- /dev/null +++ b/tests/bits/find_cell_10a.debug.output @@ -0,0 +1,16 @@ + +DEAL::cells 31242 +DEAL::1: +DEAL::cell 27707 +DEAL::vertex 20297 +DEAL::0.0969822 1125.56 +DEAL::vertex 30988 +DEAL::0.0612193 1125.61 +DEAL::vertex 1298 +DEAL::0.00000 1125.52 +DEAL::vertex 1297 +DEAL::0.00000 1125.60 +DEAL::point 0.706650 0.0885132 +DEAL::1b: +DEAL::2: +DEAL::done -- 2.39.5