MESH: Use resize_workspace() in prolong_block().

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This commit is contained in:
Grzegorz Kowal 2021-11-13 20:35:37 -03:00
parent 2f9db104d5
commit 43e32a755f

View File

@ -1017,7 +1017,7 @@ module mesh
use equations , only : nv, positive
use interpolations , only : limiter_prol
use iso_fortran_env, only : error_unit
use workspace , only : work, nwork, work_in_use
use workspace , only : resize_workspace, work, work_in_use
implicit none
@ -1060,36 +1060,24 @@ module mesh
status = 0
if (first) then
if (work_in_use) then
write(error_unit,"('[',a,']: ',a,3i4,a)") trim(loc), &
"Workspace is already occupied!"
status = 1
go to 100
else
n = product(pm(:))
if (n > nwork) then
write(error_unit,"('[',a,']: ',a,3i4,a)") trim(loc), &
"Workspace has too be increased!"
nwork = n
deallocate(work)
allocate(work(nwork), stat=status)
call resize_workspace(n, status)
if (status /= 0) then
write(error_unit,"('[',a,']: ',a)") trim(loc), &
"Cannot increase the workspace's size!"
"Could not resize the workspace!"
go to 100
end if
end if
tmp(1:pm(1),1:pm(2),1:pm(3)) => work(1:n)
end if
first = .false.
end if
if (work_in_use) then
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
work_in_use = .true.