Skip to content

Commit

Permalink
Replace db array default values with real literals
Browse files Browse the repository at this point in the history
The default values for the database transfer functions were incorrectly
assiged as integer literals, recast to types using real32/64 but
actually corresponding to whatever integer kind equals real32/64.

We now simply assign it a literal value of -1. and rely on the compiler
to handle the recasting.

Although none of these functions were intended to be used, and -1 would
probably be eventually cast into an appropriate real type, it is better
to get this correct.

Thanks to Keith Lindsay for suggesting this change.
  • Loading branch information
marshallward committed Apr 26, 2024
1 parent 0730606 commit aac5bb8
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions config_src/external/database_comms/database_client_interface.F90
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ function unpack_tensor_float_1d(self, name, data, dims) result(code)
integer :: code

code = -1
data(:) = -1_real32
data(:) = -1.
end function unpack_tensor_float_1d

!> Unpack a 32-bit real 2d tensor from the database
Expand All @@ -329,7 +329,7 @@ function unpack_tensor_float_2d(self, name, data, dims) result(code)
integer :: code

code = -1
data(:,:) = -1_real32
data(:,:) = -1.
end function unpack_tensor_float_2d

!> Unpack a 32-bit real 3d tensor from the database
Expand All @@ -341,7 +341,7 @@ function unpack_tensor_float_3d(self, name, data, dims) result(code)
integer :: code

code = -1
data(:,:,:) = -1_real32
data(:,:,:) = -1.
end function unpack_tensor_float_3d

!> Unpack a 32-bit real 4d tensor from the database
Expand All @@ -353,7 +353,7 @@ function unpack_tensor_float_4d(self, name, data, dims) result(code)
integer :: code

code = -1
data(:,:,:,:) = -1_real32
data(:,:,:,:) = -1.
end function unpack_tensor_float_4d

!> Unpack a 64-bit real 1d tensor from the database
Expand All @@ -365,7 +365,7 @@ function unpack_tensor_double_1d(self, name, data, dims) result(code)
integer :: code

code = -1
data(:) = -1_real64
data(:) = -1.
end function unpack_tensor_double_1d

!> Unpack a 64-bit real 2d tensor from the database
Expand All @@ -377,7 +377,7 @@ function unpack_tensor_double_2d(self, name, data, dims) result(code)
integer :: code

code = -1
data(:,:) = -1_real64
data(:,:) = -1.
end function unpack_tensor_double_2d

!> Unpack a 64-bit real 3d tensor from the database
Expand All @@ -389,7 +389,7 @@ function unpack_tensor_double_3d(self, name, data, dims) result(code)
integer :: code

code = -1
data(:,:,:) = -1_real64
data(:,:,:) = -1.
end function unpack_tensor_double_3d

!> Unpack a 64-bit real 4d tensor from the database
Expand All @@ -401,7 +401,7 @@ function unpack_tensor_double_4d(self, name, data, dims) result(code)
integer :: code

code = -1
data(:,:,:,:) = -1_real64
data(:,:,:,:) = -1.
end function unpack_tensor_double_4d

!> Unpack a 32-bit integer 1d tensor from the database
Expand Down

0 comments on commit aac5bb8

Please sign in to comment.