]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix a problem where FEFaceValues with FESystems that contain FE_Nothings would crash...
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Sun, 17 Apr 2011 20:42:21 +0000 (20:42 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Sun, 17 Apr 2011 20:42:21 +0000 (20:42 +0000)
git-svn-id: https://svn.dealii.org/trunk@23602 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/news/changes.h
deal.II/source/fe/fe_system.cc
tests/hp/fe_nothing_16.cc [new file with mode: 0644]
tests/hp/fe_nothing_16/cmp/generic [new file with mode: 0644]

index 76bef4543aed698fdb31f13379e1ffeedc606b7b..ee575ccf9c3caf82b03afb4e781027303225ee2c 100644 (file)
@@ -85,6 +85,12 @@ should be fixed now.
 <h3>Specific improvements</h3>
 
 <ol>
+<li> 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.
+<br>
+(Wolfgang Bangerth, 2011/04/17)
+
 <li> New: There is now an operator* for the multiplication of a <code>SymmetricTensor@<2,dim@></code>
 and a <code>Tensor@<1,dim@></code>.
 <br>
index ba1006be8de1e58b1a00379660c59ce51645bd63..a5be5ac71079ae9a2abd5efc8f7c5d7f1f0dc923 100644 (file)
@@ -1092,29 +1092,6 @@ compute_fill (const Mapping<dim,spacedim>                      &mapping,
                    };
                };
         };
-
-      if (fe_data.is_first_cell())
-       {
-                                          // delete FEValuesDatas that
-                                          // are not needed any more
-         for (unsigned int base_no=0; base_no<n_base_elements(); ++base_no)
-           {
-                                              // Pointer needed to get
-                                              // the update flags of the
-                                              // base element
-             typename Mapping<dim,spacedim>::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 (file)
index 0000000..eb78987
--- /dev/null
@@ -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 <base/logstream.h>
+#include <base/quadrature_lib.h>
+#include <fe/fe_nothing.h>
+#include <fe/fe_q.h>
+#include <hp/fe_collection.h>
+#include <hp/dof_handler.h>
+#include <grid/tria.h>
+#include <grid/grid_generator.h>
+#include <grid/tria_accessor.h>
+#include <grid/tria_iterator.h>
+#include <grid/grid_refinement.h>
+#include <dofs/dof_accessor.h>
+#include <dofs/dof_tools.h>
+#include <fe/fe_q.h>
+#include <fe/fe_system.h>
+#include <hp/dof_handler.h>
+#include <hp/fe_values.h>
+#include <lac/constraint_matrix.h>
+
+
+#include <fstream>
+
+template <int dim>
+void test ()
+{
+  Triangulation<dim>       triangulation;
+  GridGenerator :: hyper_cube (triangulation, -0.5, 0.5);
+
+  FESystem<dim> fe (FE_Q<dim>(1), 1,
+                   FE_Nothing<dim>(), 1);
+  DoFHandler<dim> dof_handler (triangulation);
+  dof_handler.distribute_dofs (fe);
+
+  QGauss<dim-1> q(2);
+  FEFaceValues<dim> 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<fe.dofs_per_cell; ++i)
+    for (unsigned int q=0; q<fe_values.n_quadrature_points; ++q)
+      deallog << "i=" << i
+             << ", q=" << q
+             << ", value="
+             << fe_values[nothing].value(i,q)
+             << std::endl;
+}
+
+
+
+int main ()
+{
+  std::ofstream logfile("fe_nothing_16/output");
+  logfile.precision(2);
+
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  test<2> ();
+
+  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 (file)
index 0000000..4d0c57d
--- /dev/null
@@ -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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.