Skip to content

Commit

Permalink
Quick fix to multithreading issue by refining specialization of contr…
Browse files Browse the repository at this point in the history
…avariant vectors (#62)

* quick fix for specialization of get_contravariant_vector

* remove unused static2val

* run formatter
  • Loading branch information
tristanmontoya authored Jan 15, 2025
1 parent e7c1de7 commit 13611fc
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/solvers/dgsem_p4est/containers_2d_manifold_in_3d_cartesian.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,22 @@ end
return uEltype
end

# Extract contravariant vector Ja^i (i = index) as SVector
# This function dispatches on the type of contravariant_vectors
static2val(::Trixi.StaticInt{N}) where {N} = Val{N}()
@inline function Trixi.get_contravariant_vector(index, contravariant_vectors::PtrArray,
indices...)
# Extract contravariant vector Ja^i (i = index) as SVector. This function dispatches on the
# type of contravariant_vectors, specializing for NDIMS = 2 and NDIMS_AMBIENT = 3 by using
# the fact that the second type parameter of PtrArray is NDIMS + 3, and the fourth type
# parameter of PtrArray is Tuple{StaticInt{NDIMS_AMBIENT}, Vararg{IntT, NDIMS + 2}}.
@inline function Trixi.get_contravariant_vector(index,
contravariant_vectors::PtrArray{RealT,
5,
<:Any,
Tuple{Trixi.StaticInt{3},
IntT,
IntT,
IntT,
IntT}},
indices...) where {RealT, IntT}
return SVector(ntuple(@inline(dim->contravariant_vectors[dim, index, indices...]),
static2val(static_size(contravariant_vectors,
Trixi.StaticInt(1)))))
3))
end

# Create element container and initialize element data.
Expand Down

0 comments on commit 13611fc

Please sign in to comment.