Skip to content

Commit

Permalink
Reinforce the pattern of destructing at the start of a constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
william-dawson committed Apr 7, 2023
1 parent 72f621f commit bc28f5d
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
2 changes: 0 additions & 2 deletions Source/Fortran/DMatrixModule.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Expand Down Expand Up @@ -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
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Expand Down
2 changes: 0 additions & 2 deletions Source/Fortran/SMatrixModule.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions Source/Fortran/dense_includes/ConstructEmptyMatrix.f90
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
CALL DestructMatrix(this)

this%rows = rows
this%columns = columns

Expand Down
2 changes: 2 additions & 0 deletions Source/Fortran/sparse_includes/ConstructEmptyMatrix.f90
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
CALL DestructMatrix(this)

this%rows = rows
this%columns = columns
ALLOCATE(this%outer_index(this%columns+1))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
INTEGER :: outer_array_ptr
INTEGER :: values_counter

CALL DestructMatrix(this)

this%rows = rows
this%columns = columns

Expand Down

0 comments on commit bc28f5d

Please sign in to comment.