SOURCES: Use resize_workspace() in update_sources().
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This commit is contained in:
parent
43e32a755f
commit
1b1e3ab034
@ -331,7 +331,7 @@ module sources
|
|||||||
use iso_fortran_env, only : error_unit
|
use iso_fortran_env, only : error_unit
|
||||||
use operators , only : divergence, gradient, laplace, curl
|
use operators , only : divergence, gradient, laplace, curl
|
||||||
use user_problem , only : update_user_sources
|
use user_problem , only : update_user_sources
|
||||||
use workspace , only : work, nwork, work_in_use
|
use workspace , only : resize_workspace, work, work_in_use
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
@ -368,28 +368,15 @@ module sources
|
|||||||
#endif /* PROFILE */
|
#endif /* PROFILE */
|
||||||
|
|
||||||
if (first) then
|
if (first) then
|
||||||
status = 0
|
i = nn**NDIMS
|
||||||
if (work_in_use) then
|
j = 10 * i
|
||||||
write(error_unit,"('[',a,']: ',a,3i4,a)") trim(loc), &
|
|
||||||
"Workspace is already occupied!"
|
|
||||||
status = 1
|
|
||||||
go to 100
|
|
||||||
else
|
|
||||||
i = nn**NDIMS
|
|
||||||
j = 10 * i
|
|
||||||
|
|
||||||
if (j > nwork) then
|
call resize_workspace(j, status)
|
||||||
write(error_unit,"('[',a,']: ',a,3i4,a)") trim(loc), &
|
if (status /= 0) then
|
||||||
"Workspace has too be increased!"
|
write(error_unit,"('[',a,']: ',a)") trim(loc), &
|
||||||
nwork = j
|
"Could not resize the workspace!"
|
||||||
deallocate(work)
|
go to 100
|
||||||
allocate(work(nwork), stat=status)
|
end if
|
||||||
if (status /= 0) then
|
|
||||||
write(error_unit,"('[',a,']: ',a)") trim(loc), &
|
|
||||||
"Cannot increase the workspace's size!"
|
|
||||||
go to 100
|
|
||||||
end if
|
|
||||||
end if
|
|
||||||
|
|
||||||
#if NDIMS == 3
|
#if NDIMS == 3
|
||||||
db(1:nn,1:nn,1:nn) => work( 1:i)
|
db(1:nn,1:nn,1:nn) => work( 1:i)
|
||||||
@ -398,7 +385,6 @@ module sources
|
|||||||
db(1:nn,1:nn,1: 1) => work( 1:i)
|
db(1:nn,1:nn,1: 1) => work( 1:i)
|
||||||
tmp(1:3,1:3,1:nn,1:nn,1: 1) => work(i+1:j)
|
tmp(1:3,1:3,1:nn,1:nn,1: 1) => work(i+1:j)
|
||||||
#endif /* NDIMS == 3 */
|
#endif /* NDIMS == 3 */
|
||||||
end if
|
|
||||||
|
|
||||||
first = .false.
|
first = .false.
|
||||||
end if
|
end if
|
||||||
@ -473,7 +459,8 @@ module sources
|
|||||||
|
|
||||||
if (work_in_use) then
|
if (work_in_use) then
|
||||||
write(error_unit,"('[',a,']: ',a,3i4,a)") trim(loc), &
|
write(error_unit,"('[',a,']: ',a,3i4,a)") trim(loc), &
|
||||||
"Workspace is already occupied! Corruptions can occur!"
|
"Workspace is being used right now! " // &
|
||||||
|
"Corruptions can occur!"
|
||||||
end if
|
end if
|
||||||
|
|
||||||
work_in_use = .true.
|
work_in_use = .true.
|
||||||
@ -614,7 +601,8 @@ module sources
|
|||||||
|
|
||||||
if (work_in_use) then
|
if (work_in_use) then
|
||||||
write(error_unit,"('[',a,']: ',a,3i4,a)") trim(loc), &
|
write(error_unit,"('[',a,']: ',a,3i4,a)") trim(loc), &
|
||||||
"Workspace is already occupied! Corruptions can occur!"
|
"Workspace is being used right now! " // &
|
||||||
|
"Corruptions can occur!"
|
||||||
end if
|
end if
|
||||||
|
|
||||||
work_in_use = .true.
|
work_in_use = .true.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user