From bc28f5d2937e93b52a55a96db0abaf07b8865f92 Mon Sep 17 00:00:00 2001 From: William Dawson Date: Fri, 7 Apr 2023 14:13:04 +0900 Subject: [PATCH] Reinforce the pattern of destructing at the start of a constructor --- Source/Fortran/DMatrixModule.F90 | 2 -- Source/Fortran/SMatrixModule.F90 | 2 -- Source/Fortran/dense_includes/ConstructEmptyMatrix.f90 | 2 ++ Source/Fortran/sparse_includes/ConstructEmptyMatrix.f90 | 2 ++ .../Fortran/sparse_includes/ConstructMatrixFromTripletList.f90 | 2 ++ 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Source/Fortran/DMatrixModule.F90 b/Source/Fortran/DMatrixModule.F90 index 5469e8dc..ed2b9525 100644 --- a/Source/Fortran/DMatrixModule.F90 +++ b/Source/Fortran/DMatrixModule.F90 @@ -101,7 +101,6 @@ PURE SUBROUTINE ConstructEmptyMatrixSup_ldr(this, rows, columns) !> Columns of the matrix INTEGER, INTENT(IN) :: columns - CALL DestructMatrix(this) #include "dense_includes/ConstructEmptyMatrix.f90" END SUBROUTINE ConstructEmptyMatrixSup_ldr !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -385,7 +384,6 @@ PURE SUBROUTINE ConstructEmptyMatrixSup_ldc(this, rows, columns) !> The number of columns o the matrix. INTEGER, INTENT(IN) :: columns - CALL DestructMatrix(this) #include "dense_includes/ConstructEmptyMatrix.f90" END SUBROUTINE ConstructEmptyMatrixSup_ldc !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! diff --git a/Source/Fortran/SMatrixModule.F90 b/Source/Fortran/SMatrixModule.F90 index 0f5b5294..f02a84c3 100644 --- a/Source/Fortran/SMatrixModule.F90 +++ b/Source/Fortran/SMatrixModule.F90 @@ -135,7 +135,6 @@ PURE SUBROUTINE ConstructEmptyMatrixSub_lsr(this, rows, columns, zero_in) !> Whether to set the matrix to zero. LOGICAL, INTENT(IN), OPTIONAL :: zero_in - CALL DestructMatrix(this) #include "sparse_includes/ConstructEmptyMatrix.f90" END SUBROUTINE ConstructEmptyMatrixSub_lsr @@ -151,7 +150,6 @@ PURE SUBROUTINE ConstructEmptyMatrixSub_lsc(this, rows, columns, zero_in) !> Whether to set the matrix to zero. LOGICAL, INTENT(IN), OPTIONAL :: zero_in - CALL DestructMatrix(this) #include "sparse_includes/ConstructEmptyMatrix.f90" END SUBROUTINE ConstructEmptyMatrixSub_lsc diff --git a/Source/Fortran/dense_includes/ConstructEmptyMatrix.f90 b/Source/Fortran/dense_includes/ConstructEmptyMatrix.f90 index 5e04d3e3..48ec05d1 100644 --- a/Source/Fortran/dense_includes/ConstructEmptyMatrix.f90 +++ b/Source/Fortran/dense_includes/ConstructEmptyMatrix.f90 @@ -1,3 +1,5 @@ + CALL DestructMatrix(this) + this%rows = rows this%columns = columns diff --git a/Source/Fortran/sparse_includes/ConstructEmptyMatrix.f90 b/Source/Fortran/sparse_includes/ConstructEmptyMatrix.f90 index 44892bc8..5b1724da 100644 --- a/Source/Fortran/sparse_includes/ConstructEmptyMatrix.f90 +++ b/Source/Fortran/sparse_includes/ConstructEmptyMatrix.f90 @@ -1,3 +1,5 @@ + CALL DestructMatrix(this) + this%rows = rows this%columns = columns ALLOCATE(this%outer_index(this%columns+1)) diff --git a/Source/Fortran/sparse_includes/ConstructMatrixFromTripletList.f90 b/Source/Fortran/sparse_includes/ConstructMatrixFromTripletList.f90 index d4553cbf..e05af04c 100644 --- a/Source/Fortran/sparse_includes/ConstructMatrixFromTripletList.f90 +++ b/Source/Fortran/sparse_includes/ConstructMatrixFromTripletList.f90 @@ -2,6 +2,8 @@ INTEGER :: outer_array_ptr INTEGER :: values_counter + CALL DestructMatrix(this) + this%rows = rows this%columns = columns