Tally results array

Hi all,

I’m using the openmc_tally_results interface. It seems that the returned array has zero entries for all RESULT_VALUE indices. This makes sense given the code here. Is this the desired behavior? Effectively, to get the correct result, I just need to take the RESULT_SUM entries and divide by the number of active batches, which obviously isn’t hard. However, it might be nice for users if the array returned already had that arithmetic done for them.

Alex

Hi Alex,

The openmc_tally_results interface is deliberately low-level; it actually gives you a pointer to the results array that OpenMC is using internally. To return an array that was normalized by the number of realizations would require allocating memory, and it’s not clear who would own that (since it is a C interface). Note that the Python bindings to our C API do allow a user to get tally mean values directly (see here), but I realize that that’s not much of a help for you since you are in C++ land. For now, you’ll have to do the extra arithmetic yourself; as more of the code moves over to C++, hopefully better interfaces will emerge.

Best regards,
Paul

Sounds good!