Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix intermediate integer overflow when reading/writing large files #224

Merged
merged 2 commits into from
May 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Solver/src/libs/mesh/HexMesh.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2978,7 +2978,7 @@ subroutine HexMesh_SaveSolution(self, iter, time, name, saveGradients, saveSenso
Q(NCONS,:,:,:) = e % storage % c(1,:,:,:)
#endif

pos = POS_INIT_DATA + (e % globID-1)*5_AddrInt*SIZEOF_INT + padding*e % offsetIO * SIZEOF_RP
pos = POS_INIT_DATA + (e % globID-1)*5_AddrInt*SIZEOF_INT + 1_AddrInt*padding*e % offsetIO * SIZEOF_RP
if (saveSensor) pos = pos + (e % globID - 1) * SIZEOF_RP
call writeArray(fid, Q, position=pos)

Expand Down Expand Up @@ -3078,7 +3078,7 @@ subroutine HexMesh_SaveStatistics(self, iter, time, name, saveGradients)
fID = putSolutionFileInWriteDataMode(trim(name))
do eID = 1, self % no_of_elements
associate( e => self % elements(eID) )
pos = POS_INIT_DATA + (e % globID-1)*5_AddrInt*SIZEOF_INT + no_of_stats_variables*e % offsetIO*SIZEOF_RP
pos = POS_INIT_DATA + (e % globID-1)*5_AddrInt*SIZEOF_INT + 1_AddrInt*no_of_stats_variables*e % offsetIO*SIZEOF_RP
no_stat_s = 9
call writeArray(fid, e % storage % stats % data(1:no_stat_s,:,:,:), position=pos)
allocate(Q(NCONS, 0:e % Nxyz(1), 0:e % Nxyz(2), 0:e % Nxyz(3)))
Expand Down Expand Up @@ -3374,7 +3374,7 @@ subroutine HexMesh_LoadSolution( self, fileName, initial_iteration, initial_time
fID = putSolutionFileInReadDataMode(trim(fileName))
do eID = 1, size(self % elements)
associate( e => self % elements(eID) )
pos = POS_INIT_DATA + (e % globID-1)*5*SIZEOF_INT + padding*e % offsetIO*SIZEOF_RP
pos = POS_INIT_DATA + (e % globID-1)*5*SIZEOF_INT + 1_AddrInt*padding*e % offsetIO*SIZEOF_RP
if (has_sensor) pos = pos + (e % globID - 1) * SIZEOF_RP
read(fID, pos=pos) array_rank
read(fID) no_of_eqs, Nxp1, Nyp1, Nzp1
Expand Down
Loading