From: Guido Kanschat Date: Mon, 14 Mar 2005 22:50:32 +0000 (+0000) Subject: GridGenerator checked all grids in 2D, including color X-Git-Tag: v8.0.0~14400 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e5da23027f362344fd471e89332ab202da952b2;p=dealii.git GridGenerator checked all grids in 2D, including color git-svn-id: https://svn.dealii.org/trunk@10136 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/bits/Makefile b/tests/bits/Makefile index ba02314110..a83fc1d571 100644 --- a/tests/bits/Makefile +++ b/tests/bits/Makefile @@ -1,4 +1,3 @@ -# Generated automatically from Makefile.in by configure. ############################################################ # Makefile,v 1.15 2002/06/13 12:51:13 hartmann Exp # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors @@ -22,9 +21,9 @@ default: run-tests ############################################################ -tests_x = anna_? \ - gerold_1 \ - geometry_info_1 \ +tests_x = geometry_info_1 \ + grid_generator_?? \ + grid_in_* \ point_inside_? \ full_matrix_1 \ block_matrix_array_* \ @@ -34,6 +33,8 @@ tests_x = anna_? \ data_out_stack_0* \ dof_tools_[0-9]* \ fe_tools_[0-9]* \ + anna_? \ + gerold_1 \ roy_1 \ denis_1 \ unit_support_points \ @@ -61,7 +62,6 @@ tests_x = anna_? \ apply_boundary_values_* \ error_estimator_* \ cylinder_shell_* \ - grid_in_* \ compressed_sparsity_pattern_* \ point_difference_* \ umfpack_* \ diff --git a/tests/bits/grid_generator_01.cc b/tests/bits/grid_generator_01.cc new file mode 100644 index 0000000000..b7a812b6b5 --- /dev/null +++ b/tests/bits/grid_generator_01.cc @@ -0,0 +1,163 @@ +//--------------------------------------------------------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2005 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 the various functions in grid generator. + +#include +#include +#include +#include +#include + +#include +#include + + +template +void test(std::ostream& out) +{ + Point p1; + p1[0] = 2.; + if (dim>1) p1[1] = -1.; + if (dim>2) p1[2] = 0.; + Point p2; + p2[0] = 3.; + if (dim>1) p2[1] = 2.; + if (dim>2) p2[2] = 4.; + Point p3; + p3[0] = 2.; + if (dim>1) p3[1] = 1.; + if (dim>2) p3[2] = 4.; + + GridOut go; + GridOutFlags::XFig xfig_flags; + xfig_flags.level_color = false; + xfig_flags.fill_style = 25; + + go.set_flags(xfig_flags); + + GridOut::OutputFormat format = (dim==2) ? GridOut::xfig : GridOut::dx; + + if (true) + { + deallog << "hyper_cube" << std::endl; + Triangulation tr; + GridGenerator::hyper_cube(tr, 3., 7.); + go.write(tr, out, format); + } + if (true) + { + deallog << "subdivided_hyper_cube" << std::endl; + Triangulation tr; + GridGenerator::subdivided_hyper_cube(tr, 3, 1., 7.); + go.write(tr, out, format); + } + if (true) + { + deallog << "hyper_rectangle" << std::endl; + Triangulation tr; + GridGenerator::hyper_rectangle(tr, p1, p2, true); + go.write(tr, out, format); + } + if (true) + { + deallog << "subdivided_hyper_rectangle" << std::endl; + Triangulation tr; + std::vector sub(dim); + sub[0] = 2; + if (dim>1) sub[1] = 3; + if (dim>2) sub[2] = 4; + GridGenerator::subdivided_hyper_rectangle(tr, sub, p1, p2, true); + go.write(tr, out, format); + } + if (dim == 2) + { + deallog << "parallelogram" << std::endl; + Triangulation tr; + Tensor corners; + corners[0] = p1; + if (dim>1) corners[1] = p2; + if (dim>2) corners[2] = p3; + GridGenerator::parallelogram(tr, corners, true); + go.write(tr, out, format); + } + if (dim>1) + { + deallog << "enclosed_hyper_cube" << std::endl; + Triangulation tr; + GridGenerator::enclosed_hyper_cube(tr, 3., 7., 1., true); + go.write(tr, out, format); + } + if (true) + { + deallog << "hyper_ball" << std::endl; + Triangulation tr; + GridGenerator::hyper_ball(tr, p1, 3.); + go.write(tr, out, format); + } + if (true) + { + deallog << "cylinder" << std::endl; + Triangulation tr; + GridGenerator::cylinder(tr, 1., 3.); + go.write(tr, out, format); + } + if (true) + { + deallog << "hyper_L" << std::endl; + Triangulation tr; + GridGenerator::hyper_L(tr, -1., 1.); + go.write(tr, out, format); + } + if (true) + { + deallog << "hyper_cube_slit" << std::endl; + Triangulation tr; + GridGenerator::hyper_cube_slit(tr, -2., 2., true); + go.write(tr, out, format); + } + if (true) + { + deallog << "hyper_shell" << std::endl; + Triangulation tr; + GridGenerator::hyper_shell(tr, p1, 4., 6.); + go.write(tr, out, format); + } + if (true) + { + deallog << "half_hyper_ball" << std::endl; + Triangulation tr; + GridGenerator::half_hyper_ball(tr, p1, 3.); + go.write(tr, out, format); + } + if (true) + { + deallog << "half_hyper_shell" << std::endl; + Triangulation tr; + GridGenerator::half_hyper_shell(tr, p1, 4., 6.); + go.write(tr, out, format); + } +} + + +int main() +{ + std::ofstream logfile("grid_generator_01.output"); + deallog.attach(logfile); + deallog.depth_console(0); + + deallog.push("2d-GridTest"); + test<2>(logfile); + deallog.pop(); +}