From fb91bd98193de63b8e19efe93853d87bdc848545 Mon Sep 17 00:00:00 2001 From: Michael Schlottke-Lakemper Date: Fri, 3 Nov 2023 14:49:55 +0100 Subject: [PATCH] Properly extend methods --- src/TrixiSmartShockFinder.jl | 2 +- src/indicators_1d.jl | 16 ++++++++-------- src/indicators_2d.jl | 20 ++++++++++---------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/TrixiSmartShockFinder.jl b/src/TrixiSmartShockFinder.jl index 90b27f6..4eee20c 100644 --- a/src/TrixiSmartShockFinder.jl +++ b/src/TrixiSmartShockFinder.jl @@ -3,7 +3,7 @@ module TrixiSmartShockFinder using MuladdMacro: @muladd using Trixi using Trixi: AbstractIndicator, AbstractEquations, AbstractSemidiscretization, @threaded, - trixi_include + summary_box, trixi_include include("indicators.jl") include("indicators_1d.jl") diff --git a/src/indicators_1d.jl b/src/indicators_1d.jl index ee9ff54..e333b0c 100644 --- a/src/indicators_1d.jl +++ b/src/indicators_1d.jl @@ -7,14 +7,14 @@ # this method is used when the indicator is constructed as for shock-capturing volume integrals # empty cache is default -function create_cache(::Type{<:IndicatorNeuralNetwork}, - equations::AbstractEquations{1}, basis::LobattoLegendreBasis) +function Trixi.create_cache(::Type{<:IndicatorNeuralNetwork}, + equations::AbstractEquations{1}, basis::LobattoLegendreBasis) return NamedTuple() end # cache for NeuralNetworkPerssonPeraire-type indicator -function create_cache(::Type{IndicatorNeuralNetwork{NeuralNetworkPerssonPeraire}}, - equations::AbstractEquations{1}, basis::LobattoLegendreBasis) +function Trixi.create_cache(::Type{IndicatorNeuralNetwork{NeuralNetworkPerssonPeraire}}, + equations::AbstractEquations{1}, basis::LobattoLegendreBasis) alpha = Vector{real(basis)}() alpha_tmp = similar(alpha) A = Array{real(basis), ndims(equations)} @@ -27,8 +27,8 @@ function create_cache(::Type{IndicatorNeuralNetwork{NeuralNetworkPerssonPeraire} end # cache for NeuralNetworkRayHesthaven-type indicator -function create_cache(::Type{IndicatorNeuralNetwork{NeuralNetworkRayHesthaven}}, - equations::AbstractEquations{1}, basis::LobattoLegendreBasis) +function Trixi.create_cache(::Type{IndicatorNeuralNetwork{NeuralNetworkRayHesthaven}}, + equations::AbstractEquations{1}, basis::LobattoLegendreBasis) alpha = Vector{real(basis)}() alpha_tmp = similar(alpha) A = Array{real(basis), ndims(equations)} @@ -41,8 +41,8 @@ function create_cache(::Type{IndicatorNeuralNetwork{NeuralNetworkRayHesthaven}}, end # this method is used when the indicator is constructed as for AMR -function create_cache(typ::Type{<:IndicatorNeuralNetwork}, - mesh, equations::AbstractEquations{1}, dg::DGSEM, cache) +function Trixi.create_cache(typ::Type{<:IndicatorNeuralNetwork}, + mesh, equations::AbstractEquations{1}, dg::DGSEM, cache) create_cache(typ, equations, dg.basis) end diff --git a/src/indicators_2d.jl b/src/indicators_2d.jl index 42e2ad7..9ed38b3 100644 --- a/src/indicators_2d.jl +++ b/src/indicators_2d.jl @@ -7,14 +7,14 @@ # this method is used when the indicator is constructed as for shock-capturing volume integrals # empty cache is default -function create_cache(::Type{IndicatorNeuralNetwork}, - equations::AbstractEquations{2}, basis::LobattoLegendreBasis) +function Trixi.create_cache(::Type{IndicatorNeuralNetwork}, + equations::AbstractEquations{2}, basis::LobattoLegendreBasis) return NamedTuple() end # cache for NeuralNetworkPerssonPeraire-type indicator -function create_cache(::Type{IndicatorNeuralNetwork{NeuralNetworkPerssonPeraire}}, - equations::AbstractEquations{2}, basis::LobattoLegendreBasis) +function Trixi.create_cache(::Type{IndicatorNeuralNetwork{NeuralNetworkPerssonPeraire}}, + equations::AbstractEquations{2}, basis::LobattoLegendreBasis) alpha = Vector{real(basis)}() alpha_tmp = similar(alpha) A = Array{real(basis), ndims(equations)} @@ -30,8 +30,8 @@ function create_cache(::Type{IndicatorNeuralNetwork{NeuralNetworkPerssonPeraire} end # cache for NeuralNetworkRayHesthaven-type indicator -function create_cache(::Type{IndicatorNeuralNetwork{NeuralNetworkRayHesthaven}}, - equations::AbstractEquations{2}, basis::LobattoLegendreBasis) +function Trixi.create_cache(::Type{IndicatorNeuralNetwork{NeuralNetworkRayHesthaven}}, + equations::AbstractEquations{2}, basis::LobattoLegendreBasis) alpha = Vector{real(basis)}() alpha_tmp = similar(alpha) A = Array{real(basis), ndims(equations)} @@ -50,8 +50,8 @@ function create_cache(::Type{IndicatorNeuralNetwork{NeuralNetworkRayHesthaven}}, end # cache for NeuralNetworkCNN-type indicator -function create_cache(::Type{IndicatorNeuralNetwork{NeuralNetworkCNN}}, - equations::AbstractEquations{2}, basis::LobattoLegendreBasis) +function Trixi.create_cache(::Type{IndicatorNeuralNetwork{NeuralNetworkCNN}}, + equations::AbstractEquations{2}, basis::LobattoLegendreBasis) alpha = Vector{real(basis)}() alpha_tmp = similar(alpha) A = Array{real(basis), ndims(equations)} @@ -69,8 +69,8 @@ function create_cache(::Type{IndicatorNeuralNetwork{NeuralNetworkCNN}}, end # this method is used when the indicator is constructed as for AMR -function create_cache(typ::Type{<:IndicatorNeuralNetwork}, - mesh, equations::AbstractEquations{2}, dg::DGSEM, cache) +function Trixi.create_cache(typ::Type{<:IndicatorNeuralNetwork}, + mesh, equations::AbstractEquations{2}, dg::DGSEM, cache) create_cache(typ, equations, dg.basis) end