From: bangerth Date: Tue, 11 May 2010 12:29:32 +0000 (+0000) Subject: New test. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac77119bb52caef85a1b00d04b907049a03d8a96;p=dealii-svn.git New test. git-svn-id: https://svn.dealii.org/trunk@21118 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/deal.II/Makefile b/tests/deal.II/Makefile index 6d2d3b7ac2..53a5037840 100644 --- a/tests/deal.II/Makefile +++ b/tests/deal.II/Makefile @@ -1,6 +1,6 @@ ############################################################ # $Id$ -# Copyright (C) 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009 by the deal.II authors +# Copyright (C) 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors ############################################################ ############################################################ @@ -17,7 +17,7 @@ libraries = $(lib-deal2-1d.g) \ $(lib-lac.g) \ $(lib-base.g) -default: run-tests +default: run-tests ############################################################ @@ -46,6 +46,7 @@ tests_x = block_info block_matrices \ grid_transform_3d \ grid_hyper_* \ measure_et_al \ + extent_in_direction \ normals_at_vertices \ intergrid_constraints \ intergrid_map \ diff --git a/tests/deal.II/extent_in_direction.cc b/tests/deal.II/extent_in_direction.cc new file mode 100644 index 0000000000..86910e701c --- /dev/null +++ b/tests/deal.II/extent_in_direction.cc @@ -0,0 +1,117 @@ +//---------------------------- extent_in_direction.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2010 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. +// +//---------------------------- extent_in_direction.cc --------------------------- + +// test TriaAccessor::extent_in_direction + +#include "../tests.h" +#include +#include +#include +#include +#include +#include + +#define PRECISION 5 + + +void create_triangulation(const unsigned int case_no, + Triangulation<1> &tria) +{ + switch (case_no) + { + case 0: + GridGenerator::hyper_cube(tria, 1., 3.); + break; + case 1: + GridGenerator::hyper_cube(tria, 1., 4.); + break; + default: + Assert(false, ExcNotImplemented()); + }; +} + + +void create_triangulation(const unsigned int case_no, + Triangulation<2> &tria) +{ + switch (case_no) + { + case 0: + GridGenerator::hyper_cube(tria, 1., 3.); + break; + case 1: + { + GridGenerator::hyper_cube(tria, 1., 3.); + Point<2> &v0=tria.begin_active()->vertex(0); + v0(0) = 0.; + Point<2> &v2=tria.begin_active()->vertex(3); + v2(0) = 5.; + v2(1) = 4.; + break; + } + default: + Assert(false, ExcNotImplemented()); + }; +} + + +void create_triangulation(const unsigned int case_no, + Triangulation<3> &tria) +{ + switch (case_no) + { + case 0: + GridGenerator::hyper_cube(tria, 1., 3.); + break; + case 1: + { + GridGenerator::hyper_cube(tria, 1., 3.); + Point<3> &v0=tria.begin_active()->vertex(0); + v0(0) = 0.; + break; + } + default: + Assert(false, ExcNotImplemented()); + }; +} + + +template +void test() +{ + Triangulation tria; + for (unsigned int case_no=0; case_no<2; ++case_no) + { + create_triangulation(case_no, tria); + deallog << "dim " << dim << ", case " << case_no << ": "; + for (unsigned int i=0; iextent_in_direction(i) << ' '; + deallog << std::endl; + tria.clear(); + } +} + + +int main() +{ + std::ofstream logfile ("extent_in_direction/output"); + deallog << std::setprecision (PRECISION); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + test<1>(); + test<2>(); + test<3>(); +} + diff --git a/tests/deal.II/extent_in_direction/cmp/generic b/tests/deal.II/extent_in_direction/cmp/generic new file mode 100644 index 0000000000..e4863e20e2 --- /dev/null +++ b/tests/deal.II/extent_in_direction/cmp/generic @@ -0,0 +1,13 @@ + +DEAL::dim2:case0:measure=4.0000 +DEAL::dim2:case0:center=2.0000 2.0000 +DEAL::dim2:case0:barycenter=2.0000 2.0000 +DEAL::dim2:case1:measure=8.0000 +DEAL::dim2:case1:center=2.2500 2.2500 +DEAL::dim2:case1:barycenter=2.3750 2.2917 +DEAL::dim3:case0:measure=8.0000 +DEAL::dim3:case0:center=2.0000 2.0000 2.0000 +DEAL::dim3:case0:barycenter=2.0000 2.0000 2.0000 +DEAL::dim3:case1:measure=9.0000 +DEAL::dim3:case1:center=1.8750 2.0000 2.0000 +DEAL::dim3:case1:barycenter=1.8642 1.9630 1.9630