From: wolf Date: Thu, 11 Dec 2003 15:36:51 +0000 (+0000) Subject: Fix one bug in the computation of the value of the solution in the neighbor cell... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=997ffa50b4cc27a363a062c05c4421226a3ded1e;p=dealii-svn.git Fix one bug in the computation of the value of the solution in the neighbor cell. Move one variable out of the loop. git-svn-id: https://svn.dealii.org/trunk@8254 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/doc/news/c-4-0.html b/deal.II/doc/news/c-4-0.html index 012c4cb7cc..e0d5dde0f1 100644 --- a/deal.II/doc/news/c-4-0.html +++ b/deal.II/doc/news/c-4-0.html @@ -79,6 +79,16 @@ contributor's names are abbreviated by WB (Wolfgang Bangerth), GK

General

    +
  1. + Fixed: step-9 had the computation of the value of the + solution in the mid-point of the neighbor cell wrong. This is now + fixed. Consequently, the resulting mesh also looks much nicer now (much + smoother). +
    + (Werner Scholz + 2003/12/11) +

    +
  2. New: The config.h file now declares a variable deal_II_numbers::invalid_unsigned_int. diff --git a/deal.II/doc/tutorial/chapter-2.step-by-step/step-9.data/final-grid.gif b/deal.II/doc/tutorial/chapter-2.step-by-step/step-9.data/final-grid.gif index 91c55c068e..d468124836 100644 Binary files a/deal.II/doc/tutorial/chapter-2.step-by-step/step-9.data/final-grid.gif and b/deal.II/doc/tutorial/chapter-2.step-by-step/step-9.data/final-grid.gif differ diff --git a/deal.II/examples/step-9/step-9.cc b/deal.II/examples/step-9/step-9.cc index bedbda9b03..32da47f75f 100644 --- a/deal.II/examples/step-9/step-9.cc +++ b/deal.II/examples/step-9/step-9.cc @@ -1924,9 +1924,19 @@ GradientEstimation::estimate_interval (const DoFHandler &dof_handler, fe_midpoint_value.get_function_values (solution, this_midpoint_value); - // Now loop over all active - // neighbors and collect the - // data we need. + // Now loop over all active neighbors + // and collect the data we + // need. Allocate a vector just like + // ``this_midpoint_value'' which we + // will use to store the value of the + // solution in the midpoint of the + // neighbor cell. We allocate it here + // already, since that way we don't + // have to allocate memory repeatedly + // in each iteration of this inner loop + // (memory allocation is a rather + // expensive operation): + std::vector neighbor_midpoint_value(1); typename std::vector::active_cell_iterator>::const_iterator neighbor_ptr = active_neighbors.begin(); for (; neighbor_ptr!=active_neighbors.end(); ++neighbor_ptr) @@ -1943,15 +1953,15 @@ GradientEstimation::estimate_interval (const DoFHandler &dof_handler, // the value of the finite // element function // thereon. Note that for - // these information we + // this information we // have to reinitialize the // ``FEValues'' object for // the neighbor cell. fe_midpoint_value.reinit (neighbor); const Point neighbor_center = fe_midpoint_value.quadrature_point(0); - std::vector neighbor_midpoint_value(1); - fe_midpoint_value.get_function_values (solution, this_midpoint_value); + fe_midpoint_value.get_function_values (solution, + neighbor_midpoint_value); // Compute the vector ``y'' // connecting the centers