Skip to content

Commit

Permalink
Undo change to create_cache
Browse files Browse the repository at this point in the history
  • Loading branch information
sloede committed Nov 3, 2023
1 parent fb91bd9 commit 0b8cb3b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
16 changes: 8 additions & 8 deletions src/indicators_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

# this method is used when the indicator is constructed as for shock-capturing volume integrals
# empty cache is default
function Trixi.create_cache(::Type{<:IndicatorNeuralNetwork},
equations::AbstractEquations{1}, basis::LobattoLegendreBasis)
function create_cache(::Type{<:IndicatorNeuralNetwork},
equations::AbstractEquations{1}, basis::LobattoLegendreBasis)
return NamedTuple()
end

# cache for NeuralNetworkPerssonPeraire-type indicator
function Trixi.create_cache(::Type{IndicatorNeuralNetwork{NeuralNetworkPerssonPeraire}},
equations::AbstractEquations{1}, basis::LobattoLegendreBasis)
function create_cache(::Type{IndicatorNeuralNetwork{NeuralNetworkPerssonPeraire}},
equations::AbstractEquations{1}, basis::LobattoLegendreBasis)
alpha = Vector{real(basis)}()
alpha_tmp = similar(alpha)
A = Array{real(basis), ndims(equations)}
Expand All @@ -27,8 +27,8 @@ function Trixi.create_cache(::Type{IndicatorNeuralNetwork{NeuralNetworkPerssonPe
end

# cache for NeuralNetworkRayHesthaven-type indicator
function Trixi.create_cache(::Type{IndicatorNeuralNetwork{NeuralNetworkRayHesthaven}},
equations::AbstractEquations{1}, basis::LobattoLegendreBasis)
function create_cache(::Type{IndicatorNeuralNetwork{NeuralNetworkRayHesthaven}},
equations::AbstractEquations{1}, basis::LobattoLegendreBasis)
alpha = Vector{real(basis)}()
alpha_tmp = similar(alpha)
A = Array{real(basis), ndims(equations)}
Expand All @@ -41,8 +41,8 @@ function Trixi.create_cache(::Type{IndicatorNeuralNetwork{NeuralNetworkRayHestha
end

# this method is used when the indicator is constructed as for AMR
function Trixi.create_cache(typ::Type{<:IndicatorNeuralNetwork},
mesh, equations::AbstractEquations{1}, dg::DGSEM, cache)
function create_cache(typ::Type{<:IndicatorNeuralNetwork},
mesh, equations::AbstractEquations{1}, dg::DGSEM, cache)
create_cache(typ, equations, dg.basis)
end

Expand Down
20 changes: 10 additions & 10 deletions src/indicators_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

# this method is used when the indicator is constructed as for shock-capturing volume integrals
# empty cache is default
function Trixi.create_cache(::Type{IndicatorNeuralNetwork},
equations::AbstractEquations{2}, basis::LobattoLegendreBasis)
function create_cache(::Type{IndicatorNeuralNetwork},
equations::AbstractEquations{2}, basis::LobattoLegendreBasis)
return NamedTuple()
end

# cache for NeuralNetworkPerssonPeraire-type indicator
function Trixi.create_cache(::Type{IndicatorNeuralNetwork{NeuralNetworkPerssonPeraire}},
equations::AbstractEquations{2}, basis::LobattoLegendreBasis)
function create_cache(::Type{IndicatorNeuralNetwork{NeuralNetworkPerssonPeraire}},
equations::AbstractEquations{2}, basis::LobattoLegendreBasis)
alpha = Vector{real(basis)}()
alpha_tmp = similar(alpha)
A = Array{real(basis), ndims(equations)}
Expand All @@ -30,8 +30,8 @@ function Trixi.create_cache(::Type{IndicatorNeuralNetwork{NeuralNetworkPerssonPe
end

# cache for NeuralNetworkRayHesthaven-type indicator
function Trixi.create_cache(::Type{IndicatorNeuralNetwork{NeuralNetworkRayHesthaven}},
equations::AbstractEquations{2}, basis::LobattoLegendreBasis)
function create_cache(::Type{IndicatorNeuralNetwork{NeuralNetworkRayHesthaven}},
equations::AbstractEquations{2}, basis::LobattoLegendreBasis)
alpha = Vector{real(basis)}()
alpha_tmp = similar(alpha)
A = Array{real(basis), ndims(equations)}
Expand All @@ -50,8 +50,8 @@ function Trixi.create_cache(::Type{IndicatorNeuralNetwork{NeuralNetworkRayHestha
end

# cache for NeuralNetworkCNN-type indicator
function Trixi.create_cache(::Type{IndicatorNeuralNetwork{NeuralNetworkCNN}},
equations::AbstractEquations{2}, basis::LobattoLegendreBasis)
function create_cache(::Type{IndicatorNeuralNetwork{NeuralNetworkCNN}},
equations::AbstractEquations{2}, basis::LobattoLegendreBasis)
alpha = Vector{real(basis)}()
alpha_tmp = similar(alpha)
A = Array{real(basis), ndims(equations)}
Expand All @@ -69,8 +69,8 @@ function Trixi.create_cache(::Type{IndicatorNeuralNetwork{NeuralNetworkCNN}},
end

# this method is used when the indicator is constructed as for AMR
function Trixi.create_cache(typ::Type{<:IndicatorNeuralNetwork},
mesh, equations::AbstractEquations{2}, dg::DGSEM, cache)
function create_cache(typ::Type{<:IndicatorNeuralNetwork},
mesh, equations::AbstractEquations{2}, dg::DGSEM, cache)
create_cache(typ, equations, dg.basis)
end

Expand Down

0 comments on commit 0b8cb3b

Please sign in to comment.