Open jb-mackay opened 2 years ago
similar
is for AbstractArray
subtypes and Field
's are explicitly not arrays, so I suspect the generic version treats the Field as a scalar by default but we overload enough methods of AbstractArray interface that you get some result (the backing data layouts have length 1). Assigning fields to each other on the same space is a bug but you would have to special case that and not use the generic broadcast fallback.
That's a good point about the data layout length.
Assigning fields to each other on the same space is a bug but you would have to special case that and not use the generic broadcast fallback.
What methods need special casing here?
In general, what are the to-dos that arise from this?
Was playing around with Field broadcasting and stumbled into some unexpected behavior. My setup (from test/Operators/remapping.jl) is below.
When I write
field2 .= field1
I expect to havebut instead I have
where only the first nodal value is changed. Furthermore,
similar(field1)
returns aFloat64-valued Field: [2.17214e-314]
.So again, only a single nodal value is represented.
To reproduce:
I'll note that I should update to using
Fields.ones(source)
going forward, and using that this issue does not come up. So there is something with how I construct these fields that is causing this behavior.