From 6b6dbb73c571847057763f429e2d7629b98b3bd9 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Wed, 10 Oct 2018 10:00:42 -0500 Subject: [PATCH] Reverse shape for openmc_tally_results (makes sense for C/C++) --- openmc/capi/tally.py | 2 +- src/tallies/tally_header.F90 | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/openmc/capi/tally.py b/openmc/capi/tally.py index 44bf89415b..56c4799aac 100644 --- a/openmc/capi/tally.py +++ b/openmc/capi/tally.py @@ -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): diff --git a/src/tallies/tally_header.F90 b/src/tallies/tally_header.F90 index c6238a88d9..85cc5133bd 100644 --- a/src/tallies/tally_header.F90 +++ b/src/tallies/tally_header.F90 @@ -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