Update documentation for remaining file formats

This commit is contained in:
Paul Romano 2017-02-20 11:05:52 -06:00
parent 26e2601141
commit 05d7e81794
9 changed files with 71 additions and 57 deletions

View file

@ -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.

View file

@ -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_<i>** (*double[][3]*) -- (x,y,z) coordinates for the
*i*-th particle.

View file

@ -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_<id>/**
**/domain_<id>/**
: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

View file

@ -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.

View file

@ -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

View file

@ -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"
! ============================================================================

View file

@ -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

View file

@ -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, &

View file

@ -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.