@@ -11,7 +11,7 @@ that are affected by that motion.
11
11
12
12
# Arguments
13
13
- `action`: (`::AbstractAction{T<:Real}`) action, such as [`Translate`](@ref) or [`Rotate`](@ref)
14
- - `time`: (`::AbstractTimeSpan {T<:Real}`, `=TimeRange(0.0)`) time information about the motion
14
+ - `time`: (`::TimeCurve {T<:Real}`, `=TimeRange(0.0)`) time information about the motion
15
15
- `spins`: (`::AbstractSpinSpan`, `=AllSpins()`) spin indexes affected by the motion
16
16
17
17
# Returns
@@ -28,22 +28,22 @@ julia> motion = Motion(
28
28
"""
29
29
@with_kw mutable struct Motion{T<: Real }
30
30
action:: AbstractAction{T}
31
- time :: AbstractTimeSpan {T} = TimeRange (zero (typeof (action). parameters[1 ]))
32
- spins :: AbstractSpinSpan = AllSpins ()
31
+ time :: TimeCurve {T} = TimeRange (t_start = zero ( typeof (action) . parameters[ 1 ]), t_end = eps (typeof (action). parameters[1 ]))
32
+ spins :: AbstractSpinSpan = AllSpins ()
33
33
end
34
34
35
35
# Main constructors
36
36
function Motion (action)
37
37
T = first (typeof (action). parameters)
38
- return Motion (action, TimeRange (zero (T)), AllSpins ())
38
+ return Motion (action, TimeRange (t_start = zero (T), t_end = eps (T)), AllSpins ())
39
39
end
40
- function Motion (action, time:: AbstractTimeSpan )
40
+ function Motion (action, time:: TimeCurve )
41
41
T = first (typeof (action). parameters)
42
42
return Motion (action, time, AllSpins ())
43
43
end
44
44
function Motion (action, spins:: AbstractSpinSpan )
45
45
T = first (typeof (action). parameters)
46
- return Motion (action, TimeRange (zero (T)), spins)
46
+ return Motion (action, TimeRange (t_start = zero (T), t_end = eps (T)), spins)
47
47
end
48
48
49
49
# Custom constructors
54
54
- `dx`: (`::Real`, `[m]`) translation in x
55
55
- `dy`: (`::Real`, `[m]`) translation in y
56
56
- `dz`: (`::Real`, `[m]`) translation in z
57
- - `time`: (`::AbstractTimeSpan {T<:Real}`) time information about the motion
57
+ - `time`: (`::TimeCurve {T<:Real}`) time information about the motion
58
58
- `spins`: (`::AbstractSpinSpan`) spin indexes affected by the motion
59
59
60
60
# Returns
65
65
julia> translate = Translate(0.01, 0.02, 0.03, TimeRange(0.0, 1.0), SpinRange(1:10))
66
66
```
67
67
"""
68
- function Translate (dx, dy, dz, time= TimeRange (zero (eltype (dx))), spins= AllSpins ())
68
+ function Translate (dx, dy, dz, time= TimeRange (t_start = zero ( eltype (dx)), t_end = eps (eltype (dx))), spins= AllSpins ())
69
69
return Motion (Translate (dx, dy, dz), time, spins)
70
70
end
71
71
76
76
- `pitch`: (`::Real`, `[º]`) rotation in x
77
77
- `roll`: (`::Real`, `[º]`) rotation in y
78
78
- `yaw`: (`::Real`, `[º]`) rotation in z
79
- - `time`: (`::AbstractTimeSpan {T<:Real}`) time information about the motion
79
+ - `time`: (`::TimeCurve {T<:Real}`) time information about the motion
80
80
- `spins`: (`::AbstractSpinSpan`) spin indexes affected by the motion
81
81
82
82
# Returns
87
87
julia> rotate = Rotate(15.0, 0.0, 20.0, TimeRange(0.0, 1.0), SpinRange(1:10))
88
88
```
89
89
"""
90
- function Rotate (pitch, roll, yaw, time= TimeRange (zero (eltype (pitch))), spins= AllSpins ())
90
+ function Rotate (pitch, roll, yaw, time= TimeRange (t_start = zero ( eltype (pitch)), t_end = eps (eltype (pitch))), spins= AllSpins ())
91
91
return Motion (Rotate (pitch, roll, yaw), time, spins)
92
92
end
93
93
98
98
- `circumferential_strain`: (`::Real`) contraction parameter
99
99
- `radial_strain`: (`::Real`) contraction parameter
100
100
- `longitudinal_strain`: (`::Real`) contraction parameter
101
- - `time`: (`::AbstractTimeSpan {T<:Real}`) time information about the motion
101
+ - `time`: (`::TimeCurve {T<:Real}`) time information about the motion
102
102
- `spins`: (`::AbstractSpinSpan`) spin indexes affected by the motion
103
103
104
104
# Returns
109
109
julia> heartbeat = HeartBeat(-0.3, -0.2, 0.0, TimeRange(0.0, 1.0), SpinRange(1:10))
110
110
```
111
111
"""
112
- function HeartBeat (circumferential_strain, radial_strain, longitudinal_strain, time= TimeRange (zero (eltype (circumferential_strain))), spins= AllSpins ())
112
+ function HeartBeat (circumferential_strain, radial_strain, longitudinal_strain, time= TimeRange (t_start = zero ( eltype (circumferential_strain)), t_end = eps (eltype (circumferential_strain))), spins= AllSpins ())
113
113
return Motion (HeartBeat (circumferential_strain, radial_strain, longitudinal_strain), time, spins)
114
114
end
115
115
120
120
- `dx`: (`::AbstractArray{T<:Real}`, `[m]`) displacements in x
121
121
- `dy`: (`::AbstractArray{T<:Real}`, `[m]`) displacements in y
122
122
- `dz`: (`::AbstractArray{T<:Real}`, `[m]`) displacements in z
123
- - `time`: (`::AbstractTimeSpan {T<:Real}`) time information about the motion
123
+ - `time`: (`::TimeCurve {T<:Real}`) time information about the motion
124
124
- `spins`: (`::AbstractSpinSpan`) spin indexes affected by the motion
125
125
126
126
# Returns
@@ -137,7 +137,7 @@ julia> path = Path(
137
137
)
138
138
```
139
139
"""
140
- function Path (dx, dy, dz, time= TimeRange (zero (eltype (dx))), spins= AllSpins ())
140
+ function Path (dx, dy, dz, time= TimeRange (t_start = zero ( eltype (dx)), t_end = eps (eltype (dx))), spins= AllSpins ())
141
141
return Motion (Path (dx, dy, dz), time, spins)
142
142
end
143
143
149
149
- `dy`: (`::AbstractArray{T<:Real}`, `[m]`) displacements in y
150
150
- `dz`: (`::AbstractArray{T<:Real}`, `[m]`) displacements in z
151
151
- `spin_reset`: (`::AbstractArray{Bool}`) reset spin state flags
152
- - `time`: (`::AbstractTimeSpan {T<:Real}`) time information about the motion
152
+ - `time`: (`::TimeCurve {T<:Real}`) time information about the motion
153
153
- `spins`: (`::AbstractSpinSpan`) spin indexes affected by the motion
154
154
155
155
# Returns
@@ -167,7 +167,7 @@ julia> flowpath = FlowPath(
167
167
)
168
168
```
169
169
"""
170
- function FlowPath (dx, dy, dz, spin_reset, time= TimeRange (zero (eltype (dx))), spins= AllSpins ())
170
+ function FlowPath (dx, dy, dz, spin_reset, time= TimeRange (t_start = zero ( eltype (dx)), t_end = eps (eltype (dx))), spins= AllSpins ())
171
171
return Motion (FlowPath (dx, dy, dz, spin_reset), time, spins)
172
172
end
173
173
@@ -192,7 +192,7 @@ function get_spin_coords(
192
192
m:: Motion{T} , x:: AbstractVector{T} , y:: AbstractVector{T} , z:: AbstractVector{T} , t
193
193
) where {T<: Real }
194
194
ux, uy, uz = x .* (0 * t), y .* (0 * t), z .* (0 * t) # Buffers for displacements
195
- t_unit = unit_time (t, m. time)
195
+ t_unit = unit_time (t, m. time. t, m . time . t_unit, m . time . periodic, m . time . periods )
196
196
idx = get_indexing_range (m. spins)
197
197
displacement_x! (@view (ux[idx, :]), m. action, @view (x[idx]), @view (y[idx]), @view (z[idx]), t_unit)
198
198
displacement_y! (@view (uy[idx, :]), m. action, @view (x[idx]), @view (y[idx]), @view (z[idx]), t_unit)
@@ -201,7 +201,7 @@ function get_spin_coords(
201
201
end
202
202
203
203
# Auxiliary functions
204
- times (m:: Motion ) = times (m. time)
204
+ times (m:: Motion ) = times (m. time. t, m . time . periods )
205
205
is_composable (m:: Motion ) = is_composable (m. action)
206
206
add_jump_times! (t, m:: Motion ) = add_jump_times! (t, m. action, m. time)
207
- add_jump_times! (t, :: AbstractAction , :: AbstractTimeSpan ) = nothing
207
+ add_jump_times! (t, :: AbstractAction , :: TimeCurve ) = nothing
0 commit comments