Skip to content

Commit

Permalink
create regenerate_system_pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
aoterodelaroza committed Feb 1, 2024
1 parent 703300c commit f03c13f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
3 changes: 3 additions & 0 deletions src/gui/gui_main.f90
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ module gui_main
public :: add_systems_from_name
public :: remove_system
public :: set_default_ui_settings
public :: regenerate_system_pointers

interface
module subroutine gui_start()
Expand Down Expand Up @@ -138,6 +139,8 @@ recursive module subroutine remove_system(idx)
end subroutine remove_system
module subroutine set_default_ui_settings()
end subroutine set_default_ui_settings
module subroutine regenerate_system_pointers()
end subroutine regenerate_system_pointers
end interface

end module gui_main
27 changes: 19 additions & 8 deletions src/gui/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -586,14 +586,8 @@ module subroutine add_systems_from_seeds(nseed,seed,collapse,iafield)
syscaux(1:size(sysc,1)) = sysc
call move_alloc(syscaux,sysc)

! refresh pointers in the systems after the move_alloc
do i = 1, nsys
do j = 1, sys(i)%nf
sys(i)%f(j)%sptr = c_loc(sys(i))
end do
end do

! refresh window pointers
! refresh system and window pointers
call regenerate_system_pointers()
call regenerate_window_pointers()
end if

Expand Down Expand Up @@ -733,6 +727,23 @@ module subroutine set_default_ui_settings()

end subroutine set_default_ui_settings

!> This routine regenerates all pointers to the sytsems in the
!> sys(:) and sysc(:) structures and components. It is used when an
!> array size is exceeded and move_alloc needs to be used to
!> allocate more memory.
module subroutine regenerate_system_pointers()

integer :: i, j

! refresh pointers in the systems after the move_alloc
do i = 1, nsys
do j = 1, sys(i)%nf
sys(i)%f(j)%sptr = c_loc(sys(i))
end do
end do

end subroutine regenerate_system_pointers

!xx! private procedures

! Process the command-line arguments. Skip the options and load the files.
Expand Down

0 comments on commit f03c13f

Please sign in to comment.