Skip to content

Commit

Permalink
Updates in CSRMatrix
Browse files Browse the repository at this point in the history
- Adding SetMethods
- Working on issue #264
  • Loading branch information
vickysharma0812 committed Dec 16, 2023
1 parent ac05c85 commit b81e5b0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
17 changes: 17 additions & 0 deletions src/modules/CSRMatrix/src/CSRMatrix_SetMethods.F90
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,23 @@ MODULE PURE SUBROUTINE obj_Set14(obj, iNodeNum, jNodeNum, ivar, &
END SUBROUTINE obj_Set14
END INTERFACE Set

!----------------------------------------------------------------------------
! Set@setMethod
!----------------------------------------------------------------------------

!> author: Vikas Sharma, Ph. D.
! date: 2023-12-17
! summary: Scale the sparse matrix , obj = scale*Value

INTERFACE Set
MODULE PURE SUBROUTINE obj_Set15(obj, VALUE, scale)
TYPE(CSRMatrix_), INTENT(INOUT) :: obj
TYPE(CSRMatrix_), INTENT(IN) :: VALUE
REAL(DFP), OPTIONAL, INTENT(IN) :: scale
!! scale
END SUBROUTINE obj_Set15
END INTERFACE Set

!----------------------------------------------------------------------------
! SetIA@GetMethods
!----------------------------------------------------------------------------
Expand Down
16 changes: 12 additions & 4 deletions src/submodules/CSRMatrix/src/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -355,12 +355,11 @@
! Internal variables
INTEGER(I4B), ALLOCATABLE :: row(:), col(:)
INTEGER(I4B) :: ii, jj, kk
!

row = getNodeLoc(obj=obj%csr%idof, nodeNum=iNodeNum, ivar=ivar, &
& spacecompo=ispacecompo, timecompo=itimecompo)
col = getNodeLoc(obj=obj%csr%jdof, nodeNum=jNodeNum, ivar=jvar, &
& spacecompo=jspacecompo, timecompo=jtimecompo)
!
DO ii = 1, SIZE(row)
DO kk = 1, SIZE(col)
DO jj = obj%csr%IA(row(ii)), obj%csr%IA(row(ii) + 1) - 1
Expand All @@ -371,11 +370,20 @@
END DO
END DO
END DO
!
DEALLOCATE (row, col)
!
END PROCEDURE obj_set14

!----------------------------------------------------------------------------
! Set
!----------------------------------------------------------------------------

MODULE PROCEDURE obj_set15
CALL COPY(Y=obj%A, X=VALUE%A)
IF (PRESENT(scale)) THEN
CALL SCAL(X=obj%A, A=scale)
END IF
END PROCEDURE obj_set15

!----------------------------------------------------------------------------
! SetIA
!----------------------------------------------------------------------------
Expand Down

0 comments on commit b81e5b0

Please sign in to comment.