API Reference

IMASutils

IMASutils.argmin_absFunction
argmin_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.

source
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.

source
IMASutils.contour_cacheFunction
contour_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:

  1. assume contour no bigger than an inscribed ellipse
  2. assume contour no bigger than the other boundary
  3. assume contour could go through every single cell once
source
IMASutils.contour_from_midplaneFunction
contour_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

source
IMASutils.contour_from_midplane!Function
contour_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

source
IMASutils.cumtrapzFunction
cumtrapz(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.

source
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.

source
Missing docstring.

Missing docstring for cumtrapz!. Check Documenter's build log for details.

IMASutils.mirror_boundFunction
mirror_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.

source
IMASutils.trapzFunction
trapz(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.

source
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.

source