{"action":"created","issue":{"url":"https://api.github.com/repos/mit-crpg/openmc/issues/387","labels_url":"https://api.github.com/repos/mit-crpg/openmc/issues/387/labels{/name}","comments_url":"https://api.github.com/repos/mit-crpg/openmc/issues/387/comments","events_url":"https://api.github.com/repos/mit-crpg/openmc/issues/387/events","html_url":"https://github.com/mit-crpg/openmc/pull/387","id":75400892,"number":387,"title":"Mergeable tallies","user":{"login":"wbinventor","id":209492,"avatar_url":"https://avatars.githubusercontent.com/u/209492?v=3","gravatar_id":"","url":"https://api.github.com/users/wbinventor","html_url":"https://github.com/wbinventor","followers_url":"https://api.github.com/users/wbinventor/followers","following_url":"https://api.github.com/users/wbinventor/following{/other_user}","gists_url":"https://api.github.com/users/wbinventor/gists{/gist_id}","starred_url":"https://api.github.com/users/wbinventor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wbinventor/subscriptions","organizations_url":"https://api.github.com/users/wbinventor/orgs","repos_url":"https://api.github.com/users/wbinventor/repos","events_url":"https://api.github.com/users/wbinventor/events{/privacy}","received_events_url":"https://api.github.com/users/wbinventor/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mit-crpg/openmc/labels/Python%20API","name":"Python API","color":"bfd4f2"},{"url":"https://api.github.com/repos/mit-crpg/openmc/labels/Tallies","name":"Tallies","color":"02e10c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-12T00:08:24Z","updated_at":"2015-05-23T01:21:21Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mit-crpg/openmc/pulls/387","html_url":"https://github.com/mit-crpg/openmc/pull/387","diff_url":"https://github.com/mit-crpg/openmc/pull/387.diff","patch_url":"https://github.com/mit-crpg/openmc/pull/387.patch"},"body":"This PR adds a few new routines to the Python API to merge tallies together. In some use cases (such as mine), it is simple and easy to create lots of distinct ``Tally`` objects when creating input files. However, this can have a severe impact on OpenMC's performance at runtime since tally lookups scale as O(N) for N tallies in a simulation. \r\n\r\nTo improve performance, it is best to combine as many ``Tally`` objects together as possible since it is much more efficient to lookup a bin within a tally than a tally within the global list of tallies in OpenMC. This PR is designed to allow users to register any and all ``Tallies`` with a ``TalliesFile`` object, and let it analyze the ``Tallies`` and merge them at will under-the-hood. For some of my input files for multi-group cross-section generation, I've observed speedups of >10x just by merging tallies. In addition, by merging tallies the size of HDF5 ``statepoint`` files can be reduced by 2-8x simply by eliminating the sugary metadata to delineate distinct tallies.\r\n\r\nIn particular, the following routines have been added to the Python API in this PR:\r\n\r\n* ``Tally.can_merge(test_tally)`` - determines if two ``Tally`` objects are mergeable\r\n* ``Tally.merge(tally)`` - returns a new combined ``Tally`` object\r\n* ``Filter.can_merge(test_filter)`` - determines if two ``Filter`` objects are mergeable\r\n* ``Filter.merge(filter)`` - returns a new combined ``Filter`` object\r\n* ``TalliesFile.add_tally(tally, merge=False)`` - new ``merge`` param to merge new tally if possible\r\n* ``TalliesFile.merge_tallies()`` - analyzes all tallies in file and merges all possible\r\n\r\nThis PR also introduces the following minor revisions and bug fixes to the Python API\r\n\r\n* The ``Filter`` class definition was moved from \"tallies.py\" to \"filter.py\"\r\n* The ``Mesh`` class definition was moved from \"tallies.py\" to \"mesh.py\"\r\n* The ``Trigger`` class definition was moved from \"tallies.py\" to \"trigger.py\"\r\n* Fixed bug in ``Tally.__deepcopy(...)`` routine\r\n* Fixed bug in ``Trigger.__deepcopy__(...)`` routine"},"comment":{"url":"https://api.github.com/repos/mit-crpg/openmc/issues/comments/104810715","html_url":"https://github.com/mit-crpg/openmc/pull/387#issuecomment-104810715","issue_url":"https://api.github.com/repos/mit-crpg/openmc/issues/387","id":104810715,"user":{"login":"paulromano","id":743095,"avatar_url":"https://avatars.githubusercontent.com/u/743095?v=3","gravatar_id":"","url":"https://api.github.com/users/paulromano","html_url":"https://github.com/paulromano","followers_url":"https://api.github.com/users/paulromano/followers","following_url":"https://api.github.com/users/paulromano/following{/other_user}","gists_url":"https://api.github.com/users/paulromano/gists{/gist_id}","starred_url":"https://api.github.com/users/paulromano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulromano/subscriptions","organizations_url":"https://api.github.com/users/paulromano/orgs","repos_url":"https://api.github.com/users/paulromano/repos","events_url":"https://api.github.com/users/paulromano/events{/privacy}","received_events_url":"https://api.github.com/users/paulromano/received_events","type":"User","site_admin":false},"created_at":"2015-05-23T01:21:21Z","updated_at":"2015-05-23T01:21:21Z","body":"I don't see anything that was changed in `Trigger.__deepcopy__()`? What was the bug there?"}}