]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Minor update to FETools::get_interpolation_difference_matrix().
authorWolfgang Bangerth <bangerth@colostate.edu>
Sat, 17 Mar 2018 00:32:21 +0000 (18:32 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Mon, 19 Mar 2018 00:21:44 +0000 (18:21 -0600)
In particular, (i) update the documentation slightly, and (ii) simplify the logic of
the implementation by using IdentityMatrix. This also fixes the bug that there was an
assumption that the matrix was all zeros beforehand.

include/deal.II/fe/fe_tools.h
include/deal.II/fe/fe_tools.templates.h

index 312e9663afee84f173b6ae7b6303e823381af8c9..eb5991591c3e7c961fe7c42d975da2a9202e292a 100644 (file)
@@ -210,14 +210,15 @@ namespace FETools
                                 FullMatrix<number> &interpolation_matrix);
 
   /**
-   * Compute the identity matrix minus the back interpolation matrix.  The @p
-   * difference_matrix needs to be of size <tt>(fe1.dofs_per_cell,
-   * fe1.dofs_per_cell)</tt>.
+   * Compute the identity matrix minus the back interpolation matrix.
+   * The @p difference_matrix will be of size <tt>(fe1.dofs_per_cell,
+   * fe1.dofs_per_cell)</tt> after this function. Previous content
+   * of the argument will be overwritten.
    *
    * This function computes the matrix that transforms a @p fe1 function $z$ to
    * $z-I_hz$ where $I_h$ denotes the interpolation operator from the @p fe1
-   * space to the @p fe2 space. This matrix hence is useful to evaluate error-
-   * representations where $z$ denotes the dual solution.
+   * space to the @p fe2 space. This matrix hence is useful to evaluate
+   * error-representations where $z$ denotes the dual solution.
    */
   template <int dim, typename number, int spacedim>
   void
index 7be75da35c3581da9974655cdccef9020c720e92..785d87879f4b36d30c5fb1da1de486e6ef1a5e60 100644 (file)
@@ -1512,10 +1512,8 @@ namespace FETools
     FullMatrix<number> interpolation_matrix(fe1.dofs_per_cell);
     get_back_interpolation_matrix(fe1, fe2, interpolation_matrix);
 
-    for (unsigned int i=0; i<fe1.dofs_per_cell; ++i)
-      difference_matrix(i,i) = 1.;
-
     // compute difference
+    difference_matrix = IdentityMatrix(fe1.dofs_per_cell);
     difference_matrix.add (-1, interpolation_matrix);
   }
 

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.