Skip to content

Commit 6cba01f

Browse files
Complex Fields (#49)
* Added Complex Field Functionality. * Update Version Number * Update ci.yml * Apply code review suggestions. * Fixed documation - Final * Update .gitignore --------- Co-authored-by: Sebastian Micluța-Câmpeanu <31181429+SebastianM-C@users.noreply.github.com>
1 parent bf2a610 commit 6cba01f

11 files changed

Lines changed: 55 additions & 22 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
version:
20-
- '1.6'
20+
- '1'
2121
- 'nightly'
2222
os:
2323
- ubuntu-latest
@@ -34,7 +34,7 @@ jobs:
3434
with:
3535
version: ${{ matrix.version }}
3636
arch: ${{ matrix.julia-arch }}
37-
- uses: actions/cache@v1
37+
- uses: actions/cache@v4
3838
env:
3939
cache-name: cache-artifacts
4040
with:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.DS_Store
22
/Manifest.toml
33
/dev/
4+
.vscode

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "LaserTypes"
22
uuid = "e07c0bfa-524c-4f35-a151-c3dd916fa2f0"
33
authors = ["Sebastian Micluța-Câmpeanu <m.c.sebastian95@gmail.com>", "Petru-Vlad Toma <tomapv@gmail.com>"]
4-
version = "0.1.8"
4+
version = "0.1.9"
55

66
[deps]
77
AutoHashEquals = "15f4f7f2-30c1-5605-9d31-71845cf9641f"
@@ -17,7 +17,7 @@ Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
1717
UnitfulAtomic = "a7773ee8-282e-5fa2-be4e-bd808c38a91a"
1818

1919
[compat]
20-
AutoHashEquals = "0.2"
20+
AutoHashEquals = "2.2"
2121
CoordinateTransformations = "0.6"
2222
HypergeometricFunctions = "0.2, 0.3"
2323
ParallelProcessingTools = "0.4"

docs/make.jl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,17 @@ makedocs(
1717
"temporal-profiles.md"
1818
],
1919
"covariant.md",
20+
"derived.md",
2021
"advanced.md"
2122
],
22-
modules = [LaserTypes]
23+
modules = [LaserTypes],
24+
checkdocs = :exports
2325
)
2426

2527
# Documenter can also automatically deploy documentation to gh-pages.
2628
# See "Hosting Documentation" and deploydocs() in the Documenter manual
2729
# for more information.
28-
deploydocs(
29-
repo = "github.com/SebastianM-C/LaserTypes.jl",
30-
push_preview = true
31-
)
30+
# deploydocs(
31+
# repo = "github.com/SebastianM-C/LaserTypes.jl",
32+
# push_preview = true
33+
# )

docs/src/advanced.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ Order = [:type]
1515
Modules = [LaserTypes]
1616
Pages = ["src/coords.jl"]
1717
Order = [:type]
18-
```
18+
```

docs/src/derived.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Derived Properties
2+
3+
```@autodocs
4+
Modules = [LaserTypes]
5+
Pages = ["src/derived.jl"]
6+
```

src/LaserTypes.jl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module LaserTypes
44

5-
export E, B,
5+
export E, B, EB,
66
GaussLaser, LaguerreGaussLaser,
77
ConstantProfile, GaussProfile, Cos²Profile, QuasiRectangularProfile,
88
setup_laser, Fμν, S
@@ -11,16 +11,13 @@ using Unitful
1111
using UnitfulAtomic
1212
using UnPack
1313
using LinearAlgebra
14-
using HypergeometricFunctions
1514
using StaticArrays
1615
using CoordinateTransformations
1716
using AutoHashEquals
1817
using ParallelProcessingTools
18+
using HypergeometricFunctions: _₁F₁, pochhammer
1919
import PhysicalConstants.CODATA2018: c_0, e, m_e, ε_0, μ_0
2020

21-
const _₁F₁ = HypergeometricFunctions.drummond1F1
22-
const pochhammer = HypergeometricFunctions.pochhammer
23-
2421
abstract type AbstractLaser end
2522
abstract type AbstractTemporalProfile end
2623

src/electricfield.jl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# # Electric Field
22

3-
function E(r, t, laser)
3+
E(r, t, laser, symbol::Symbol) = E(r, t, laser, Val(symbol))
4+
5+
function E(r, t, laser, v::Val{T}) where T
6+
@error "Got unsupported field type :$T\n Valid arguments are :real and :complex."
7+
end
8+
9+
function E(r, t, laser, ::Val{:complex})
410
R = geometry(laser).rotation_matrix
511
r′ = rotate_coords(R, r)
612
inv_c = immutable_cache(laser, :inv_c)
@@ -9,11 +15,14 @@ function E(r, t, laser)
915
r′ = uconvert.(unit(λ), r′)
1016
end
1117

12-
ElectricField = real(E(r′, laser) * g(r′[3], t, laser; inv_c))
18+
ElectricField = E(r′, laser) * g(r′[3], t, laser; inv_c)
1319

1420
return inv_rotate(R, ElectricField)
1521
end
1622

23+
E(r, t, laser) = E(r, t, laser, :real)
24+
E(r, t, laser, ::Val{:real}) = real(E(r, t, laser, :complex))
25+
1726
function E(x::SVector{4}, laser::AbstractLaser)
1827
inv_c = immutable_cache(laser, :inv_c)
1928
r = x[SVector{3}(2,3,4)]

src/faraday.jl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# # 4-Potential
22

3-
function EB(r, t, laser)
3+
EB(r, t, laser, symbol::Symbol) = EB(r, t, laser, Val(symbol))
4+
5+
function EB(r, t, laser, v::Val{T}) where T
6+
@error "Got unsupported field type :$T\n Valid arguments are :real and :complex."
7+
end
8+
9+
function EB(r, t, laser, ::Val{:complex})
410
R = geometry(laser).rotation_matrix
511
r′ = rotate_coords(R, r)
612
inv_c = immutable_cache(laser, :inv_c)
@@ -9,11 +15,14 @@ function EB(r, t, laser)
915
r′ = uconvert.(unit(λ), r′)
1016
end
1117

12-
E_B = real.(EB(r′, laser) .* g(r′[end], t, laser; inv_c))
18+
E_B = EB(r′, laser) .* g(r′[end], t, laser; inv_c)
1319

1420
return inv_rotate.((R,), E_B)
1521
end
1622

23+
EB(r, t, laser) = EB(r, t, laser, :real)
24+
EB(r, t, laser, ::Val{:real}) = real.(EB(r, t, laser, :complex))
25+
1726
function EB(r, laser)
1827
@assert length(r) == 3 "The laser is only defined in 3D"
1928
fill!(mutable_cache(laser), r)

src/laguerre-gauss.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ function LaguerreGaussLaser(units;
200200
)
201201
end
202202

203-
"""
203+
@doc """
204204
convert_laser(::Type{GaussLaser}, laser::LaguerreGaussLaser)
205205
206206
Convert a `LaguerreGaussLaser` to a `GaussLaser` with similar parameters.

0 commit comments

Comments
 (0)