From: bangerth Date: Wed, 4 Jul 2012 14:01:27 +0000 (+0000) Subject: New test. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=adab67c7beddeed9f883d35499387facec24e396;p=dealii-svn.git New test. git-svn-id: https://svn.dealii.org/trunk@25684 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/bits/find_cell_6.cc b/tests/bits/find_cell_6.cc index ea10481828..0efe9ed306 100644 --- a/tests/bits/find_cell_6.cc +++ b/tests/bits/find_cell_6.cc @@ -1,6 +1,6 @@ -//---------------------------- find_cell_5.cc --------------------------- +//---------------------------- find_cell_6.cc --------------------------- // $Id: find_cell_5.cc 25229 2012-03-09 18:34:59Z pauletti $ -// Version: $Name$ +// Version: $Name$ // // Copyright (C) 2003, 2004, 2005, 2006, 2012 by the deal.II authors // @@ -9,7 +9,7 @@ // to the file deal.II/doc/license.html for the text and // further information on this license. // -//---------------------------- find_cell_5.cc --------------------------- +//---------------------------- find_cell_6.cc --------------------------- // find_active_cell_around_point() stops working if some cells are refined in 3d. // this is caused by a bug in GridTools::find_cells_adjacent_to_vertex that got fixed in r 25562. @@ -30,7 +30,7 @@ bool inside(Triangulation<3> &tria, Point<3> &p) { - + for(Triangulation<3>::cell_iterator cell = tria.begin(0); cell != tria.end(0); ++cell) if( cell->point_inside (p) ) @@ -55,7 +55,7 @@ void check2 () for (Triangulation<3>::active_cell_iterator cell = tria.begin_active(); cell!=tria.end(); ++cell, ++idx) { if (idx==21) - cell->set_refine_flag(); + cell->set_refine_flag(); } tria.execute_coarsening_and_refinement (); @@ -89,10 +89,10 @@ void check1 () } tria.execute_coarsening_and_refinement(); - } + } } -int main () +int main () { std::ofstream logfile("find_cell_6/output"); deallog.attach(logfile); @@ -112,5 +112,5 @@ int main () } } - - + + diff --git a/tests/bits/find_cell_7.cc b/tests/bits/find_cell_7.cc new file mode 100644 index 0000000000..ff82f85952 --- /dev/null +++ b/tests/bits/find_cell_7.cc @@ -0,0 +1,105 @@ +//---------------------------- find_cell_7.cc --------------------------- +// $Id: find_cell_5.cc 25229 2012-03-09 18:34:59Z pauletti $ +// Version: $Name$ +// +// Copyright (C) 2003, 2004, 2005, 2006, 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. +// +//---------------------------- find_cell_7.cc --------------------------- + +// find_active_cell_around_point() stops working if some cells are +// refined in 3d. this is caused by a bug in +// GridTools::find_cells_adjacent_to_vertex that got fixed in r 25562. +// +// the bug here is the same as in find_cell_6 but when calling the +// function with hp:: arguments + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +bool inside(Triangulation<3> &tria, Point<3> &p) +{ + + for(Triangulation<3>::cell_iterator cell = tria.begin(0); + cell != tria.end(0); ++cell) + if( cell->point_inside (p) ) + return true; + + return false; +} + +void check2 () +{ + Triangulation<3> tria; + GridIn<3> gridIn; + gridIn.attach_triangulation (tria); + std::ifstream inputFile("find_cell_7/grid.inp"); + gridIn.read_ucd (inputFile); + + Point<3> p2(304.767,-57.0113,254.766); + + int idx=0; + for (Triangulation<3>::active_cell_iterator cell = tria.begin_active(); cell!=tria.end(); ++cell, ++idx) + { + if (idx==21) + cell->set_refine_flag(); + } + tria.execute_coarsening_and_refinement (); + + deallog << inside(tria, p2) << std::endl; + + hp::MappingCollection<3> mappings; + mappings.push_back (MappingQ1<3>()); + mappings.push_back (MappingQ1<3>()); + + hp::FECollection<3> fes; + fes.push_back (FE_Q<3>(1)); + fes.push_back (FE_Q<3>(1)); + + hp::DoFHandler<3> dof_handler (tria); + dof_handler.distribute_dofs (fes); + + GridTools::find_active_cell_around_point(mappings, dof_handler, p2); //triggered exception +} + + +int main () +{ + std::ofstream logfile("find_cell_7/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + try + { + check2(); + } + catch (const std::exception &exc) + { + // we shouldn't get here... + deallog << "Caught an error..." << std::endl; + deallog << exc.what() << std::endl; + } +} + + + diff --git a/tests/bits/find_cell_7/cmp/generic b/tests/bits/find_cell_7/cmp/generic new file mode 100644 index 0000000000..8c57f5ac65 --- /dev/null +++ b/tests/bits/find_cell_7/cmp/generic @@ -0,0 +1,2 @@ + +DEAL::1 diff --git a/tests/bits/find_cell_7/grid.inp b/tests/bits/find_cell_7/grid.inp new file mode 100644 index 0000000000..7874765f7d --- /dev/null +++ b/tests/bits/find_cell_7/grid.inp @@ -0,0 +1,146 @@ +# sixD mesh generator, version 1 +# omit element on surface: 1 +# nodes: x: 6 y: 4 z: 4 total: 96 +# elements: x: 5 y: 3 z: 3 total: 44 +# size: first corner: (-1000;-500;0) second corner: (1150;650;650) +96 44 0 0 0 +1 -1000 -500 0 +2 -500 -500 0 +3 -6.10352e-05 -500 0 +4 150 -500 0 +5 650 -500 0 +6 1150 -500 0 +7 -1000 0 0 +8 -500 0 0 +9 -6.10352e-05 0 0 +10 150 0 0 +11 650 0 0 +12 1150 0 0 +13 -1000 150 0 +14 -500 150 0 +15 -6.10352e-05 150 0 +16 150 150 0 +17 650 150 0 +18 1150 150 0 +19 -1000 650 0 +20 -500 650 0 +21 -6.10352e-05 650 0 +22 150 650 0 +23 650 650 0 +24 1150 650 0 +25 -1000 -500 150 +26 -500 -500 150 +27 -6.10352e-05 -500 150 +28 150 -500 150 +29 650 -500 150 +30 1150 -500 150 +31 -1000 0 150 +32 -500 0 150 +33 -6.10352e-05 0 150 +34 150 0 150 +35 650 0 150 +36 1150 0 150 +37 -1000 150 150 +38 -500 150 150 +39 -6.10352e-05 150 150 +40 150 150 150 +41 650 150 150 +42 1150 150 150 +43 -1000 650 150 +44 -500 650 150 +45 -6.10352e-05 650 150 +46 150 650 150 +47 650 650 150 +48 1150 650 150 +49 -1000 -500 400 +50 -500 -500 400 +51 -6.10352e-05 -500 400 +52 150 -500 400 +53 650 -500 400 +54 1150 -500 400 +55 -1000 0 400 +56 -500 0 400 +57 -6.10352e-05 0 400 +58 150 0 400 +59 650 0 400 +60 1150 0 400 +61 -1000 150 400 +62 -500 150 400 +63 -6.10352e-05 150 400 +64 150 150 400 +65 650 150 400 +66 1150 150 400 +67 -1000 650 400 +68 -500 650 400 +69 -6.10352e-05 650 400 +70 150 650 400 +71 650 650 400 +72 1150 650 400 +73 -1000 -500 650 +74 -500 -500 650 +75 -6.10352e-05 -500 650 +76 150 -500 650 +77 650 -500 650 +78 1150 -500 650 +79 -1000 0 650 +80 -500 0 650 +81 -6.10352e-05 0 650 +82 150 0 650 +83 650 0 650 +84 1150 0 650 +85 -1000 150 650 +86 -500 150 650 +87 -6.10352e-05 150 650 +88 150 150 650 +89 650 150 650 +90 1150 150 650 +91 -1000 650 650 +92 -500 650 650 +93 -6.10352e-05 650 650 +94 150 650 650 +95 650 650 650 +96 1150 650 650 +1 0 hex 1 2 8 7 25 26 32 31 +2 0 hex 2 3 9 8 26 27 33 32 +3 0 hex 3 4 10 9 27 28 34 33 +4 0 hex 4 5 11 10 28 29 35 34 +5 0 hex 5 6 12 11 29 30 36 35 +6 0 hex 7 8 14 13 31 32 38 37 +7 0 hex 8 9 15 14 32 33 39 38 +8 0 hex 10 11 17 16 34 35 41 40 +9 0 hex 11 12 18 17 35 36 42 41 +10 0 hex 13 14 20 19 37 38 44 43 +11 0 hex 14 15 21 20 38 39 45 44 +12 0 hex 15 16 22 21 39 40 46 45 +13 0 hex 16 17 23 22 40 41 47 46 +14 0 hex 17 18 24 23 41 42 48 47 +15 0 hex 25 26 32 31 49 50 56 55 +16 0 hex 26 27 33 32 50 51 57 56 +17 0 hex 27 28 34 33 51 52 58 57 +18 0 hex 28 29 35 34 52 53 59 58 +19 0 hex 29 30 36 35 53 54 60 59 +20 0 hex 31 32 38 37 55 56 62 61 +21 0 hex 32 33 39 38 56 57 63 62 +22 0 hex 33 34 40 39 57 58 64 63 +23 0 hex 34 35 41 40 58 59 65 64 +24 0 hex 35 36 42 41 59 60 66 65 +25 0 hex 37 38 44 43 61 62 68 67 +26 0 hex 38 39 45 44 62 63 69 68 +27 0 hex 39 40 46 45 63 64 70 69 +28 0 hex 40 41 47 46 64 65 71 70 +29 0 hex 41 42 48 47 65 66 72 71 +30 0 hex 49 50 56 55 73 74 80 79 +31 0 hex 50 51 57 56 74 75 81 80 +32 0 hex 51 52 58 57 75 76 82 81 +33 0 hex 52 53 59 58 76 77 83 82 +34 0 hex 53 54 60 59 77 78 84 83 +35 0 hex 55 56 62 61 79 80 86 85 +36 0 hex 56 57 63 62 80 81 87 86 +37 0 hex 57 58 64 63 81 82 88 87 +38 0 hex 58 59 65 64 82 83 89 88 +39 0 hex 59 60 66 65 83 84 90 89 +40 0 hex 61 62 68 67 85 86 92 91 +41 0 hex 62 63 69 68 86 87 93 92 +42 0 hex 63 64 70 69 87 88 94 93 +43 0 hex 64 65 71 70 88 89 95 94 +44 0 hex 65 66 72 71 89 90 96 95