Skip to content

Commit

Permalink
debugging cont release
Browse files Browse the repository at this point in the history
  • Loading branch information
pprcht committed Aug 22, 2024
1 parent a2d6ae0 commit f5af38b
Show file tree
Hide file tree
Showing 5 changed files with 170 additions and 53 deletions.
34 changes: 17 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,32 +29,32 @@ jobs:
build: [cmake]
build-type: [debug]
compiler: [gnu]
version: [11, 12]
version: [12]

include:
- os: ubuntu-latest
build: cmake
build-type: debug
compiler: intel
version: 2023.1.0

- os: macos-latest
build: cmake
build-type: debug
compiler: gnu
version: 12
# - os: ubuntu-latest
# build: cmake
# build-type: debug
# compiler: intel
# version: 2023.1.0
#
# - os: macos-latest
# build: cmake
# build-type: debug
# compiler: gnu
# version: 12

- os: ubuntu-latest
build: cmake
build-type: debugoptimized
compiler: gnu
version: 12

- os: ubuntu-latest
build: meson
build-type: debugoptimized
compiler: intel
version: 2023.1.0
# - os: ubuntu-latest
# build: meson
# build-type: debugoptimized
# compiler: intel
# version: 2023.1.0

defaults:
run:
Expand Down
14 changes: 10 additions & 4 deletions src/parsing/parse_block.f90
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,20 @@ subroutine blk_addkv(self,kv)
class(datablock) :: self
type(keyvalue) :: kv
type(keyvalue),allocatable :: newlist(:)
integer :: i,j
integer :: i,j,ii
i = self%nkv
j = i+1
allocate (newlist(j))
newlist(1:i) = self%kv_list(1:i)
newlist(j) = kv
call move_alloc(newlist,self%kv_list)
if(allocated(self%kv_list))then
do ii=1,i
newlist(ii) = self%kv_list(ii)%copy()
enddo
deallocate(self%kv_list)
endif
newlist(j) = kv%copy()
allocate(self%kv_list, source=newlist)
self%nkv = j
deallocate(newlist)
end subroutine blk_addkv

!========================================================================================!
Expand Down
16 changes: 11 additions & 5 deletions src/parsing/parse_datastruct.f90
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,14 @@ subroutine root_addkv(self,kv)
class(root_object) :: self
type(keyvalue) :: kv
type(keyvalue),allocatable :: newlist(:)
integer :: i,j
integer :: i,j,ii
i = self%nkv
j = i+1
allocate (newlist(j))
newlist(1:i) = self%kv_list(1:i)
newlist(j) = kv
do ii=1,i
newlist(ii) = self%kv_list(ii)%copy()
enddo
newlist(j) = kv%copy()
call move_alloc(newlist,self%kv_list)
self%nkv = j
end subroutine root_addkv
Expand All @@ -86,10 +88,14 @@ subroutine root_addblk(self,blk)
i = self%nblk
j = i+1
allocate (newlist(j))
newlist(1:i) = self%blk_list(1:i)
if(allocated(self%blk_list))then
newlist(1:i) = self%blk_list(1:i)
deallocate(self%blk_list)
endif
newlist(j) = blk
call move_alloc(newlist,self%blk_list)
!call move_alloc(newlist,self%blk_list)
self%nblk = j
allocate(self%blk_list, source=newlist)
end subroutine root_addblk

subroutine root_lowercase_keys(self)
Expand Down
52 changes: 51 additions & 1 deletion src/parsing/parse_keyvalue.f90
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ module parse_keyvalue
procedure :: deallocate => deallocate_kv
procedure :: set_valuestring => kv_set_valuestring
procedure :: add_raw_array_string => kv_add_raw_array_string
procedure :: copy => copy_kv
end type keyvalue

character(len=*),parameter :: kv_indicator = '=' !> used for fallback parsing
Expand Down Expand Up @@ -89,6 +90,55 @@ subroutine deallocate_kv(self)
return
end subroutine

function copy_kv(self) result(kv)
implicit none
class(keyvalue) :: self
type(keyvalue) :: kv
integer :: k,i
if (allocated(self%key)) kv%key = self%key
if (allocated(self%rawvalue)) kv%rawvalue = self%rawvalue
kv%id = self%id
kv%value_f = self%value_f
kv%value_i = self%value_i
kv%value_b = self%value_b
if (allocated(self%value_c)) kv%value_c = self%value_c
kv%na = self%na
if (allocated(self%value_rawa))then
k = len(self%rawvalue)
allocate(kv%value_rawa(kv%na), source=repeat(' ',k))
do i=1,self%na
kv%value_rawa(i) = self%value_rawa(i)
enddo
endif
if (allocated(self%value_fa))then
allocate(kv%value_fa(kv%na), source=0.0_wp)
do i=1,self%na
kv%value_fa(i) = self%value_fa(i)
enddo
endif
if (allocated(self%value_ia))then
allocate(kv%value_ia(kv%na), source=0)
do i=1,self%na
kv%value_ia(i) = self%value_ia(i)
enddo
endif
if (allocated(self%value_ba))then
allocate(kv%value_ba(kv%na), source=.false.)
do i=1,self%na
kv%value_ba(i) = self%value_ba(i)
enddo
endif
if (allocated(self%value_ca))then
k = len(self%rawvalue)
allocate(kv%value_ca(kv%na), source=repeat(' ',k))
do i=1,self%na
kv%value_ca(i) = self%value_ca(i)
enddo
endif
return
end function copy_kv


!========================================================================================!

!> The following routines are used only in the fallback implementation!
Expand Down Expand Up @@ -445,7 +495,7 @@ end function is_float
subroutine kv_set_valuestring(self)
implicit none
class(keyvalue) :: self
character(len=20) :: atmp
character(len=100) :: atmp
character(len=:),allocatable :: btmp
integer :: i
if (allocated(self%rawvalue)) deallocate (self%rawvalue)
Expand Down
Loading

0 comments on commit f5af38b

Please sign in to comment.