From 6104bd7276a27dbfb289f9cccb40108ce6f3fa81 Mon Sep 17 00:00:00 2001 From: Alberto Ramos Date: Sun, 17 Oct 2021 23:03:14 +0200 Subject: [PATCH] CartesianIndex in reduction of Scalar action --- src/Scalar/ScalarAction.jl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Scalar/ScalarAction.jl b/src/Scalar/ScalarAction.jl index f8a89b2..ba1b52b 100644 --- a/src/Scalar/ScalarAction.jl +++ b/src/Scalar/ScalarAction.jl @@ -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