]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
New test.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 4 May 2010 19:37:54 +0000 (19:37 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 4 May 2010 19:37:54 +0000 (19:37 +0000)
git-svn-id: https://svn.dealii.org/trunk@21067 0785d39b-7218-0410-832d-ea1e28bc413d

tests/hp/crash_19.cc [new file with mode: 0644]
tests/hp/crash_19/cmp/generic [new file with mode: 0644]

diff --git a/tests/hp/crash_19.cc b/tests/hp/crash_19.cc
new file mode 100644 (file)
index 0000000..0032ee4
--- /dev/null
@@ -0,0 +1,149 @@
+//----------------------------  crash_19.cc  ---------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2005, 2006, 2007, 2008, 2010 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.
+//
+//----------------------------  crash_19.cc  ---------------------------
+
+
+// VectorTools::interpolate_boundary_values produced an exception when
+// used with hp::DoFHandler in 1d. Test that this is no longer the case
+
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <fstream>
+std::ofstream logfile("crash_19/output");
+
+
+#include <base/quadrature_lib.h>
+#include <base/function.h>
+#include <base/logstream.h>
+#include <base/table_handler.h>
+#include <base/thread_management.h>
+#include <lac/vector.h>
+#include <lac/full_matrix.h>
+#include <lac/sparse_matrix.h>
+#include <lac/solver_cg.h>
+#include <lac/precondition.h>
+#include <grid/tria.h>
+#include <grid/grid_generator.h>
+#include <grid/tria_accessor.h>
+#include <grid/tria_iterator.h>
+#include <grid/grid_refinement.h>
+#include <dofs/dof_handler.h>
+#include <lac/constraint_matrix.h>
+#include <dofs/dof_accessor.h>
+#include <dofs/dof_tools.h>
+#include <fe/fe_q.h>
+#include <hp/fe_values.h>
+#include <numerics/vectors.h>
+#include <numerics/matrices.h>
+#include <numerics/data_out.h>
+#include <numerics/error_estimator.h>
+
+#include <iostream>
+#include <fstream>
+#include <list>
+#include <sstream>
+
+
+template <int dim>
+class ExactSolution: public Function<dim> {
+  public:
+    ExactSolution () {}
+    virtual double value (const Point<dim>& p, const unsigned int) const
+      {
+       return p (0);
+      }
+ };
+
+
+template <int dim>
+void test ()
+{
+  Triangulation<dim>     triangulation;
+  hp::FECollection<dim>      fe;
+  fe.push_back (FE_Q<dim> (1));
+
+  hp::DoFHandler<dim>        dof_handler (triangulation);
+
+  GridGenerator::hyper_cube (triangulation);
+  triangulation.refine_global (2);
+  deallog << "Number of active cells: "
+         << triangulation.n_active_cells()
+         << std::endl;
+  deallog << "Total number of cells: "
+         << triangulation.n_cells()
+         << std::endl;
+
+  dof_handler.distribute_dofs (fe);
+  deallog << "Number of degrees of freedom: "
+         << dof_handler.n_dofs()
+         << std::endl;
+
+  ExactSolution<dim> exact_solution;
+  std::map<unsigned int,double> boundary_values;
+  VectorTools::interpolate_boundary_values (dof_handler,
+                                            0,
+                                            exact_solution,
+                                            boundary_values);
+  if (dim == 1)
+    VectorTools::interpolate_boundary_values (dof_handler,
+                                             1,
+                                             exact_solution,
+                                             boundary_values);
+
+  for (std::map<unsigned int,double>::iterator i=boundary_values.begin();
+       i != boundary_values.end(); ++i)
+    deallog << i->first << ' ' << i->second << std::endl;
+}
+
+
+int main ()
+{
+  try
+    {
+      logfile.precision(2);
+      deallog << std::setprecision(2);
+
+      deallog.attach(logfile);
+      deallog.depth_console(0);
+      deallog.threshold_double(1.e-10);
+
+      test<1> ();
+      test<2> ();
+      test<3> ();
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    }
+  catch (...)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+
+  return 0;
+}
diff --git a/tests/hp/crash_19/cmp/generic b/tests/hp/crash_19/cmp/generic
new file mode 100644 (file)
index 0000000..053a7cf
--- /dev/null
@@ -0,0 +1,126 @@
+
+DEAL::Number of active cells: 4
+DEAL::Total number of cells: 7
+DEAL::Number of degrees of freedom: 5
+DEAL::0 0
+DEAL::4 1.0
+DEAL::Number of active cells: 16
+DEAL::Total number of cells: 21
+DEAL::Number of degrees of freedom: 25
+DEAL::0 0
+DEAL::1 0.25
+DEAL::2 0
+DEAL::4 0.50
+DEAL::6 0
+DEAL::9 0.75
+DEAL::11 1.0
+DEAL::12 1.0
+DEAL::14 1.0
+DEAL::15 0
+DEAL::18 0
+DEAL::19 0.25
+DEAL::20 0.50
+DEAL::22 1.0
+DEAL::23 0.75
+DEAL::24 1.0
+DEAL::Number of active cells: 64
+DEAL::Total number of cells: 73
+DEAL::Number of degrees of freedom: 125
+DEAL::0 0
+DEAL::1 0.25
+DEAL::2 0
+DEAL::3 0.25
+DEAL::4 0
+DEAL::5 0.25
+DEAL::6 0
+DEAL::8 0.50
+DEAL::9 0.50
+DEAL::10 0.50
+DEAL::12 0
+DEAL::13 0.25
+DEAL::14 0
+DEAL::16 0.50
+DEAL::18 0
+DEAL::19 0.25
+DEAL::20 0
+DEAL::22 0.50
+DEAL::24 0
+DEAL::27 0.75
+DEAL::28 0.75
+DEAL::29 0.75
+DEAL::31 1.0
+DEAL::32 1.0
+DEAL::33 1.0
+DEAL::34 1.0
+DEAL::35 0.75
+DEAL::37 1.0
+DEAL::38 1.0
+DEAL::39 0.75
+DEAL::41 1.0
+DEAL::42 1.0
+DEAL::44 1.0
+DEAL::45 0
+DEAL::46 0.25
+DEAL::47 0
+DEAL::49 0.50
+DEAL::51 0
+DEAL::52 0.25
+DEAL::53 0
+DEAL::54 0.25
+DEAL::55 0.50
+DEAL::56 0.50
+DEAL::57 0
+DEAL::60 0
+DEAL::61 0.25
+DEAL::62 0.50
+DEAL::63 0.75
+DEAL::65 1.0
+DEAL::66 1.0
+DEAL::67 0.75
+DEAL::68 0.75
+DEAL::69 1.0
+DEAL::70 1.0
+DEAL::72 1.0
+DEAL::73 0.75
+DEAL::74 1.0
+DEAL::75 0
+DEAL::76 0.25
+DEAL::77 0
+DEAL::79 0.50
+DEAL::81 0
+DEAL::84 0
+DEAL::85 0.25
+DEAL::86 0
+DEAL::87 0.25
+DEAL::88 0.50
+DEAL::89 0.50
+DEAL::90 0
+DEAL::91 0.25
+DEAL::92 0.50
+DEAL::93 0.75
+DEAL::95 1.0
+DEAL::96 1.0
+DEAL::98 1.0
+DEAL::99 0.75
+DEAL::100 0.75
+DEAL::101 1.0
+DEAL::102 1.0
+DEAL::103 0.75
+DEAL::104 1.0
+DEAL::105 0
+DEAL::108 0
+DEAL::109 0.25
+DEAL::110 0.50
+DEAL::111 0
+DEAL::112 0.25
+DEAL::113 0.50
+DEAL::114 0
+DEAL::115 0.25
+DEAL::116 0.50
+DEAL::118 1.0
+DEAL::119 0.75
+DEAL::120 1.0
+DEAL::121 0.75
+DEAL::122 1.0
+DEAL::123 0.75
+DEAL::124 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.