Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
matrix:
version:
- '1'
- 'nightly'
- 'pre'
os:
- ubuntu-latest
- macOS-latest
Expand All @@ -30,7 +30,7 @@ jobs:
- "2"
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.julia-arch }}
Expand All @@ -55,7 +55,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
- uses: julia-actions/setup-julia@v2
with:
version: '1'
- run: |
Expand Down
5 changes: 3 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "LaserTypes"
uuid = "e07c0bfa-524c-4f35-a151-c3dd916fa2f0"
authors = ["Sebastian Micluța-Câmpeanu <m.c.sebastian95@gmail.com>", "Petru-Vlad Toma <tomapv@gmail.com>"]
version = "0.1.9"
version = "0.2.0"

[deps]
AutoHashEquals = "15f4f7f2-30c1-5605-9d31-71845cf9641f"
Expand Down Expand Up @@ -31,8 +31,9 @@ julia = "1"

[extras]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test", "SafeTestsets", "CSV"]
test = ["Test", "SafeTestsets", "CSV", "JET"]
6 changes: 2 additions & 4 deletions src/electricfield.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# # Electric Field

E(r, t, laser, symbol::Symbol) = E(r, t, laser, Val(symbol))

function E(r, t, laser, v::Val{T}) where T
@error "Got unsupported field type :$T\n Valid arguments are :real and :complex."
end
Expand All @@ -20,8 +18,8 @@ function E(r, t, laser, ::Val{:complex})
return inv_rotate(R, ElectricField)
end

E(r, t, laser) = E(r, t, laser, :real)
E(r, t, laser, ::Val{:real}) = real(E(r, t, laser, :complex))
E(r, t, laser) = E(r, t, laser, Val(:real))
E(r, t, laser, ::Val{:real}) = real(E(r, t, laser, Val(:complex)))

function E(x::SVector{4}, laser::AbstractLaser)
inv_c = immutable_cache(laser, :inv_c)
Expand Down
6 changes: 2 additions & 4 deletions src/faraday.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# # 4-Potential

EB(r, t, laser, symbol::Symbol) = EB(r, t, laser, Val(symbol))

function EB(r, t, laser, v::Val{T}) where T
@error "Got unsupported field type :$T\n Valid arguments are :real and :complex."
end
Expand All @@ -20,8 +18,8 @@ function EB(r, t, laser, ::Val{:complex})
return inv_rotate.((R,), E_B)
end

EB(r, t, laser) = EB(r, t, laser, :real)
EB(r, t, laser, ::Val{:real}) = real.(EB(r, t, laser, :complex))
EB(r, t, laser) = EB(r, t, laser, Val(:real))
EB(r, t, laser, ::Val{:real}) = real.(EB(r, t, laser, Val(:complex)))

function EB(r, laser)
@assert length(r) == 3 "The laser is only defined in 3D"
Expand Down
6 changes: 2 additions & 4 deletions src/magneticfield.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# # Magnetic Field

B(r, t, laser, symbol::Symbol) = B(r, t, laser, Val(symbol))

function B(r, t, laser, v::Val{T}) where T
@error "Got unsupported field type :$T\n Valid arguments are :real and :complex."
end
Expand All @@ -20,8 +18,8 @@ function B(r, t, laser, ::Val{:complex})
return inv_rotate(R, MagneticField)
end

B(r, t, laser) = B(r, t, laser, :real)
B(r, t, laser, ::Val{:real}) = real(B(r, t, laser, :complex))
B(r, t, laser) = B(r, t, laser, Val(:real))
B(r, t, laser, ::Val{:real}) = real(B(r, t, laser, Val(:complex)))

function B(x::SVector{4}, laser::AbstractLaser)
inv_c = immutable_cache(laser, :inv_c)
Expand Down
40 changes: 40 additions & 0 deletions test/qa.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using LaserTypes, Test
using JET

@testset "JET type stability tests" begin
@testset "$laser" for laser in [GaussLaser, LaguerreGaussLaser]
# Setup laser with atomic units (simplest for testing)
if laser == GaussLaser
lt_laser = setup_laser(GaussLaser, :atomic, profile=ConstantProfile())
else
lt_laser = setup_laser(LaguerreGaussLaser, :atomic, profile=ConstantProfile(), p=1, m=1)
end

r = [0.0, 0.0, 0.0]
t = 0.0

@testset "E field - Val(:real)" begin
@test_opt LaserTypes.E(r, t, lt_laser, Val(:real))
end

@testset "E field - Val(:complex)" begin
@test_opt LaserTypes.E(r, t, lt_laser, Val(:complex))
end

@testset "B field - Val(:real)" begin
@test_opt LaserTypes.B(r, t, lt_laser, Val(:real))
end

@testset "B field - Val(:complex)" begin
@test_opt LaserTypes.B(r, t, lt_laser, Val(:complex))
end

@testset "EB field - Val(:real)" begin
@test_opt LaserTypes.EB(r, t, lt_laser, Val(:real))
end

@testset "EB field - Val(:complex)" begin
@test_opt LaserTypes.EB(r, t, lt_laser, Val(:complex))
end
end
end
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ using Test, SafeTestsets
@safetestset "Fμν" begin include("faraday.jl") end
@safetestset "Derived" begin include("derived.jl") end
@safetestset "Show" begin include("show.jl") end
@safetestset "QA" begin include("qa.jl") end
end
Loading