Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(string): implement CharacterStringType #1013

Merged
merged 13 commits into from
Aug 25, 2022
Prev Previous commit
Next Next commit
additional cleanup on memory manager
  • Loading branch information
langevin-usgs committed Aug 24, 2022
commit 12addd04798548b6eac0b92ae8d37bdb89cd906f
4 changes: 2 additions & 2 deletions src/Model/BaseModel.f90
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ subroutine model_da(this)
! ------------------------------------------------------------------------------
!
! -- Strings
call mem_deallocate(this%name)
call mem_deallocate(this%macronym)
call mem_deallocate(this%name, 'NAME', this%memoryPath)
call mem_deallocate(this%macronym, 'MACRONYM', this%memoryPath)
!
! -- Scalars
call mem_deallocate(this%id)
Expand Down
27 changes: 18 additions & 9 deletions src/Utilities/Memory/MemoryManager.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1871,11 +1871,12 @@ subroutine deallocate_str(sclr, name, mem_path)
logical(LGP) :: found
integer(I4B) :: ipos
! -- code
found = .false.
if (present(name) .and. present(mem_path)) then
call get_from_memorylist(name, mem_path, mt, found)
nullify (mt%strsclr)
found = .true.
else
found = .false.
do ipos = 1, memorylist%count()
mt => memorylist%Get(ipos)
if (associated(mt%strsclr, sclr)) then
Expand Down Expand Up @@ -1913,11 +1914,12 @@ subroutine deallocate_str1d(astr1d, name, mem_path)
! -- code
!
! -- process optional variables
found = .false.
if (present(name) .and. present(mem_path)) then
call get_from_memorylist(name, mem_path, mt, found)
nullify (mt%astr1d)
found = .true.
else
found = .false.
do ipos = 1, memorylist%count()
mt => memorylist%Get(ipos)
if (associated(mt%astr1d, astr1d)) then
Expand Down Expand Up @@ -1956,11 +1958,12 @@ subroutine deallocate_charstr1d(astr1d, name, mem_path)
! -- code
!
! -- process optional variables
found = .false.
if (present(name) .and. present(mem_path)) then
call get_from_memorylist(name, mem_path, mt, found)
nullify (mt%acharstr1d)
found = .true.
else
found = .false.
do ipos = 1, memorylist%count()
mt => memorylist%Get(ipos)
if (associated(mt%acharstr1d, astr1d)) then
Expand Down Expand Up @@ -2095,11 +2098,12 @@ subroutine deallocate_int1d(aint, name, mem_path)
! -- code
!
! -- process optional variables
found = .false.
if (present(name) .and. present(mem_path)) then
call get_from_memorylist(name, mem_path, mt, found)
nullify (mt%aint1d)
found = .true.
else
found = .false.
do ipos = 1, memorylist%count()
mt => memorylist%Get(ipos)
if (associated(mt%aint1d, aint)) then
Expand Down Expand Up @@ -2136,11 +2140,12 @@ subroutine deallocate_int2d(aint, name, mem_path)
! -- code
!
! -- process optional variables
found = .false.
if (present(name) .and. present(mem_path)) then
call get_from_memorylist(name, mem_path, mt, found)
nullify (mt%aint2d)
found = .true.
else
found = .false.
do ipos = 1, memorylist%count()
mt => memorylist%Get(ipos)
if (associated(mt%aint2d, aint)) then
Expand Down Expand Up @@ -2177,11 +2182,12 @@ subroutine deallocate_int3d(aint, name, mem_path)
! -- code
!
! -- process optional variables
found = .false.
if (present(name) .and. present(mem_path)) then
call get_from_memorylist(name, mem_path, mt, found)
nullify (mt%aint3d)
found = .true.
else
found = .false.
do ipos = 1, memorylist%count()
mt => memorylist%Get(ipos)
if (associated(mt%aint3d, aint)) then
Expand Down Expand Up @@ -2218,11 +2224,12 @@ subroutine deallocate_dbl1d(adbl, name, mem_path)
! -- code
!
! -- process optional variables
found = .false.
if (present(name) .and. present(mem_path)) then
call get_from_memorylist(name, mem_path, mt, found)
nullify (mt%adbl1d)
found = .true.
else
found = .false.
do ipos = 1, memorylist%count()
mt => memorylist%Get(ipos)
if (associated(mt%adbl1d, adbl)) then
Expand Down Expand Up @@ -2259,11 +2266,12 @@ subroutine deallocate_dbl2d(adbl, name, mem_path)
! -- code
!
! -- process optional variables
found = .false.
if (present(name) .and. present(mem_path)) then
call get_from_memorylist(name, mem_path, mt, found)
nullify (mt%adbl2d)
found = .true.
else
found = .false.
do ipos = 1, memorylist%count()
mt => memorylist%Get(ipos)
if (associated(mt%adbl2d, adbl)) then
Expand Down Expand Up @@ -2300,11 +2308,12 @@ subroutine deallocate_dbl3d(adbl, name, mem_path)
! -- code
!
! -- process optional variables
found = .false.
if (present(name) .and. present(mem_path)) then
call get_from_memorylist(name, mem_path, mt, found)
nullify (mt%adbl3d)
found = .true.
else
found = .false.
do ipos = 1, memorylist%count()
mt => memorylist%Get(ipos)
if (associated(mt%adbl3d, adbl)) then
Expand Down