]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Allow a second argument for clear_row and clear_rows
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 10 Aug 2005 21:49:09 +0000 (21:49 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 10 Aug 2005 21:49:09 +0000 (21:49 +0000)
git-svn-id: https://svn.dealii.org/trunk@11275 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/petsc_matrix_base.h
deal.II/lac/source/petsc_matrix_base.cc

index 5731f48d98ecd6545ef11f7e7a737a71ec2814f4..c2ba92bff44424ef00e7579d88ebfb0a90f7826b 100644 (file)
@@ -383,14 +383,30 @@ namespace PETScWrappers
                                         * without this operation, removing
                                         * constraints on parallel matrices is
                                         * a rather complicated procedure.
+                                        *
+                                        * The second parameter can be used to
+                                        * set the diagonal entry of this row
+                                        * to a value different from zero. The
+                                        * default is to set it to zero.
                                         */
-      void clear_row (const unsigned int row);
+      void clear_row (const unsigned int row,
+                      const PetscScalar  new_diag_value = 0);
 
                                        /**
                                         * Same as clear_row(), except that it
                                         * works on a number of rows at once.
+                                        *
+                                        * The second parameter can be used to
+                                        * set the diagonal entries of all
+                                        * cleared rows to something different
+                                        * from zero. Note that all of these
+                                        * diagonal entries get the same value
+                                        * -- if you want different values for
+                                        * the diagonal entries, you have to
+                                        * set them by hand.
                                         */
-      void clear_rows (const std::vector<unsigned int> &rows);
+      void clear_rows (const std::vector<unsigned int> &rows,
+                       const PetscScalar                new_diag_value = 0);
       
                                        /**
                                         * PETSc matrices store their own
index 5d9d449eca94dedacabc9b52a2a352b3b6300474..e7774dc451b2bfc25c009590209b8c1713ce68c5 100644 (file)
@@ -198,7 +198,8 @@ namespace PETScWrappers
 
 
   void
-  MatrixBase::clear_row (const unsigned int row)
+  MatrixBase::clear_row (const unsigned int row,
+                         const PetscScalar  new_diag_value)
   {
     compress ();
 
@@ -215,12 +216,11 @@ namespace PETScWrappers
     ISCreateGeneral (get_mpi_communicator(), 1, &petsc_row, &index_set);
     
 #if (PETSC_VERSION_MAJOR <= 2) && (PETSC_VERSION_MINOR <= 2)
-    static const PetscScalar zero = 0;
     const int ierr
-      = MatZeroRows(matrix, index_set, &zero);
+      = MatZeroRows(matrix, index_set, &new_diag_value);
 #else
     const int ierr
-      = MatZeroRowsIS(matrix, index_set, 0);
+      = MatZeroRowsIS(matrix, index_set, new_diag_value);
 #endif
     
     AssertThrow (ierr == 0, ExcPETScError(ierr));
@@ -231,7 +231,8 @@ namespace PETScWrappers
 
 
   void
-  MatrixBase::clear_rows (const std::vector<unsigned int> &rows)
+  MatrixBase::clear_rows (const std::vector<unsigned int> &rows,
+                          const PetscScalar                new_diag_value)
   {
     compress ();
 
@@ -253,12 +254,11 @@ namespace PETScWrappers
                      &petsc_rows[0], &index_set);
     
 #if (PETSC_VERSION_MAJOR <= 2) && (PETSC_VERSION_MINOR <= 2)
-    static const PetscScalar zero = 0;
     const int ierr
-      = MatZeroRows(matrix, index_set, &zero);
+      = MatZeroRows(matrix, index_set, &new_diag_value);
 #else
     const int ierr
-      = MatZeroRowsIS(matrix, index_set, 0.);
+      = MatZeroRowsIS(matrix, index_set, new_diag_value);
 #endif
     
     AssertThrow (ierr == 0, ExcPETScError(ierr));

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.