diff --git a/docs/source/io_formats/particle_restart.rst b/docs/source/io_formats/particle_restart.rst index 9f34184955..6ebf7e7baa 100644 --- a/docs/source/io_formats/particle_restart.rst +++ b/docs/source/io_formats/particle_restart.rst @@ -9,8 +9,8 @@ The current version of the particle restart file format is 2.0. **/** :Attributes: - **filetype** (*char[]*) -- String indicating the type of file. - - **version** (*int[2]*) -- Major and minor version of the summary - file format. + - **version** (*int[2]*) -- Major and minor version of the particle + restart file format. - **openmc_version** (*int[3]*) -- Major, minor, and release version number for OpenMC. - **git_sha1** (*char[40]*) -- Git commit SHA-1 hash. diff --git a/docs/source/io_formats/track.rst b/docs/source/io_formats/track.rst index e5cb5d46e3..c617cd73e3 100644 --- a/docs/source/io_formats/track.rst +++ b/docs/source/io_formats/track.rst @@ -4,27 +4,18 @@ Track File Format ================= -The current revision of the particle track file format is 1. +The current revision of the particle track file format is 2.0. -**/filetype** (*char[]*) +**/** - String indicating the type of file. +:Attributes: - **filetype** (*char[]*) -- String indicating the type of file. + - **version** (*int[2]*) -- Major and minor version of the track + file format. + - **n_particles** (*int*) -- Number of particles for which tracks + are recorded. + - **n_coords** (*int[]*) -- Number of coordinates for each + particle. -**/revision** (*int*) - - Revision of the track file format. Any time a change is made in the format, - this integer is incremented. - -**/n_particles** (*int*) - - Number of particles for which tracks are recorded. - -**/n_coords** (*int[]*) - - Number of coordinates for each particle. - -*do i = 1, n_particles* - - **/coordinates_i** (*double[][3]*) - - (x,y,z) coordinates for the *i*-th particle. +:Datasets: + - **coordinates_** (*double[][3]*) -- (x,y,z) coordinates for the + *i*-th particle. diff --git a/docs/source/io_formats/volume.rst b/docs/source/io_formats/volume.rst index 10b7a3b732..456a06eef5 100644 --- a/docs/source/io_formats/volume.rst +++ b/docs/source/io_formats/volume.rst @@ -4,19 +4,31 @@ Volume File Format ================== +The current version of the volume file format is 1.0. + **/** -:Attributes: - **samples** (*int*) -- Number of samples +:Attributes: - **filetype** (*char[]*) -- String indicating the type of file. + - **version** (*int[2]*) -- Major and minor version of the summary + file format. + - **openmc_version** (*int[3]*) -- Major, minor, and release + version number for OpenMC. + - **git_sha1** (*char[40]*) -- Git commit SHA-1 hash. + - **date_and_time** (*char[]*) -- Date and time the summary was + written. + - **domain_type** (*char[]*) -- The type of domain for which + volumes are calculated, either 'cell', 'material', or 'universe'. + - **samples** (*int*) -- Number of samples - **lower_left** (*double[3]*) -- Lower-left coordinates of bounding box - **upper_right** (*double[3]*) -- Upper-right coordinates of bounding box -**/cell_/** +**/domain_/** :Datasets: - **volume** (*double[2]*) -- Calculated volume and its uncertainty in cubic centimeters - **nuclides** (*char[][]*) -- Names of nuclides identified in the - cell + domain - **atoms** (*double[][2]*) -- Total number of atoms of each nuclide and its uncertainty diff --git a/docs/source/io_formats/voxel.rst b/docs/source/io_formats/voxel.rst index 6b73f2800a..52ae78aaa0 100644 --- a/docs/source/io_formats/voxel.rst +++ b/docs/source/io_formats/voxel.rst @@ -4,22 +4,24 @@ Voxel Plot File Format ====================== -**/filetype** (*char[]*) +The current version of the voxel file format is 1.0. - String indicating the type of file. +**/** -**/num_voxels** (*int[3]*) +:Attributes: - **filetype** (*char[]*) -- String indicating the type of file. + - **version** (*int[2]*) -- Major and minor version of the voxel + file format. + - **openmc_version** (*int[3]*) -- Major, minor, and release + version number for OpenMC. + - **git_sha1** (*char[40]*) -- Git commit SHA-1 hash. + - **date_and_time** (*char[]*) -- Date and time the summary was + written. + - **num_voxels** (*int[3]*) -- Number of voxels in the x-, y-, and + z- directions. + - **voxel_width** (*double[3]*) -- Width of a voxel in centimeters. + - **lower_left** (*double[3]*) -- Cartesian coordinates of the + lower-left corner of the plot. - Number of voxels in the x-, y-, and z- directions. - -**/voxel_width** (*double[3]*) - - Width of a voxel in centimeters. - -**/lower_left** (*double[3]*) - - Cartesian coordinates of the lower-left corner of the plot. - -**/data** (*int[][][]*) - - Data for each voxel that represents a material or cell ID. +:Datasets: + - **data** (*int[][][]*) -- Data for each voxel that represents a + material or cell ID. diff --git a/scripts/openmc-voxel-to-silovtk b/scripts/openmc-voxel-to-silovtk index 1329b6b6c7..471047127e 100755 --- a/scripts/openmc-voxel-to-silovtk +++ b/scripts/openmc-voxel-to-silovtk @@ -27,9 +27,9 @@ def parse_options(): def main(filename, o): # Read data from voxel file fh = h5py.File(filename, 'r') - dimension = fh['num_voxels'].value - width = fh['voxel_width'].value - lower_left = fh['lower_left'].value + dimension = fh.attrs['num_voxels'] + width = fh.attrs['voxel_width'] + lower_left = fh.attrs['lower_left'] voxel_data = fh['data'].value nx, ny, nz = dimension @@ -40,7 +40,7 @@ def main(filename, o): import vtk except: print('The vtk python bindings do not appear to be installed ' - 'properly.\nOn Ubuntu: sudo apt-get install python-vtk\n' + 'properly.\nOn Ubuntu: sudo apt install python-vtk\n' 'See: http://www.vtk.org/') return diff --git a/src/constants.F90 b/src/constants.F90 index d1095d786b..4b57ac5406 100644 --- a/src/constants.F90 +++ b/src/constants.F90 @@ -21,6 +21,7 @@ module constants integer, parameter :: VERSION_TRACK(2) = [2, 0] integer, parameter :: VERSION_SUMMARY(2) = [5, 0] integer, parameter :: VERSION_VOLUME(2) = [1, 0] + integer, parameter :: VERSION_VOXEL(2) = [1, 0] character(10), parameter :: VERSION_MULTIPOLE = "v0.2" ! ============================================================================ diff --git a/src/plot.F90 b/src/plot.F90 index b5832bbdfa..5ed6ee853f 100644 --- a/src/plot.F90 +++ b/src/plot.F90 @@ -8,7 +8,7 @@ module plot use hdf5_interface use mesh, only: get_mesh_indices use mesh_header, only: RegularMesh - use output, only: write_message + use output, only: write_message, time_stamp use particle_header, only: LocalCoord, Particle use plot_header use ppmlib, only: Image, init_image, allocate_image, & @@ -381,11 +381,20 @@ contains ! Open binary plot file for writing file_id = file_create(pl%path_plot) - ! write plot header info - call write_dataset(file_id, "filetype", 'voxel') - call write_dataset(file_id, "num_voxels", pl%pixels) - call write_dataset(file_id, "voxel_width", vox) - call write_dataset(file_id, "lower_left", ll) + ! write header info + call write_attribute(file_id, "filetype", 'voxel') + call write_attribute(file_id, "version", VERSION_VOXEL) + call write_attribute(file_id, "openmc_version", VERSION) +#ifdef GIT_SHA1 + call write_attribute(file_id, "git_sha1", GIT_SHA1) +#endif + + ! Write current date and time + call write_attribute(file_id, "date_and_time", time_stamp()) + + call write_attribute(file_id, "num_voxels", pl%pixels) + call write_attribute(file_id, "voxel_width", vox) + call write_attribute(file_id, "lower_left", ll) ! Create dataset for voxel data -- note that the dimensions are reversed ! since we want the order in the file to be z, y, x diff --git a/src/state_point.F90 b/src/state_point.F90 index 378fde6519..f3b452953b 100644 --- a/src/state_point.F90 +++ b/src/state_point.F90 @@ -42,7 +42,6 @@ contains integer :: n_order ! loop index for moment orders integer :: nm_order ! loop index for Ynm moment orders integer, allocatable :: id_array(:) - integer, allocatable :: key_array(:) integer(HID_T) :: file_id integer(HID_T) :: cmfd_group, tallies_group, tally_group, meshes_group, & mesh_group, filter_group, derivs_group, deriv_group, & diff --git a/tests/test_plot/test_plot.py b/tests/test_plot/test_plot.py index 606a1fd647..718d6505c9 100644 --- a/tests/test_plot/test_plot.py +++ b/tests/test_plot/test_plot.py @@ -50,10 +50,10 @@ class PlotTestHarness(TestHarness): voxel_files = glob.glob(os.path.join(os.getcwd(), '*.voxel')) for fname in sorted(voxel_files): with h5py.File(fname, 'r') as fh: - outstr += fh['filetype'].value - outstr += fh['num_voxels'].value.tostring() - outstr += fh['lower_left'].value.tostring() - outstr += fh['voxel_width'].value.tostring() + outstr += fh.attrs['filetype'] + outstr += fh.attrs['num_voxels'].tostring() + outstr += fh.attrs['lower_left'].tostring() + outstr += fh.attrs['voxel_width'].tostring() outstr += fh['data'].value.tostring() # Hash the information and return.