]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Instantiate GridIn<1,3>. 1432/head
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 25 Aug 2015 20:37:52 +0000 (15:37 -0500)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 25 Aug 2015 21:14:23 +0000 (16:14 -0500)
doc/news/changes.h
source/grid/grid_in.cc
source/grid/grid_in.inst.in
tests/deal.II/grid_in_msh_02_13.cc [new file with mode: 0644]
tests/deal.II/grid_in_msh_02_13.output [new file with mode: 0644]

index c3f7f5cff3407694f14de8e96893e24ea9c7cbf6..1539acbc24dca12168fc8a56d0a1d7cdd5670431 100644 (file)
@@ -108,6 +108,12 @@ inconvenience this causes.
 
 
 <ol>
+  <li> Fixed: The GridIn class was not instantiated for the
+  <code>dim==1,spacedim==3</code> case. This is now fixed.
+  <br>
+  (Wolfgang Bangerth, 2015/08/25)
+  </li>
+
   <li> Fixed: In 1d, GridIn::read_msh() ignored boundary indicators
   associated with vertices. This is now fixed.
   <br>
index 29c131f0fa4921cbc022c1006783bb79c5d15b76..d56518ed561c28bb3339710907ca839a47597c01 100644 (file)
@@ -1570,6 +1570,13 @@ void GridIn<1,2>::read_netcdf (const std::string &)
 }
 
 
+template <>
+void GridIn<1,3>::read_netcdf (const std::string &)
+{
+  AssertThrow(false, ExcImpossibleInDim(1));
+}
+
+
 template <>
 void GridIn<2, 3>::read_netcdf (const std::string &)
 {
index 141391f7cd7578f88372eddf36fd631de478b6c5..40efc0e120d4e5f76e773171dee1392dc7d04ad8 100644 (file)
 // ---------------------------------------------------------------------
 
 
-for (deal_II_dimension : DIMENSIONS)
+for (deal_II_dimension, deal_II_space_dimension : DIMENSIONS)
   {
-    template class GridIn<deal_II_dimension>;
-
-#if deal_II_dimension != 3
-    template class GridIn<deal_II_dimension, deal_II_dimension+1>;
+#if deal_II_dimension <= deal_II_space_dimension
+    template class GridIn<deal_II_dimension, deal_II_space_dimension>;
 #endif
   }
 
diff --git a/tests/deal.II/grid_in_msh_02_13.cc b/tests/deal.II/grid_in_msh_02_13.cc
new file mode 100644 (file)
index 0000000..57d9004
--- /dev/null
@@ -0,0 +1,77 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2002 - 2015 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+
+// in 1d, we have to read vertex information to set boundary
+// indicators
+//
+// test case by Jan Strebel
+//
+// this is a variation of the grid_in_msh_02 testcase, but as in Jan's
+// original code snippet, it uses GridIn<1,3> (which wasn't
+// instantiated at the time)
+
+
+#include "../tests.h"
+#include <deal.II/dofs/dof_handler.h>
+#include <deal.II/grid/tria.h>
+#include <deal.II/grid/tria_boundary.h>
+#include <deal.II/grid/tria_boundary_lib.h>
+#include <deal.II/grid/tria_accessor.h>
+#include <deal.II/grid/tria_iterator.h>
+#include <deal.II/grid/grid_out.h>
+#include <deal.II/grid/grid_in.h>
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/base/logstream.h>
+
+#include <fstream>
+#include <iomanip>
+#include <string>
+
+std::ofstream logfile("output");
+
+
+void check_file ()
+{
+  Triangulation<1,3> tria;
+  GridIn<1,3> gi;
+  gi.attach_triangulation (tria);
+  std::ifstream in (SOURCE_DIR "/../grid/grids/grid_in_msh_02.msh");
+  gi.read_msh(in);
+
+  for (Triangulation<1,3>::active_cell_iterator cell = tria.begin_active(); cell != tria.end(); ++cell)
+    {
+      for (unsigned int face = 0; face < 2; ++face)
+      {
+        if (cell->at_boundary(face))
+          deallog << "vertex " << cell->face_index(face)
+                  << " has boundary indicator " << (int)cell->face(face)->boundary_indicator()
+                  << std::endl;
+      }
+    }
+}
+
+
+int main ()
+{
+  deallog << std::setprecision (2);
+  logfile << std::setprecision (2);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  check_file ();
+}
+
diff --git a/tests/deal.II/grid_in_msh_02_13.output b/tests/deal.II/grid_in_msh_02_13.output
new file mode 100644 (file)
index 0000000..2ebba38
--- /dev/null
@@ -0,0 +1,3 @@
+
+DEAL::vertex 0 has boundary indicator 10
+DEAL::vertex 1 has boundary indicator 20

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.