diff --git a/docs/source/releasenotes/0.13.1.rst b/docs/source/releasenotes/0.13.1.rst index 4df31e4569..70c8609ac3 100644 --- a/docs/source/releasenotes/0.13.1.rst +++ b/docs/source/releasenotes/0.13.1.rst @@ -101,7 +101,8 @@ New Features a corresponding Python binding :func:`openmc.lib.sample_external_source`. - The track file generation capability has been completely overhauled. Track files now include much more information, and a new :class:`~openmc.Tracks` - class allows access to track file information from the Python API. Multiple + class allows access to track file information from the Python API and has a + :meth:`~openmc.Tracks.write_to_vtk` method for writing a VTK file. Multiple tracks are now written to a single file (one per MPI rank). - A new :func:`openmc.wwinp_to_wws` function that converts weight windows from a ``wwinp`` file to a list of :class:`~openmc.WeightWindows` objects. diff --git a/openmc/tracks.py b/openmc/tracks.py index 15bd297274..9b4b55247d 100644 --- a/openmc/tracks.py +++ b/openmc/tracks.py @@ -271,7 +271,7 @@ class Tracks(list): track.plot(ax) return ax - def write_tracks_to_vtk(self, filename=Path('tracks.vtp')): + def write_to_vtk(self, filename=Path('tracks.vtp')): """Creates a VTP file of the tracks Parameters diff --git a/scripts/openmc-track-to-vtk b/scripts/openmc-track-to-vtk index 118e658274..82439bea73 100755 --- a/scripts/openmc-track-to-vtk +++ b/scripts/openmc-track-to-vtk @@ -35,7 +35,7 @@ def main(): # Write coordinate values to points array. track_file = openmc.Tracks(args.input) - track_file.write_tracks_to_vtk(args.out) + track_file.write_to_vtk(args.out) if __name__ == '__main__': main() diff --git a/tests/unit_tests/test_tracks.py b/tests/unit_tests/test_tracks.py index 5f3940fadd..be75c6f881 100644 --- a/tests/unit_tests/test_tracks.py +++ b/tests/unit_tests/test_tracks.py @@ -143,7 +143,7 @@ def test_filter(sphere_model, run_in_tmpdir): assert matches == [] -def test_write_tracks_to_vtk(sphere_model): +def test_write_to_vtk(sphere_model): vtk = pytest.importorskip('vtk') # Set maximum number of tracks per process to write sphere_model.settings.max_tracks = 25 @@ -153,7 +153,7 @@ def test_write_tracks_to_vtk(sphere_model): generate_track_file(sphere_model, tracks=True) tracks = openmc.Tracks('tracks.h5') - polydata = tracks.write_tracks_to_vtk('tracks.vtp') + polydata = tracks.write_to_vtk('tracks.vtp') assert isinstance(polydata, vtk.vtkPolyData) assert Path('tracks.vtp').is_file()