Skip to content

Commit

Permalink
Remove unused indices and methods
Browse files Browse the repository at this point in the history
  • Loading branch information
charleskawczynski committed Aug 29, 2024
1 parent d04ebe3 commit 78ac7bb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 129 deletions.
107 changes: 6 additions & 101 deletions src/Topologies/dss.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,6 @@ struct DSSBuffer{S, G, D, A, B, VI}
send_buf_idx::B
"indexing array for loading (and summing) data from recv buffer to `perimeter_data`"
recv_buf_idx::B
"field id for all scalar fields stored in the `data` array"
scalarfidx::VI
"field id for all covariant12vector fields stored in the `data` array"
covariant12fidx::VI
"field id for all contravariant12vector fields stored in the `data` array"
contravariant12fidx::VI
"internal local elements (lidx)"
covariant123fidx::VI
"field id for all contravariant123vector fields stored in the `data` array"
contravariant123fidx::VI
"internal local elements (lidx)"
internal_elems::VI
"local elements (lidx) located on process boundary"
Expand Down Expand Up @@ -69,14 +59,15 @@ function create_dss_buffer(
Nf = DataLayouts.ncomponents(data)
nfacedof = Nij - 2
T = eltype(parent(data))
TS = _transformed_type(data, local_geometry, local_weights, DA) # extract transformed type
# Add TS for Covariant123Vector
# For DSS of Covariant123Vector, the third component is treated like a scalar
# and is not transformed
if eltype(data) <: Geometry.Covariant123Vector
TS = Geometry.UVWVector{T}
TS = if eltype(data) <: Geometry.Covariant123Vector
Geometry.UVWVector{T}
elseif eltype(data) <: Geometry.Contravariant123Vector
TS = Geometry.UVWVector{T}
Geometry.UVWVector{T}
else
_transformed_type(data, local_geometry, local_weights, DA) # extract transformed type
end
perimeter_data =
DataLayouts.VIFH{TS, Nv, Np, Nh}(DA{T}(undef, Nv, Np, Nf, Nh))
Expand Down Expand Up @@ -111,104 +102,18 @@ function create_dss_buffer(
internal_elems = DA(topology.internal_elems)
perimeter_elems = DA(topology.perimeter_elems)
end
scalarfidx,
covariant12fidx,
contravariant12fidx,
covariant123fidx,
contravariant123fidx = Int[], Int[], Int[], Int[], Int[]
supportedvectortypes = Union{
Geometry.UVector,
Geometry.VVector,
Geometry.WVector,
Geometry.UVVector,
Geometry.UWVector,
Geometry.VWVector,
Geometry.UVWVector,
Geometry.Covariant12Vector,
Geometry.Covariant3Vector,
Geometry.Covariant123Vector,
Geometry.Contravariant123Vector,
Geometry.Contravariant12Vector,
Geometry.Contravariant3Vector,
}

if S <: NamedTuple
for (i, fieldtype) in enumerate(S.parameters[2].types)
offset = DataLayouts.fieldtypeoffset(T, S, i)
ncomponents = DataLayouts.typesize(T, fieldtype)
if fieldtype <: Geometry.AxisVector # vector fields
if !(fieldtype <: supportedvectortypes)
@show fieldtype
@show supportedvectortypes
end
@assert fieldtype <: supportedvectortypes
if fieldtype <: Geometry.Covariant12Vector
push!(covariant12fidx, offset + 1)
elseif fieldtype <: Geometry.Covariant123Vector
push!(covariant123fidx, offset + 1)
elseif fieldtype <: Geometry.Contravariant12Vector
push!(contravariant12fidx, offset + 1)
elseif fieldtype <: Geometry.Contravariant123Vector
push!(contravariant123fidx, offset + 1)
else
append!(
scalarfidx,
Vector((offset + 1):(offset + ncomponents)),
)
end
elseif fieldtype <: NTuple # support a NTuple of primitive types
append!(scalarfidx, Vector((offset + 1):(offset + ncomponents)))
else # scalar fields
push!(scalarfidx, offset + 1)
end
end
else # deals with simple type, with single field (e.g: S = Float64, S = CovariantVector12, etc.)
ncomponents = DataLayouts.typesize(T, S)
if S <: Geometry.AxisVector # vector field
if !(S <: supportedvectortypes)
@show S
@show supportedvectortypes
end
@assert S <: supportedvectortypes
if S <: Geometry.Covariant12Vector
push!(covariant12fidx, 1)
elseif S <: Geometry.Covariant123Vector
push!(covariant123fidx, 1)
elseif S <: Geometry.Contravariant12Vector
push!(contravariant12fidx, 1)
elseif S <: Geometry.Contravariant123Vector
push!(contravariant123fidx, 1)
else
append!(scalarfidx, Vector(1:ncomponents))
end
elseif S <: NTuple # support a NTuple of primitive types
append!(scalarfidx, Vector(1:ncomponents))
else # scalar field
push!(scalarfidx, 1)
end
end
scalarfidx = DA(scalarfidx)
covariant12fidx = DA(covariant12fidx)
covariant123fidx = DA(covariant123fidx)
contravariant12fidx = DA(contravariant12fidx)
contravariant123fidx = DA(contravariant123fidx)
G = typeof(graph_context)
D = typeof(perimeter_data)
A = typeof(send_data)
B = typeof(send_buf_idx)
VI = typeof(scalarfidx)
VI = typeof(perimeter_elems)
return DSSBuffer{S, G, D, A, B, VI}(
graph_context,
perimeter_data,
send_data,
recv_data,
send_buf_idx,
recv_buf_idx,
scalarfidx,
covariant12fidx,
contravariant12fidx,
covariant123fidx,
contravariant123fidx,
internal_elems,
perimeter_elems,
)
Expand Down
28 changes: 0 additions & 28 deletions src/Topologies/dss_transform.jl
Original file line number Diff line number Diff line change
Expand Up @@ -201,34 +201,6 @@ end

# helper functions for DSS2

function _get_idx_metric(sizet::NTuple{5, Int}, loc::NTuple{4, Int})
nmetric = sizet[4]
(i11, i12, i21, i22) = nmetric == 4 ? (1, 2, 3, 4) : (1, 2, 4, 5)
(level, i, j, elem) = loc
return (
linear_ind(sizet, (level, i, j, i11, elem)),
linear_ind(sizet, (level, i, j, i12, elem)),
linear_ind(sizet, (level, i, j, i21, elem)),
linear_ind(sizet, (level, i, j, i22, elem)),
)
end

function _get_idx_metric_3d(sizet::NTuple{5, Int}, loc::NTuple{4, Int})
nmetric = sizet[4]
(level, i, j, elem) = loc
return (
linear_ind(sizet, (level, i, j, 1, elem)),
linear_ind(sizet, (level, i, j, 2, elem)),
linear_ind(sizet, (level, i, j, 3, elem)),
linear_ind(sizet, (level, i, j, 4, elem)),
linear_ind(sizet, (level, i, j, 5, elem)),
linear_ind(sizet, (level, i, j, 6, elem)),
linear_ind(sizet, (level, i, j, 7, elem)),
linear_ind(sizet, (level, i, j, 8, elem)),
linear_ind(sizet, (level, i, j, 9, elem)),
)
end

function _representative_slab(
data::Union{DataLayouts.AbstractData, Nothing},
::Type{DA},
Expand Down

0 comments on commit 78ac7bb

Please sign in to comment.