From 9b24c3d08767c643adc71eb444242b3172cb777e Mon Sep 17 00:00:00 2001 From: wolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d> Date: Mon, 6 Apr 1998 17:32:08 +0000 Subject: [PATCH] Bug fix and clean-up. git-svn-id: https://svn.dealii.org/trunk@148 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/source/numerics/base.cc | 28 +++++++++++-------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/deal.II/deal.II/source/numerics/base.cc b/deal.II/deal.II/source/numerics/base.cc index bae1b0ee03..69e88f9bfb 100644 --- a/deal.II/deal.II/source/numerics/base.cc +++ b/deal.II/deal.II/source/numerics/base.cc @@ -13,7 +13,7 @@ #include <map.h> #include <algo.h> - +#include <cmath> @@ -110,17 +110,18 @@ void ProblemBase<dim>::assemble (const Equation<dim> &equation, } while ((++assembler).state() == valid); + // condense system matrix in-place + constraints.condense (system_matrix); + + // condense right hand side in-place + constraints.condense (right_hand_side); + // apply Dirichlet bc as described // in the docs apply_dirichlet_bc (system_matrix, solution, right_hand_side, dirichlet_bc, fe); - // condense system matrix in-place - constraints.condense (system_matrix); - - // condense right hand side in-place - constraints.condense (right_hand_side); }; @@ -223,12 +224,6 @@ void ProblemBase<dim>::integrate_difference (const Function<dim> &exact_sol for (unsigned int j=0; j<n_dofs; ++j) for (unsigned int i=0; i<n_dofs; ++i) psi[j] -= dof_values[i]*shape_values(i,j); - cout << " Cell = " << cell << ", "; - cout << " Delta = "; - for (unsigned int i=0; i<psi.size(); ++i) - cout << psi[i] << " "; - cout << ", av = " << (psi[0]+psi[1]+psi[2]+psi[3])/4; - cout << endl; // for L1_norm and Linfty_norm: // take absolute @@ -241,7 +236,7 @@ void ProblemBase<dim>::integrate_difference (const Function<dim> &exact_sol case L1_norm: case Linfty_norm: transform (psi.begin(), psi.end(), - psi.begin(), ptr_fun(abs)); + psi.begin(), ptr_fun(fabs)); break; case L2_norm: transform (psi.begin(), psi.end(), @@ -258,6 +253,10 @@ void ProblemBase<dim>::integrate_difference (const Function<dim> &exact_sol { case mean: case L1_norm: + diff = inner_product (psi.begin(), psi.end(), + fe_values.get_JxW_values().begin(), + 0.0); + break; case L2_norm: diff = sqrt(inner_product (psi.begin(), psi.end(), fe_values.get_JxW_values().begin(), @@ -268,9 +267,6 @@ void ProblemBase<dim>::integrate_difference (const Function<dim> &exact_sol break; }; - if (norm==L2_norm) - diff = sqrt(diff); - break; }; -- 2.39.5