From 1ba58ce6284277b2b1a71b601512f0caf101e1ef Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 27 Aug 2019 17:17:57 -0600 Subject: [PATCH] Add a failing test. --- ...ata_out_postprocessor_vector_complex_01.cc | 206 +++++ ...out_postprocessor_vector_complex_01.output | 783 ++++++++++++++++++ 2 files changed, 989 insertions(+) create mode 100644 tests/data_out/data_out_postprocessor_vector_complex_01.cc create mode 100644 tests/data_out/data_out_postprocessor_vector_complex_01.output diff --git a/tests/data_out/data_out_postprocessor_vector_complex_01.cc b/tests/data_out/data_out_postprocessor_vector_complex_01.cc new file mode 100644 index 0000000000..c3420addab --- /dev/null +++ b/tests/data_out/data_out_postprocessor_vector_complex_01.cc @@ -0,0 +1,206 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2000 - 2018 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE.md at +// the top level directory of deal.II. +// +// --------------------------------------------------------------------- + + +// tests std::complex DataPostprocessorVector: 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 +// +// this test uses the shortcut class DataPostprocessorVector to make +// writing postprocessors simpler + + +#include + +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include "../tests.h" + + + +std::ofstream logfile("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) + {} + + std::complex + 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 DataPostprocessorVector +{ +public: + MyPostprocessor() + : DataPostprocessorVector("magnitude_times_d", update_values) + {} + + virtual void + evaluate_vector_field(const DataPostprocessorInputs::Vector &input_data, + std::vector> &computed_quantities) const + { + for (unsigned int q = 0; q < input_data.solution_values.size(); ++q) + { + Assert(computed_quantities[q].size() == dim, ExcInternalError()); + + for (unsigned int d = 0; d < dim; ++d) + computed_quantities[q](d) = + input_data.solution_values[q](0) * + input_data.solution_values[q](0) + + input_data.solution_values[q](1) * input_data.solution_values[q](1); + AssertThrow(std::fabs(computed_quantities[q](0) - 1) < 1e-12, + ExcInternalError()); + } + } +}; + + + +template +void +LaplaceProblem::output_results() const +{ + { + // Save the data in the log file + 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() +{ + 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/data_out/data_out_postprocessor_vector_complex_01.output b/tests/data_out/data_out_postprocessor_vector_complex_01.output new file mode 100644 index 0000000000..6e914eca0c --- /dev/null +++ b/tests/data_out/data_out_postprocessor_vector_complex_01.output @@ -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 +1 0 1 1 + +0.5 0.5 1 1 +1 0.5 1 1 + + +0 0.5 1 1 +0.5 0.5 1 1 + +0 1 1 1 +0.5 1 1 1 + + +0.5 0.5 1 1 +1 0.5 1 1 + +0.5 1 1 1 +1 1 1 1 + + +0 0 1 1 +0.25 0 1 1 + +0 0.25 1 1 +0.25 0.25 1 1 + + +0.25 0 1 1 +0.5 0 1 1 + +0.25 0.25 1 1 +0.5 0.25 1 1 + + +0 0.25 1 1 +0.25 0.25 1 1 + +0 0.5 1 1 +0.25 0.5 1 1 + + +0.25 0.25 1 1 +0.5 0.25 1 1 + +0.25 0.5 1 1 +0.5 0.5 1 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 1 +1 0 0 1 1 1 + + +0.5 0 0 1 1 1 +0.5 0.5 0 1 1 1 + + +0.5 0 0 1 1 1 +0.5 0 0.5 1 1 1 + + +1 0 0 1 1 1 +1 0.5 0 1 1 1 + + +1 0 0 1 1 1 +1 0 0.5 1 1 1 + + +0.5 0.5 0 1 1 1 +1 0.5 0 1 1 1 + + +0.5 0.5 0 1 1 1 +0.5 0.5 0.5 1 1 1 + + +1 0.5 0 1 1 1 +1 0.5 0.5 1 1 1 + + +0.5 0 0.5 1 1 1 +1 0 0.5 1 1 1 + + +0.5 0 0.5 1 1 1 +0.5 0.5 0.5 1 1 1 + + +1 0 0.5 1 1 1 +1 0.5 0.5 1 1 1 + + +0.5 0.5 0.5 1 1 1 +1 0.5 0.5 1 1 1 + + +0 0.5 0 1 1 1 +0.5 0.5 0 1 1 1 + + +0 0.5 0 1 1 1 +0 1 0 1 1 1 + + +0 0.5 0 1 1 1 +0 0.5 0.5 1 1 1 + + +0.5 0.5 0 1 1 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0.5 1 1 1 +1 1 0.5 1 1 1 + + +1 0.5 0.5 1 1 1 +1 0.5 1 1 1 1 + + +0.5 1 0.5 1 1 1 +1 1 0.5 1 1 1 + + +0.5 1 0.5 1 1 1 +0.5 1 1 1 1 1 + + +1 1 0.5 1 1 1 +1 1 1 1 1 1 + + +0.5 0.5 1 1 1 1 +1 0.5 1 1 1 1 + + +0.5 0.5 1 1 1 1 +0.5 1 1 1 1 1 + + +1 0.5 1 1 1 1 +1 1 1 1 1 1 + + +0.5 1 1 1 1 1 +1 1 1 1 1 1 + + +0 0 0 1 1 1 +0.25 0 0 1 1 1 + + +0 0 0 1 1 1 +0 0.25 0 1 1 1 + + +0 0 0 1 1 1 +0 0 0.25 1 1 1 + + +0.25 0 0 1 1 1 +0.25 0.25 0 1 1 1 + + +0.25 0 0 1 1 1 +0.25 0 0.25 1 1 1 + + +0 0.25 0 1 1 1 +0.25 0.25 0 1 1 1 + + +0 0.25 0 1 1 1 +0 0.25 0.25 1 1 1 + + +0.25 0.25 0 1 1 1 +0.25 0.25 0.25 1 1 1 + + +0 0 0.25 1 1 1 +0.25 0 0.25 1 1 1 + + +0 0 0.25 1 1 1 +0 0.25 0.25 1 1 1 + + +0.25 0 0.25 1 1 1 +0.25 0.25 0.25 1 1 1 + + +0 0.25 0.25 1 1 1 +0.25 0.25 0.25 1 1 1 + + +0.25 0 0 1 1 1 +0.5 0 0 1 1 1 + + +0.25 0 0 1 1 1 +0.25 0.25 0 1 1 1 + + +0.25 0 0 1 1 1 +0.25 0 0.25 1 1 1 + + +0.5 0 0 1 1 1 +0.5 0.25 0 1 1 1 + + +0.5 0 0 1 1 1 +0.5 0 0.25 1 1 1 + + +0.25 0.25 0 1 1 1 +0.5 0.25 0 1 1 1 + + +0.25 0.25 0 1 1 1 +0.25 0.25 0.25 1 1 1 + + +0.5 0.25 0 1 1 1 +0.5 0.25 0.25 1 1 1 + + +0.25 0 0.25 1 1 1 +0.5 0 0.25 1 1 1 + + +0.25 0 0.25 1 1 1 +0.25 0.25 0.25 1 1 1 + + +0.5 0 0.25 1 1 1 +0.5 0.25 0.25 1 1 1 + + +0.25 0.25 0.25 1 1 1 +0.5 0.25 0.25 1 1 1 + + +0 0.25 0 1 1 1 +0.25 0.25 0 1 1 1 + + +0 0.25 0 1 1 1 +0 0.5 0 1 1 1 + + +0 0.25 0 1 1 1 +0 0.25 0.25 1 1 1 + + +0.25 0.25 0 1 1 1 +0.25 0.5 0 1 1 1 + + +0.25 0.25 0 1 1 1 +0.25 0.25 0.25 1 1 1 + + +0 0.5 0 1 1 1 +0.25 0.5 0 1 1 1 + + +0 0.5 0 1 1 1 +0 0.5 0.25 1 1 1 + + +0.25 0.5 0 1 1 1 +0.25 0.5 0.25 1 1 1 + + +0 0.25 0.25 1 1 1 +0.25 0.25 0.25 1 1 1 + + +0 0.25 0.25 1 1 1 +0 0.5 0.25 1 1 1 + + +0.25 0.25 0.25 1 1 1 +0.25 0.5 0.25 1 1 1 + + +0 0.5 0.25 1 1 1 +0.25 0.5 0.25 1 1 1 + + +0.25 0.25 0 1 1 1 +0.5 0.25 0 1 1 1 + + +0.25 0.25 0 1 1 1 +0.25 0.5 0 1 1 1 + + +0.25 0.25 0 1 1 1 +0.25 0.25 0.25 1 1 1 + + +0.5 0.25 0 1 1 1 +0.5 0.5 0 1 1 1 + + +0.5 0.25 0 1 1 1 +0.5 0.25 0.25 1 1 1 + + +0.25 0.5 0 1 1 1 +0.5 0.5 0 1 1 1 + + +0.25 0.5 0 1 1 1 +0.25 0.5 0.25 1 1 1 + + +0.5 0.5 0 1 1 1 +0.5 0.5 0.25 1 1 1 + + +0.25 0.25 0.25 1 1 1 +0.5 0.25 0.25 1 1 1 + + +0.25 0.25 0.25 1 1 1 +0.25 0.5 0.25 1 1 1 + + +0.5 0.25 0.25 1 1 1 +0.5 0.5 0.25 1 1 1 + + +0.25 0.5 0.25 1 1 1 +0.5 0.5 0.25 1 1 1 + + +0 0 0.25 1 1 1 +0.25 0 0.25 1 1 1 + + +0 0 0.25 1 1 1 +0 0.25 0.25 1 1 1 + + +0 0 0.25 1 1 1 +0 0 0.5 1 1 1 + + +0.25 0 0.25 1 1 1 +0.25 0.25 0.25 1 1 1 + + +0.25 0 0.25 1 1 1 +0.25 0 0.5 1 1 1 + + +0 0.25 0.25 1 1 1 +0.25 0.25 0.25 1 1 1 + + +0 0.25 0.25 1 1 1 +0 0.25 0.5 1 1 1 + + +0.25 0.25 0.25 1 1 1 +0.25 0.25 0.5 1 1 1 + + +0 0 0.5 1 1 1 +0.25 0 0.5 1 1 1 + + +0 0 0.5 1 1 1 +0 0.25 0.5 1 1 1 + + +0.25 0 0.5 1 1 1 +0.25 0.25 0.5 1 1 1 + + +0 0.25 0.5 1 1 1 +0.25 0.25 0.5 1 1 1 + + +0.25 0 0.25 1 1 1 +0.5 0 0.25 1 1 1 + + +0.25 0 0.25 1 1 1 +0.25 0.25 0.25 1 1 1 + + +0.25 0 0.25 1 1 1 +0.25 0 0.5 1 1 1 + + +0.5 0 0.25 1 1 1 +0.5 0.25 0.25 1 1 1 + + +0.5 0 0.25 1 1 1 +0.5 0 0.5 1 1 1 + + +0.25 0.25 0.25 1 1 1 +0.5 0.25 0.25 1 1 1 + + +0.25 0.25 0.25 1 1 1 +0.25 0.25 0.5 1 1 1 + + +0.5 0.25 0.25 1 1 1 +0.5 0.25 0.5 1 1 1 + + +0.25 0 0.5 1 1 1 +0.5 0 0.5 1 1 1 + + +0.25 0 0.5 1 1 1 +0.25 0.25 0.5 1 1 1 + + +0.5 0 0.5 1 1 1 +0.5 0.25 0.5 1 1 1 + + +0.25 0.25 0.5 1 1 1 +0.5 0.25 0.5 1 1 1 + + +0 0.25 0.25 1 1 1 +0.25 0.25 0.25 1 1 1 + + +0 0.25 0.25 1 1 1 +0 0.5 0.25 1 1 1 + + +0 0.25 0.25 1 1 1 +0 0.25 0.5 1 1 1 + + +0.25 0.25 0.25 1 1 1 +0.25 0.5 0.25 1 1 1 + + +0.25 0.25 0.25 1 1 1 +0.25 0.25 0.5 1 1 1 + + +0 0.5 0.25 1 1 1 +0.25 0.5 0.25 1 1 1 + + +0 0.5 0.25 1 1 1 +0 0.5 0.5 1 1 1 + + +0.25 0.5 0.25 1 1 1 +0.25 0.5 0.5 1 1 1 + + +0 0.25 0.5 1 1 1 +0.25 0.25 0.5 1 1 1 + + +0 0.25 0.5 1 1 1 +0 0.5 0.5 1 1 1 + + +0.25 0.25 0.5 1 1 1 +0.25 0.5 0.5 1 1 1 + + +0 0.5 0.5 1 1 1 +0.25 0.5 0.5 1 1 1 + + +0.25 0.25 0.25 1 1 1 +0.5 0.25 0.25 1 1 1 + + +0.25 0.25 0.25 1 1 1 +0.25 0.5 0.25 1 1 1 + + +0.25 0.25 0.25 1 1 1 +0.25 0.25 0.5 1 1 1 + + +0.5 0.25 0.25 1 1 1 +0.5 0.5 0.25 1 1 1 + + +0.5 0.25 0.25 1 1 1 +0.5 0.25 0.5 1 1 1 + + +0.25 0.5 0.25 1 1 1 +0.5 0.5 0.25 1 1 1 + + +0.25 0.5 0.25 1 1 1 +0.25 0.5 0.5 1 1 1 + + +0.5 0.5 0.25 1 1 1 +0.5 0.5 0.5 1 1 1 + + +0.25 0.25 0.5 1 1 1 +0.5 0.25 0.5 1 1 1 + + +0.25 0.25 0.5 1 1 1 +0.25 0.5 0.5 1 1 1 + + +0.5 0.25 0.5 1 1 1 +0.5 0.5 0.5 1 1 1 + + +0.25 0.5 0.5 1 1 1 +0.5 0.5 0.5 1 1 1 + + -- 2.39.5