From c6349da2a5f4fe6927d9bae010d62a412baaed5f Mon Sep 17 00:00:00 2001 From: heltai Date: Mon, 16 May 2011 10:50:02 +0000 Subject: [PATCH] Added tetst for persistent triangulation git-svn-id: https://svn.dealii.org/trunk@23697 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/codim_one/grid_in_out_03.cc | 66 ++++++++++++++++++++++ tests/codim_one/grid_in_out_03/cmp/generic | 31 ++++++++++ 2 files changed, 97 insertions(+) create mode 100644 tests/codim_one/grid_in_out_03.cc create mode 100644 tests/codim_one/grid_in_out_03/cmp/generic diff --git a/tests/codim_one/grid_in_out_03.cc b/tests/codim_one/grid_in_out_03.cc new file mode 100644 index 0000000000..373ea64b25 --- /dev/null +++ b/tests/codim_one/grid_in_out_03.cc @@ -0,0 +1,66 @@ + +//---------------------------- template.cc --------------------------- +// $Id: grid_in_out_02.cc 22595 2010-11-03 11:30:11Z bangerth $ +// Version: $Name$ +// +// Copyright (C) 2005, 2008, 2010, 2011 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. +// +//---------------------------- template.cc --------------------------- + + +// like grid_in_out but test persistent triangulation + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include + +#include + +std::ofstream logfile("grid_in_out_03/output"); + +template +void test(std::string filename) { + logfile << " Tria<" << dim << "," << spacedim << ">: " + << filename << std::endl; + Triangulation tria; + GridIn gi; + gi.attach_triangulation (tria); + std::ifstream in (filename.c_str()); + gi.read_ucd (in); + + PersistentTriangulation ptria(tria); + typename Triangulation::active_cell_iterator cell; + + ptria.restore(); + for(unsigned int i=0; i<2; ++i) + { + for(cell=ptria.begin_active(); cell != ptria.end(); ++cell) + if(cell->center()[0]<.5) + cell->set_refine_flag(); + ptria.execute_coarsening_and_refinement(); + } + + ptria.write_flags(logfile); +} + +int main () +{ + deallog.attach(logfile); + deallog.depth_console(0); + + test<2,3>("grids/square.inp"); + test<2,3>("grids/sphere_1.inp"); + + return 0; +} + diff --git a/tests/codim_one/grid_in_out_03/cmp/generic b/tests/codim_one/grid_in_out_03/cmp/generic new file mode 100644 index 0000000000..47e91aa1dd --- /dev/null +++ b/tests/codim_one/grid_in_out_03/cmp/generic @@ -0,0 +1,31 @@ + + Tria<2,3>: grids/square.inp +41472 2 +40960 8 +0 0 +40961 +40976 4 +0 +40977 +40960 8 +0 0 +40961 +40976 4 +0 +40977 +41473 + Tria<2,3>: grids/sphere_1.inp +41472 2 +40960 212 +255 255 255 255 255 255 255 252 255 15 255 255 255 0 240 255 0 252 3 12 240 240 255 255 243 255 15 +40961 +40976 106 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 +40977 +40960 698 +0 0 0 0 0 0 252 255 255 255 255 255 255 255 255 255 255 255 255 207 204 204 252 255 255 255 255 255 255 255 255 255 63 204 252 255 255 255 255 255 255 255 255 63 252 255 255 255 255 255 255 255 255 255 63 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 3 +40961 +40976 349 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +40977 +41473 -- 2.39.5