mit-crpg/openmc — pull request #140 by paulromano (2013-01-29 16:25:53+00:00)
Title: Tally cleanup

This pull request attempts to simplify the way that different types of tallies are handled in OpenMC and addresses issue #113. Things have been getting a bit out of hand lately: we had the main `tallies` array, separate arrays for `analog_tallies`, `tracklength_tallies`, and `current_tallies` which stored integer indices in the tallies array, and then the corresponding active tally lists which stored indices in the `analog_tallies`, etc. lists. Then there were all the various `n_...` variables counting how many tallies of different types were in each array.

My general observation was that the `analog_tallies`, `tracklength_tallies`, and `current_tallies` index arrays and the active tally lists were not serving separate purposes. I have deleted the index arrays so that now we only have the active tally lists. Furthermore, the active tally lists are of type SetInt, a new derived type I recently wrote that represents a set of objects (i.e. cannot contain the same thing twice -- a nice feature in the case of active tally lists so that you can't have the same tally twice). With only the active tally lists used, there is no need to have n_user_analog_tallies, n_cmfd_analog_tallies, etc. so those have been deleted.

For various reasons, I still want all tallies to be contained in one array since this simplifies parallel communication, state points, etc. However, to ease access to different groups within the tallies array, I've also added two new pointers, `user_tallies` and `cmfd_tallies` which allow a simple way of addressing the separate parts of `tallies`. This means you can have a do loop from 1 to n_cmfd_tallies and access cmfd_tallies(i). In the `tally_initialize` module, there is a subroutine add_tallies which simplifies adding a new "tally group" to the tallies array. I plan on using this for depletion and perhaps global tallies in the future.

Can you give this PR a look @bhermanmit and let me know if you have any concerns or suggestions?