From ab14384e673a53834bf0b729bda7dadddd869f33 Mon Sep 17 00:00:00 2001 From: bangerth Date: Wed, 5 May 2010 13:24:47 +0000 Subject: [PATCH] New test. git-svn-id: https://svn.dealii.org/trunk@21074 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/bits/mapping_q1_eulerian_01.cc | 129 ++++++++++++++++++ tests/bits/mapping_q1_eulerian_01/cmp/generic | 84 ++++++++++++ 2 files changed, 213 insertions(+) create mode 100644 tests/bits/mapping_q1_eulerian_01.cc create mode 100644 tests/bits/mapping_q1_eulerian_01/cmp/generic diff --git a/tests/bits/mapping_q1_eulerian_01.cc b/tests/bits/mapping_q1_eulerian_01.cc new file mode 100644 index 0000000000..89c9d4c031 --- /dev/null +++ b/tests/bits/mapping_q1_eulerian_01.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 MappingQ1Eulerian agree on how to output a +// displaced mesh. This seems to have always worked (unless +// MappingQEulerian, which is tested in mapping_q_eulerian_01) but it +// never hurts to test + +#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); + + MappingQ1Eulerian euler(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_q1_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_q1_eulerian_01/cmp/generic b/tests/bits/mapping_q1_eulerian_01/cmp/generic new file mode 100644 index 0000000000..3c5900d04e --- /dev/null +++ b/tests/bits/mapping_q1_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