]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Added assertion in reading msh file to check that a number of cells != 0 is actually...
authorLuca Heltai <luca.heltai@sissa.it>
Tue, 28 Jul 2009 14:48:25 +0000 (14:48 +0000)
committerLuca Heltai <luca.heltai@sissa.it>
Tue, 28 Jul 2009 14:48:25 +0000 (14:48 +0000)
git-svn-id: https://svn.dealii.org/trunk@19126 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/grid/grid_in.h
deal.II/deal.II/source/grid/grid_in.cc

index 544a79e972235894cff4dd302121e7bd8779fe67..729ab09361b2c8a5a289445f017c6889809cfffe 100644 (file)
@@ -433,6 +433,9 @@ class GridIn
                    << "3 Quadrilateral (4 nodes, 4 edges).\n"
                    << "5 Hexahedron (8 nodes, 12 edges, 6 faces).\n"
                    << "15 Point (1 node, ignored when read)");
+
+    
+    DeclException0 (ExcGmshNoCellInformation);
   protected:
                                     /**
                                      * Store address of the triangulation to
index ce76598a9658e7433f22cee3eef48a7d6e7e967a..d976f337ecffad1c0e736b2dd640d04919899683 100644 (file)
@@ -583,7 +583,8 @@ void GridIn<dim, spacedim>::read_msh (std::istream &in)
 
       in >> version >> file_type >> data_size;
 
-      Assert (version == 2.0, ExcNotImplemented());
+      Assert ( (version >= 2.0) &&
+              (version <= 2.1), ExcNotImplemented());
       Assert (file_type == 0, ExcNotImplemented());
       Assert (data_size == sizeof(double), ExcNotImplemented());
 
@@ -637,6 +638,7 @@ void GridIn<dim, spacedim>::read_msh (std::istream &in)
               ExcInvalidGMSHInput(line));
 
   in >> n_cells;
+  
                                   // set up array of cells
   std::vector<CellData<dim> > cells;
   SubCellData                 subcelldata;
@@ -842,7 +844,12 @@ void GridIn<dim, spacedim>::read_msh (std::istream &in)
 
   AssertThrow (in, ExcIO());
 
-                                  // do some clean-up on vertices...
+                                  // check that we actually read some
+                                  // cells.
+  AssertThrow(cells.size() > 0, ExcGmshNoCellInformation());
+  
+                                  // do some clean-up on
+                                  // vertices...
   GridTools::delete_unused_vertices (vertices, cells, subcelldata);
                                   // ... and cells
   if(dim==spacedim)

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.