Skip to content

Commit

Permalink
Used optval for tolerances.
Browse files Browse the repository at this point in the history
  • Loading branch information
Simkern committed Oct 21, 2024
1 parent edf70bf commit 46d4e01
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 100 deletions.
96 changes: 16 additions & 80 deletions src/IterativeSolvers.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1752,16 +1752,8 @@ subroutine gmres_rsp(A, b, x, info, rtol, atol, preconditioner, options, transpo
character(len=256) :: msg

! Deals with the optional args.
if (present(rtol)) then
rtol_ = rtol
else
rtol_ = rtol_sp
end if
if (present(atol)) then
atol_ = atol
else
atol_ = atol_sp
end if
rtol_ = optval(rtol, rtol_sp)
atol_ = optval(atol, atol_sp)
if (present(options)) then
select type (options)
type is (gmres_sp_opts)
Expand Down Expand Up @@ -1931,16 +1923,8 @@ subroutine gmres_rdp(A, b, x, info, rtol, atol, preconditioner, options, transpo
character(len=256) :: msg

! Deals with the optional args.
if (present(rtol)) then
rtol_ = rtol
else
rtol_ = rtol_dp
end if
if (present(atol)) then
atol_ = atol
else
atol_ = atol_dp
end if
rtol_ = optval(rtol, rtol_dp)
atol_ = optval(atol, atol_dp)
if (present(options)) then
select type (options)
type is (gmres_dp_opts)
Expand Down Expand Up @@ -2110,16 +2094,8 @@ subroutine gmres_csp(A, b, x, info, rtol, atol, preconditioner, options, transpo
character(len=256) :: msg

! Deals with the optional args.
if (present(rtol)) then
rtol_ = rtol
else
rtol_ = rtol_sp
end if
if (present(atol)) then
atol_ = atol
else
atol_ = atol_sp
end if
rtol_ = optval(rtol, rtol_sp)
atol_ = optval(atol, atol_sp)
if (present(options)) then
select type (options)
type is (gmres_sp_opts)
Expand Down Expand Up @@ -2289,16 +2265,8 @@ subroutine gmres_cdp(A, b, x, info, rtol, atol, preconditioner, options, transpo
character(len=256) :: msg

! Deals with the optional args.
if (present(rtol)) then
rtol_ = rtol
else
rtol_ = rtol_dp
end if
if (present(atol)) then
atol_ = atol
else
atol_ = atol_dp
end if
rtol_ = optval(rtol, rtol_dp)
atol_ = optval(atol, atol_dp)
if (present(options)) then
select type (options)
type is (gmres_dp_opts)
Expand Down Expand Up @@ -2463,16 +2431,8 @@ subroutine cg_rsp(A, b, x, info, rtol, atol, preconditioner, options)
character(len=256) :: msg

! Deals with the optional args.
if (present(rtol)) then
rtol_ = rtol
else
rtol_ = rtol_sp
end if
if (present(atol)) then
atol_ = atol
else
atol_ = atol_sp
end if
rtol_ = optval(rtol, rtol_sp)
atol_ = optval(atol, atol_sp)
if (present(options)) then
opts = options
else
Expand Down Expand Up @@ -2567,16 +2527,8 @@ subroutine cg_rdp(A, b, x, info, rtol, atol, preconditioner, options)
character(len=256) :: msg

! Deals with the optional args.
if (present(rtol)) then
rtol_ = rtol
else
rtol_ = rtol_dp
end if
if (present(atol)) then
atol_ = atol
else
atol_ = atol_dp
end if
rtol_ = optval(rtol, rtol_dp)
atol_ = optval(atol, atol_dp)
if (present(options)) then
opts = options
else
Expand Down Expand Up @@ -2671,16 +2623,8 @@ subroutine cg_csp(A, b, x, info, rtol, atol, preconditioner, options)
character(len=256) :: msg

! Deals with the optional args.
if (present(rtol)) then
rtol_ = rtol
else
rtol_ = rtol_sp
end if
if (present(atol)) then
atol_ = atol
else
atol_ = atol_sp
end if
rtol_ = optval(rtol, rtol_sp)
atol_ = optval(atol, atol_sp)
if (present(options)) then
opts = options
else
Expand Down Expand Up @@ -2775,16 +2719,8 @@ subroutine cg_cdp(A, b, x, info, rtol, atol, preconditioner, options)
character(len=256) :: msg

! Deals with the optional args.
if (present(rtol)) then
rtol_ = rtol
else
rtol_ = rtol_dp
end if
if (present(atol)) then
atol_ = atol
else
atol_ = atol_dp
end if
rtol_ = optval(rtol, rtol_dp)
atol_ = optval(atol, atol_dp)
if (present(options)) then
opts = options
else
Expand Down
24 changes: 4 additions & 20 deletions src/IterativeSolvers.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -612,16 +612,8 @@ contains
character(len=256) :: msg

! Deals with the optional args.
if (present(rtol)) then
rtol_ = rtol
else
rtol_ = rtol_${kind}$
end if
if (present(atol)) then
atol_ = atol
else
atol_ = atol_${kind}$
end if
rtol_ = optval(rtol, rtol_${kind}$)
atol_ = optval(atol, atol_${kind}$)
if (present(options)) then
select type (options)
type is (gmres_${kind}$_opts)
Expand Down Expand Up @@ -792,16 +784,8 @@ contains
character(len=256) :: msg

! Deals with the optional args.
if (present(rtol)) then
rtol_ = rtol
else
rtol_ = rtol_${kind}$
end if
if (present(atol)) then
atol_ = atol
else
atol_ = atol_${kind}$
end if
rtol_ = optval(rtol, rtol_${kind}$)
atol_ = optval(atol, atol_${kind}$)
if (present(options)) then
opts = options
else
Expand Down

0 comments on commit 46d4e01

Please sign in to comment.