mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Move duplicate id checking to openmc_tally_set_id
This commit is contained in:
parent
78a1741628
commit
6524261807
2 changed files with 13 additions and 14 deletions
|
|
@ -2168,22 +2168,15 @@ contains
|
|||
! Get pointer to tally xml node
|
||||
node_tal = node_tal_list(i)
|
||||
|
||||
! Copy tally id
|
||||
! Copy and set tally id
|
||||
if (check_for_node(node_tal, "id")) then
|
||||
call get_node_value(node_tal, "id", tally_id)
|
||||
err = openmc_tally_set_id(i_start + i - 1, tally_id)
|
||||
if (err /= 0) call fatal_error(to_f_string(openmc_err_msg))
|
||||
else
|
||||
call fatal_error("Must specify id for tally in tally XML file.")
|
||||
end if
|
||||
|
||||
! Check to make sure 'id' hasn't been used
|
||||
if (tally_dict % has(t % id)) then
|
||||
call fatal_error("Two or more tallies use the same unique ID: " &
|
||||
// to_str(tally_id))
|
||||
end if
|
||||
|
||||
! Set tally id
|
||||
err = openmc_tally_set_id(i_start + i - 1, tally_id)
|
||||
|
||||
! Copy tally name
|
||||
if (check_for_node(node_tal, "name")) &
|
||||
call get_node_value(node_tal, "name", t % name)
|
||||
|
|
|
|||
|
|
@ -777,11 +777,17 @@ contains
|
|||
|
||||
if (index >= 1 .and. index <= n_tallies) then
|
||||
if (allocated(tallies(index) % obj)) then
|
||||
tallies(index) % obj % id = id
|
||||
call tally_dict % set(id, index)
|
||||
if (id > largest_tally_id) largest_tally_id = id
|
||||
if (tally_dict % has(id)) then
|
||||
call set_errmsg("Two or more tallies use the same unique ID: " &
|
||||
// to_str(id))
|
||||
err = E_INVALID_ID
|
||||
else
|
||||
tallies(index) % obj % id = id
|
||||
call tally_dict % set(id, index)
|
||||
if (id > largest_tally_id) largest_tally_id = id
|
||||
|
||||
err = 0
|
||||
err = 0
|
||||
end if
|
||||
else
|
||||
err = E_ALLOCATE
|
||||
call set_errmsg("Tally type has not been set yet.")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue