]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add tests. 1495/head
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 31 Aug 2015 22:23:41 +0000 (17:23 -0500)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 31 Aug 2015 22:23:41 +0000 (17:23 -0500)
tests/hp/face_domination_01.cc [new file with mode: 0644]
tests/hp/face_domination_01.output [new file with mode: 0644]
tests/hp/face_domination_02.cc [new file with mode: 0644]
tests/hp/face_domination_02.output [new file with mode: 0644]

diff --git a/tests/hp/face_domination_01.cc b/tests/hp/face_domination_01.cc
new file mode 100644 (file)
index 0000000..26eb855
--- /dev/null
@@ -0,0 +1,92 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 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.
+//
+// ---------------------------------------------------------------------
+
+// A test that checks that FE_Nothing does not dominate the neighboring Q1.
+
+
+
+#include "../tests.h"
+#include <deal.II/base/logstream.h>
+
+#include <deal.II/grid/tria.h>
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/grid_refinement.h>
+#include <deal.II/grid/tria_accessor.h>
+#include <deal.II/grid/tria_iterator.h>
+#include <deal.II/dofs/dof_accessor.h>
+#include <deal.II/dofs/dof_tools.h>
+#include <deal.II/fe/fe_q.h>
+#include <deal.II/fe/fe_nothing.h>
+#include <deal.II/fe/fe_system.h>
+#include <deal.II/hp/fe_values.h>
+#include <deal.II/hp/dof_handler.h>
+#include <deal.II/hp/fe_collection.h>
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+const unsigned int dim=2;
+
+void print_dofs (const hp::DoFHandler<2>::active_cell_iterator &cell)
+{
+  deallog << "DoFs on cell=" << cell << ": ";
+  
+  std::vector<types::global_dof_index> dof_indices (cell->get_fe().dofs_per_cell);
+  cell->get_dof_indices (dof_indices);
+  for (unsigned int i=0; i<dof_indices.size(); ++i)
+    deallog << dof_indices[i] << ' ';
+  deallog << std::endl;
+}
+
+
+int main()
+{
+  std::ofstream logfile("output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  Triangulation<dim>   triangulation;
+  std::vector<unsigned int> subdivisions(dim, 1U);
+  subdivisions[0] = 2;
+  GridGenerator::subdivided_hyper_rectangle (triangulation,
+                                            subdivisions,
+                                            Point<dim>(0,0),
+                                            Point<dim>(2,1));
+
+  hp::FECollection<dim> fe_collection;
+  fe_collection.push_back(FESystem<dim>(FE_Nothing<dim>(),1));
+  fe_collection.push_back(FESystem<dim>(FE_Q<dim>(1),1));
+
+  hp::DoFHandler<dim> dof_handler(triangulation);
+
+  dof_handler.begin_active()->set_active_fe_index(1);
+
+  dof_handler.distribute_dofs(fe_collection);
+
+  print_dofs (dof_handler.begin_active());
+  print_dofs (++dof_handler.begin_active());
+  
+  ConstraintMatrix constraints;
+  constraints.clear();
+  dealii::DoFTools::make_hanging_node_constraints  (dof_handler, constraints);
+  constraints.close ();
+
+  constraints.print(deallog.get_file_stream());
+}
+
+
+
diff --git a/tests/hp/face_domination_01.output b/tests/hp/face_domination_01.output
new file mode 100644 (file)
index 0000000..d4853e5
--- /dev/null
@@ -0,0 +1,3 @@
+
+DEAL::DoFs on cell=0.0: 0 1 2 3 
+DEAL::DoFs on cell=0.1: 
diff --git a/tests/hp/face_domination_02.cc b/tests/hp/face_domination_02.cc
new file mode 100644 (file)
index 0000000..16abe78
--- /dev/null
@@ -0,0 +1,96 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 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.
+//
+// ---------------------------------------------------------------------
+
+// A test that checks that FE_Nothing does not dominate the
+// neighboring Q1. This works fine for a single, scalar element as
+// shown in the _01 test, but fails at the time the test was written
+// for systems
+
+
+#include "../tests.h"
+#include <deal.II/base/logstream.h>
+
+#include <deal.II/grid/tria.h>
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/grid_refinement.h>
+#include <deal.II/grid/tria_accessor.h>
+#include <deal.II/grid/tria_iterator.h>
+#include <deal.II/dofs/dof_accessor.h>
+#include <deal.II/dofs/dof_tools.h>
+#include <deal.II/fe/fe_q.h>
+#include <deal.II/fe/fe_nothing.h>
+#include <deal.II/fe/fe_system.h>
+#include <deal.II/hp/fe_values.h>
+#include <deal.II/hp/dof_handler.h>
+#include <deal.II/hp/fe_collection.h>
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+const unsigned int dim=2;
+
+void print_dofs (const hp::DoFHandler<2>::active_cell_iterator &cell)
+{
+  deallog << "DoFs on cell=" << cell << ": ";
+  
+  std::vector<types::global_dof_index> dof_indices (cell->get_fe().dofs_per_cell);
+  cell->get_dof_indices (dof_indices);
+  for (unsigned int i=0; i<dof_indices.size(); ++i)
+    deallog << dof_indices[i] << ' ';
+  deallog << std::endl;
+}
+
+
+int main()
+{
+  std::ofstream logfile("output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  Triangulation<dim>   triangulation;
+  std::vector<unsigned int> subdivisions(dim, 1U);
+  subdivisions[0] = 2;
+  GridGenerator::subdivided_hyper_rectangle (triangulation,
+                                            subdivisions,
+                                            Point<dim>(0,0),
+                                            Point<dim>(2,1));
+
+  hp::FECollection<dim> fe_collection;
+  fe_collection.push_back(FESystem<dim>(FE_Q<dim>(1),1,
+                                        FE_Nothing<dim>(),1));
+  fe_collection.push_back(FESystem<dim>(FE_Q<dim>(2),1,
+                                        FE_Q<dim>(1),1));
+
+  hp::DoFHandler<dim> dof_handler(triangulation);
+
+  dof_handler.begin_active()->set_active_fe_index(1);
+
+  dof_handler.distribute_dofs(fe_collection);
+
+  print_dofs (dof_handler.begin_active());
+  print_dofs (++dof_handler.begin_active());
+  
+  ConstraintMatrix constraints;
+  constraints.clear();
+  dealii::DoFTools::make_hanging_node_constraints  (dof_handler, constraints);
+  constraints.close ();
+
+  constraints.print(deallog.get_file_stream());
+}
+
+
+
diff --git a/tests/hp/face_domination_02.output b/tests/hp/face_domination_02.output
new file mode 100644 (file)
index 0000000..464831b
--- /dev/null
@@ -0,0 +1,7 @@
+
+DEAL::DoFs on cell=0.0: 0 1 11 2 3 4 13 5 6 7 8 9 10 
+DEAL::DoFs on cell=0.1: 11 12 13 14 
+    2 = 0
+    5 = 0
+    7 11:  0.500000
+    7 13:  0.500000

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.