]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Fix a problem in the GMSH reader with type-15 cells (nodes) where we failed to read...
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 5 Nov 2008 19:20:38 +0000 (19:20 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 5 Nov 2008 19:20:38 +0000 (19:20 +0000)
git-svn-id: https://svn.dealii.org/trunk@17477 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/source/grid/grid_in.cc
deal.II/doc/news/changes.h
tests/deal.II/grid_in_msh_02.cc [new file with mode: 0644]
tests/deal.II/grid_in_msh_02/cmp/generic [new file with mode: 0644]
tests/deal.II/grid_in_msh_02/mesh.msh [new file with mode: 0644]

index ad0c805f71af6f47452a2a23a11615d7a1dcfa80..90b9098225a9bb0327a175a2a23a68b0cc349b09 100644 (file)
@@ -802,6 +802,11 @@ void GridIn<dim>::read_msh (std::istream &in)
            if (cell_type == 15)
              {
                                                 // Ignore vertices
+                                                // but read the
+                                                // number of nodes
+                                                // given
+               for (unsigned int i=0; i<nod_num; ++i)
+                 in >> dummy;
              }
            else
                                               // cannot read this
index 0b0fcb4bf23a36b9a32872bfc0757fb90ef97c81..30edd5512cad4ad31f5659f8fd3639a7b6ed8b20 100644 (file)
@@ -152,7 +152,7 @@ inconvenience this causes.
   </p>
   </li>
 
-    <li>
+  <li>
   <p>
   Updated: The version of the <a href="http://www.boost.org/">BOOST</a>
   library that is in the <code>contrib/</code> directory and is used in
@@ -422,6 +422,15 @@ inconvenience this causes.
 <h3>deal.II</h3>
 
 <ol>
+  <li>
+  <p>
+  Fixed: The GridIn::read_msh function had a bug that made it reject
+  MSH input files if they contained type-15 cells with more than one
+  associated vertex.
+  <br>
+  (WB 2008/11/05)
+  </p>
+
   <li>
   <p>
   Fixed: The DoFRenumbering::Cuthill_McKee algorithm had a bug when applied
diff --git a/tests/deal.II/grid_in_msh_02.cc b/tests/deal.II/grid_in_msh_02.cc
new file mode 100644 (file)
index 0000000..17b7020
--- /dev/null
@@ -0,0 +1,70 @@
+//----------------------------  grid_in_msh_02.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2002, 2003, 2004, 2005, 2006, 2008 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.
+//
+//----------------------------  grid_in_msh_02.cc  ---------------------------
+
+// read a file in the MSH format used by the GMSH program. this
+// particular mesh has type-15 cells (nodes) with more than one
+// associated vertex. we failed to read the vertices
+
+#include "../tests.h"
+#include <dofs/dof_handler.h>
+#include <grid/tria.h>
+#include <grid/tria_boundary.h>
+#include <grid/tria_boundary_lib.h>
+#include <grid/tria_accessor.h>
+#include <grid/tria_iterator.h>
+#include <grid/grid_out.h>
+#include <grid/grid_in.h>
+#include <grid/grid_generator.h>
+#include <base/logstream.h>
+
+#include <fstream>
+#include <iomanip>
+#include <string>
+
+std::ofstream logfile("grid_in_msh_02/output");
+
+
+template<int dim>
+void check_file (const std::string name,
+                typename GridIn<dim>::Format format)
+{
+  Triangulation<dim> tria;
+  GridIn<dim> gi;
+  gi.attach_triangulation (tria);
+  gi.read(name, format);
+  deallog << name
+         << '\t' << tria.n_vertices()
+         << '\t' << tria.n_cells()
+         << std::endl;
+
+  GridOut grid_out;
+  grid_out.write_gnuplot (tria, deallog.get_file_stream());
+}
+
+void filename_resolution()
+{
+  check_file<2> (std::string("grid_in_msh_02/mesh"), GridIn<2>::msh);
+}
+
+
+int main ()
+{
+  deallog << std::setprecision (2);
+  logfile << std::setprecision (2);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  filename_resolution();
+}
+
diff --git a/tests/deal.II/grid_in_msh_02/cmp/generic b/tests/deal.II/grid_in_msh_02/cmp/generic
new file mode 100644 (file)
index 0000000..e9630d8
--- /dev/null
@@ -0,0 +1,128 @@
+
+DEAL::grid_in_msh_02/mesh      28      18
+2.0e+03 0.0 0 0
+2.0e+03 6.7e+02 0 0
+1.4e+03 5.0e+02 0 0
+1.5e+03 0.0 0 0
+2.0e+03 0.0 0 0
+
+
+1.5e+03 0.0 0 0
+1.4e+03 5.0e+02 0 0
+9.6e+02 4.0e+02 0 0
+1.0e+03 0.0 0 0
+1.5e+03 0.0 0 0
+
+
+1.0e+03 0.0 0 0
+9.6e+02 4.0e+02 0 0
+5.0e+02 3.3e+02 0 0
+5.0e+02 0.0 0 0
+1.0e+03 0.0 0 0
+
+
+2.0e+03 6.7e+02 0 0
+2.0e+03 1.3e+03 0 0
+1.4e+03 9.6e+02 0 0
+1.4e+03 5.0e+02 0 0
+2.0e+03 6.7e+02 0 0
+
+
+1.4e+03 5.0e+02 0 0
+1.4e+03 9.6e+02 0 0
+9.0e+02 7.8e+02 0 0
+9.6e+02 4.0e+02 0 0
+1.4e+03 5.0e+02 0 0
+
+
+9.6e+02 4.0e+02 0 0
+9.0e+02 7.8e+02 0 0
+5.0e+02 6.7e+02 0 0
+5.0e+02 3.3e+02 0 0
+9.6e+02 4.0e+02 0 0
+
+
+2.0e+03 1.3e+03 0 0
+2.0e+03 2.0e+03 0 0
+1.2e+03 1.3e+03 0 0
+1.4e+03 9.6e+02 0 0
+2.0e+03 1.3e+03 0 0
+
+
+1.4e+03 9.6e+02 0 0
+1.2e+03 1.3e+03 0 0
+7.9e+02 1.1e+03 0 0
+9.0e+02 7.8e+02 0 0
+1.4e+03 9.6e+02 0 0
+
+
+9.0e+02 7.8e+02 0 0
+7.9e+02 1.1e+03 0 0
+5.0e+02 1.0e+03 0 0
+5.0e+02 6.7e+02 0 0
+9.0e+02 7.8e+02 0 0
+
+
+2.0e+03 2.0e+03 0 0
+1.3e+03 2.0e+03 0 0
+8.4e+02 1.6e+03 0 0
+1.2e+03 1.3e+03 0 0
+2.0e+03 2.0e+03 0 0
+
+
+1.2e+03 1.3e+03 0 0
+8.4e+02 1.6e+03 0 0
+6.0e+02 1.4e+03 0 0
+7.9e+02 1.1e+03 0 0
+1.2e+03 1.3e+03 0 0
+
+
+7.9e+02 1.1e+03 0 0
+6.0e+02 1.4e+03 0 0
+4.3e+02 1.2e+03 0 0
+5.0e+02 1.0e+03 0 0
+7.9e+02 1.1e+03 0 0
+
+
+1.3e+03 2.0e+03 0 0
+6.7e+02 2.0e+03 0 0
+4.4e+02 1.8e+03 0 0
+8.4e+02 1.6e+03 0 0
+1.3e+03 2.0e+03 0 0
+
+
+8.4e+02 1.6e+03 0 0
+4.4e+02 1.8e+03 0 0
+3.3e+02 1.6e+03 0 0
+6.0e+02 1.4e+03 0 0
+8.4e+02 1.6e+03 0 0
+
+
+6.0e+02 1.4e+03 0 0
+3.3e+02 1.6e+03 0 0
+2.5e+02 1.4e+03 0 0
+4.3e+02 1.2e+03 0 0
+6.0e+02 1.4e+03 0 0
+
+
+6.7e+02 2.0e+03 0 0
+0.0 2.0e+03 0 0
+0.0 1.8e+03 0 0
+4.4e+02 1.8e+03 0 0
+6.7e+02 2.0e+03 0 0
+
+
+4.4e+02 1.8e+03 0 0
+0.0 1.8e+03 0 0
+0.0 1.7e+03 0 0
+3.3e+02 1.6e+03 0 0
+4.4e+02 1.8e+03 0 0
+
+
+3.3e+02 1.6e+03 0 0
+0.0 1.7e+03 0 0
+0.0 1.5e+03 0 0
+2.5e+02 1.4e+03 0 0
+3.3e+02 1.6e+03 0 0
+
+
diff --git a/tests/deal.II/grid_in_msh_02/mesh.msh b/tests/deal.II/grid_in_msh_02/mesh.msh
new file mode 100644 (file)
index 0000000..7c5fc1f
--- /dev/null
@@ -0,0 +1,78 @@
+$NOD
+29
+1 0 1000 0
+2 500 1000 0
+3 500 0 0
+4 2000 0 0
+5 2000 2000 0
+6 0 2000 0
+7 0 1500 0
+8 249.9999999986911 1433.012701892975 0
+9 433.012701892244 1249.999999999957 0
+10 500 666.6666666667851 0
+11 500 333.3333333332149 0
+12 999.9999999971578 0 0
+13 1499.999999997632 0 0
+14 2000 666.6666666658045 0
+15 2000 1333.333333333021 0
+16 1333.33333333357 2000 0
+17 666.6666666664298 2000 0
+18 0 1833.333333333807 0
+19 0 1666.666666666193 0
+20 1448.855824064164 495.717915423294 0
+21 959.9856402214641 398.3668079907822 0
+22 1351.673876195213 956.2359119432751 0
+23 898.2810558340404 779.8687519422836 0
+24 1160.681109470998 1341.402689062506 0
+25 787.3265082283497 1124.849859227498 0
+26 835.3482117692673 1592.930027561749 0
+27 599.1617013501501 1393.190760419901 0
+28 444.6735536553252 1756.412694406243 0
+29 330.6069773257424 1578.577143704019 0
+$ENDNOD
+$ELM
+43
+1 15 0 1 1 1
+2 15 0 2 1 2
+3 15 0 3 1 3
+4 15 0 4 1 4
+5 15 0 5 1 5
+6 15 0 6 1 6
+7 15 0 7 1 7
+8 1 0 1 2 7 8
+9 1 0 1 2 8 9
+10 1 0 1 2 9 2
+11 1 0 2 2 2 10
+12 1 0 2 2 10 11
+13 1 0 2 2 11 3
+14 1 0 3 2 3 12
+15 1 0 3 2 12 13
+16 1 0 3 2 13 4
+17 1 0 4 2 4 14
+18 1 0 4 2 14 15
+19 1 0 4 2 15 5
+20 1 0 5 2 5 16
+21 1 0 5 2 16 17
+22 1 0 5 2 17 6
+23 1 0 6 2 6 18
+24 1 0 6 2 18 19
+25 1 0 6 2 19 7
+26 3 0 8 4 4 14 20 13
+27 3 0 8 4 13 20 21 12
+28 3 0 8 4 12 21 11 3
+29 3 0 8 4 14 15 22 20
+30 3 0 8 4 20 22 23 21
+31 3 0 8 4 21 23 10 11
+32 3 0 8 4 15 5 24 22
+33 3 0 8 4 22 24 25 23
+34 3 0 8 4 23 25 2 10
+35 3 0 8 4 5 16 26 24
+36 3 0 8 4 24 26 27 25
+37 3 0 8 4 25 27 9 2
+38 3 0 8 4 16 17 28 26
+39 3 0 8 4 26 28 29 27
+40 3 0 8 4 27 29 8 9
+41 3 0 8 4 17 6 18 28
+42 3 0 8 4 28 18 19 29
+43 3 0 8 4 29 19 7 8
+$ENDELM
\ No newline at end of file

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.