Updating voxel version and using that for a check rather than the OpenMC version.

This commit is contained in:
Patrick Shriwise 2019-02-27 18:09:59 -06:00
parent 14f9d04ad7
commit 125812c487
2 changed files with 7 additions and 6 deletions

View file

@ -33,7 +33,7 @@ constexpr std::array<int, 2> VERSION_PARTICLE_RESTART {2, 0};
constexpr std::array<int, 2> VERSION_TRACK {2, 0};
constexpr std::array<int, 2> VERSION_SUMMARY {6, 0};
constexpr std::array<int, 2> VERSION_VOLUME {1, 0};
constexpr std::array<int, 2> VERSION_VOXEL {1, 0};
constexpr std::array<int, 2> VERSION_VOXEL {1, 1};
constexpr std::array<int, 2> VERSION_MGXS_LIBRARY {1, 0};
constexpr char VERSION_MULTIPOLE[] {"v0.2"};

View file

@ -8,7 +8,7 @@ import numpy as np
import h5py
import vtk
_min_version = (0,10,0)
_min_version = (1,1)
def main():
@ -23,13 +23,14 @@ def main():
fh = h5py.File(args.voxel_file, 'r')
# check version
version = tuple(fh.attrs['openmc_version'])
version = tuple(fh.attrs['version'])
if version < _min_version:
old_version = ".".join(map(str,version))
min_version = ".".join(map(str,_min_version))
err_msg = "This voxel file was generated using OpenMC " \
"version {}. Please re-generate using "\
"version {} or higher.".format(old_version, min_version)
err_msg = "This voxel file's version is {}. This script " \
"only supports voxel files with version {} or " \
"higher. Please generate a new voxel file using " \
"a newer version of OpenMC.".format(old_version, min_version)
raise ValueError(err_msg)
dimension = fh.attrs['num_voxels']