From 31319820724bc519b6065e97f187999de880f4aa Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 14 Dec 2011 17:34:25 +0000 Subject: [PATCH] New test. git-svn-id: https://svn.dealii.org/trunk@24826 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/deal.II/data_out_postprocessor_01.cc | 207 +++++ .../data_out_postprocessor_01/cmp/generic | 783 ++++++++++++++++++ 2 files changed, 990 insertions(+) create mode 100644 tests/deal.II/data_out_postprocessor_01.cc create mode 100644 tests/deal.II/data_out_postprocessor_01/cmp/generic diff --git a/tests/deal.II/data_out_postprocessor_01.cc b/tests/deal.II/data_out_postprocessor_01.cc new file mode 100644 index 0000000000..752b016b8f --- /dev/null +++ b/tests/deal.II/data_out_postprocessor_01.cc @@ -0,0 +1,207 @@ +//---------------------------- data_out.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2007, 2008, 2011 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. +// +//---------------------------- data_out.cc --------------------------- + +// tests DataPostprocessor: create a FE field that has two components of +// the kind cos(something) and sin(something) and then have a postprocessor +// that computes the sum of squares. should always be equal to one + + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + + +std::ofstream logfile("data_out_postprocessor_01/output"); + + +template +class LaplaceProblem +{ + public: + LaplaceProblem (); + void run (); + + private: + void make_grid_and_dofs (); + void solve (); + void output_results () const; + + Triangulation triangulation; + FESystem fe; + DoFHandler dof_handler; + + Vector solution; +}; + + +template +LaplaceProblem::LaplaceProblem () + : + fe (FE_Q(1),2), + dof_handler (triangulation) +{} + + + +template +void LaplaceProblem::make_grid_and_dofs () +{ + GridGenerator::hyper_cube (triangulation, 0, 1); + triangulation.refine_global (1); + triangulation.begin_active()->set_refine_flag (); + triangulation.execute_coarsening_and_refinement (); + + dof_handler.distribute_dofs (fe); + solution.reinit (dof_handler.n_dofs()); +} + + + +template +class SinesAndCosines : public Function +{ + public: + SinesAndCosines () + : + Function (2) + {} + + double value (const Point &p, + const unsigned int component) const + { + switch (component) + { + case 0: + return std::sin (p.norm()); + case 1: + return std::cos (p.norm()); + default: + Assert (false, ExcNotImplemented()); + return 0; + } + } +}; + + + +template +void LaplaceProblem::solve () +{ + // dummy solve. just insert some + // values as mentioned at the top + // of the file + VectorTools::interpolate (dof_handler, + SinesAndCosines(), + solution); +} + + +template +class MyPostprocessor : public DataPostprocessor +{ + public: + virtual std::vector get_names () const + { + return std::vector(1,"magnitude"); + } + + virtual + std::vector + get_data_component_interpretation () const + { + return + std::vector + (1,DataComponentInterpretation::component_is_scalar); + } + + virtual UpdateFlags get_needed_update_flags () const + { + return update_values; + } + + virtual + void + compute_derived_quantities_vector (const std::vector > &uh, + const std::vector > > &, + const std::vector > > &, + const std::vector > &, + const std::vector > &, + std::vector > &computed_quantities) const + { + for (unsigned int q=0; q +void LaplaceProblem::output_results () const +{ + MyPostprocessor p; + DataOut data_out; + data_out.attach_dof_handler (dof_handler); + data_out.add_data_vector (solution, p); + data_out.build_patches (); + data_out.write_gnuplot (logfile); +} + + + +template +void LaplaceProblem::run () +{ + make_grid_and_dofs(); + solve (); + output_results (); +} + + + +int main () +{ + deallog.depth_console (0); + logfile << std::setprecision(2); + deallog << std::setprecision(2); + + LaplaceProblem<2> laplace_problem_2d; + laplace_problem_2d.run (); + + LaplaceProblem<3> laplace_problem_3d; + laplace_problem_3d.run (); + + return 0; +} diff --git a/tests/deal.II/data_out_postprocessor_01/cmp/generic b/tests/deal.II/data_out_postprocessor_01/cmp/generic new file mode 100644 index 0000000000..5df4e5c863 --- /dev/null +++ b/tests/deal.II/data_out_postprocessor_01/cmp/generic @@ -0,0 +1,783 @@ +# This file was generated by the deal.II library. + + +# +# For a description of the GNUPLOT format see the GNUPLOT manual. +# +# +0.5 0 1 +1 0 1 + +0.5 0.5 1 +1 0.5 1 + + +0 0.5 1 +0.5 0.5 1 + +0 1 1 +0.5 1 1 + + +0.5 0.5 1 +1 0.5 1 + +0.5 1 1 +1 1 1 + + +0 0 1 +0.25 0 1 + +0 0.25 1 +0.25 0.25 1 + + +0.25 0 1 +0.5 0 1 + +0.25 0.25 1 +0.5 0.25 1 + + +0 0.25 1 +0.25 0.25 1 + +0 0.5 1 +0.25 0.5 1 + + +0.25 0.25 1 +0.5 0.25 1 + +0.25 0.5 1 +0.5 0.5 1 + + +# This file was generated by the deal.II library. + + +# +# For a description of the GNUPLOT format see the GNUPLOT manual. +# +# +0.5 0 0 1 +1 0 0 1 + + +0.5 0 0 1 +0.5 0.5 0 1 + + +0.5 0 0 1 +0.5 0 0.5 1 + + +1 0 0 1 +1 0.5 0 1 + + +1 0 0 1 +1 0 0.5 1 + + +0.5 0.5 0 1 +1 0.5 0 1 + + +0.5 0.5 0 1 +0.5 0.5 0.5 1 + + +1 0.5 0 1 +1 0.5 0.5 1 + + +0.5 0 0.5 1 +1 0 0.5 1 + + +0.5 0 0.5 1 +0.5 0.5 0.5 1 + + +1 0 0.5 1 +1 0.5 0.5 1 + + +0.5 0.5 0.5 1 +1 0.5 0.5 1 + + +0 0.5 0 1 +0.5 0.5 0 1 + + +0 0.5 0 1 +0 1 0 1 + + +0 0.5 0 1 +0 0.5 0.5 1 + + +0.5 0.5 0 1 +0.5 1 0 1 + + +0.5 0.5 0 1 +0.5 0.5 0.5 1 + + +0 1 0 1 +0.5 1 0 1 + + +0 1 0 1 +0 1 0.5 1 + + +0.5 1 0 1 +0.5 1 0.5 1 + + +0 0.5 0.5 1 +0.5 0.5 0.5 1 + + +0 0.5 0.5 1 +0 1 0.5 1 + + +0.5 0.5 0.5 1 +0.5 1 0.5 1 + + +0 1 0.5 1 +0.5 1 0.5 1 + + +0.5 0.5 0 1 +1 0.5 0 1 + + +0.5 0.5 0 1 +0.5 1 0 1 + + +0.5 0.5 0 1 +0.5 0.5 0.5 1 + + +1 0.5 0 1 +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1 1 1 + + +0.5 1 0.5 1 +0.5 1 1 1 + + +0 0.5 1 1 +0.5 0.5 1 1 + + +0 0.5 1 1 +0 1 1 1 + + +0.5 0.5 1 1 +0.5 1 1 1 + + +0 1 1 1 +0.5 1 1 1 + + +0.5 0.5 0.5 1 +1 0.5 0.5 1 + + +0.5 0.5 0.5 1 +0.5 1 0.5 1 + + +0.5 0.5 0.5 1 +0.5 0.5 1 1 + + +1 0.5 0.5 1 +1 1 0.5 1 + + +1 0.5 0.5 1 +1 0.5 1 1 + + +0.5 1 0.5 1 +1 1 0.5 1 + + +0.5 1 0.5 1 +0.5 1 1 1 + + +1 1 0.5 1 +1 1 1 1 + + +0.5 0.5 1 1 +1 0.5 1 1 + + +0.5 0.5 1 1 +0.5 1 1 1 + + +1 0.5 1 1 +1 1 1 1 + + +0.5 1 1 1 +1 1 1 1 + + +0 0 0 1 +0.25 0 0 1 + + +0 0 0 1 +0 0.25 0 1 + + +0 0 0 1 +0 0 0.25 1 + + +0.25 0 0 1 +0.25 0.25 0 1 + + +0.25 0 0 1 +0.25 0 0.25 1 + + +0 0.25 0 1 +0.25 0.25 0 1 + + +0 0.25 0 1 +0 0.25 0.25 1 + + +0.25 0.25 0 1 +0.25 0.25 0.25 1 + + +0 0 0.25 1 +0.25 0 0.25 1 + + +0 0 0.25 1 +0 0.25 0.25 1 + + +0.25 0 0.25 1 +0.25 0.25 0.25 1 + + +0 0.25 0.25 1 +0.25 0.25 0.25 1 + + +0.25 0 0 1 +0.5 0 0 1 + + +0.25 0 0 1 +0.25 0.25 0 1 + + +0.25 0 0 1 +0.25 0 0.25 1 + + +0.5 0 0 1 +0.5 0.25 0 1 + + +0.5 0 0 1 +0.5 0 0.25 1 + + +0.25 0.25 0 1 +0.5 0.25 0 1 + + +0.25 0.25 0 1 +0.25 0.25 0.25 1 + + +0.5 0.25 0 1 +0.5 0.25 0.25 1 + + +0.25 0 0.25 1 +0.5 0 0.25 1 + + +0.25 0 0.25 1 +0.25 0.25 0.25 1 + + +0.5 0 0.25 1 +0.5 0.25 0.25 1 + + +0.25 0.25 0.25 1 +0.5 0.25 0.25 1 + + +0 0.25 0 1 +0.25 0.25 0 1 + + +0 0.25 0 1 +0 0.5 0 1 + + +0 0.25 0 1 +0 0.25 0.25 1 + + +0.25 0.25 0 1 +0.25 0.5 0 1 + + +0.25 0.25 0 1 +0.25 0.25 0.25 1 + + +0 0.5 0 1 +0.25 0.5 0 1 + + +0 0.5 0 1 +0 0.5 0.25 1 + + +0.25 0.5 0 1 +0.25 0.5 0.25 1 + + +0 0.25 0.25 1 +0.25 0.25 0.25 1 + + +0 0.25 0.25 1 +0 0.5 0.25 1 + + +0.25 0.25 0.25 1 +0.25 0.5 0.25 1 + + +0 0.5 0.25 1 +0.25 0.5 0.25 1 + + +0.25 0.25 0 1 +0.5 0.25 0 1 + + +0.25 0.25 0 1 +0.25 0.5 0 1 + + +0.25 0.25 0 1 +0.25 0.25 0.25 1 + + +0.5 0.25 0 1 +0.5 0.5 0 1 + + +0.5 0.25 0 1 +0.5 0.25 0.25 1 + + +0.25 0.5 0 1 +0.5 0.5 0 1 + + +0.25 0.5 0 1 +0.25 0.5 0.25 1 + + +0.5 0.5 0 1 +0.5 0.5 0.25 1 + + +0.25 0.25 0.25 1 +0.5 0.25 0.25 1 + + +0.25 0.25 0.25 1 +0.25 0.5 0.25 1 + + +0.5 0.25 0.25 1 +0.5 0.5 0.25 1 + + +0.25 0.5 0.25 1 +0.5 0.5 0.25 1 + + +0 0 0.25 1 +0.25 0 0.25 1 + + +0 0 0.25 1 +0 0.25 0.25 1 + + +0 0 0.25 1 +0 0 0.5 1 + + +0.25 0 0.25 1 +0.25 0.25 0.25 1 + + +0.25 0 0.25 1 +0.25 0 0.5 1 + + +0 0.25 0.25 1 +0.25 0.25 0.25 1 + + +0 0.25 0.25 1 +0 0.25 0.5 1 + + +0.25 0.25 0.25 1 +0.25 0.25 0.5 1 + + +0 0 0.5 1 +0.25 0 0.5 1 + + +0 0 0.5 1 +0 0.25 0.5 1 + + +0.25 0 0.5 1 +0.25 0.25 0.5 1 + + +0 0.25 0.5 1 +0.25 0.25 0.5 1 + + +0.25 0 0.25 1 +0.5 0 0.25 1 + + +0.25 0 0.25 1 +0.25 0.25 0.25 1 + + +0.25 0 0.25 1 +0.25 0 0.5 1 + + +0.5 0 0.25 1 +0.5 0.25 0.25 1 + + +0.5 0 0.25 1 +0.5 0 0.5 1 + + +0.25 0.25 0.25 1 +0.5 0.25 0.25 1 + + +0.25 0.25 0.25 1 +0.25 0.25 0.5 1 + + +0.5 0.25 0.25 1 +0.5 0.25 0.5 1 + + +0.25 0 0.5 1 +0.5 0 0.5 1 + + +0.25 0 0.5 1 +0.25 0.25 0.5 1 + + +0.5 0 0.5 1 +0.5 0.25 0.5 1 + + +0.25 0.25 0.5 1 +0.5 0.25 0.5 1 + + +0 0.25 0.25 1 +0.25 0.25 0.25 1 + + +0 0.25 0.25 1 +0 0.5 0.25 1 + + +0 0.25 0.25 1 +0 0.25 0.5 1 + + +0.25 0.25 0.25 1 +0.25 0.5 0.25 1 + + +0.25 0.25 0.25 1 +0.25 0.25 0.5 1 + + +0 0.5 0.25 1 +0.25 0.5 0.25 1 + + +0 0.5 0.25 1 +0 0.5 0.5 1 + + +0.25 0.5 0.25 1 +0.25 0.5 0.5 1 + + +0 0.25 0.5 1 +0.25 0.25 0.5 1 + + +0 0.25 0.5 1 +0 0.5 0.5 1 + + +0.25 0.25 0.5 1 +0.25 0.5 0.5 1 + + +0 0.5 0.5 1 +0.25 0.5 0.5 1 + + +0.25 0.25 0.25 1 +0.5 0.25 0.25 1 + + +0.25 0.25 0.25 1 +0.25 0.5 0.25 1 + + +0.25 0.25 0.25 1 +0.25 0.25 0.5 1 + + +0.5 0.25 0.25 1 +0.5 0.5 0.25 1 + + +0.5 0.25 0.25 1 +0.5 0.25 0.5 1 + + +0.25 0.5 0.25 1 +0.5 0.5 0.25 1 + + +0.25 0.5 0.25 1 +0.25 0.5 0.5 1 + + +0.5 0.5 0.25 1 +0.5 0.5 0.5 1 + + +0.25 0.25 0.5 1 +0.5 0.25 0.5 1 + + +0.25 0.25 0.5 1 +0.25 0.5 0.5 1 + + +0.5 0.25 0.5 1 +0.5 0.5 0.5 1 + + +0.25 0.5 0.5 1 +0.5 0.5 0.5 1 + + -- 2.39.5