From 5afccb8f2bdf67443dca40bfc3f6cec207f6fa47 Mon Sep 17 00:00:00 2001 From: bangerth Date: Sat, 18 May 2013 12:49:17 +0000 Subject: [PATCH] New test. git-svn-id: https://svn.dealii.org/trunk@29524 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/bits/periodicity_01.cc | 73 +++++++++++++++++++++++++++ tests/bits/periodicity_01/cmp/generic | 7 +++ 2 files changed, 80 insertions(+) create mode 100644 tests/bits/periodicity_01.cc create mode 100644 tests/bits/periodicity_01/cmp/generic diff --git a/tests/bits/periodicity_01.cc b/tests/bits/periodicity_01.cc new file mode 100644 index 0000000000..8b5e34114f --- /dev/null +++ b/tests/bits/periodicity_01.cc @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + + + +template +void test () +{ + // create a 2x1 (or 2x1x1) mesh + Triangulation triangulation; + std::vector repetitions (dim, 1); + repetitions[0] = 2; + GridGenerator::subdivided_hyper_rectangle (triangulation, + repetitions, + Point(), + (dim == 2 ? + Point(2,1) : + Point(2,1,1))); + + FE_Q fe(1); + DoFHandler 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 index 0000000000..f8a8f09002 --- /dev/null +++ b/tests/bits/periodicity_01/cmp/generic @@ -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 -- 2.39.5