CartesianIndex in reduction of Scalar action

This commit is contained in:
Alberto Ramos 2021-10-17 23:03:14 +02:00
parent 4601626b5b
commit 6104bd7276

View file

@ -37,7 +37,7 @@ function krnl_act!(act, U::AbstractArray{TG}, Phi::AbstractArray{TS}, sp::Scalar
end
sync_threads()
act[b,r] = zero(act[b,r])
S = zero(eltype(act))
for id in 1:N
bu, ru = up((b, r), id, lp)
@ -48,15 +48,18 @@ function krnl_act!(act, U::AbstractArray{TG}, Phi::AbstractArray{TS}, sp::Scalar
Pup = Phi[bu,i,ru]
end
act[b,r] += -2*sp.kap[i]*dot(Psh[b,i],Ush[b,id]*Pup)
S += -2*sp.kap[i]*dot(Psh[b,i],Ush[b,id]*Pup)
end
end
for i in 1:NP
sdot = dot(Psh[b,i],Psh[b,i])
act[b,r] += sdot + sp.eta[i]*(sdot - 1)^2
S += sdot + sp.eta[i]*(sdot - 1)^2
end
I = point_coord((b,r), lp)
act[I] = S
return nothing
end