From 6f6ac0647cc662584be481b295c218e4cf3a521a Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 10 Jul 2009 21:05:34 +0000 Subject: [PATCH] New test. git-svn-id: https://svn.dealii.org/trunk@19059 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/bits/distorted_cells_02.cc | 78 +++++++++++++++++++++++ tests/bits/distorted_cells_02/2d | 6 ++ tests/bits/distorted_cells_02/3d | 10 +++ tests/bits/distorted_cells_02/cmp/generic | 3 + 4 files changed, 97 insertions(+) create mode 100644 tests/bits/distorted_cells_02.cc create mode 100644 tests/bits/distorted_cells_02/2d create mode 100644 tests/bits/distorted_cells_02/3d create mode 100644 tests/bits/distorted_cells_02/cmp/generic diff --git a/tests/bits/distorted_cells_02.cc b/tests/bits/distorted_cells_02.cc new file mode 100644 index 0000000000..a5e92c0cbb --- /dev/null +++ b/tests/bits/distorted_cells_02.cc @@ -0,0 +1,78 @@ +//---------------------------- distorted_cells_02.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2003, 2004, 2005, 2009 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. +// +//---------------------------- distorted_cells_02.cc --------------------------- + + +// check that indeed Triangulation::create_triangulation throws an +// exception if we have distorted cells. this test is like the _01 +// case except that it reads the mesh from a file + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + +template +void check () +{ + Triangulation coarse_grid; + + GridIn gi; + std::ifstream in (dim == 2 ? "distorted_cells_02/2d" : "distorted_cells_02/3d"); + + gi.attach_triangulation (coarse_grid); + + + bool flag = false; + try + { + gi.read_ucd (in); + } + catch (typename Triangulation::DistortedCellList &dcv) + { + flag = true; + + deallog << dcv.distorted_cells.size() << " distorted cells" + << std::endl; + Assert (dcv.distorted_cells.front() == coarse_grid.begin(0), + ExcInternalError()); + } + + Assert (flag == true, ExcInternalError()); + Assert (coarse_grid.n_levels() == 1, ExcInternalError()); + Assert (coarse_grid.n_active_cells() == 1, ExcInternalError()); +} + + +int main () +{ + std::ofstream logfile("distorted_cells_02/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + check<2> (); + check<3> (); +} + + + diff --git a/tests/bits/distorted_cells_02/2d b/tests/bits/distorted_cells_02/2d new file mode 100644 index 0000000000..1a53889d21 --- /dev/null +++ b/tests/bits/distorted_cells_02/2d @@ -0,0 +1,6 @@ +4 1 0 0 0 +1 0 0 0 +2 1 0 0 +3 0 1 0 +4 1 1 0 +1 0 quad 1 2 3 4 diff --git a/tests/bits/distorted_cells_02/3d b/tests/bits/distorted_cells_02/3d new file mode 100644 index 0000000000..dd37099c80 --- /dev/null +++ b/tests/bits/distorted_cells_02/3d @@ -0,0 +1,10 @@ +8 1 0 0 0 +1 0 0 0 +2 1 0 0 +3 0 1 0 +4 1 1 0 +5 0 0 1 +6 1 0 1 +7 0 1 1 +8 1 1 1 +1 0 hex 1 2 3 4 5 6 7 8 diff --git a/tests/bits/distorted_cells_02/cmp/generic b/tests/bits/distorted_cells_02/cmp/generic new file mode 100644 index 0000000000..09b3dbd5c5 --- /dev/null +++ b/tests/bits/distorted_cells_02/cmp/generic @@ -0,0 +1,3 @@ + +DEAL::1 distorted cells +DEAL::1 distorted cells -- 2.39.5