Closed zjwegert closed 4 years ago
I added some display statements
struct ThirdOrderTensorValue{D1,D2,D3,T,L} <: MultiValue{Tuple{D1,D2,D3},T,3,L}
data::NTuple{L,T}
function ThirdOrderTensorValue{D1,D2,D3,T}(data::NTuple{L,T}) where {D1,D2,D3,T,L}
display(data)
display([L,D1,D2,D3])
@assert L == D1*D2*D3
new{D1,D2,D3,T,L}(data)
end
end
and received the output for writing ThirdOrder
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27)
4-element Array{Int64,1}:
27
3
3
and when running integrate
:
(0,)
4-element Array{Int64,1}:
1
3
3
3
I think I've found the issue, ThirdOrderTensorValue did not yet have a zero
method. I've implemented the below. Will make a pull soon.
@generated function zero(::Type{<:ThirdOrderTensorValue{D1,D2,D3,T}}) where {D1,D2,D3,T}
L=D1*D2*D3
quote
ThirdOrderTensorValue{D1,D2,D3,T}(tfill(Base.zero(T),Val{$L}()))
end
end
zero(::Type{<:ThirdOrderTensorValue{D1,D2,D3,T,L}}) where {D1,D2,D3,T,L} = ThirdOrderTensorValue{D1,D2,D3,T}(tfill(Base.zero(T),Val{L}()))
zero(::ThirdOrderTensorValue{D1,D2,D3,T,L}) where {D1,D2,D3,T,L} = zero(ThirdOrderTensorValue{D1,D2,D3,T,L})
Let me know what you think.
Hi all, Please help! There seems to be a a bug with integrating a 3-tensor. See below:
Throws: