API Reference
IMASutils
IMASutils.argmin_abs — Functionargmin_abs(x::AbstractVector{<:Real}, x0::Real)Non-allocating version of argmin(abs.(x .- x0)).
Returns the index of the element in x closest to x0 in absolute difference.
Throws an error if x is empty.
argmin_abs(x::AbstractVector{<:Real}, x0::AbstractVector{<:Real})Non-allocating version of argmin(abs.(x .- x0)).
Returns the index of the element in x closest to x0 in absolute difference.
Throws an error if x is empty.
IMASutils.contour_cache — Functioncontour_cache(x_coords::AbstractVector{T}, y_coords::AbstractVector{T}; aggression_level::Int = 2) where {T<:Real}Create cache for contouring matrix of size nx times ny
aggression_level determines how large to make the cache:
- assume contour no bigger than an inscribed ellipse
- assume contour no bigger than the other boundary
- assume contour could go through every single cell once
IMASutils.contour_from_midplane — Functioncontour_from_midplane(values::Matrix{T}, x_coords::AbstractVector{T}, y_coords::AbstractVector{T}, level::T, xaxis::T, yaxis::T, vaxis::T) where {T<:Real}Find a contour of (xcoords, ycoords, values) at value=level that crosses y=yaxis at the smallest x > xaxis
This will correspond to a closed surface around the axis if it exists, otherwise it will give upto one of possibly multiple open surfaces
Returns vectors for xcontour and ycontour
IMASutils.contour_from_midplane! — Functioncontour_from_midplane!(
x_cache::Vector{T1},
y_cache::Vector{T1},
values::Matrix{T2},
x_coords::AbstractVector{T1},
y_coords::AbstractVector{T1},
level::T2,
xaxis::T1,
yaxis::T1,
vaxis::T2;
atol::T1=eps(T1),
rtol::T1=sqrt(eps(T1)),
dynamic_resize::Bool=true
) where {T1<:Real, T2<:Real}Find a contour of (xcoords, ycoords, values) at value=level that crosses y=yaxis at the smallest x > xaxis
This will correspond to a closed surface around the axis if it exists, otherwise it will give upto one of possibly multiple open surfaces
The contour is computed in-place using xcache and ycache, and returned as views of those caches to avoid allocations
atol and rtol are used for checking if the contour closes on itself in every cell
IMASutils.cumtrapz — Functioncumtrapz(x::AbstractVector{S}, y::AbstractVector{T}) where {S<:Real, T<:Real}Computes the cumulative integral of the values in y with respect to x using the trapezoidal rule.
cumtrapz(x::AbstractVector{S}, f::T) where {S<:Real, T<:Function}Computes the cumulative integral of f(k::Int, xx::S) for xx = x[k] with respect to x using the trapezoidal rule.
Missing docstring for cumtrapz!. Check Documenter's build log for details.
IMASutils.mirror_bound — Functionmirror_bound(x::Real, l::Real, u::Real)Return tuple with value of x bounded between l and u The bounding is done by mirroring the value at the bound limits.
IMASutils.trapz — Functiontrapz(x::AbstractVector{S}, y::AbstractVector{T}) where {S<:Real, T<:Real}Numerically integrates the values in y with respect to x using the trapezoidal rule.
trapz(x::AbstractVector{S}, f::T) where {S<:Real, T<:Function}Numerically integrates f(k::Int, xx::S) for xx = x[k] with respect to x using the trapezoidal rule.