Skip to content
Snippets Groups Projects
Verified Commit 16bab2fe authored by Michiel Cottaar's avatar Michiel Cottaar
Browse files

Make instant gradient adjustable

parent bf03ceeb
No related branches found
No related tags found
No related merge requests found
module InstantGradients module InstantGradients
import StaticArrays: SVector, SMatrix import StaticArrays: SVector, SMatrix
import JuMP: @constraint import JuMP: @constraint
import ...Variables: VariableType, duration, qval, bmat_gradient, get_free_variable, set_simple_constraints!, effective_time, make_generic, adjust_internal import ...Variables: VariableType, duration, qval, bmat_gradient, get_free_variable, set_simple_constraints!, effective_time, make_generic, adjust_internal, adjustable
import ...BuildSequences: global_model import ...BuildSequences: global_model
import ..AbstractTypes: EventComponent, GradientWaveform import ..AbstractTypes: EventComponent, GradientWaveform
...@@ -70,6 +70,8 @@ bmat_gradient(::InstantGradient, qstart=nothing) = zero(SMatrix{3, 3, Float64, 3 ...@@ -70,6 +70,8 @@ bmat_gradient(::InstantGradient, qstart=nothing) = zero(SMatrix{3, 3, Float64, 3
make_generic(ig::InstantGradient) = ig make_generic(ig::InstantGradient) = ig
adjustable(::InstantGradient) = :gradient
function adjust_internal(ig::InstantGradient1D; orientation=nothing, scale=1., rotation=nothing) function adjust_internal(ig::InstantGradient1D; orientation=nothing, scale=1., rotation=nothing)
if !isnothing(orientation) && !isnothing(rotation) if !isnothing(orientation) && !isnothing(rotation)
error("Cannot set both the gradient orientation and rotation.") error("Cannot set both the gradient orientation and rotation.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment