]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Templatize apply_boundary_values for BlockMatrices
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 22 Jun 2004 19:16:17 +0000 (19:16 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 22 Jun 2004 19:16:17 +0000 (19:16 +0000)
git-svn-id: https://svn.dealii.org/trunk@9458 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/numerics/matrices.h
deal.II/deal.II/source/numerics/matrices.all_dimensions.cc
deal.II/doc/news/c-5.0.html

index 5534a448b60b0c62b1790a165151c5bb99fe2ad3..b484fb4098b10b80f5f66e31f681497be4ab9c9f 100644 (file)
@@ -781,11 +781,12 @@ class MatrixTools : public MatrixCreator
                                      * local_apply_boundary_values()
                                      * function.
                                      */
+    template <typename number>
     static void
     apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
-                          BlockSparseMatrix<double>           &matrix,
-                          BlockVector<double>                 &solution,
-                          BlockVector<double>                 &right_hand_side,
+                          BlockSparseMatrix<number>           &matrix,
+                          BlockVector<number>                 &solution,
+                          BlockVector<number>                 &right_hand_side,
                           const bool           eliminate_columns = true);
 
                                     /**
index ef786a00404a2a3d57a4e862796c6a340485b85f..282428e73658d9ee0dc811bb7dad95454949f460 100644 (file)
@@ -194,11 +194,12 @@ MatrixTools::apply_boundary_values (const std::map<unsigned int,double> &boundar
 
 
 
+template <typename number>
 void
 MatrixTools::apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
-                                   BlockSparseMatrix<double>  &matrix,
-                                   BlockVector<double>   &solution,
-                                   BlockVector<double>   &right_hand_side,
+                                   BlockSparseMatrix<number>  &matrix,
+                                   BlockVector<number>   &solution,
+                                   BlockVector<number>   &right_hand_side,
                                    const bool             preserve_symmetry)
 {
   const unsigned int blocks = matrix.n_block_rows();
@@ -219,7 +220,7 @@ MatrixTools::apply_boundary_values (const std::map<unsigned int,double> &boundar
          right_hand_side.get_block_indices (),
          ExcBlocksDontMatch ());
 
-  for (unsigned int i=0;i<blocks;++i)
+  for (unsigned int i=0; i<blocks; ++i)
     Assert (matrix.block(i,i).get_sparsity_pattern().optimize_diagonal(),
            SparsityPattern::ExcDiagonalNotOptimized());
 
@@ -238,7 +239,7 @@ MatrixTools::apply_boundary_values (const std::map<unsigned int,double> &boundar
                                   // the first nonzero diagonal
                                   // element of the matrix, or 1 if
                                   // there is no such thing
-  double first_nonzero_diagonal_entry = 0;
+  number first_nonzero_diagonal_entry = 0;
   for (unsigned int diag_block=0; diag_block<blocks; ++diag_block)
     {
       for (unsigned int i=0; i<matrix.block(diag_block,diag_block).n(); ++i)
@@ -247,13 +248,13 @@ MatrixTools::apply_boundary_values (const std::map<unsigned int,double> &boundar
            first_nonzero_diagonal_entry 
              = matrix.block(diag_block,diag_block).diag_element(i);
            break;
-         };
+         }
                                       // check whether we have found
                                       // something in the present
                                       // block
       if (first_nonzero_diagonal_entry != 0)
        break;
-    };
+    }
                                   // nothing found on all diagonal
                                   // blocks? if so, use 1.0 instead
   if (first_nonzero_diagonal_entry == 0)
@@ -337,7 +338,7 @@ MatrixTools::apply_boundary_values (const std::map<unsigned int,double> &boundar
                                       //
                                       // store the new rhs entry to make
                                       // the gauss step more efficient
-      double new_rhs;
+      number new_rhs;
       if (matrix.block(block_index.first, block_index.first)
          .diag_element(block_index.second) != 0.0)
        new_rhs = dof->second * 
@@ -368,7 +369,7 @@ MatrixTools::apply_boundary_values (const std::map<unsigned int,double> &boundar
                                           // store the only nonzero entry
                                           // of this line for the Gauss
                                           // elimination step
-         const double diagonal_entry 
+         const number diagonal_entry 
            = matrix.block(block_index.first,block_index.first)
            .diag_element(block_index.second);
          
@@ -777,3 +778,18 @@ MatrixTools::apply_boundary_values<float> (const std::map<unsigned int,double> &
                                           Vector<float>   &solution,
                                           Vector<float>   &right_hand_side,
                                           const bool        preserve_symmetry);
+
+template
+void
+MatrixTools::apply_boundary_values<double> (const std::map<unsigned int,double> &boundary_values,
+                                           BlockSparseMatrix<double>  &matrix,
+                                           BlockVector<double>   &solution,
+                                           BlockVector<double>   &right_hand_side,
+                                           const bool        preserve_symmetry);
+template
+void
+MatrixTools::apply_boundary_values<float> (const std::map<unsigned int,double> &boundary_values,
+                                          BlockSparseMatrix<float>  &matrix,
+                                          BlockVector<float>   &solution,
+                                          BlockVector<float>   &right_hand_side,
+                                          const bool        preserve_symmetry);
index 7135bd335450d721ec7877ecd4bfb87b68081245..bc4824cc0f225ca28499c6b6573112b6ccce4988 100644 (file)
@@ -219,6 +219,14 @@ inconvenience this causes.
 <h3>deal.II</h3>
 
 <ol>
+  <li> <p>
+       New: The <code class="member">MatrixTools::apply_boundary_values</code>
+       that works on block matrices and vectors is now templatized over the
+       number type, i.e. it also works for float matrices and vectors.
+       <br> 
+       (WB 2004/06/22)
+       </p>
+
   <li> <p>
        New: The new <code class="member">FEValuesBase::get_cell</code>
        function returns the current cell, i.e. the latest cell the

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.