]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Apply suggestions from code review 14575/head
authorLuca Heltai <luca.heltai@sissa.it>
Tue, 20 Dec 2022 17:54:13 +0000 (18:54 +0100)
committerLuca Heltai <luca.heltai@sissa.it>
Tue, 20 Dec 2022 17:55:49 +0000 (18:55 +0100)
Co-authored-by: David Wells <drwells@email.unc.edu>
include/deal.II/lac/petsc_matrix_base.h
source/lac/petsc_matrix_base.cc

index dea9e730cbdaed749a225910f1f1cee5b863826f..2fd3d37f0c1f26318a7bf6fe79f9048a583e0975 100644 (file)
@@ -305,8 +305,22 @@ namespace PETScWrappers
     MatrixBase();
 
     /**
-     * Initialize a Matrix from a PETSc Mat object. Note that we do not copy
-     * the matrix.
+     * Initialize a Matrix from a PETSc Mat object. Note that we do not copy the
+     * matrix. Any PETSc object (including the Mat type) is in fact a reference
+     * counted pointer.
+     *
+     * A reference counted pointer is a type of pointer that maintains a
+     * reference count for the object it points to. The reference count is
+     * incremented each time a new reference to the object is created, and
+     * decremented each time a reference is destroyed. When the reference count
+     * reaches zero, the object is automatically deleted, freeing up the memory
+     * it was using.
+     *
+     * In the context of PETSc, reference counted pointers are used to manage
+     * the memory of objects such as vectors, matrices, and solvers. By using
+     * reference counted pointers, PETSc ensures that memory is automatically
+     * released when it is no longer needed, without the need for explicit
+     * memory management.
      */
     explicit MatrixBase(const Mat &);
 
index 185fbf99974d8519b7968c58db5e20552beb355f..72e0217b9762791e97917f01d73cc031e372e0eb 100644 (file)
@@ -86,8 +86,7 @@ namespace PETScWrappers
   {
     const PetscErrorCode ierr =
       PetscObjectReference(reinterpret_cast<PetscObject>(matrix));
-    AssertNothrow(ierr == 0, ExcPETScError(ierr));
-    (void)ierr;
+    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.