fortplot_streamline Module

Context type to hold velocity function pointers (eliminates trampoline need) Abstract interface for velocity functions Module-level context for current velocity functions (thread-unsafe but trampoline-free) Module-level wrapper functions to eliminate trampolines



Derived Types

type, public ::  velocity_function_context_t

Components

Type Visibility Attributes Name Initial
procedure(velocity_function_interface), public, pointer, nopass :: u_func => null()
procedure(velocity_function_interface), public, pointer, nopass :: v_func => null()
logical, public :: negate_functions = .false.

For backward integration


Subroutines

public subroutine calculate_seed_points(x, y, density, seed_x, seed_y, n_seeds)

Arguments

Type IntentOptional Attributes Name
real, intent(in), dimension(:) :: x
real, intent(in), dimension(:) :: y
real, intent(in) :: density
real, intent(out), allocatable :: seed_x(:)
real, intent(out), allocatable :: seed_y(:)
integer, intent(out) :: n_seeds

public subroutine integrate_streamline(x0, y0, u_func, v_func, dt, max_steps, path_x, path_y, n_points)

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: x0
real, intent(in) :: y0
private function u_func(x, y)
Arguments
Type IntentOptional Attributes Name
real, intent(in) :: x
real, intent(in) :: y
Return Value real
private function v_func(x, y)
Arguments
Type IntentOptional Attributes Name
real, intent(in) :: x
real, intent(in) :: y
Return Value real
real, intent(in) :: dt
integer, intent(in) :: max_steps
real, intent(out), allocatable :: path_x(:)
real, intent(out), allocatable :: path_y(:)
integer, intent(out) :: n_points

public subroutine integrate_streamline_dopri5(x0, y0, u_func, v_func, params, max_time, path_x, path_y, n_points)

High-accuracy streamline integration using DOPRI5 method Provides adaptive step size control and superior accuracy

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: x0
real, intent(in) :: y0
private function u_func(x, y)
Arguments
Type IntentOptional Attributes Name
real, intent(in) :: x
real, intent(in) :: y
Return Value real
private function v_func(x, y)
Arguments
Type IntentOptional Attributes Name
real, intent(in) :: x
real, intent(in) :: y
Return Value real
type(integration_params_t), intent(in), optional :: params
real, intent(in), optional :: max_time
real, intent(out), allocatable :: path_x(:)
real, intent(out), allocatable :: path_y(:)
integer, intent(out) :: n_points

public subroutine calculate_seed_points_matplotlib(x, y, density, seed_x, seed_y, n_seeds, mask)

Calculate seed points using matplotlib-compatible spiral algorithm with collision detection for proper streamline spacing

Arguments

Type IntentOptional Attributes Name
real, intent(in), dimension(:) :: x
real, intent(in), dimension(:) :: y
real(kind=wp), intent(in) :: density
real, intent(out), allocatable :: seed_x(:)
real, intent(out), allocatable :: seed_y(:)
integer, intent(out) :: n_seeds
type(stream_mask_t), intent(inout) :: mask

public subroutine integrate_streamline_bidirectional(x0, y0, u_func, v_func, params, max_time, path_x, path_y, n_points)

Bidirectional streamline integration like matplotlib Integrates both forward and backward from seed point for complete streamlines

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: x0
real, intent(in) :: y0
private function u_func(x, y)
Arguments
Type IntentOptional Attributes Name
real, intent(in) :: x
real, intent(in) :: y
Return Value real
private function v_func(x, y)
Arguments
Type IntentOptional Attributes Name
real, intent(in) :: x
real, intent(in) :: y
Return Value real
type(integration_params_t), intent(in), optional :: params
real, intent(in), optional :: max_time
real, intent(out), allocatable :: path_x(:)
real, intent(out), allocatable :: path_y(:)
integer, intent(out) :: n_points

public subroutine rk4_step(x, y, u_func, v_func, dt, x_new, y_new)

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: x
real, intent(in) :: y
private function u_func(x, y)
Arguments
Type IntentOptional Attributes Name
real, intent(in) :: x
real, intent(in) :: y
Return Value real
private function v_func(x, y)
Arguments
Type IntentOptional Attributes Name
real, intent(in) :: x
real, intent(in) :: y
Return Value real
real, intent(in) :: dt
real, intent(out) :: x_new
real, intent(out) :: y_new

public subroutine calculate_arrow_positions(path_x, path_y, n_points, arrow_density, arrow_mask)

Arguments

Type IntentOptional Attributes Name
real, intent(in), dimension(:) :: path_x
real, intent(in), dimension(:) :: path_y
integer, intent(in) :: n_points
real, intent(in) :: arrow_density
logical, intent(out), allocatable :: arrow_mask(:)

public subroutine check_termination(x, y, x_bounds, y_bounds, terminate)

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: x
real, intent(in) :: y
real, intent(in), dimension(2) :: x_bounds
real, intent(in), dimension(2) :: y_bounds
logical, intent(out) :: terminate

public subroutine bilinear_interpolate(x_grid, y_grid, values, x, y, result)

Arguments

Type IntentOptional Attributes Name
real, intent(in), dimension(:) :: x_grid
real, intent(in), dimension(:) :: y_grid
real, intent(in), dimension(:,:) :: values
real, intent(in) :: x
real, intent(in) :: y
real, intent(out) :: result