changeset 1666:5938f713e0d6

Merge bugfix/warnings
author Jonatan Werpers <jonatan@werpers.com>
date Sat, 29 Jun 2024 17:04:54 +0200
parents e551fe1fff14 (current diff) 7254700c13a7 (diff)
children cea116c7d019 bcc2be934326
files
diffstat 4 files changed, 10 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/src/RegionIndices/RegionIndices.jl	Wed Jun 26 10:20:32 2024 +0200
+++ b/src/RegionIndices/RegionIndices.jl	Sat Jun 29 17:04:54 2024 +0200
@@ -13,7 +13,7 @@
     Index{R,T}(i::T) where {R<:Region,T<:Integer} = new{R,T}(i)
     Index{R}(i::T) where {R<:Region,T<:Integer} = new{R,T}(i)
     Index(i::T, ::Type{R}) where {R<:Region,T<:Integer} = Index{R,T}(i)
-    Index(t::Tuple{T, DataType}) where {R<:Region,T<:Integer} = Index{t[2],T}(t[1]) # TBD: This is not very specific in what types are allowed in t[2]. Can this be fixed?
+    Index(t::Tuple{T, DataType}) where T<:Integer = Index{t[2],T}(t[1]) # TBD: This is not very specific in what types are allowed in t[2]. Can this be fixed?
 end
 
 export Index
--- a/test/LazyTensors/lazy_tensor_operations_test.jl	Wed Jun 26 10:20:32 2024 +0200
+++ b/test/LazyTensors/lazy_tensor_operations_test.jl	Sat Jun 29 17:04:54 2024 +0200
@@ -4,13 +4,13 @@
 
 using Tullio
 
-struct DummyMapping{T,R,D} <: LazyTensor{T,R,D} end
+struct TransposableDummyMapping{T,R,D} <: LazyTensor{T,R,D} end
 
-LazyTensors.apply(m::DummyMapping{T,R}, v, I::Vararg{Any,R}) where {T,R} = :apply
-LazyTensors.apply_transpose(m::DummyMapping{T,R,D}, v, I::Vararg{Any,D}) where {T,R,D} = :apply_transpose
+LazyTensors.apply(m::TransposableDummyMapping{T,R}, v, I::Vararg{Any,R}) where {T,R} = :apply
+LazyTensors.apply_transpose(m::TransposableDummyMapping{T,R,D}, v, I::Vararg{Any,D}) where {T,R,D} = :apply_transpose
 
-LazyTensors.range_size(m::DummyMapping) = :range_size
-LazyTensors.domain_size(m::DummyMapping) = :domain_size
+LazyTensors.range_size(m::TransposableDummyMapping) = :range_size
+LazyTensors.domain_size(m::TransposableDummyMapping) = :domain_size
 
 
 struct SizeDoublingMapping{T,R,D} <: LazyTensor{T,R,D}
@@ -24,7 +24,7 @@
 
 
 @testset "Mapping transpose" begin
-    m = DummyMapping{Float64,2,3}()
+    m = TransposableDummyMapping{Float64,2,3}()
     @test m' isa LazyTensor{Float64, 3,2}
     @test m'' == m
     @test apply(m',zeros(Float64,(0,0)), 0, 0, 0) == :apply_transpose
--- a/test/SbpOperators/volumeops/derivatives/dissipation_test.jl	Wed Jun 26 10:20:32 2024 +0200
+++ b/test/SbpOperators/volumeops/derivatives/dissipation_test.jl	Sat Jun 29 17:04:54 2024 +0200
@@ -13,20 +13,9 @@
 using Sbplib.SbpOperators: dissipation_lower_closure_stencils,dissipation_upper_closure_stencils
 using Sbplib.SbpOperators: dissipation_transpose_lower_closure_stencils, dissipation_transpose_upper_closure_stencils
 
-"""
-    monomial(x,k)
-
-Evaluates ``x^k/k!` with the convetion that it is ``0`` for all ``k<0``.
-Has the property that ``d/dx monomial(x,k) = monomial(x,k-1)``
-"""
-function monomial(x,k)
-    if k < 0
-        return zero(x)
-    end
-    x^k/factorial(k)
-end
 
 @testset "undivided_skewed04" begin
+    monomial(x,k) = k < 0 ? zero(x) : x^k/factorial(k)
     g = equidistant_grid(0., 11., 20)
     D,Dᵀ = undivided_skewed04(g, 1)
 
--- a/test/SbpOperators/volumeops/derivatives/first_derivative_test.jl	Wed Jun 26 10:20:32 2024 +0200
+++ b/test/SbpOperators/volumeops/derivatives/first_derivative_test.jl	Sat Jun 29 17:04:54 2024 +0200
@@ -7,19 +7,6 @@
 
 using Sbplib.SbpOperators: closure_size, Stencil, VolumeOperator
 
-"""
-    monomial(x,k)
-
-Evaluates ``x^k/k!` with the convetion that it is ``0`` for all ``k<0``.
-Has the property that ``d/dx monomial(x,k) = monomial(x,k-1)``
-"""
-function monomial(x,k)
-    if k < 0
-        return zero(x)
-    end
-    x^k/factorial(k)
-end
-
 @testset "first_derivative" begin
     @testset "Constructors" begin
         stencil_set = read_stencil_set(sbp_operators_path()*"standard_diagonal.toml"; order=2)
@@ -39,6 +26,8 @@
     @testset "Accuracy conditions" begin
         N = 20
         g = equidistant_grid(0//1, 2//1, N)
+
+        monomial(x,k) = k < 0 ? zero(x) : x^k/factorial(k)
         @testset for order ∈ [2,4]
             stencil_set = read_stencil_set(sbp_operators_path()*"standard_diagonal.toml"; order)
             D₁ = first_derivative(g, stencil_set)