]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add tests for previous two commits. 682/head
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 23 Mar 2015 18:58:07 +0000 (13:58 -0500)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 23 Mar 2015 18:58:07 +0000 (13:58 -0500)
tests/deal.II/grid_out_08.cc [new file with mode: 0644]
tests/deal.II/grid_out_08.output [new file with mode: 0644]
tests/deal.II/grid_out_09.cc [new file with mode: 0644]
tests/deal.II/grid_out_09.output [new file with mode: 0644]

diff --git a/tests/deal.II/grid_out_08.cc b/tests/deal.II/grid_out_08.cc
new file mode 100644 (file)
index 0000000..17a3f93
--- /dev/null
@@ -0,0 +1,101 @@
+// ---------------------------------------------------------------------
+//
+// 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.
+//
+// ---------------------------------------------------------------------
+
+
+// test GridOut::write_vtu for 1d meshes in 3d
+
+#include "../tests.h"
+#include <deal.II/base/geometry_info.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_generator.h>
+#include <deal.II/base/logstream.h>
+
+#include <fstream>
+#include <iomanip>
+
+
+std::ofstream logfile("output");
+
+
+void test ()
+{
+  Triangulation<1,3> tria;
+
+  const unsigned int dim = 1;
+  static const Point<3> vertices_1[]
+    = {
+        Point<3>(0,0,0), Point<3>(1,0,0), Point<3>(1,0,0), Point<3>(1,1,0),
+        Point<3>(1,1,0), Point<3>(0,1,0), Point<3>(0,1,0), Point<3>(0,0,0),
+        Point<3>(0,0,1), Point<3>(1,0,1), Point<3>(1,0,1), Point<3>(1,1,1),
+        Point<3>(1,1,1), Point<3>(0,1,1), Point<3>(0,1,1), Point<3>(0,0,1),
+       Point<3>(0,0,0), Point<3>(0,0,1), Point<3>(1,0,0), Point<3>(1,0,1),
+       Point<3>(1,1,0), Point<3>(1,1,1), Point<3>(0,1,0), Point<3>(0,1,1)
+  };
+  const unsigned int n_vertices = sizeof(vertices_1) / sizeof(vertices_1[0]);
+  const std::vector<Point<3> > vertices (&vertices_1[0],  &vertices_1[n_vertices]);
+
+  static const int cell_vertices[][GeometryInfo<dim>::vertices_per_cell]
+    = {    { 0, 1},
+          { 2, 3},
+          { 4, 5},
+          { 6, 7},
+          { 8, 9},
+          { 10, 11},
+          { 12, 13},
+          { 14, 15},
+          { 16, 17},
+          { 18, 19},
+          { 20, 21},
+          { 22, 23}
+  };
+  const unsigned int  n_cells = sizeof(cell_vertices) / sizeof(cell_vertices[0]);
+  std::vector<CellData<dim> > cells (n_cells, CellData<dim>());
+
+  for (unsigned int i=0; i<n_cells; ++i)
+    {
+      for (unsigned int j=0;
+          j<GeometryInfo<dim>::vertices_per_cell;
+          ++j)
+       cells[i].vertices[j] = cell_vertices[i][j];
+      cells[i].material_id = 0;
+    }
+  tria.create_triangulation (    vertices,
+                                cells,
+                                SubCellData());
+
+  tria.refine_global (1);
+
+  GridOut grid_out;
+  grid_out.write_vtu (tria, logfile);
+}
+
+
+int main ()
+{
+  deallog << std::setprecision (2);
+  logfile << std::setprecision (2);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  test ();
+}
+
diff --git a/tests/deal.II/grid_out_08.output b/tests/deal.II/grid_out_08.output
new file mode 100644 (file)
index 0000000..e32b888
--- /dev/null
@@ -0,0 +1,31 @@
+
+<?xml version="1.0" ?> 
+<!-- 
+# vtk DataFile Version 3.0
+#This file was generated 
+-->
+<VTKFile type="UnstructuredGrid" version="0.1" compressor="vtkZLibDataCompressor" byte_order="LittleEndian">
+<UnstructuredGrid>
+<Piece NumberOfPoints="48" NumberOfCells="24" >
+  <Points>
+    <DataArray type="Float64" NumberOfComponents="3" format="binary">
+AQAAAIAEAACABAAARwAAAA==eNpjYMAHHtiTJv6BTHF08wiJfyBS/AGJ4uT6g9RwIgRoHS7o4ujhQUicWJpUcwdLPFM7PxBrP6n++GBPn3imXT4GAB9TYe0=
+    </DataArray>
+  </Points>
+
+  <Cells>
+    <DataArray type="Int32" Name="connectivity" format="binary">
+AQAAAMAAAADAAAAAVQAAAA==eNoNw4kSgVAAAMDnliNXRUQ5c4T//7t2ZzaEEDp27dl34NCRYyMnTp05N3bh0pVrNyamZm7dmbv3YOHRk6WVZy9evXn3Ye3Tl28/Nn79+bcFIK8EaQ==
+    </DataArray>
+    <DataArray type="Int32" Name="offsets" format="binary">
+AQAAAGAAAABgAAAAOAAAAA==eNoNwwEGgEAQAMCVJElOkiQnJ0mS/v+6ZpgqImobWzt7B5Ojk7OLq5vZ3eLh6eXt4+vnD1GgAlk=
+    </DataArray>
+    <DataArray type="UInt8" Name="types" format="binary">
+AQAAABgAAAAYAAAACwAAAA==eNpjZsYOAAOcAEk=
+    </DataArray>
+  </Cells>
+  <PointData Scalars="scalars">
+  </PointData>
+ </Piece>
+ </UnstructuredGrid>
+</VTKFile>
diff --git a/tests/deal.II/grid_out_09.cc b/tests/deal.II/grid_out_09.cc
new file mode 100644 (file)
index 0000000..ed124f3
--- /dev/null
@@ -0,0 +1,101 @@
+// ---------------------------------------------------------------------
+//
+// 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.
+//
+// ---------------------------------------------------------------------
+
+
+// test GridOut::write_gnuplot for 1d meshes in 3d
+
+#include "../tests.h"
+#include <deal.II/base/geometry_info.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_generator.h>
+#include <deal.II/base/logstream.h>
+
+#include <fstream>
+#include <iomanip>
+
+
+std::ofstream logfile("output");
+
+
+void test ()
+{
+  Triangulation<1,3> tria;
+
+  const unsigned int dim = 1;
+  static const Point<3> vertices_1[]
+    = {
+        Point<3>(0,0,0), Point<3>(1,0,0), Point<3>(1,0,0), Point<3>(1,1,0),
+        Point<3>(1,1,0), Point<3>(0,1,0), Point<3>(0,1,0), Point<3>(0,0,0),
+        Point<3>(0,0,1), Point<3>(1,0,1), Point<3>(1,0,1), Point<3>(1,1,1),
+        Point<3>(1,1,1), Point<3>(0,1,1), Point<3>(0,1,1), Point<3>(0,0,1),
+       Point<3>(0,0,0), Point<3>(0,0,1), Point<3>(1,0,0), Point<3>(1,0,1),
+       Point<3>(1,1,0), Point<3>(1,1,1), Point<3>(0,1,0), Point<3>(0,1,1)
+  };
+  const unsigned int n_vertices = sizeof(vertices_1) / sizeof(vertices_1[0]);
+  const std::vector<Point<3> > vertices (&vertices_1[0],  &vertices_1[n_vertices]);
+
+  static const int cell_vertices[][GeometryInfo<dim>::vertices_per_cell]
+    = {    { 0, 1},
+          { 2, 3},
+          { 4, 5},
+          { 6, 7},
+          { 8, 9},
+          { 10, 11},
+          { 12, 13},
+          { 14, 15},
+          { 16, 17},
+          { 18, 19},
+          { 20, 21},
+          { 22, 23}
+  };
+  const unsigned int  n_cells = sizeof(cell_vertices) / sizeof(cell_vertices[0]);
+  std::vector<CellData<dim> > cells (n_cells, CellData<dim>());
+
+  for (unsigned int i=0; i<n_cells; ++i)
+    {
+      for (unsigned int j=0;
+          j<GeometryInfo<dim>::vertices_per_cell;
+          ++j)
+       cells[i].vertices[j] = cell_vertices[i][j];
+      cells[i].material_id = 0;
+    }
+  tria.create_triangulation (    vertices,
+                                cells,
+                                SubCellData());
+
+  tria.refine_global (1);
+
+  GridOut grid_out;
+  grid_out.write_gnuplot (tria, logfile);
+}
+
+
+int main ()
+{
+  deallog << std::setprecision (2);
+  logfile << std::setprecision (2);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  test ();
+}
+
diff --git a/tests/deal.II/grid_out_09.output b/tests/deal.II/grid_out_09.output
new file mode 100644 (file)
index 0000000..ec91b4a
--- /dev/null
@@ -0,0 +1,97 @@
+
+0.0 0.0 0.0 1 0
+0.50 0.0 0.0 1 0
+
+
+0.50 0.0 0.0 1 0
+1.0 0.0 0.0 1 0
+
+
+1.0 0.0 0.0 1 0
+1.0 0.50 0.0 1 0
+
+
+1.0 0.50 0.0 1 0
+1.0 1.0 0.0 1 0
+
+
+1.0 1.0 0.0 1 0
+0.50 1.0 0.0 1 0
+
+
+0.50 1.0 0.0 1 0
+0.0 1.0 0.0 1 0
+
+
+0.0 1.0 0.0 1 0
+0.0 0.50 0.0 1 0
+
+
+0.0 0.50 0.0 1 0
+0.0 0.0 0.0 1 0
+
+
+0.0 0.0 1.0 1 0
+0.50 0.0 1.0 1 0
+
+
+0.50 0.0 1.0 1 0
+1.0 0.0 1.0 1 0
+
+
+1.0 0.0 1.0 1 0
+1.0 0.50 1.0 1 0
+
+
+1.0 0.50 1.0 1 0
+1.0 1.0 1.0 1 0
+
+
+1.0 1.0 1.0 1 0
+0.50 1.0 1.0 1 0
+
+
+0.50 1.0 1.0 1 0
+0.0 1.0 1.0 1 0
+
+
+0.0 1.0 1.0 1 0
+0.0 0.50 1.0 1 0
+
+
+0.0 0.50 1.0 1 0
+0.0 0.0 1.0 1 0
+
+
+0.0 0.0 0.0 1 0
+0.0 0.0 0.50 1 0
+
+
+0.0 0.0 0.50 1 0
+0.0 0.0 1.0 1 0
+
+
+1.0 0.0 0.0 1 0
+1.0 0.0 0.50 1 0
+
+
+1.0 0.0 0.50 1 0
+1.0 0.0 1.0 1 0
+
+
+1.0 1.0 0.0 1 0
+1.0 1.0 0.50 1 0
+
+
+1.0 1.0 0.50 1 0
+1.0 1.0 1.0 1 0
+
+
+0.0 1.0 0.0 1 0
+0.0 1.0 0.50 1 0
+
+
+0.0 1.0 0.50 1 0
+0.0 1.0 1.0 1 0
+
+

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.