Skip to content

Commit

Permalink
Fix some conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
charleskawczynski committed Aug 29, 2024
1 parent f4b7718 commit 5e3f3ed
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/Topologies/dss.jl
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,15 @@ function dss_transform!(
return nothing
end

# For DSS of Covariant123Vector, the third component is treated like a scalar
# and is not transformed
@inline drop_vert_dim(
::Type{T},
x::Geometry.UVWVector,
) where {T <: Geometry.UVVector} = Geometry.UVVector(x.u, x.v)
@inline drop_vert_dim(::Type{T}, x::T) where {T} = x
@inline drop_vert_dim(::Type{T}, x::Real) where {T <: Real} = x

"""
function dss_transform!(
::ClimaComms.AbstractCPUDevice,
Expand Down Expand Up @@ -215,12 +224,14 @@ function dss_transform!(
for (p, (ip, jp)) in enumerate(perimeter)
for level in 1:nlevels
loc = CI(ip, jp, 1, level, elem)
wt = weight[loc]
perimeter_data[CI(p, 1, 1, level, elem)] = dss_transform(
src = dss_transform(
data[loc],
local_geometry[CI(ip, jp, 1, level, elem)],
wt,
weight[loc],
)
perimeter_data[CI(p, 1, 1, level, elem)] =
drop_vert_dim(eltype(perimeter_data), src)

end
end
end
Expand Down

0 comments on commit 5e3f3ed

Please sign in to comment.