From 6382afc9f8f5d2e7d3e03e0df243876ec4aa3eb4 Mon Sep 17 00:00:00 2001 From: heister Date: Tue, 3 Jul 2012 22:12:54 +0000 Subject: [PATCH] add failing test for transform_real_to_unit_cell git-svn-id: https://svn.dealii.org/trunk@25670 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/fe/mapping_real_to_unit_02.cc | 149 +++++++++++++++++++ tests/fe/mapping_real_to_unit_02/cmp/generic | 43 ++++++ 2 files changed, 192 insertions(+) create mode 100644 tests/fe/mapping_real_to_unit_02.cc create mode 100644 tests/fe/mapping_real_to_unit_02/cmp/generic diff --git a/tests/fe/mapping_real_to_unit_02.cc b/tests/fe/mapping_real_to_unit_02.cc new file mode 100644 index 0000000000..ff1bb4ccc1 --- /dev/null +++ b/tests/fe/mapping_real_to_unit_02.cc @@ -0,0 +1,149 @@ +//----------------------------------------------------------------------------- +// $Id: mapping_real_to_unit_q1.cc 25655 2012-06-27 21:40:00Z bangerth $ +// Version: $Name$ +// +// Copyright (C) 2006, 2007, 2010, 2012 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. +// +//----------------------------------------------------------------------------- + +/* + + reduced failing test. Original exception in transform_real_to_unit_cell: + +#0 0x00007fffeec931a0 in __cxa_throw () from /usr/lib64/libstdc++.so.6 +#1 0x00007ffff5215d60 in dealii::deal_II_exceptions::internals::issue_error_throw::ExcTransformationFailed> ( + file=0x7ffff6b47ce8 "/w/kwang/kwang/deal.II/source/fe/mapping_q1.cc", line=1803, + function=0x7ffff6b54e80 "dealii::Point dealii::MappingQ1::transform_real_to_unit_cell_internal(const typename dealii::Triangulation::cell_iterator&, const dealii::Point&, c"..., cond=0x7ffff6b47b3d "false", + exc_name=0x7ffff6b47fd8 "(typename Mapping::ExcTransformationFailed())", e=...) + at /w/kwang/kwang/deal.II/include/deal.II/base/exceptions.h:304 +#2 0x00007ffff5201d5f in dealii::MappingQ1<2, 2>::transform_real_to_unit_cell_internal (this=0x7ffff7dd8160, cell={ + triangulation = 0x7fffffffd2b0, + level = 1, + index = 4 +}, p={-0.27999999999999992, -0.62999999999999989}, initial_p_unit={1.4871340295728577, -0.21318360089489402}, mdata=...) + at /w/kwang/kwang/deal.II/source/fe/mapping_q1.cc:1803 +#3 0x00007ffff51ff24a in dealii::MappingQ1<2, 2>::transform_real_to_unit_cell (this=0x7ffff7dd8160, cell={ + triangulation = 0x7fffffffd2b0, + level = 1, + index = 4 +}, p={-0.27999999999999992, -0.62999999999999989}) at /w/kwang/kwang/deal.II/source/fe/mapping_q1.cc:1683 +#4 0x00007ffff4037ea2 in dealii::Functions::FEFieldFunction<2, dealii::DoFHandler<2, 2>, dealii::Vector >::compute_point_locations (this=0x7fffffffcc80, points=..., cells=..., qpoints=..., maps=...) + at /w/kwang/kwang/deal.II/include/deal.II/numerics/fe_field_function.templates.h:443 +#5 0x00007ffff4035808 in dealii::Functions::FEFieldFunction<2, dealii::DoFHandler<2, 2>, dealii::Vector >::vector_value_list (this=0x7fffffffcc80, points=..., values=...) at /w/kwang/kwang/deal.II/include/deal.II/numerics/fe_field_function.templates.h:208 +#6 0x00007ffff40355e5 in dealii::Functions::FEFieldFunction<2, dealii::DoFHandler<2, 2>, dealii::Vector >::value_list ( + this=0x7fffffffcc80, points=..., values=..., component=0) + at /w/kwang/kwang/deal.II/include/deal.II/numerics/fe_field_function.templates.h:246 +#7 0x0000000000450fd5 in Step6<2>::compute_measure (this=0x7fffffffd2b0) at step-6.cc:627 +#8 0x000000000045874c in Step6<2>::run (this=0x7fffffffd2b0) at step-6.cc:705 +#9 0x000000000045127f in main () at step-6.cc:728 + + + Note that test() only looks at the one cell that causes the failure. + +test2() is the original code using FEFieldFunction. Note that it depends on the contents of the points in the value_list (see comments). + + */ + +#include "../tests.h" + +#include +#include +#include +#include +#include +#include +#include + + +template +void test() +{ + const HyperBallBoundary boundary_description; + + Triangulation triangulation; + GridGenerator::hyper_ball (triangulation); + triangulation.set_boundary (0, boundary_description); + triangulation.refine_global (1); + MappingQ1< dim > mapping; + + + Point p(-0.27999999999999992, -0.62999999999999989); + typename Triangulation::active_cell_iterator cell; + + for (cell = triangulation.begin_active(); + cell != triangulation.end(); cell++) + { + if (cell->level()==1 && cell->index()==4) + mapping.transform_real_to_unit_cell(cell, p); + + + } + + triangulation.set_boundary (0); + + deallog << "OK" << std::endl; +} + + +template +void test2() +{ + const HyperBallBoundary boundary_description; + + Triangulation triangulation; + GridGenerator::hyper_ball (triangulation); + triangulation.set_boundary (0, boundary_description); + triangulation.refine_global (1); + MappingQ1< dim > mapping; + + + Point p(-0.27999999999999992, -0.62999999999999989); + + FE_Q fe(2); + DoFHandler dof_handler(triangulation); + dof_handler.distribute_dofs(fe); + + Vector solution(dof_handler.n_dofs()); + Functions::FEFieldFunction<2> fe_function (dof_handler, solution); + fe_function.value (p); //this works <<<<<<<<<<< + + std::vector > points(19*19); + std::vector m (19*19); + + if (1) //works if changed to "if (0)" <<<<<<<<< + for (unsigned int i = 0; i < 19; i++) + for (unsigned int j = 0; j < 19; j++) + { /// all points are inside + points[19*i+j] (0) = -0.7 + (i + 1) * .07; + points[19*i+j] (1) = -0.7 + (j + 1) * .07; + } + points[95]=p; + fe_function.value_list (points, m); // <<<< this fails at point[95] but only if the other points are filled in?! + + triangulation.set_boundary (0); + + deallog << "OK" << std::endl; +} + + +int +main() +{ + std::ofstream logfile ("mapping_real_to_unit_02/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + test<2>(); + test2<2>(); + + return 0; +} + + + diff --git a/tests/fe/mapping_real_to_unit_02/cmp/generic b/tests/fe/mapping_real_to_unit_02/cmp/generic new file mode 100644 index 0000000000..c68c1fb460 --- /dev/null +++ b/tests/fe/mapping_real_to_unit_02/cmp/generic @@ -0,0 +1,43 @@ + +DEAL::dim=1, spacedim=1 +DEAL::Vertex displacement: 0.00000 +DEAL::Vertex displacement: 0.0800000 +DEAL::Vertex displacement: 0.160000 +DEAL::Vertex displacement: 0.240000 +DEAL::Vertex displacement: 0.320000 +DEAL::OK +DEAL::dim=2, spacedim=2 +DEAL::Vertex displacement: 0.00000 0.00000 +DEAL::Vertex displacement: 0.0800000 0.0800000 +DEAL::Vertex displacement: 0.160000 0.160000 +DEAL::Vertex displacement: 0.240000 0.240000 +DEAL::Vertex displacement: 0.320000 0.320000 +DEAL::OK +DEAL::dim=3, spacedim=3 +DEAL::Vertex displacement: 0.00000 0.00000 0.00000 +DEAL::Vertex displacement: 0.0800000 0.0800000 0.0800000 +DEAL::Vertex displacement: 0.160000 0.160000 0.160000 +DEAL::Vertex displacement: 0.240000 0.240000 0.240000 +DEAL::Vertex displacement: 0.320000 0.320000 0.320000 +DEAL::OK +DEAL::dim=1, spacedim=2 +DEAL::Vertex displacement: 0.00000 0.00000 +DEAL::Vertex displacement: 0.0800000 0.0800000 +DEAL::Vertex displacement: 0.160000 0.160000 +DEAL::Vertex displacement: 0.240000 0.240000 +DEAL::Vertex displacement: 0.320000 0.320000 +DEAL::OK +DEAL::dim=1, spacedim=3 +DEAL::Vertex displacement: 0.00000 0.00000 0.00000 +DEAL::Vertex displacement: 0.0800000 0.0800000 0.0800000 +DEAL::Vertex displacement: 0.160000 0.160000 0.160000 +DEAL::Vertex displacement: 0.240000 0.240000 0.240000 +DEAL::Vertex displacement: 0.320000 0.320000 0.320000 +DEAL::OK +DEAL::dim=2, spacedim=3 +DEAL::Vertex displacement: 0.00000 0.00000 0.00000 +DEAL::Vertex displacement: 0.0800000 0.0800000 0.0800000 +DEAL::Vertex displacement: 0.160000 0.160000 0.160000 +DEAL::Vertex displacement: 0.240000 0.240000 0.240000 +DEAL::Vertex displacement: 0.320000 0.320000 0.320000 +DEAL::OK -- 2.39.5