From: Luca Heltai Date: Tue, 20 Dec 2022 17:54:13 +0000 (+0100) Subject: Apply suggestions from code review X-Git-Tag: v9.5.0-rc1~715^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F14575%2Fhead;p=dealii.git Apply suggestions from code review Co-authored-by: David Wells --- diff --git a/include/deal.II/lac/petsc_matrix_base.h b/include/deal.II/lac/petsc_matrix_base.h index dea9e730cb..2fd3d37f0c 100644 --- a/include/deal.II/lac/petsc_matrix_base.h +++ b/include/deal.II/lac/petsc_matrix_base.h @@ -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 &); diff --git a/source/lac/petsc_matrix_base.cc b/source/lac/petsc_matrix_base.cc index 185fbf9997..72e0217b97 100644 --- a/source/lac/petsc_matrix_base.cc +++ b/source/lac/petsc_matrix_base.cc @@ -86,8 +86,7 @@ namespace PETScWrappers { const PetscErrorCode ierr = PetscObjectReference(reinterpret_cast(matrix)); - AssertNothrow(ierr == 0, ExcPETScError(ierr)); - (void)ierr; + AssertThrow(ierr == 0, ExcPETScError(ierr)); }