From 9de38550e3d97f8cb75a28b4e8d33f8851a60620 Mon Sep 17 00:00:00 2001 From: bangerth Date: Wed, 5 May 2010 13:06:21 +0000 Subject: [PATCH] New test. git-svn-id: https://svn.dealii.org/trunk@21073 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/bits/Makefile | 5 +- tests/bits/mapping_q_eulerian_01.cc | 127 +++++++++++++++++++ tests/bits/mapping_q_eulerian_01/cmp/generic | 84 ++++++++++++ 3 files changed, 213 insertions(+), 3 deletions(-) create mode 100644 tests/bits/mapping_q_eulerian_01.cc create mode 100644 tests/bits/mapping_q_eulerian_01/cmp/generic diff --git a/tests/bits/Makefile b/tests/bits/Makefile index a117de3452..d51a1eaf7b 100644 --- a/tests/bits/Makefile +++ b/tests/bits/Makefile @@ -1,6 +1,6 @@ ############################################################ # Makefile,v 1.15 2002/06/13 12:51:13 hartmann Exp -# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors +# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors ############################################################ ############################################################ @@ -56,8 +56,7 @@ tests_x = grid_generator_?? \ normals_* \ q_point_sum_* \ volume_* \ - mapping_cartesian_1 \ - mapping_q4_3d \ + mapping_* \ q_points \ find_closest_vertex_* \ find_cells_adjacent_to_vertex_* \ diff --git a/tests/bits/mapping_q_eulerian_01.cc b/tests/bits/mapping_q_eulerian_01.cc new file mode 100644 index 0000000000..c7c8663c79 --- /dev/null +++ b/tests/bits/mapping_q_eulerian_01.cc @@ -0,0 +1,127 @@ +//---------------------------------------------------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 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. +// +//---------------------------------------------------------------------- + +// test that DataOut and MappingQEulerian agree on how to output a +// displaced mesh. This was broken between r20158 and r21072 + +#include "../tests.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace dealii; + + +template +class Displacement : public Function +{ + public: + Displacement() : + Function(dim) + {} + + double value (const Point &p, + const unsigned int component) const + { + return p[component]; + } + + void vector_value (const Point &p, + Vector &v) const + { + for (unsigned int i=0; i +void test () +{ + deallog << "dim=" << dim << std::endl; + + Triangulation triangulation; + GridGenerator::hyper_cube (triangulation, -1, 1); + + FESystem fe(FE_Q(1),dim); + DoFHandler dof_handler(triangulation); + dof_handler.distribute_dofs(fe); + + Vector displacements (dof_handler.n_dofs()); + + VectorTools::interpolate (dof_handler, + Displacement(), + displacements); + + MappingQEulerian euler(2, displacements, dof_handler); + // now the actual test + DataOut data_out; + data_out.attach_dof_handler(dof_handler); + std::vector names (dim, "displacement"); + data_out.add_data_vector(displacements,names); + + // output with all cells curved + data_out.build_patches(euler,1,DataOut::curved_inner_cells); + data_out.write_gnuplot(deallog.get_file_stream()); +} + + + +int main () +{ + std::ofstream logfile("mapping_q_eulerian_01/output"); + deallog.attach(logfile); + deallog << std::setprecision (4); + logfile << std::setprecision (4); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + test<1> (); + test<2> (); + test<3> (); +} + + diff --git a/tests/bits/mapping_q_eulerian_01/cmp/generic b/tests/bits/mapping_q_eulerian_01/cmp/generic new file mode 100644 index 0000000000..3c5900d04e --- /dev/null +++ b/tests/bits/mapping_q_eulerian_01/cmp/generic @@ -0,0 +1,84 @@ + +DEAL::dim=1 +# This file was generated by the deal.II library. + + +# +# For a description of the GNUPLOT format see the GNUPLOT manual. +# +# +-2.000 -1.000 +2.000 1.000 + + +DEAL::dim=2 +# This file was generated by the deal.II library. + + +# +# For a description of the GNUPLOT format see the GNUPLOT manual. +# +# +-2.000 -2.000 -1.000 -1.000 +2.000 -2.000 1.000 -1.000 + +-2.000 2.000 -1.000 1.000 +2.000 2.000 1.000 1.000 + + +DEAL::dim=3 +# This file was generated by the deal.II library. + + +# +# For a description of the GNUPLOT format see the GNUPLOT manual. +# +# +-2.000 -2.000 -2.000 -1.000 -1.000 -1.000 +2.000 -2.000 -2.000 1.000 -1.000 -1.000 + + +-2.000 -2.000 -2.000 -1.000 -1.000 -1.000 +-2.000 2.000 -2.000 -1.000 1.000 -1.000 + + +-2.000 -2.000 -2.000 -1.000 -1.000 -1.000 +-2.000 -2.000 2.000 -1.000 -1.000 1.000 + + +2.000 -2.000 -2.000 1.000 -1.000 -1.000 +2.000 2.000 -2.000 1.000 1.000 -1.000 + + +2.000 -2.000 -2.000 1.000 -1.000 -1.000 +2.000 -2.000 2.000 1.000 -1.000 1.000 + + +-2.000 2.000 -2.000 -1.000 1.000 -1.000 +2.000 2.000 -2.000 1.000 1.000 -1.000 + + +-2.000 2.000 -2.000 -1.000 1.000 -1.000 +-2.000 2.000 2.000 -1.000 1.000 1.000 + + +2.000 2.000 -2.000 1.000 1.000 -1.000 +2.000 2.000 2.000 1.000 1.000 1.000 + + +-2.000 -2.000 2.000 -1.000 -1.000 1.000 +2.000 -2.000 2.000 1.000 -1.000 1.000 + + +-2.000 -2.000 2.000 -1.000 -1.000 1.000 +-2.000 2.000 2.000 -1.000 1.000 1.000 + + +2.000 -2.000 2.000 1.000 -1.000 1.000 +2.000 2.000 2.000 1.000 1.000 1.000 + + +-2.000 2.000 2.000 -1.000 1.000 1.000 +2.000 2.000 2.000 1.000 1.000 1.000 + + -- 2.39.5