]> https://gitweb.dealii.org/ - dealii.git/commitdiff
extend MatrixTools::apply_boundary_values() to complex numbers
authorDenis Davydov <davydden@gmail.com>
Sat, 27 Feb 2016 21:07:04 +0000 (22:07 +0100)
committerDenis Davydov <davydden@gmail.com>
Sat, 27 Feb 2016 21:29:10 +0000 (22:29 +0100)
source/numerics/matrix_tools.cc
source/numerics/matrix_tools.inst.in

index a03a48fc6b1040b859ac10efa62b954cac9fa8b5..5c937072f59bf432c2d7da6eef2513cc85f355f9 100644 (file)
@@ -1964,7 +1964,7 @@ namespace MatrixTools
     // there is no such thing
     number first_nonzero_diagonal_entry = 1;
     for (unsigned int i=0; i<n_dofs; ++i)
-      if (matrix.diag_element(i) != 0)
+      if (matrix.diag_element(i) != number())
         {
           first_nonzero_diagonal_entry = matrix.diag_element(i);
           break;
@@ -2002,7 +2002,7 @@ namespace MatrixTools
         // store the new rhs entry to make
         // the gauss step more efficient
         number new_rhs;
-        if (matrix.diag_element(dof_number) != 0.0)
+        if (matrix.diag_element(dof_number) != number())
           {
             new_rhs = dof->second * matrix.diag_element(dof_number);
             right_hand_side(dof_number) = new_rhs;
@@ -2076,7 +2076,7 @@ namespace MatrixTools
                                    "function, see the documentation."));
 
                 // correct right hand side
-                right_hand_side(row) -= p->value() /
+                right_hand_side(row) -= static_cast<number>(p->value()) /
                                         diagonal_entry * new_rhs;
 
                 // set matrix entry to zero
index 0e7329057d04a72d5ce88e1909a1029406dd11b4..59073c0117771c77e4ec3f268e5861db379bae3e 100644 (file)
@@ -38,10 +38,20 @@ for (number: REAL_SCALARS)
        BlockVector<number>   &solution,
        BlockVector<number>   &right_hand_side,
        const bool        eliminate_columns);
-       
 
   }
 
+for (number: COMPLEX_SCALARS)
+  {
+    template
+      void MatrixTools::apply_boundary_values
+      (const std::map<types::global_dof_index,number> &boundary_values,
+       SparseMatrix<number>  &matrix,
+       Vector<number>   &solution,
+       Vector<number>   &right_hand_side,
+       const bool        eliminate_columns);
+  }
+
 for (scalar: REAL_SCALARS; deal_II_dimension : DIMENSIONS; deal_II_space_dimension :  SPACE_DIMENSIONS)
   {
 #if deal_II_dimension <= deal_II_space_dimension

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.