From 41f48de059f0f713ad88562676f3376f572ed4d1 Mon Sep 17 00:00:00 2001 From: bangerth Date: Wed, 5 May 2010 13:37:53 +0000 Subject: [PATCH] New test. git-svn-id: https://svn.dealii.org/trunk@21075 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/bits/mapping_q_eulerian_02.cc | 129 +++++++++++++++++++ tests/bits/mapping_q_eulerian_02/cmp/generic | 84 ++++++++++++ 2 files changed, 213 insertions(+) create mode 100644 tests/bits/mapping_q_eulerian_02.cc create mode 100644 tests/bits/mapping_q_eulerian_02/cmp/generic diff --git a/tests/bits/mapping_q_eulerian_02.cc b/tests/bits/mapping_q_eulerian_02.cc new file mode 100644 index 0000000000..860ac5ce95 --- /dev/null +++ b/tests/bits/mapping_q_eulerian_02.cc @@ -0,0 +1,129 @@ +//---------------------------------------------------------------------- +// $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 +// +// this is a variant of _01 except that we use a quadratic FE field + +#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]*p[0]/2; + } + + 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(2),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_02/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_02/cmp/generic b/tests/bits/mapping_q_eulerian_02/cmp/generic new file mode 100644 index 0000000000..7349634163 --- /dev/null +++ b/tests/bits/mapping_q_eulerian_02/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. +# +# +-0.5000 0.5000 +1.500 0.5000 + + +DEAL::dim=2 +# This file was generated by the deal.II library. + + +# +# For a description of the GNUPLOT format see the GNUPLOT manual. +# +# +-0.5000 -0.5000 0.5000 0.5000 +1.500 -1.500 0.5000 -0.5000 + +-0.5000 0.5000 0.5000 -0.5000 +1.500 1.500 0.5000 0.5000 + + +DEAL::dim=3 +# This file was generated by the deal.II library. + + +# +# For a description of the GNUPLOT format see the GNUPLOT manual. +# +# +-0.5000 -0.5000 -0.5000 0.5000 0.5000 0.5000 +1.500 -1.500 -1.500 0.5000 -0.5000 -0.5000 + + +-0.5000 -0.5000 -0.5000 0.5000 0.5000 0.5000 +-0.5000 0.5000 -0.5000 0.5000 -0.5000 0.5000 + + +-0.5000 -0.5000 -0.5000 0.5000 0.5000 0.5000 +-0.5000 -0.5000 0.5000 0.5000 0.5000 -0.5000 + + +1.500 -1.500 -1.500 0.5000 -0.5000 -0.5000 +1.500 1.500 -1.500 0.5000 0.5000 -0.5000 + + +1.500 -1.500 -1.500 0.5000 -0.5000 -0.5000 +1.500 -1.500 1.500 0.5000 -0.5000 0.5000 + + +-0.5000 0.5000 -0.5000 0.5000 -0.5000 0.5000 +1.500 1.500 -1.500 0.5000 0.5000 -0.5000 + + +-0.5000 0.5000 -0.5000 0.5000 -0.5000 0.5000 +-0.5000 0.5000 0.5000 0.5000 -0.5000 -0.5000 + + +1.500 1.500 -1.500 0.5000 0.5000 -0.5000 +1.500 1.500 1.500 0.5000 0.5000 0.5000 + + +-0.5000 -0.5000 0.5000 0.5000 0.5000 -0.5000 +1.500 -1.500 1.500 0.5000 -0.5000 0.5000 + + +-0.5000 -0.5000 0.5000 0.5000 0.5000 -0.5000 +-0.5000 0.5000 0.5000 0.5000 -0.5000 -0.5000 + + +1.500 -1.500 1.500 0.5000 -0.5000 0.5000 +1.500 1.500 1.500 0.5000 0.5000 0.5000 + + +-0.5000 0.5000 0.5000 0.5000 -0.5000 -0.5000 +1.500 1.500 1.500 0.5000 0.5000 0.5000 + + -- 2.39.5