template <int dim>
void VectorTools<dim>::project (const DoFHandler<dim> &dof,
const ConstraintMatrix &constraints,
- const Quadrature<dim> &q,
+ const Quadrature<dim> &quadrature,
const Function<dim> &function,
Vector<double> &vec,
const bool enforce_zero_boundary,
SparseMatrix<double> mass_matrix (sparsity);
Vector<double> tmp (mass_matrix.n());
- MatrixCreator<dim>::create_mass_matrix (dof, mass_matrix);
- VectorTools<dim>::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<dim>::create_mass_matrix (dof, mass_matrix);
+ }
+ catch (FiniteElement<dim>::ExcComputationNotUseful)
+ {
+ MatrixCreator<dim>::create_mass_matrix (dof, quadrature, mass_matrix);
+ };
+
+ VectorTools<dim>::create_right_hand_side (dof, quadrature, function, tmp);
constraints.condense (mass_matrix);
constraints.condense (tmp);
template <int dim>
void VectorTools<dim>::create_right_hand_side (const DoFHandler<dim> &dof,
- const Quadrature<dim> &q,
+ const Quadrature<dim> &quadrature,
const Function<dim> &rhs,
Vector<double> &rhs_vector) {
UpdateFlags update_flags = UpdateFlags(update_q_points |
const AssemblerData<dim> data (dof,
false, true,
dummy, rhs_vector,
- q, update_flags);
+ quadrature, update_flags);
TriaActiveIterator<dim, Assembler<dim> >
assembler (const_cast<Triangulation<dim>*>(&dof.get_tria()),
dof.get_tria().begin_active()->level(),