mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 05:35:49 -04:00
Have openmc_tally_results accept ID instead of array index
This commit is contained in:
parent
9d456c3ff1
commit
14226862f3
2 changed files with 9 additions and 6 deletions
|
|
@ -124,12 +124,12 @@ C API
|
|||
:return: Return status (negative if an error occurs)
|
||||
:rtype: int
|
||||
|
||||
.. c:function:: void openmc_tally_results(int i, double** ptr, int shape_[3])
|
||||
.. c:function:: void openmc_tally_results(int id, double** ptr, int shape_[3])
|
||||
|
||||
Get a pointer to tally results array.
|
||||
|
||||
:param i: Index in the tallies array
|
||||
:type i: int
|
||||
:param id: ID of the tally
|
||||
:type id: int
|
||||
:param ptr: Pointer to the results array
|
||||
:type ptr: double**
|
||||
:param shape_: Shape of the results array
|
||||
|
|
|
|||
|
|
@ -376,14 +376,17 @@ contains
|
|||
! directly.
|
||||
!===============================================================================
|
||||
|
||||
subroutine openmc_tally_results(i, ptr, shape_) bind(C)
|
||||
integer(C_INT), intent(in), value :: i
|
||||
subroutine openmc_tally_results(id, ptr, shape_) bind(C)
|
||||
integer(C_INT), intent(in), value :: id
|
||||
type(C_PTR), intent(out) :: ptr
|
||||
integer(C_INT), intent(out) :: shape_(3)
|
||||
|
||||
integer :: i
|
||||
|
||||
ptr = C_NULL_PTR
|
||||
if (allocated(tallies)) then
|
||||
if (i >= 1 .and. i <= size(tallies)) then
|
||||
if (tally_dict % has_key(id)) then
|
||||
i = tally_dict % get_key(id)
|
||||
if (allocated(tallies(i) % results)) then
|
||||
ptr = C_LOC(tallies(i) % results(1,1,1))
|
||||
shape_(:) = shape(tallies(i) % results)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue