Skip to content

Commit a742fb9

Browse files
committed
Fix bug in field2array
1 parent e2f9d3f commit a742fb9

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

src/Fields/Fields.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ function field2array(field::Field)
614614
represented by $f_axis_size array elements (must be 1)")
615615
end
616616
axes(field) isa Spaces.AbstractSpectralElementSpace && return vec(parent(field))
617-
return reshape(parent(field), nlevels(axes(field)), :)
617+
return reshape(parent(field), DataLayouts.nlevels(field_values(field)), :)
618618
end
619619

620620
set_mask!(space::Spaces.AbstractSpace, field::Field) =

src/Fields/broadcast.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,13 @@ Base.similar(
167167
return dest
168168
end
169169

170-
# Fused multi-broadcast entry point for Fields
170+
# Fused multi-broadcast entry point for Fields. The mask argument must be
171+
# constrained to DataMask because an unconstrained second argument makes this
172+
# ambiguous with copyto! methods that only constrain their second arguments,
173+
# like the ones for Lmul and Rmul in ArrayLayouts.
171174
function Base.copyto!(
172175
fmbc::FusedMultiBroadcast{T},
173-
mask = get_mask(axes(first(fmbc.pairs).first)),
176+
mask::DataLayouts.DataMask = get_mask(axes(first(fmbc.pairs).first)),
174177
) where {N, T <: NTuple{N, Pair{<:Field, <:Any}}}
175178
fmb_data = FusedMultiBroadcast(
176179
map(fmbc.pairs) do pair

0 commit comments

Comments
 (0)