From 8ce34616e9b5094ac3ee732dfa93bdbe62021867 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sun, 17 Apr 2011 20:42:21 +0000 Subject: [PATCH] Fix a problem where FEFaceValues with FESystems that contain FE_Nothings would crash. The solution is to remove an optimization that was added by Ralf in 2001 but that apparently never triggered; it sits in a piece of code that only gets executed with FEValues objects where sub-objects set their update_each to update_default. I don't think there were any occasions where this could have happened before with any of the usual elements, FE_Nothing being the first one where this could be the case. git-svn-id: https://svn.dealii.org/trunk@23602 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/doc/news/changes.h | 6 ++ deal.II/source/fe/fe_system.cc | 23 -------- tests/hp/fe_nothing_16.cc | 90 ++++++++++++++++++++++++++++++ tests/hp/fe_nothing_16/cmp/generic | 10 ++++ 4 files changed, 106 insertions(+), 23 deletions(-) create mode 100644 tests/hp/fe_nothing_16.cc create mode 100644 tests/hp/fe_nothing_16/cmp/generic diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index 76bef4543a..ee575ccf9c 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -85,6 +85,12 @@ should be fixed now.

Specific improvements

    +
  1. Fixed: Under some conditions, FEFaceValues applied to an FESystem element +that contained elements of type FE_Nothing would receive an erroneous +exception. This is now fixed. +
    +(Wolfgang Bangerth, 2011/04/17) +
  2. New: There is now an operator* for the multiplication of a SymmetricTensor@<2,dim@> and a Tensor@<1,dim@>.
    diff --git a/deal.II/source/fe/fe_system.cc b/deal.II/source/fe/fe_system.cc index ba1006be8d..a5be5ac710 100644 --- a/deal.II/source/fe/fe_system.cc +++ b/deal.II/source/fe/fe_system.cc @@ -1092,29 +1092,6 @@ compute_fill (const Mapping &mapping, }; }; }; - - if (fe_data.is_first_cell()) - { - // delete FEValuesDatas that - // are not needed any more - for (unsigned int base_no=0; base_no::InternalDataBase &base_fe_data= - fe_data.get_fe_data(base_no); - - // compute update flags ... - UpdateFlags base_flags_each( - dim_1==dim ? - mapping_data.update_each | base_fe_data.update_each : - mapping_data.update_flags | base_fe_data.update_flags); - - if (base_flags_each==update_default) - fe_data.delete_fe_values_data(base_no); - } - } } if (fe_data.compute_hessians && cell_similarity != CellSimilarity::translation) diff --git a/tests/hp/fe_nothing_16.cc b/tests/hp/fe_nothing_16.cc new file mode 100644 index 0000000000..eb78987f03 --- /dev/null +++ b/tests/hp/fe_nothing_16.cc @@ -0,0 +1,90 @@ +//---------------------------- fe_nothing_16.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2009, 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. +// +//---------------------------- fe_nothing_16.cc --------------------------- + + +// test a problem we used to have: FESystem would delete an internal object +// after reinitialization for the first time if it determined that it was no +// longer necessary. yet, somehow, it was still referenced. the point seems to +// have been that the base element always only had update_default for the +// values that need to be updated on each cell, which is rather uncommon (the +// base element is FE_Nothing) +// +// an extract of this bug is fe/crash_01 + + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include + +template +void test () +{ + Triangulation triangulation; + GridGenerator :: hyper_cube (triangulation, -0.5, 0.5); + + FESystem fe (FE_Q(1), 1, + FE_Nothing(), 1); + DoFHandler dof_handler (triangulation); + dof_handler.distribute_dofs (fe); + + QGauss q(2); + FEFaceValues fe_values(fe, q, update_values); + FEValuesExtractors::Scalar nothing(1); + fe_values.reinit (dof_handler.begin_active(), 0); + + // the following (second) call to reinit + // used to abort + fe_values.reinit (dof_handler.begin_active(), 1); + for (unsigned int i=0; i (); + + deallog << "OK" << std::endl; +} diff --git a/tests/hp/fe_nothing_16/cmp/generic b/tests/hp/fe_nothing_16/cmp/generic new file mode 100644 index 0000000000..4d0c57df8c --- /dev/null +++ b/tests/hp/fe_nothing_16/cmp/generic @@ -0,0 +1,10 @@ + +DEAL::i=0, q=0, value=0 +DEAL::i=0, q=1, value=0 +DEAL::i=1, q=0, value=0 +DEAL::i=1, q=1, value=0 +DEAL::i=2, q=0, value=0 +DEAL::i=2, q=1, value=0 +DEAL::i=3, q=0, value=0 +DEAL::i=3, q=1, value=0 +DEAL::OK -- 2.39.5