Skip to content

Commit 98805bc

Browse files
formatting
1 parent be21068 commit 98805bc

File tree

16 files changed

+352
-351
lines changed

16 files changed

+352
-351
lines changed

src/Core/ad.jl

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,45 @@
1-
const TagAD1{T} = ForwardDiff.Tag{JSMDDiffTag, T}
2-
const DualAD1{T} = ForwardDiff.Dual{TagAD1{T}, T, 1}
1+
const TagAD1{T} = ForwardDiff.Tag{JSMDDiffTag,T}
2+
const DualAD1{T} = ForwardDiff.Dual{TagAD1{T},T,1}
33

44
# ------------------------------------------------------------------------------------------
55
# Points
66

7-
const FramePointFunSignature{O, T} = FunctionWrapper{Translation{O, T}, Tuple{T}}
8-
const FramePointFunWrapper{O, T} = FunctionWrappersWrapper{
7+
const FramePointFunSignature{O,T} = FunctionWrapper{Translation{O,T},Tuple{T}}
8+
const FramePointFunWrapper{O,T} = FunctionWrappersWrapper{
99
Tuple{
10-
FramePointFunSignature{O, T},
11-
FramePointFunSignature{O, DualAD1{T}}
12-
}, true
10+
FramePointFunSignature{O,T},
11+
FramePointFunSignature{O,DualAD1{T}}
12+
},true
1313
}
1414

15-
function FramePointFunWrapper{O, T}(fun::Function) where {O, T}
15+
function FramePointFunWrapper{O,T}(fun::Function) where {O,T}
1616
types = (T, DualAD1{T})
17-
inps = map(x->Tuple{x}, types)
18-
outs = map(x->Translation{O, x}, types)
19-
wrps = map(inps, outs) do A, R
20-
FunctionWrapper{R, A}(fun)
17+
inps = map(x -> Tuple{x}, types)
18+
outs = map(x -> Translation{O,x}, types)
19+
wrps = map(inps, outs) do A, R
20+
FunctionWrapper{R,A}(fun)
2121
end
22-
return FramePointFunWrapper{O, T}(wrps)
22+
return FramePointFunWrapper{O,T}(wrps)
2323
end
2424

2525

2626
# ------------------------------------------------------------------------------------------
2727
# Axes
2828

29-
const FrameAxesFunSignature{O, T} = FunctionWrapper{Rotation{O, T}, Tuple{T}}
30-
const FrameAxesFunWrapper{O, T} = FunctionWrappersWrapper{
29+
const FrameAxesFunSignature{O,T} = FunctionWrapper{Rotation{O,T},Tuple{T}}
30+
const FrameAxesFunWrapper{O,T} = FunctionWrappersWrapper{
3131
Tuple{
32-
FrameAxesFunSignature{O, T},
33-
FrameAxesFunSignature{O, DualAD1{T}}
34-
}, true
32+
FrameAxesFunSignature{O,T},
33+
FrameAxesFunSignature{O,DualAD1{T}}
34+
},true
3535
}
3636

37-
function FrameAxesFunWrapper{O, T}(fun::Function) where {O, T}
37+
function FrameAxesFunWrapper{O,T}(fun::Function) where {O,T}
3838
types = (T, DualAD1{T})
39-
inps = map(x->Tuple{x}, types)
40-
outs = map(x->Rotation{O, x}, types)
41-
wrps = map(inps, outs) do A, R
42-
FunctionWrapper{R, A}(fun)
39+
inps = map(x -> Tuple{x}, types)
40+
outs = map(x -> Rotation{O,x}, types)
41+
wrps = map(inps, outs) do A, R
42+
FunctionWrapper{R,A}(fun)
4343
end
44-
return FrameAxesFunWrapper{O, T}(wrps)
44+
return FrameAxesFunWrapper{O,T}(wrps)
4545
end

src/Core/axes.jl

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ Add a new axes node to `frames`.
1717
[`add_axes_fixedoffset!`](@ref) and [`add_axes_root!`](@ref).
1818
"""
1919
function add_axes!(
20-
frames::FrameSystem{O, N}, name::Symbol, id::Int,
21-
funs::FrameAxesFunctions{O, N} = FrameAxesFunctions{O, N}(),
20+
frames::FrameSystem{O,N}, name::Symbol, id::Int,
21+
funs::FrameAxesFunctions{O,N}=FrameAxesFunctions{O,N}(),
2222
parentid=nothing
23-
) where {O, N <: Number}
23+
) where {O,N<:Number}
2424

2525
if has_axes(frames, id)
2626
# Check if a set of axes with the same ID is already registered within
@@ -64,7 +64,7 @@ function add_axes!(
6464

6565

6666
# Create point
67-
node = FrameAxesNode{O, N}(name, id, parentid, funs)
67+
node = FrameAxesNode{O,N}(name, id, parentid, funs)
6868

6969
# Insert new point in the graph
7070
add_axes!(frames, node)
@@ -86,10 +86,10 @@ represented by `dcm`, a Direction Cosine Matrix (DCM).
8686
See also [`add_axes!`](@ref).
8787
"""
8888
function add_axes_fixedoffset!(
89-
frames::FrameSystem{O, N}, name::Symbol, id::Int, parent, dcm::DCM{N}
90-
) where {O, N}
89+
frames::FrameSystem{O,N}, name::Symbol, id::Int, parent, dcm::DCM{N}
90+
) where {O,N}
9191

92-
funs = FrameAxesFunctions{O, N}( t -> Rotation{O}(dcm) )
92+
funs = FrameAxesFunctions{O,N}(t -> Rotation{O}(dcm))
9393
add_axes!(frames, name, id, funs, axes_id(frames, parent))
9494
end
9595

@@ -107,9 +107,9 @@ despite the rotation depends on time).
107107
See also [`add_axes!`](@ref).
108108
"""
109109
function add_axes_projected!(
110-
frames::FrameSystem{O, N}, name::Symbol, id::Int, parent, fun::Function
111-
) where {O, N}
112-
funs = FrameAxesFunctions{O, N}( t -> Rotation{O}(fun(t)) )
110+
frames::FrameSystem{O,N}, name::Symbol, id::Int, parent, fun::Function
111+
) where {O,N}
112+
funs = FrameAxesFunctions{O,N}(t -> Rotation{O}(fun(t)))
113113
add_axes!(frames, name, id, funs, axes_id(frames, parent))
114114
end
115115

@@ -134,17 +134,17 @@ If `δfun`, `δ²fun` or `δ³fun` are not provided, they are computed via autom
134134
function does not perform any checks on the output types.
135135
"""
136136
function add_axes_rotating!(
137-
frames::FrameSystem{O, N}, name::Symbol, id::Int, parent, fun,
138-
δfun = nothing, δ²fun = nothing, δ³fun = nothing,
139-
) where {O, N}
137+
frames::FrameSystem{O,N}, name::Symbol, id::Int, parent, fun,
138+
δfun=nothing, δ²fun=nothing, δ³fun=nothing,
139+
) where {O,N}
140140

141141
for (order, fcn) in enumerate([δfun, δ²fun, δ³fun])
142142
if (O < order + 1 && !isnothing(fcn))
143143
@warn "ignoring $fcn, frame system order is less than $(order+1)"
144144
end
145145
end
146146

147-
funs = FrameAxesFunctions{O, N}(
147+
funs = FrameAxesFunctions{O,N}(
148148
t -> Rotation{O}(fun(t)),
149149

150150
# First derivative

src/Core/directions.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ Add a new direction node to `frames`.
1212
eventually, its time derivatives. It must match the type and order of `frames`.
1313
"""
1414
function add_direction!(
15-
frames::FrameSystem{O, N}, name::Symbol, axesid::Int, funs::DirectionFunctions{O, N}
16-
) where {O, N <: Number}
15+
frames::FrameSystem{O,N}, name::Symbol, axesid::Int, funs::DirectionFunctions{O,N}
16+
) where {O,N<:Number}
1717
if name in directions(frames)
1818
throw(
1919
ArgumentError(
@@ -22,7 +22,7 @@ function add_direction!(
2222
)
2323
end
2424

25-
dir = Direction{O, N}(name, length(directions(frames))+1, axesid, funs)
25+
dir = Direction{O,N}(name, length(directions(frames)) + 1, axesid, funs)
2626
push!(directions(frames), Pair(name, dir))
2727
nothing
2828
end
@@ -47,17 +47,17 @@ If `δfun`, `δ²fun` or `δ³fun` are not provided, they are computed via autom
4747
function does not perform any checks on the output types.
4848
"""
4949
function add_direction!(
50-
frames::FrameSystem{O, N}, name::Symbol, ax, fun::Function,
51-
δfun = nothing, δ²fun = nothing, δ³fun = nothing
52-
) where {O, N}
50+
frames::FrameSystem{O,N}, name::Symbol, ax, fun::Function,
51+
δfun=nothing, δ²fun=nothing, δ³fun=nothing
52+
) where {O,N}
5353

5454
for (order, fcn) in enumerate([δfun, δ²fun, δ³fun])
5555
if (O < order + 1 && !isnothing(fcn))
5656
@warn "ignoring $fcn, frame system order is less than $(order+1)"
5757
end
5858
end
5959

60-
funs = DirectionFunctions{O, N}(
60+
funs = DirectionFunctions{O,N}(
6161
t -> Translation{O}fun(t),
6262

6363
# First derivative

src/Core/graph.jl

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

2-
struct AliasGraph{G, A}
3-
graph::G
2+
struct AliasGraph{G,A}
3+
graph::G
44
alias::A
55
end
66

@@ -25,23 +25,23 @@ The following transformation orders are accepted:
2525
Create a new, empty `FrameSystem` object of order `O`, datatype `T` and timescale `S`.
2626
The parameter `S` can be dropped, in case the default (`BarycentricDynamicalTime`) is used.
2727
"""
28-
struct FrameSystem{O, T<:Number, S<:AbstractTimeScale}
29-
points::AliasGraph{PointsGraph{O, T}, Dict{Symbol, Int}}
30-
axes::AliasGraph{AxesGraph{O, T}, Dict{Symbol, Int}}
31-
dir::Dict{Symbol, Direction{O, T}}
28+
struct FrameSystem{O,T<:Number,S<:AbstractTimeScale}
29+
points::AliasGraph{PointsGraph{O,T},Dict{Symbol,Int}}
30+
axes::AliasGraph{AxesGraph{O,T},Dict{Symbol,Int}}
31+
dir::Dict{Symbol,Direction{O,T}}
3232
end
3333

34-
function FrameSystem{O, T, S}() where {O, T, S}
35-
return FrameSystem{O, T, S}(
36-
AliasGraph(MappedGraph(FramePointNode{O, T}), Dict{Symbol, Int}()),
37-
AliasGraph(MappedGraph(FrameAxesNode{O, T}), Dict{Symbol, Int}()),
34+
function FrameSystem{O,T,S}() where {O,T,S}
35+
return FrameSystem{O,T,S}(
36+
AliasGraph(MappedGraph(FramePointNode{O,T}), Dict{Symbol,Int}()),
37+
AliasGraph(MappedGraph(FrameAxesNode{O,T}), Dict{Symbol,Int}()),
3838
Dict()
3939
)
4040
end
4141

42-
@inline FrameSystem{O, T}() where {O, T} = FrameSystem{O, T, BarycentricDynamicalTime}()
42+
@inline FrameSystem{O,T}() where {O,T} = FrameSystem{O,T,BarycentricDynamicalTime}()
4343

44-
function Base.summary(io::IO, ::FrameSystem{O, T, S}) where {O, T, S}
44+
function Base.summary(io::IO, ::FrameSystem{O,T,S}) where {O,T,S}
4545
return println(io, "FrameSystem{$O, $T, $S}")
4646
end
4747

@@ -50,14 +50,14 @@ end
5050
5151
Return the frame system order `O`.
5252
"""
53-
@inline order(::FrameSystem{O}) where O = O
53+
@inline order(::FrameSystem{O}) where {O} = O
5454

5555
"""
5656
timescale(frames::FrameSystem{O, T, S}) where {O, T, S}
5757
5858
Return the frame system order timescale `S`.
5959
"""
60-
@inline timescale(::FrameSystem{O, T, S}) where {O, T, S} = S
60+
@inline timescale(::FrameSystem{O,T,S}) where {O,T,S} = S
6161

6262
"""
6363
points_graph(frames::FrameSystem)
@@ -99,7 +99,7 @@ Return the direction dictionary.
9999
100100
Get the `id` associate to a point.
101101
"""
102-
@inline point_id(::FrameSystem, id::Int) = id
102+
@inline point_id(::FrameSystem, id::Int) = id
103103
@inline point_id(f::FrameSystem, name::Symbol) = points_alias(f)[name]
104104

105105
"""
@@ -115,7 +115,7 @@ Get the `id` associate to an axes.
115115
116116
Add point to the frame system.
117117
"""
118-
function add_point!(fs::FrameSystem{O, T}, p::FramePointNode{O, T}) where {O,T}
118+
function add_point!(fs::FrameSystem{O,T}, p::FramePointNode{O,T}) where {O,T}
119119
push!(fs.points.alias, Pair(p.name, p.id))
120120
return add_vertex!(fs.points.graph, p)
121121
end
@@ -125,7 +125,7 @@ end
125125
126126
Add axes to the frame system.
127127
"""
128-
function add_axes!(fs::FrameSystem{O, T}, ax::FrameAxesNode{O, T}) where {O,T}
128+
function add_axes!(fs::FrameSystem{O,T}, ax::FrameAxesNode{O,T}) where {O,T}
129129
push!(fs.axes.alias, Pair(ax.name, ax.id))
130130
return add_vertex!(fs.axes.graph, ax)
131131
end
@@ -162,7 +162,7 @@ function _fmt_node(n::FrameAxesNode)
162162
return " $(n.name)(id=$(n.id))"
163163
end
164164

165-
function prettyprint(g::Union{AxesGraph, PointsGraph})
165+
function prettyprint(g::Union{AxesGraph,PointsGraph})
166166
if !isempty(g.nodes)
167167
println(_fmt_node(g.nodes[1]))
168168
_print_frame_graph(g, get_node_id(g.nodes[1]), 2, " ", "")
@@ -180,11 +180,12 @@ function _print_frame_graph(g, pid::Int, idx::Int, last::String, prefix::String)
180180
end
181181
end
182182

183-
function Base.show(io::IO, g::FrameSystem{O, T, S}) where {O, T, S}
183+
function Base.show(io::IO, g::FrameSystem{O,T,S}) where {O,T,S}
184184
println(
185-
io,
186-
"FrameSystem{$O, $T, $S} with $(length(points_graph(g).nodes))"
187-
* " points, $(length(axes_graph(g).nodes)) axes and $(length(g.dir)) directions"
185+
io,
186+
"FrameSystem{$O, $T, $S} with $(length(points_graph(g).nodes))"
187+
*
188+
" points, $(length(axes_graph(g).nodes)) axes and $(length(g.dir)) directions"
188189
)
189190
if !isempty(points_graph(g).nodes)
190191
printstyled(io, "\nPoints: \n"; bold=true)

0 commit comments

Comments
 (0)