From 7b4a34027d544032bba48f28e38fc8703ba8a12a Mon Sep 17 00:00:00 2001 From: Artur Gower Date: Thu, 30 Nov 2023 13:26:44 +0000 Subject: [PATCH] fix broadcast test error --- src/physics/physical_medium.jl | 3 --- src/result.jl | 2 +- test/end_to_end_tests.jl | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/physics/physical_medium.jl b/src/physics/physical_medium.jl index d60442c3..f97e3029 100644 --- a/src/physics/physical_medium.jl +++ b/src/physics/physical_medium.jl @@ -27,7 +27,6 @@ struct ScalarMedium{T,Dim} <: PhysicalMedium{Dim,1} c::Complex{T} # complex wavespeed end - """ A basis for regular functions, that is, smooth functions. A series expansion in this basis should converge to any regular function within a ball. """ @@ -63,7 +62,6 @@ basisorder_to_basislength(::Type{P}, order::Int) where P <: PhysicalMedium{2,1} basislength_to_basisorder(::Type{P},len::Int) where P <: PhysicalMedium{3,1} = Int(sqrt(len) - 1) basislength_to_basisorder(::Type{P},len::Int) where P <: PhysicalMedium{2,1} = Int((len - 1) / 2.0) - function outgoing_radial_basis(medium::PhysicalMedium{2,1}, ω::T, order::Integer, r::T) where {T<:Number} k = ω/medium.c return hankelh1.(-order:order,k*r) @@ -197,7 +195,6 @@ function regular_translation_matrix(medium::PhysicalMedium{3,1}, in_order::Integ end - """ estimate_regular_basis_order(medium::PhysicalMedium, ω::Number, radius::Number; tol = 1e-6) """ diff --git a/src/result.jl b/src/result.jl index af5934d0..f576d307 100644 --- a/src/result.jl +++ b/src/result.jl @@ -108,7 +108,7 @@ function +(s1::SimulationResult,s2::SimulationResult)::SimulationResult end function +(s::SimulationResult,a::Union{Complex{T},T})::SimulationResult where T <: Number - if length(s.field) > 1 + if length(s.field[1]) > 1 error("Can not add a number to a vector field") elseif typeof(s.field[1] .+ a) != typeof(s.field[1]) error("Summing SimulationResult with $a would cause SimulationResult.field to change its type.") diff --git a/test/end_to_end_tests.jl b/test/end_to_end_tests.jl index 1c9f3b43..0982ab26 100644 --- a/test/end_to_end_tests.jl +++ b/test/end_to_end_tests.jl @@ -17,7 +17,7 @@ result = run(sim, [1.0,2.0], 0.1) result = run(particles, source, [1.0,2.0], 0.1) - result = 3.2*result + result*4.0im + [0.3+4.0im] # changes result.field + result = 3.2*result + result*4.0im + 0.3+4.0im # changes result.field @test field(result)[1] == result.field[1][1] # returns @test field(result,1,1) == result.field[1][1] # returns