Skip to content

Commit

Permalink
Merge pull request #740 from galacticusorg/fixMergerTreeReadMultipleF…
Browse files Browse the repository at this point in the history
…iles

Correctly handle reading of multiple merger tree files
  • Loading branch information
abensonca authored Nov 21, 2024
2 parents db8884f + 771bd1d commit c5185af
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions source/merger_trees.construct.read.F90
Original file line number Diff line number Diff line change
Expand Up @@ -995,12 +995,13 @@ function readConstruct(self,treeNumber,finished) result(tree)
! Find the maximum tree number in the current file.
treeNumberMaximum=int(self%mergerTreeImporter_%treeCount(),kind=c_size_t)
! Check if we need to move to a new file.
if (treeNumber-self%treeNumberOffset > treeNumberMaximum .and. self%fileCurrent < size(self%fileNames)) then
do while (treeNumber-self%treeNumberOffset > treeNumberMaximum .and. self%fileCurrent < size(self%fileNames))
self%fileCurrent =self%fileCurrent +1
self%treeNumberOffset=self%treeNumberOffset+treeNumberMaximum
call self%mergerTreeImporter_%close( )
call self%mergerTreeImporter_%open (File_Name_Expand(char(self%fileNames(self%fileCurrent))))
end if
treeNumberMaximum=int(self%mergerTreeImporter_%treeCount(),kind=c_size_t)
end do
treeNumberOffset=treeNumber-self%treeNumberOffset
if (treeNumberOffset <= treeNumberMaximum) then
! Set tree properties.
Expand Down

0 comments on commit c5185af

Please sign in to comment.