moved source_present data to the end of meta data section of statepoint writing

This commit is contained in:
Bryan Herman 2014-03-05 13:34:59 -05:00
parent 4ca97dde96
commit 76cbf0ffaa
2 changed files with 31 additions and 25 deletions

View file

@ -232,6 +232,13 @@ contains
end if
! Indicate where source bank is stored in statepoint
if (source_separate) then
call sp % write_data(0, "source_present")
else
call sp % write_data(1, "source_present")
end if
! Check for the no-tally-reduction method
if (.not. reduce_tallies) then
! If using the no-tally-reduction method, we need to collect tally
@ -275,13 +282,6 @@ contains
end if
! Indicate where source bank is stored in statepoint
if (source_separate) then
call sp % write_data(0, "source_present")
else
call sp % write_data(1, "source_present")
end if
! Close the file for serial writing
call sp % file_close()
@ -730,6 +730,20 @@ contains
end do TALLY_METADATA
! Check for source in statepoint if needed
call sp % read_data(int_array(1), "source_present")
if (int_array(1) == 1) then
source_present = .true.
else
source_present = .false.
end if
! Check to make sure source bank is present
if (path_source_point == path_state_point .and. .not. source_present) then
message = "Source bank must be contained in statepoint restart file"
call fatal_error()
end if
! Read tallies to master
if (master) then
@ -766,20 +780,6 @@ contains
end if
end if
! Check for source in statepoint if needed
call sp % read_data(int_array(1), "source_present")
if (int_array(1) == 1) then
source_present = .true.
else
source_present = .false.
end if
! Check to make sure source bank is present
if (path_source_point == path_state_point .and. .not. source_present) then
message = "Source bank must be contained in statepoint restart file"
call fatal_error()
end if
! Read source if in eigenvalue mode
if (run_mode == MODE_EIGENVALUE) then

View file

@ -298,6 +298,13 @@ class StatePoint(object):
f.stride = stride
stride *= f.length
# Source bank present
source_present = self._get_int(path='source_present')[0]
if source_present == 1:
self.source_present = True
else:
self.source_present = False
# Set flag indicating metadata has already been read
self._metadata = True
@ -342,10 +349,9 @@ class StatePoint(object):
if not self._results:
self.read_results()
# Source bank present
source_present = self._get_int(path='source_present')[0]
if source_present != 1:
print('Source bank not present.')
# Check if source bank is in statepoint
if not self.source_present:
print('Source not in statepoint file.')
return
# For HDF5 state points, copy entire bank