From b253002a68a326f94ff6c231f7369cdacb0581dd Mon Sep 17 00:00:00 2001 From: Luca Heltai Date: Fri, 7 Sep 2007 14:46:57 +0000 Subject: [PATCH] Added test for bug in grid in / grid out git-svn-id: https://svn.dealii.org/trunk@15161 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/fail/grid_output_input.cc | 87 +++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 tests/fail/grid_output_input.cc diff --git a/tests/fail/grid_output_input.cc b/tests/fail/grid_output_input.cc new file mode 100644 index 0000000000..3264ba16b9 --- /dev/null +++ b/tests/fail/grid_output_input.cc @@ -0,0 +1,87 @@ +//--------------------------------------------------------------------------- +// $Id: grid_generator_03.cc 14287 2006-12-30 00:52:57Z bangerth $ +// Version: $Name$ +// +// Copyright (C) 2005, 2006 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. +// +//--------------------------------------------------------------------------- + + +// Test output and input of meshes, to see if the meshes are different +// after a couple of global refinements + +#include "../tests.h" +#include +#include +#include +#include +#include +#include + +#include +#include + + +template +void test(std::ostream& out) +{ + GridOut go; + go.set_flags(GridOutFlags::Ucd(false, true)); + go.set_flags(GridOutFlags::Msh(true)); + Triangulation tr; + + GridGenerator::hyper_cube_with_cylindrical_hole(tr, .3, .4, 1, 1, false); + CylinderBoundary boundary(.3, 2); + tr.set_boundary(1, boundary); + { + std::ofstream grid_file("grid_output_input/coarse_grid.inp"); + go.write_ucd(tr, grid_file); + grid_file.close(); + } + tr.refine_global(1); + deallog << "Writing refined from constructor" << std::endl; + go.write_ucd(tr, out); + + tr.set_boundary(1); + tr.clear(); + + GridIn gi; + gi.attach_triangulation(tr); + { + deallog << "Read coarse grid" << std::endl; + std::ifstream grid_file("grid_output_input/coarse_grid.inp"); + gi.read_ucd(grid_file); + grid_file.close(); + } + + tr.set_boundary(1, boundary); + tr.refine_global(1); + deallog << "Writing refined from file" << std::endl; + go.write_ucd(tr, out); + + { + std::ofstream grid_file("grid_output_input/grid.msh"); + go.write_msh(tr, grid_file); + grid_file.close(); + } + + tr.set_boundary(1); + tr.clear(); +} + +int main() +{ + std::ofstream logfile("grid_output_input/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + deallog.push("3d"); + test<3>(logfile); + deallog.pop(); +} -- 2.39.5