]> https://gitweb.dealii.org/ - dealii.git/commitdiff
New test.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Sat, 18 May 2013 12:49:17 +0000 (12:49 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Sat, 18 May 2013 12:49:17 +0000 (12:49 +0000)
git-svn-id: https://svn.dealii.org/trunk@29524 0785d39b-7218-0410-832d-ea1e28bc413d

tests/bits/periodicity_01.cc [new file with mode: 0644]
tests/bits/periodicity_01/cmp/generic [new file with mode: 0644]

diff --git a/tests/bits/periodicity_01.cc b/tests/bits/periodicity_01.cc
new file mode 100644 (file)
index 0000000..8b5e341
--- /dev/null
@@ -0,0 +1,73 @@
+//----------------------------  periodicity_01.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2002, 2003, 2004, 2005, 2010, 2013 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  periodicity_01.cc  ---------------------------
+
+
+// check periodic boundary conditions for a simple enough case where we know
+// the exact set of constraints
+//
+// this test simply uses two hypercubes and matches the faces at the far ends
+
+#include "../tests.h"
+#include <deal.II/base/logstream.h>
+#include <deal.II/grid/tria.h>
+#include <deal.II/dofs/dof_handler.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/dofs/dof_accessor.h>
+#include <deal.II/dofs/dof_tools.h>
+#include <deal.II/fe/fe_q.h>
+
+#include <iomanip>
+#include <fstream>
+
+
+
+template <int dim>
+void test () 
+{
+  // create a 2x1 (or 2x1x1) mesh
+  Triangulation<dim> triangulation;
+  std::vector<unsigned int> repetitions (dim, 1);
+  repetitions[0] = 2;
+  GridGenerator::subdivided_hyper_rectangle (triangulation,
+                                            repetitions,
+                                            Point<dim>(),
+                                            (dim == 2 ?
+                                             Point<dim>(2,1) :
+                                             Point<dim>(2,1,1)));
+  
+  FE_Q<dim>          fe(1);
+  DoFHandler<dim>    dof_handler (triangulation);
+  dof_handler.distribute_dofs (fe);
+
+  ConstraintMatrix cm;
+  DoFTools::make_periodicity_constraints (dof_handler.begin(0)->face(0),
+                                         (++dof_handler.begin(0))->face(1),
+                                         cm);
+  cm.print (deallog.get_file_stream());
+}
+
+    
+
+int main () 
+{
+  std::ofstream logfile("periodicity_01/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  test<2>();
+  test<3>();
+  return 0;
+}
diff --git a/tests/bits/periodicity_01/cmp/generic b/tests/bits/periodicity_01/cmp/generic
new file mode 100644 (file)
index 0000000..f8a8f09
--- /dev/null
@@ -0,0 +1,7 @@
+
+    0 4:  1.00000
+    2 5:  1.00000
+    0 8:  1.00000
+    2 9:  1.00000
+    4 10:  1.00000
+    6 11:  1.00000

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.