From: Daniel Arndt Date: Sun, 17 Dec 2017 11:08:29 +0000 (+0100) Subject: Increase stability of gmsh/create_tria_01 X-Git-Tag: v9.0.0-rc1~647^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F5635%2Fhead;p=dealii.git Increase stability of gmsh/create_tria_01 --- diff --git a/tests/gmsh/create_tria_01.cc b/tests/gmsh/create_tria_01.cc index 41ed72b2c8..fb790848c7 100644 --- a/tests/gmsh/create_tria_01.cc +++ b/tests/gmsh/create_tria_01.cc @@ -13,6 +13,28 @@ // format. #include "../tests.h" +#include +#include + +template +void gmsh_grid (const char *name) +{ + Triangulation tria; + GridIn grid_in; + grid_in.attach_triangulation (tria); + std::ifstream input_file(name); + grid_in.read_msh(input_file); + + deallog << " " << tria.n_active_cells() << " active cells" << std::endl; + + int hash = 0; + int index = 0; + for (typename Triangulation::active_cell_iterator c=tria.begin_active(); + c!=tria.end(); ++c, ++index) + for (unsigned int i=0; i::vertices_per_cell; ++i) + hash += (index * i * c->vertex_index(i)) % (tria.n_active_cells()+1); + deallog << " hash=" << hash << std::endl; +} int main () { @@ -21,10 +43,10 @@ int main () geo << "Lx = 25.0;" << std::endl << "Ly = 1.0;" << std::endl - << "Point(1) = {0, 0, 0, 1};" << std::endl - << "Point(2) = {Lx, 0, 0, 1};" << std::endl - << "Point(3) = {Lx, Ly, 0, 1};" << std::endl - << "Point(4) = {0, Ly, 0, 1};" << std::endl + << "Point(1) = {0, 0, 0, Lx};" << std::endl + << "Point(2) = {Lx, 0, 0, Lx};" << std::endl + << "Point(3) = {Lx, Ly, 0, Lx};" << std::endl + << "Point(4) = {0, Ly, 0, Lx};" << std::endl << "Line(1) = {1, 2};" << std::endl << "Line(2) = {2, 3};" << std::endl << "Line(3) = {3, 4};" << std::endl @@ -36,8 +58,9 @@ int main () geo.close(); - std::system(DEAL_II_GMSH_EXECUTABLE_PATH " -2 file.geo 1>file.log 2>file_warn.log"); - + const int ierr = std::system(DEAL_II_GMSH_EXECUTABLE_PATH " -2 file.geo 1>file.log 2>file_warn.log"); + Assert(ierr==0, ExcInternalError()); + gmsh_grid<2>("file.msh"); cat_file("file.msh"); return 0; diff --git a/tests/gmsh/create_tria_01.output b/tests/gmsh/create_tria_01.output index 9233a4400d..053731e3d2 100644 --- a/tests/gmsh/create_tria_01.output +++ b/tests/gmsh/create_tria_01.output @@ -1,69 +1,31 @@ +DEAL:: 2 active cells +DEAL:: hash=2 $MeshFormat 2.2 0 8 $EndMeshFormat $Nodes -22 +6 1 0 0 0 2 25 0 0 3 25 1 0 4 0 1 0 -5 2.499999999990396 0 0 -6 4.999999999978534 0 0 -7 7.499999999965566 0 0 -8 9.999999999960014 0 0 -9 12.49999999995592 0 0 -10 14.99999999995182 0 0 -11 17.49999999995897 0 0 -12 19.99999999997264 0 0 -13 22.49999999998631 0 0 -14 22.50000000001776 1 0 -15 20.00000000003553 1 0 -16 17.50000000005329 1 0 -17 15.00000000006453 1 0 -18 12.50000000006454 1 0 -19 10.00000000006455 1 0 -20 7.500000000053301 1 0 -21 5.000000000035541 1 0 -22 2.500000000017781 1 0 +5 12.49999999995592 0 0 +6 12.50000000006453 1 0 $EndNodes $Elements -36 +12 1 15 2 0 1 1 2 15 2 0 2 2 3 15 2 0 3 3 4 15 2 0 4 4 5 1 2 0 1 1 5 -6 1 2 0 1 5 6 -7 1 2 0 1 6 7 -8 1 2 0 1 7 8 -9 1 2 0 1 8 9 -10 1 2 0 1 9 10 -11 1 2 0 1 10 11 -12 1 2 0 1 11 12 -13 1 2 0 1 12 13 -14 1 2 0 1 13 2 -15 1 2 0 2 2 3 -16 1 2 0 3 3 14 -17 1 2 0 3 14 15 -18 1 2 0 3 15 16 -19 1 2 0 3 16 17 -20 1 2 0 3 17 18 -21 1 2 0 3 18 19 -22 1 2 0 3 19 20 -23 1 2 0 3 20 21 -24 1 2 0 3 21 22 -25 1 2 0 3 22 4 -26 1 2 0 4 4 1 -27 3 2 0 0 3 14 13 2 -28 3 2 0 0 14 15 12 13 -29 3 2 0 0 15 16 11 12 -30 3 2 0 0 16 17 10 11 -31 3 2 0 0 17 18 9 10 -32 3 2 0 0 18 19 8 9 -33 3 2 0 0 19 20 7 8 -34 3 2 0 0 20 21 6 7 -35 3 2 0 0 21 22 5 6 -36 3 2 0 0 22 4 1 5 +6 1 2 0 1 5 2 +7 1 2 0 2 2 3 +8 1 2 0 3 3 6 +9 1 2 0 3 6 4 +10 1 2 0 4 4 1 +11 3 2 0 0 3 6 5 2 +12 3 2 0 0 6 4 1 5 $EndElements