From b6a9bdaa03e81d0aee74928b1f459d9658110f2a Mon Sep 17 00:00:00 2001 From: Gabriele Bozzola Date: Fri, 15 Sep 2023 14:57:14 -0700 Subject: [PATCH] Fix element type for more complex Fields If we a Vector Field, `eltype` will return `Vector`, not float. So, we have to be more creative with how to get the float_type for general cases. --- src/diagnostics/diagnostic.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/diagnostics/diagnostic.jl b/src/diagnostics/diagnostic.jl index c891059c122..7b9fc551521 100644 --- a/src/diagnostics/diagnostic.jl +++ b/src/diagnostics/diagnostic.jl @@ -577,7 +577,7 @@ reset_accumulator!(_, reduction_time_func::Nothing) = nothing function reset_accumulator!(diag_accumulator, reduction_time_func) # identity_of_reduction works by dispatching over operation identity = identity_of_reduction(reduction_time_func) - float_type = eltype(diag_accumulator) + float_type = Spaces.undertype(axes((diag_accumulator))) identity_ft = convert(float_type, identity) diag_accumulator .= identity_ft end