Skip to content

Commit 827efa2

Browse files
matthiasfabrymatthiasfabry
andauthored
Small binary_history_fix (#750)
* fix binary_history.f90 to ignore spec checks in pgbinary_summary.f90 * remove unused variables --------- Co-authored-by: matthiasfabry <[email protected]>
1 parent 762be58 commit 827efa2

File tree

4 files changed

+18
-13
lines changed

4 files changed

+18
-13
lines changed

binary/private/binary_history.f90

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ subroutine binary_history_getval(b, c, val, int_val, is_int_val, ierr)
753753

754754
end subroutine binary_history_getval
755755

756-
subroutine get_binary_history_specs(b, num, names, specs)
756+
subroutine get_binary_history_specs(b, num, names, specs, report)
757757

758758
use utils_lib
759759
use utils_def
@@ -762,6 +762,7 @@ subroutine get_binary_history_specs(b, num, names, specs)
762762
integer, intent(in) :: num
763763
character (len = *), intent(in) :: names(:)
764764
integer, intent(out) :: specs(:)
765+
logical, intent(in) :: report
765766

766767
integer :: i, ierr, n, j, iounit, t
767768
character (len = strlen) :: buffer, string
@@ -778,15 +779,16 @@ subroutine get_binary_history_specs(b, num, names, specs)
778779
j = 0
779780
t = token(iounit, n, j, buffer, string)
780781
if (t /= name_token) then
781-
if (len_trim(names(i)) > 0) &
782+
if (len_trim(names(i)) > 0 .and. report) &
782783
write(*, *) 'bad value for name of history item ' // trim(names(i))
783784
specs(i) = -1
784785
ierr = 0
785786
cycle
786787
end if
787788
specs(i) = do1_binary_history_spec(&
788-
iounit, t, n, j, string, buffer, ierr)
789+
iounit, t, n, j, string, buffer, report, ierr)
789790
if (ierr /= 0) then
791+
if (report) write(*, *) 'get_binary_history_specs failed for ' // trim(names(i))
790792
specs(i) = -1
791793
ierr = 0
792794
end if
@@ -833,7 +835,7 @@ subroutine get_binary_history_values(b, num, specs, &
833835
end subroutine get_binary_history_values
834836

835837
logical function get1_binary_hist_value(b, name, val)
836-
! includes other_history_columns from run_star_extras
838+
! includes other_history_columns from run_binary_extras
837839
use utils_lib, only : integer_dict_lookup
838840
type (binary_info), pointer :: b
839841
character (len = *) :: name

binary/private/binary_history_specs.f90

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,15 @@ module binary_history_specs
4141
contains
4242

4343
recursive subroutine add_binary_history_columns(&
44-
b, level, capacity, spec, history_columns_file, ierr)
44+
b, level, capacity, spec, history_columns_file, report, ierr)
4545
use utils_lib
4646
use utils_def
4747
use const_def, only : mesa_dir
4848
type (binary_info), pointer :: b
4949
integer, intent(in) :: level
5050
integer, intent(inout) :: capacity
5151
integer, pointer :: spec(:)
52+
logical, intent(in) :: report
5253
character (len = *), intent(in) :: history_columns_file
5354
integer, intent(out) :: ierr
5455

@@ -107,7 +108,7 @@ recursive subroutine add_binary_history_columns(&
107108
if (t /= string_token) then
108109
call error; return
109110
end if
110-
call add_binary_history_columns(b, level + 1, capacity, spec, string, ierr)
111+
call add_binary_history_columns(b, level + 1, capacity, spec, string, report, ierr)
111112
if (ierr /= 0) then
112113
write(*, *) 'failed for included log columns list ' // trim(string)
113114
bad_item = .true.
@@ -116,7 +117,7 @@ recursive subroutine add_binary_history_columns(&
116117
cycle
117118
end if
118119

119-
nxt_spec = do1_binary_history_spec(iounit, t, n, i, string, buffer, ierr)
120+
nxt_spec = do1_binary_history_spec(iounit, t, n, i, string, buffer, report, ierr)
120121
if (ierr /= 0) bad_item = .true.
121122
if (.not. bad_item) then
122123
call insert_spec(nxt_spec, string, ierr)
@@ -190,13 +191,14 @@ end subroutine add_binary_history_columns
190191

191192

192193
integer function do1_binary_history_spec(&
193-
iounit, t, n, i, string, buffer, ierr) result(spec)
194+
iounit, t, n, i, string, buffer, report, ierr) result(spec)
194195
use utils_lib
195196
use utils_def
196197
use chem_lib
197198

198199
integer :: iounit, t, n, i, j
199200
character (len = *) :: string, buffer
201+
logical, intent(in) :: report
200202
integer, intent(out) :: ierr
201203

202204
ierr = 0
@@ -209,15 +211,16 @@ integer function do1_binary_history_spec(&
209211
end if
210212
end do
211213

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

215217
end function do1_binary_history_spec
216218

217-
subroutine set_binary_history_columns(b, binary_history_columns_file, ierr)
219+
subroutine set_binary_history_columns(b, binary_history_columns_file, report, ierr)
218220
use utils_lib, only : realloc_integer
219221
type(binary_info), pointer :: b
220222
character (len = *), intent(in) :: binary_history_columns_file
223+
logical, intent(in) :: report
221224
integer, intent(out) :: ierr
222225
integer :: capacity, cnt, i
223226
logical, parameter :: dbg = .false.
@@ -235,7 +238,7 @@ subroutine set_binary_history_columns(b, binary_history_columns_file, ierr)
235238
if (ierr /= 0) return
236239
b% binary_history_column_spec(:) = 0
237240
call add_binary_history_columns(b, 1, capacity, &
238-
b% binary_history_column_spec, binary_history_columns_file, ierr)
241+
b% binary_history_column_spec, binary_history_columns_file, report, ierr)
239242
if (ierr /= 0) then
240243
if (associated(old_binary_history_column_spec)) &
241244
deallocate(old_binary_history_column_spec)

binary/private/pgbinary_summary.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ subroutine show_column(col, num_rows)
403403
real(dp) :: val
404404

405405
call get_binary_history_specs(&
406-
b, num_rows, Text_Summary_name(:, col), specs)
406+
b, num_rows, Text_Summary_name(:, col), specs, .false.)
407407
call get_binary_history_values(&
408408
b, num_rows, specs, &
409409
is_int_value, int_values, values, failed_to_find_value)

binary/private/run_binary_support.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ end subroutine extras_binary_controls
290290
call binarydata_init(b, doing_restart)
291291
call binary_private_def_init
292292
call binary_history_column_names_init(ierr)
293-
call set_binary_history_columns(b, b% job% binary_history_columns_file, ierr)
293+
call set_binary_history_columns(b, b% job% binary_history_columns_file, .true., ierr)
294294

295295
! setup pgbinary
296296
if (.not. doing_restart) then

0 commit comments

Comments
 (0)