Reverse shape for openmc_tally_results (makes sense for C/C++)

This commit is contained in:
Paul Romano 2018-10-10 10:00:42 -05:00
parent ab41674527
commit 6b6dbb73c5
2 changed files with 8 additions and 3 deletions

View file

@ -298,7 +298,7 @@ class Tally(_FortranObjectWithID):
data = POINTER(c_double)()
shape = (c_int*3)()
_dll.openmc_tally_results(self._index, data, shape)
return as_array(data, tuple(shape[::-1]))
return as_array(data, tuple(shape))
@property
def scores(self):

View file

@ -153,7 +153,7 @@ module tally_header
! Normalization for statistics
integer(C_INT32_T), public, bind(C) :: n_realizations = 0 ! # of independent realizations
real(8), public :: total_weight ! total starting particle weight in realization
real(C_DOUBLE), public, bind(C) :: total_weight ! total starting particle weight in realization
contains
@ -688,7 +688,12 @@ contains
associate (t => tallies(index) % obj)
if (allocated(t % results)) then
ptr = C_LOC(t % results(1,1,1))
shape_(:) = shape(t % results)
! Note that shape is reversed since it is assumed to be used from
! C/C++ code
shape_(1) = size(t % results, 3)
shape_(2) = size(t % results, 2)
shape_(3) = size(t % results, 1)
err = 0
else
err = E_ALLOCATE