From 6e3ae0145d5b1c34c5ec97d56d5e3b04af4f8d57 Mon Sep 17 00:00:00 2001 From: Ivan Utkin Date: Thu, 29 Aug 2024 00:14:41 +0200 Subject: [PATCH] Fix index handling in 1D (#39) --- Project.toml | 2 +- src/BoundaryConditions/batch.jl | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index 2371228c..509ba7ee 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Chmy" uuid = "33a72cf0-4690-46d7-b987-06506c2248b9" authors = ["Ivan Utkin , Ludovic Raess , and contributors"] -version = "0.1.18" +version = "0.1.19" [deps] Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" diff --git a/src/BoundaryConditions/batch.jl b/src/BoundaryConditions/batch.jl index 817e9100..c74c8ba5 100644 --- a/src/BoundaryConditions/batch.jl +++ b/src/BoundaryConditions/batch.jl @@ -156,13 +156,16 @@ end bc!(arch::Architecture, grid::SG, f_bc::Vararg{FieldAndBC}; kwargs...) = bc!(arch, grid, batch(grid, f_bc...; kwargs...)) +@inline to_bc_index(::SG, I) = I .- 1 +@inline to_bc_index(::SG{1}, I) = () + # batched kernels @kernel function bc_kernel!(side::Side, dim::Dim, grid::SG{N}, fields::NTuple{K,Field}, conditions::NTuple{K,FieldBoundaryCondition}) where {N,K} J = @index(Global, NTuple) - I = J .- 1 + I = to_bc_index(grid, J) ntuple(Val(K)) do ifield Base.@_inline_meta @inbounds begin