]> https://gitweb.dealii.org/ - dealii.git/commitdiff
set small entries equal zero
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Fri, 8 Apr 2005 07:42:56 +0000 (07:42 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Fri, 8 Apr 2005 07:42:56 +0000 (07:42 +0000)
git-svn-id: https://svn.dealii.org/trunk@10423 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/source/fe/fe_tools.cc

index d81bcc5cfe66f4a77e4fda53c735e431bd78de49..d8edb0d82788fd6282ad8fbe52b31b48939dd0c9 100644 (file)
@@ -571,19 +571,24 @@ FETools::compute_embedding_matrices(const FiniteElement<dim>& fe,
                                           // solve the least squares
                                           // problem.
          const double result = H.least_squares(v_fine, v_coarse);
-         Assert (result < 1.e-10, ExcLeastSquaresError(result));
+         Assert (result < 1.e-12, ExcLeastSquaresError(result));
            
-                                          // Finally copy into the
-                                          // result matrix. Since the
-                                          // matrix maps a coarse
-                                          // grid function to a fine
-                                          // grid function, the
-                                          // columns are fine grid.
+                                          // Copy into the result
+                                          // matrix. Since the matrix
+                                          // maps a coarse grid
+                                          // function to a fine grid
+                                          // function, the columns
+                                          // are fine grid.
          for (unsigned int j=0;j<n;++j)
            matrix(j,i) = v_fine(j);
        }
+                                      // Remove small entries from
+                                      // the matrix
+      for (unsigned int i=0; i<matrix.m(); ++i)
+       for (unsigned int j=0; j<matrix.n(); ++j)
+         if (std::fabs(matrix(i,j)) < 1e-12)
+           matrix(i,j) = 0.;
     }
-  
 }
 
 

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.