Skip to content

Commit

Permalink
fix broadcast test error
Browse files Browse the repository at this point in the history
  • Loading branch information
arturgower committed Nov 30, 2023
1 parent 8c5b811 commit 7b4a340
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
3 changes: 0 additions & 3 deletions src/physics/physical_medium.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
"""
Expand Down
2 changes: 1 addition & 1 deletion src/result.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
2 changes: 1 addition & 1 deletion test/end_to_end_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7b4a340

Please sign in to comment.