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

Small binary_history_fix #750

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions binary/private/binary_history.f90
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ subroutine binary_history_getval(b, c, val, int_val, is_int_val, ierr)

end subroutine binary_history_getval

subroutine get_binary_history_specs(b, num, names, specs)
subroutine get_binary_history_specs(b, num, names, specs, report)

use utils_lib
use utils_def
Expand All @@ -762,6 +762,7 @@ subroutine get_binary_history_specs(b, num, names, specs)
integer, intent(in) :: num
character (len = *), intent(in) :: names(:)
integer, intent(out) :: specs(:)
logical, intent(in) :: report

integer :: i, ierr, n, j, iounit, t
character (len = strlen) :: buffer, string
Expand All @@ -778,15 +779,16 @@ subroutine get_binary_history_specs(b, num, names, specs)
j = 0
t = token(iounit, n, j, buffer, string)
if (t /= name_token) then
if (len_trim(names(i)) > 0) &
if (len_trim(names(i)) > 0 .and. report) &
write(*, *) 'bad value for name of history item ' // trim(names(i))
specs(i) = -1
ierr = 0
cycle
end if
specs(i) = do1_binary_history_spec(&
iounit, t, n, j, string, buffer, ierr)
iounit, t, n, j, string, buffer, report, ierr)
if (ierr /= 0) then
if (report) write(*, *) 'get_binary_history_specs failed for ' // trim(names(i))
specs(i) = -1
ierr = 0
end if
Expand Down Expand Up @@ -833,7 +835,7 @@ subroutine get_binary_history_values(b, num, specs, &
end subroutine get_binary_history_values

logical function get1_binary_hist_value(b, name, val)
! includes other_history_columns from run_star_extras
! includes other_history_columns from run_binary_extras
use utils_lib, only : integer_dict_lookup
type (binary_info), pointer :: b
character (len = *) :: name
Expand Down
17 changes: 10 additions & 7 deletions binary/private/binary_history_specs.f90
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@ module binary_history_specs
contains

recursive subroutine add_binary_history_columns(&
b, level, capacity, spec, history_columns_file, ierr)
b, level, capacity, spec, history_columns_file, report, ierr)
use utils_lib
use utils_def
use const_def, only : mesa_dir
type (binary_info), pointer :: b
integer, intent(in) :: level
integer, intent(inout) :: capacity
integer, pointer :: spec(:)
logical, intent(in) :: report
character (len = *), intent(in) :: history_columns_file
integer, intent(out) :: ierr

Expand Down Expand Up @@ -107,7 +108,7 @@ recursive subroutine add_binary_history_columns(&
if (t /= string_token) then
call error; return
end if
call add_binary_history_columns(b, level + 1, capacity, spec, string, ierr)
call add_binary_history_columns(b, level + 1, capacity, spec, string, report, ierr)
if (ierr /= 0) then
write(*, *) 'failed for included log columns list ' // trim(string)
bad_item = .true.
Expand All @@ -116,7 +117,7 @@ recursive subroutine add_binary_history_columns(&
cycle
end if

nxt_spec = do1_binary_history_spec(iounit, t, n, i, string, buffer, ierr)
nxt_spec = do1_binary_history_spec(iounit, t, n, i, string, buffer, report, ierr)
if (ierr /= 0) bad_item = .true.
if (.not. bad_item) then
call insert_spec(nxt_spec, string, ierr)
Expand Down Expand Up @@ -190,13 +191,14 @@ end subroutine add_binary_history_columns


integer function do1_binary_history_spec(&
iounit, t, n, i, string, buffer, ierr) result(spec)
iounit, t, n, i, string, buffer, report, ierr) result(spec)
use utils_lib
use utils_def
use chem_lib

integer :: iounit, t, n, i, j
character (len = *) :: string, buffer
logical, intent(in) :: report
integer, intent(out) :: ierr

ierr = 0
Expand All @@ -209,15 +211,16 @@ integer function do1_binary_history_spec(&
end if
end do

write(*, *) 'bad history list name: ' // trim(string)
if (report) write(*, *) 'bad history list name: ' // trim(string)
ierr = -1

end function do1_binary_history_spec

subroutine set_binary_history_columns(b, binary_history_columns_file, ierr)
subroutine set_binary_history_columns(b, binary_history_columns_file, report, ierr)
use utils_lib, only : realloc_integer
type(binary_info), pointer :: b
character (len = *), intent(in) :: binary_history_columns_file
logical, intent(in) :: report
integer, intent(out) :: ierr
integer :: capacity, cnt, i
logical, parameter :: dbg = .false.
Expand All @@ -235,7 +238,7 @@ subroutine set_binary_history_columns(b, binary_history_columns_file, ierr)
if (ierr /= 0) return
b% binary_history_column_spec(:) = 0
call add_binary_history_columns(b, 1, capacity, &
b% binary_history_column_spec, binary_history_columns_file, ierr)
b% binary_history_column_spec, binary_history_columns_file, report, ierr)
if (ierr /= 0) then
if (associated(old_binary_history_column_spec)) &
deallocate(old_binary_history_column_spec)
Expand Down
2 changes: 1 addition & 1 deletion binary/private/pgbinary_summary.f90
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ subroutine show_column(col, num_rows)
real(dp) :: val

call get_binary_history_specs(&
b, num_rows, Text_Summary_name(:, col), specs)
b, num_rows, Text_Summary_name(:, col), specs, .false.)
call get_binary_history_values(&
b, num_rows, specs, &
is_int_value, int_values, values, failed_to_find_value)
Expand Down
2 changes: 1 addition & 1 deletion binary/private/run_binary_support.f90
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ end subroutine extras_binary_controls
call binarydata_init(b, doing_restart)
call binary_private_def_init
call binary_history_column_names_init(ierr)
call set_binary_history_columns(b, b% job% binary_history_columns_file, ierr)
call set_binary_history_columns(b, b% job% binary_history_columns_file, .true., ierr)

! setup pgbinary
if (.not. doing_restart) then
Expand Down