Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove some unused code. #1359

Merged
merged 2 commits into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions examples/hybrid/schur_complement_W.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using ClimaCore.Utilities: half
const compose = Operators.ComposeStencils()
const apply = Operators.ApplyStencil()

struct SchurComplementW{F, FT, J1, J2, J3, J4, S, A}
struct SchurComplementW{F, FT, J1, J2, J3, J4, S}
# whether this struct is used to compute Wfact_t or Wfact
transform::Bool

Expand All @@ -25,7 +25,6 @@ struct SchurComplementW{F, FT, J1, J2, J3, J4, S, A}

# cache for the Schur complement linear solve
S::S
S_column_array::A

# whether to test the Jacobian and linear solver
test::Bool
Expand Down Expand Up @@ -53,11 +52,6 @@ function SchurComplementW(Y, transform, flags, test = false)
S_eltype = Operators.StencilCoefs{-1, 1, NTuple{3, FT}}
S = Fields.Field(S_eltype, face_space)
N = Spaces.nlevels(face_space)
S_column_array = Tridiagonal(
Array{FT}(undef, N - 1),
Array{FT}(undef, N),
Array{FT}(undef, N - 1),
)

SchurComplementW{
typeof(flags),
Expand All @@ -67,7 +61,6 @@ function SchurComplementW(Y, transform, flags, test = false)
typeof(∂ᶠ𝕄ₜ∂ᶜρ),
typeof(∂ᶠ𝕄ₜ∂ᶠ𝕄),
typeof(S),
typeof(S_column_array),
}(
transform,
flags,
Expand All @@ -78,7 +71,6 @@ function SchurComplementW(Y, transform, flags, test = false)
∂ᶠ𝕄ₜ∂ᶜρ,
∂ᶠ𝕄ₜ∂ᶠ𝕄,
S,
S_column_array,
test,
)
end
Expand Down Expand Up @@ -112,7 +104,7 @@ Note: The matrix S = A31 A13 + A32 A23 + A33 - I is the "Schur complement" of
function linsolve!(::Type{Val{:init}}, f, u0; kwargs...)
function _linsolve!(x, A, b, update_matrix = false; kwargs...)
(; dtγ_ref, ∂ᶜρₜ∂ᶠ𝕄, ∂ᶜ𝔼ₜ∂ᶠ𝕄, ∂ᶠ𝕄ₜ∂ᶜ𝔼, ∂ᶠ𝕄ₜ∂ᶜρ, ∂ᶠ𝕄ₜ∂ᶠ𝕄) = A
(; S, S_column_array) = A
(; S) = A
dtγ = dtγ_ref[]

xᶜρ = x.c.ρ
Expand Down
17 changes: 0 additions & 17 deletions src/DataLayouts/struct.jl
Original file line number Diff line number Diff line change
Expand Up @@ -151,23 +151,6 @@ Similar to `sizeof(S)`, but gives the result in multiples of `sizeof(T)`.
"""
typesize(::Type{T}, ::Type{S}) where {T, S} = div(sizeof(S), sizeof(T))

# TODO: this assumes that the field struct zero type is the same as the backing
# zero'd out memory, which should be true in all "real world" cases
# but is something that should be revisited
@inline function _mzero!(out::MArray{S, T, N, L}, FT) where {S, T, N, L}
TdivFT = DataLayouts.typesize(FT, T)
Base.GC.@preserve out begin
@inbounds for i in 1:(L * TdivFT)
Base.unsafe_store!(
Base.unsafe_convert(Ptr{FT}, Base.pointer_from_objref(out)),
zero(FT),
i,
)
end
end
return out
end

@inline offset_index(
start_index::CartesianIndex{N},
::Val{D},
Expand Down