From: wolf Date: Thu, 8 Apr 1999 17:35:00 +0000 (+0000) Subject: Use quadrature instead of the exact mass matrix if the latter is not available. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=26f7c3655d959505c8d3f1ea4383700425c2e431;p=dealii-svn.git Use quadrature instead of the exact mass matrix if the latter is not available. git-svn-id: https://svn.dealii.org/trunk@1108 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/source/numerics/vectors.cc b/deal.II/deal.II/source/numerics/vectors.cc index 8c6852a7d4..6faf714ff5 100644 --- a/deal.II/deal.II/source/numerics/vectors.cc +++ b/deal.II/deal.II/source/numerics/vectors.cc @@ -122,7 +122,7 @@ void VectorTools<1>::project (const DoFHandler<1> &, template void VectorTools::project (const DoFHandler &dof, const ConstraintMatrix &constraints, - const Quadrature &q, + const Quadrature &quadrature, const Function &function, Vector &vec, const bool enforce_zero_boundary, @@ -179,8 +179,20 @@ void VectorTools::project (const DoFHandler &dof, SparseMatrix mass_matrix (sparsity); Vector tmp (mass_matrix.n()); - MatrixCreator::create_mass_matrix (dof, mass_matrix); - VectorTools::create_right_hand_side (dof, q, function, tmp); + + // try to assemble the mass matrix by exact + // integration. if this is not supported, + // then use quadrature + try + { + MatrixCreator::create_mass_matrix (dof, mass_matrix); + } + catch (FiniteElement::ExcComputationNotUseful) + { + MatrixCreator::create_mass_matrix (dof, quadrature, mass_matrix); + }; + + VectorTools::create_right_hand_side (dof, quadrature, function, tmp); constraints.condense (mass_matrix); constraints.condense (tmp); @@ -202,7 +214,7 @@ void VectorTools::project (const DoFHandler &dof, template void VectorTools::create_right_hand_side (const DoFHandler &dof, - const Quadrature &q, + const Quadrature &quadrature, const Function &rhs, Vector &rhs_vector) { UpdateFlags update_flags = UpdateFlags(update_q_points | @@ -211,7 +223,7 @@ void VectorTools::create_right_hand_side (const DoFHandler &dof, const AssemblerData data (dof, false, true, dummy, rhs_vector, - q, update_flags); + quadrature, update_flags); TriaActiveIterator > assembler (const_cast*>(&dof.get_tria()), dof.get_tria().begin_active()->level(),