]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Added test for bug in grid in / grid out
authorLuca Heltai <luca.heltai@sissa.it>
Fri, 7 Sep 2007 14:46:57 +0000 (14:46 +0000)
committerLuca Heltai <luca.heltai@sissa.it>
Fri, 7 Sep 2007 14:46:57 +0000 (14:46 +0000)
git-svn-id: https://svn.dealii.org/trunk@15161 0785d39b-7218-0410-832d-ea1e28bc413d

tests/fail/grid_output_input.cc [new file with mode: 0644]

diff --git a/tests/fail/grid_output_input.cc b/tests/fail/grid_output_input.cc
new file mode 100644 (file)
index 0000000..3264ba1
--- /dev/null
@@ -0,0 +1,87 @@
+//---------------------------------------------------------------------------
+//    $Id: grid_generator_03.cc 14287 2006-12-30 00:52:57Z bangerth $
+//    Version: $Name$ 
+//
+//    Copyright (C) 2005, 2006 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.
+//
+//---------------------------------------------------------------------------
+
+
+// Test output and input of meshes, to see if the meshes are different
+// after a couple of global refinements
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <grid/tria.h>
+#include <grid/grid_generator.h>
+#include <grid/tria_boundary_lib.h>
+#include <grid/grid_out.h>
+#include <grid/grid_in.h>
+
+#include <fstream>
+#include <iostream>
+
+
+template<int dim>
+void test(std::ostream& out)
+{
+  GridOut go;
+  go.set_flags(GridOutFlags::Ucd(false, true));
+  go.set_flags(GridOutFlags::Msh(true));
+  Triangulation<dim> tr;
+  
+  GridGenerator::hyper_cube_with_cylindrical_hole(tr, .3, .4, 1, 1, false);
+  CylinderBoundary<dim> boundary(.3, 2);
+  tr.set_boundary(1, boundary);
+  {
+    std::ofstream grid_file("grid_output_input/coarse_grid.inp");
+    go.write_ucd(tr, grid_file);
+    grid_file.close();
+  }
+  tr.refine_global(1);
+  deallog << "Writing refined from constructor" << std::endl;
+  go.write_ucd(tr, out);
+  
+  tr.set_boundary(1);
+  tr.clear();
+  
+  GridIn<dim> gi;
+  gi.attach_triangulation(tr);
+  {
+    deallog << "Read coarse grid" << std::endl;
+    std::ifstream grid_file("grid_output_input/coarse_grid.inp");
+    gi.read_ucd(grid_file);
+    grid_file.close();
+  }
+
+  tr.set_boundary(1, boundary);
+  tr.refine_global(1);
+  deallog << "Writing refined from file" << std::endl;
+  go.write_ucd(tr, out);
+  
+  {
+    std::ofstream grid_file("grid_output_input/grid.msh");
+    go.write_msh(tr, grid_file);
+    grid_file.close();
+  }
+  
+  tr.set_boundary(1);
+  tr.clear();
+}
+
+int main()
+{
+  std::ofstream logfile("grid_output_input/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+  
+  deallog.push("3d");
+  test<3>(logfile);
+  deallog.pop();
+}

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.