]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add a test.
authorWolfgang Bangerth <bangerth@colostate.edu>
Wed, 27 Apr 2022 20:00:08 +0000 (14:00 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Wed, 27 Apr 2022 23:02:01 +0000 (17:02 -0600)
tests/data_out/data_out_faces_postprocessor_boundary_id_02.cc [new file with mode: 0644]
tests/data_out/data_out_faces_postprocessor_boundary_id_02.output [new file with mode: 0644]

diff --git a/tests/data_out/data_out_faces_postprocessor_boundary_id_02.cc b/tests/data_out/data_out_faces_postprocessor_boundary_id_02.cc
new file mode 100644 (file)
index 0000000..933c253
--- /dev/null
@@ -0,0 +1,86 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2016 - 2018 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.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+
+// Like the data_out_faces_postprocess_boundary_id test, except that
+// it uses the class that is now actually part of the library, rather
+// than its own implementation.
+
+
+#include <deal.II/base/function.h>
+
+#include <deal.II/dofs/dof_accessor.h>
+#include <deal.II/dofs/dof_handler.h>
+
+#include <deal.II/fe/fe_dgq.h>
+#include <deal.II/fe/fe_system.h>
+
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/tria.h>
+#include <deal.II/grid/tria_accessor.h>
+#include <deal.II/grid/tria_iterator.h>
+
+#include <deal.II/lac/vector.h>
+
+#include <deal.II/numerics/data_out_faces.h>
+#include <deal.II/numerics/data_postprocessor.h>
+#include <deal.II/numerics/matrix_tools.h>
+#include <deal.II/numerics/vector_tools.h>
+
+#include "../tests.h"
+
+
+
+std::ofstream logfile("output");
+
+
+template <int dim>
+void
+test()
+{
+  Triangulation<dim> triangulation;
+  FE_DGQ<dim>        fe(1);
+  DoFHandler<dim>    dof_handler(triangulation);
+
+  GridGenerator::hyper_cube(triangulation, 0, 1, true);
+  triangulation.refine_global(1);
+  triangulation.begin_active()->set_refine_flag();
+  triangulation.execute_coarsening_and_refinement();
+
+  dof_handler.distribute_dofs(fe);
+
+  // Create a dummy vector. We will ignore its contents.
+  Vector<double> solution(dof_handler.n_dofs());
+
+  DataPostprocessors::BoundaryIds<dim> p;
+  DataOutFaces<dim>                    data_out;
+  data_out.attach_dof_handler(dof_handler);
+  data_out.add_data_vector(solution, p);
+  data_out.build_patches();
+  data_out.write_gnuplot(logfile);
+}
+
+
+int
+main()
+{
+  logfile << std::setprecision(2);
+  deallog << std::setprecision(2);
+
+  test<2>();
+  test<2>();
+
+  return 0;
+}
diff --git a/tests/data_out/data_out_faces_postprocessor_boundary_id_02.output b/tests/data_out/data_out_faces_postprocessor_boundary_id_02.output
new file mode 100644 (file)
index 0000000..60c706e
--- /dev/null
@@ -0,0 +1,94 @@
+# This file was generated by the deal.II library.
+
+
+#
+# For a description of the GNUPLOT format see the GNUPLOT manual.
+#
+# <x> <y> <boundary_id> 
+1 0 1 
+1 0.5 1 
+
+
+0.5 0 2 
+1 0 2 
+
+
+0 0.5 0 
+0 1 0 
+
+
+0 1 3 
+0.5 1 3 
+
+
+1 0.5 1 
+1 1 1 
+
+
+0.5 1 3 
+1 1 3 
+
+
+0 0 0 
+0 0.25 0 
+
+
+0 0 2 
+0.25 0 2 
+
+
+0.25 0 2 
+0.5 0 2 
+
+
+0 0.25 0 
+0 0.5 0 
+
+
+# This file was generated by the deal.II library.
+
+
+#
+# For a description of the GNUPLOT format see the GNUPLOT manual.
+#
+# <x> <y> <boundary_id> 
+1 0 1 
+1 0.5 1 
+
+
+0.5 0 2 
+1 0 2 
+
+
+0 0.5 0 
+0 1 0 
+
+
+0 1 3 
+0.5 1 3 
+
+
+1 0.5 1 
+1 1 1 
+
+
+0.5 1 3 
+1 1 3 
+
+
+0 0 0 
+0 0.25 0 
+
+
+0 0 2 
+0.25 0 2 
+
+
+0.25 0 2 
+0.5 0 2 
+
+
+0 0.25 0 
+0 0.5 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.