]> https://gitweb.dealii.org/ - dealii.git/commitdiff
test case interpolate_nothing_03 added
authorangelrca <angel.rcarballo@udc.es>
Wed, 3 Jun 2015 09:29:22 +0000 (11:29 +0200)
committerangelrca <angel.rcarballo@udc.es>
Wed, 3 Jun 2015 09:29:22 +0000 (11:29 +0200)
tests/hp/interpolate_nothing_03.cc [new file with mode: 0644]
tests/hp/interpolate_nothing_03.output [new file with mode: 0644]

diff --git a/tests/hp/interpolate_nothing_03.cc b/tests/hp/interpolate_nothing_03.cc
new file mode 100644 (file)
index 0000000..37f21dc
--- /dev/null
@@ -0,0 +1,99 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2014 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.
+//
+// ---------------------------------------------------------------------
+
+
+
+// check that VectorTools::interpolate works for FE_Nothing
+// scalar elements.
+
+#include "../tests.h"
+#include <deal.II/base/logstream.h>
+#include <deal.II/base/quadrature_lib.h>
+#include <deal.II/fe/fe_nothing.h>
+#include <deal.II/fe/fe_q.h>
+#include <deal.II/grid/tria.h>
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/tria_accessor.h>
+#include <deal.II/grid/tria_iterator.h>
+#include <deal.II/grid/grid_refinement.h>
+#include <deal.II/dofs/dof_accessor.h>
+#include <deal.II/dofs/dof_tools.h>
+#include <deal.II/dofs/dof_handler.h>
+#include <deal.II/numerics/vector_tools.h>
+#include <deal.II/numerics/data_out.h>
+#include <deal.II/base/function.h>
+#include <deal.II/hp/fe_collection.h>
+#include <deal.II/hp/dof_handler.h>
+
+
+#include <fstream>
+
+
+template <int dim>
+void test ()
+{
+  Triangulation<dim>       triangulation;
+  GridGenerator :: hyper_cube (triangulation, -0.5, 0.5);
+  triangulation.refine_global(3);
+
+  hp::FECollection<dim>    fe_collection;
+
+  fe_collection.push_back(FE_Q<dim>(1));
+  fe_collection.push_back(FE_Nothing<dim>());
+
+  hp::DoFHandler<dim>      dof_handler (triangulation);
+
+  typename hp::DoFHandler<dim>::active_cell_iterator
+  cell = dof_handler.begin_active(),
+  endc = dof_handler.end();
+
+  for (; cell!= endc; ++cell)
+    {
+      Point<dim> center = cell -> center();
+      if (center[0] < 0)
+        cell->set_active_fe_index(1);
+      else
+        cell->set_active_fe_index(0);
+    }
+
+  dof_handler.distribute_dofs (fe_collection);
+
+  Vector<double> interpolant(dof_handler.n_dofs());
+
+  // interpolate the function
+  VectorTools::interpolate(dof_handler,
+                           ConstantFunction<dim>(3.14),
+                           interpolant);
+  deallog << interpolant.mean_value() << std::endl;
+}
+
+
+
+int main ()
+{
+  std::ofstream logfile("output");
+  logfile.precision(3);
+  deallog << std::setprecision(3);
+
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  test<1> ();
+  test<2> ();
+  test<3> ();
+
+
+}
diff --git a/tests/hp/interpolate_nothing_03.output b/tests/hp/interpolate_nothing_03.output
new file mode 100644 (file)
index 0000000..b479409
--- /dev/null
@@ -0,0 +1,5 @@
+
+
+DEAL::3.14
+DEAL::3.14
+DEAL::3.14

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.