From f51fc6d78099009fb85442521d44f805d0ea0392 Mon Sep 17 00:00:00 2001 From: bangerth Date: Wed, 8 Jan 2014 23:32:11 +0000 Subject: [PATCH] Fix a testcase by Minh Do-Quang: DataOut also got with FE_Nothing elements. git-svn-id: https://svn.dealii.org/trunk@32179 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/doc/news/changes.h | 7 ++ deal.II/source/fe/fe_values.cc | 20 +++-- tests/hp/solution_transfer_05.cc | 112 +++++++++++++++++++++++++++ tests/hp/solution_transfer_05.output | 36 +++++++++ 4 files changed, 167 insertions(+), 8 deletions(-) create mode 100644 tests/hp/solution_transfer_05.cc create mode 100644 tests/hp/solution_transfer_05.output diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index 444e2a9d14..2b1f3d07b5 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -85,9 +85,16 @@ inconvenience this causes.
    +
  1. Fixed: DataOut got confused in some situations where one uses FE_Nothing. + This is now fixed. +
    + (Minh Do-Quang, Wolfgang Bangerth, 2014/01/08) +
  2. +
  3. Fixed: FESystem::get_interpolation_matrix, a function that is among other places used by SolutionTransfer, had a bug that prevented it from running correctly in some situations where one uses FE_Nothing. + This is now fixed.
    (Minh Do-Quang, Wolfgang Bangerth, 2014/01/08)
  4. diff --git a/deal.II/source/fe/fe_values.cc b/deal.II/source/fe/fe_values.cc index 066c79c4c8..7e00704767 100644 --- a/deal.II/source/fe/fe_values.cc +++ b/deal.II/source/fe/fe_values.cc @@ -1,7 +1,7 @@ // --------------------------------------------------------------------- // $Id$ // -// Copyright (C) 1998 - 2013 by the deal.II authors +// Copyright (C) 1998 - 2014 by the deal.II authors // // This file is part of the deal.II library. // @@ -2242,9 +2242,18 @@ namespace internal const bool quadrature_points_fastest = false, const unsigned int component_multiple = 1) { + // initialize with zero + for (unsigned int i=0; i 0 ? - shape_values.n_cols() : 0; + if (dofs_per_cell == 0) + return; + + const unsigned int n_quadrature_points = shape_values.n_cols(); const unsigned int n_components = fe.n_components(); // Assert that we can write all components into the result vectors @@ -2262,11 +2271,6 @@ namespace internal AssertDimension (values[i].size(), result_components); } - // initialize with zero - for (unsigned int i=0; i +#include +#include + +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include + +#include + +using namespace dealii; + +int main() +{ + std::ofstream logfile("output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + Triangulation<2> triangulation; + GridGenerator::hyper_cube (triangulation); + triangulation.refine_global (1); + + + hp::FECollection<2> fe_collection; + + fe_collection.push_back(FESystem<2>(FE_Q<2>(1), 1, FE_Q<2>(1), 1)); + fe_collection.push_back(FESystem<2>(FE_Nothing<2>(), 1, FE_Nothing<2>(), 1)); + + hp::DoFHandler<2> dof_handler(triangulation); + + // Assign FE to cells + hp::DoFHandler<2>::active_cell_iterator cell; + hp::DoFHandler<2>::active_cell_iterator endc = dof_handler.end(); + + + cell = dof_handler.begin_active(); + cell->set_active_fe_index(1); + cell++; + cell->set_active_fe_index(1); + cell++; + cell->set_active_fe_index(0); + cell++; + cell->set_active_fe_index(0); + + + dof_handler.distribute_dofs (fe_collection); + + // Init solution + Vector solution(dof_handler.n_dofs()); + solution = 1.0; + + + SolutionTransfer<2, Vector, hp::DoFHandler<2> > solultion_trans(dof_handler); + solultion_trans.prepare_for_coarsening_and_refinement(solution); + + triangulation.execute_coarsening_and_refinement (); + dof_handler.distribute_dofs (fe_collection); + + Vector new_solution(dof_handler.n_dofs()); + solultion_trans.interpolate(solution, new_solution); + + // a follow-up error to the one fixed with _04 was that DataOut also got + // itself confused + DataOut<2, hp::DoFHandler<2> > data_out2; + data_out2.attach_dof_handler (dof_handler); + data_out2.add_data_vector (new_solution, "Solution"); + data_out2.build_patches(); + data_out2.write_vtu(deallog.get_file_stream()); + + // we are good if we made it to here + deallog << "OK" << std::endl; +} + + + diff --git a/tests/hp/solution_transfer_05.output b/tests/hp/solution_transfer_05.output new file mode 100644 index 0000000000..437080e930 --- /dev/null +++ b/tests/hp/solution_transfer_05.output @@ -0,0 +1,36 @@ + + + + + + + + +AQAAAIABAACAAQAAMwAAAA==eNpjYMAHHtgzkCQP4+MSRwcf7PGbi67vgz1+84h1Dy77Yeo+2FPmHlzmfMAQBwBtNxtp + + + + + +AQAAAEAAAABAAAAAKAAAAA==eNoNwwkSwBAQALB1VIvi/7+VzCQiIlnMVh9fm5/d6fB3edxeCvAAeQ== + + +AQAAABAAAAAQAAAAEwAAAA==eNpjYWBg4ABiHiAWAGIAAVAAKQ== + + +AQAAAAQAAAAEAAAADAAAAA==eNrj5OTkBAAAXgAl + + + + +AQAAAIAAAACAAAAAEAAAAA==eNpjYKAG+GBPLg0AGqcJeQ== + +AQAAAIAAAACAAAAAEAAAAA==eNpjYKAG+GBPLg0AGqcJeQ== + + + + +DEAL::OK -- 2.39.5