]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Use quadrature instead of the exact mass matrix if the latter is not available.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 8 Apr 1999 17:35:00 +0000 (17:35 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 8 Apr 1999 17:35:00 +0000 (17:35 +0000)
git-svn-id: https://svn.dealii.org/trunk@1108 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/source/numerics/vectors.cc

index 8c6852a7d4d0a4f597fbee8ff2ead104a25e6739..6faf714ff5df4c2fed397b77f8f4be4bd778f6d0 100644 (file)
@@ -122,7 +122,7 @@ void VectorTools<1>::project (const DoFHandler<1>    &,
 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,
@@ -179,8 +179,20 @@ void VectorTools<dim>::project (const DoFHandler<dim>    &dof,
   
   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);
@@ -202,7 +214,7 @@ void VectorTools<dim>::project (const DoFHandler<dim>    &dof,
 
 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 |
@@ -211,7 +223,7 @@ void VectorTools<dim>::create_right_hand_side (const DoFHandler<dim>    &dof,
   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(),

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.