API Reference
IMASutils
IMASutils.contour_cache
— Functioncontour_cache(values::Matrix{T}; aggression_level::Int = 2) where {T<:Real}
For a given matrix values
, create cache for xcontour and ycontour 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{T}, y_cache::Vector{T},
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
The contour is computed in-place using xcache and ycache, and returned as view
s of those caches to avoid allocations
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.
IMASutils.mirror_bound
— Functionmirror_bound(x::T, l::T, u::T) where {T<: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.