vkf_trajectory Module

Trajectory data: times with positions, attitudes and optional data vectors, as in OpenFrames' Trajectory.

Data are appended: each time may get one position (with num_optionals optional vectors), one attitude and one color, so there may be fewer positions, attitudes or colors than times (data can arrive separately). Colors are optional (not in OpenFrames): a CurveArtist draws a trajectory with colors in them, blended along each segment between its points' colors (see CurveArtist%set_point_colors). No sorting is done; times are expected to be monotonic, increasing or decreasing. Indices are 1-based.

Differences from OpenFrames: * Storage grows by doubling, positions, attitudes and colors separately, so a trajectory without attitudes (colors) holds no attitude (color) memory. reserve sets it for a known size; compact frees what's unused once a trajectory is complete (one copy of each array; storage_bytes says what is held). * Instead of subscriber callbacks, a trajectory counts its changes (revision) and clears (generation): a reader such as an artist compares them with what it last saw and updates only what changed (e.g. uploads only the points appended since). * No locking: vkframes updates and renders on one thread.

Between points, a trajectory is linear in time: point_at(t) is the point at any time (the first or last point outside its times), and point_between(k, k2, t) and time_fraction(k, k2, t) the same between two points already found (followers, trace mode's tail, intermediate markers and time handles use them).


Uses

  • module~~vkf_trajectory~~UsesGraph module~vkf_trajectory vkf_trajectory iso_c_binding iso_c_binding module~vkf_trajectory->iso_c_binding iso_fortran_env iso_fortran_env module~vkf_trajectory->iso_fortran_env module~vkf_math vkf_math module~vkf_trajectory->module~vkf_math module~vkf_math->iso_fortran_env

Used by

  • module~~vkf_trajectory~~UsedByGraph module~vkf_trajectory vkf_trajectory module~vkf_artists vkf_artists module~vkf_artists->module~vkf_trajectory module~vkf_frames vkf_frames module~vkf_artists->module~vkf_frames module~vkf_follower vkf_follower module~vkf_follower->module~vkf_trajectory module~vkf_frames->module~vkf_trajectory module~vkf_frames->module~vkf_follower module~vkf_handles vkf_handles module~vkf_handles->module~vkf_trajectory module~vkf_handles->module~vkf_artists module~vkf_handles->module~vkf_frames module~vkframes vkframes module~vkframes->module~vkf_trajectory module~vkframes->module~vkf_artists module~vkframes->module~vkf_follower module~vkframes->module~vkf_frames module~vkframes->module~vkf_handles module~vkf_hud vkf_hud module~vkframes->module~vkf_hud module~vkf_line_segments vkf_line_segments module~vkframes->module~vkf_line_segments module~vkf_model vkf_model module~vkframes->module~vkf_model module~vkf_shadow vkf_shadow module~vkframes->module~vkf_shadow module~vkf_shapes vkf_shapes module~vkframes->module~vkf_shapes module~vkf_sphere vkf_sphere module~vkframes->module~vkf_sphere module~vkf_terrain vkf_terrain module~vkframes->module~vkf_terrain module~vkf_view vkf_view module~vkframes->module~vkf_view module~vkf_window vkf_window module~vkframes->module~vkf_window module~vkf_hud->module~vkf_frames module~vkf_line_segments->module~vkf_frames module~vkf_model->module~vkf_frames module~vkf_shadow->module~vkf_frames module~vkf_shadow->module~vkf_sphere module~vkf_shadow->module~vkf_terrain module~vkf_shapes->module~vkf_artists module~vkf_shapes->module~vkf_frames module~vkf_sphere->module~vkf_frames module~vkf_terrain->module~vkf_frames module~vkf_view->module~vkf_frames module~vkf_window->module~vkf_frames module~vkf_window->module~vkf_handles module~vkf_window->module~vkf_hud module~vkf_window->module~vkf_view

Variables

Type Visibility Attributes Name Initial
integer, public, parameter :: SOURCE_ATTITUDE = 3

an element of the attitude quaternion

integer, public, parameter :: SOURCE_POSOPT = 2

an element of the position or of an optional

integer, public, parameter :: SOURCE_TIME = 1

the time

integer, public, parameter :: SOURCE_ZERO = 0

where a component of a DataSource comes from (OpenFrames' SourceType) 0

integer, public, parameter :: TIME_AT_BOUND = 0

index = 1 or num_times (at the first or last time)

integer, public, parameter :: TIME_NOT_FOUND = -2

results of Trajectory%time_index (as OpenFrames' getTimeIndex) the search did not converge

integer, public, parameter :: TIME_OUT_OF_RANGE = -1

index = 0 (before the first time) or num_times + 1 (after the last)


Interfaces

public interface DataSource

The DataSource constructor: DataSource(...) makes one (see new_data_source for its arguments).

  • private pure function new_data_source(src, element, opt, scale) result(s)

    A data source (see DataSource); element defaults to 1, opt to 0, scale to 1.

    Arguments

    Type IntentOptional Attributes Name
    integer, intent(in) :: src

    a SOURCE_* constant

    integer, intent(in), optional :: element

    element (1 to dof, or 1 to 4 for an attitude; default 1)

    integer, intent(in), optional :: opt

    (0: the position (default), k: optional k)

    real(kind=wp), intent(in), optional :: scale

    factor the value is multiplied by (default 1)

    Return Value type(DataSource)

public interface Trajectory

The Trajectory constructor: Trajectory(...) makes one (see new_trajectory for its arguments).

  • private function new_trajectory(dof, nopt) result(traj)

    A trajectory with dof (2 or 3, default 3) degrees of freedom and nopt (default 0) optional vectors per position.

    Arguments

    Type IntentOptional Attributes Name
    integer, intent(in), optional :: dof

    degrees of freedom (2 or 3, default 3)

    integer, intent(in), optional :: nopt

    optional vectors per position (default 0)

    Return Value type(Trajectory)


Derived Types

type, public ::  DataSource

Where one component (x, y or z) of a point is taken from, as OpenFrames' Trajectory::DataSource: src is a SOURCE_* constant; for SOURCE_POSOPT, element (1 to dof) of the position (opt = 0) or of optional opt; for SOURCE_ATTITUDE, element (1 to 4) of the quaternion. The value is multiplied by scale.

Components

Type Visibility Attributes Name Initial
integer, public :: element = 1

element (1 to dof, or 1 to 4 for SOURCE_ATTITUDE)

integer, public :: opt = 0

(0: the position, k: optional k (SOURCE_POSOPT))

real(kind=wp), public :: scale = 1.0_wp

factor the value is multiplied by

integer, public :: src = SOURCE_ZERO

where the component comes from: a SOURCE_* constant

Constructor

The DataSource constructor: DataSource(...) makes one (see new_data_source for its arguments).

private pure function new_data_source (src, element, opt, scale)

A data source (see DataSource); element defaults to 1, opt to 0, scale to 1.

type, public ::  Trajectory

A trajectory (see the module documentation).

Components

Type Visibility Attributes Name Initial
real(kind=wp), private, allocatable :: att(:,:)

(4, capacity): quaternions [x, y, z, w]

real(kind=c_float), private, allocatable :: col(:,:)

(4, capacity): colors [r, g, b, a] (as drawn)

integer, private :: dof_ = 3

degrees of freedom of positions and optionals (2 or 3)

integer, private :: generation_ = 0

incremented when the data are cleared

integer, private :: n_att = 0

number of attitudes (<= n_times)

integer, private :: n_col = 0

number of colors (<= n_times)

integer, private :: n_pos = 0

number of positions (<= n_times)

integer, private :: n_times = 0

number of times

integer, private :: nopt_ = 0

optionals per position

real(kind=wp), private, allocatable :: posopt(:,:,:)

(3, 0:nopt, capacity): position, then optionals

integer, private :: revision_ = 0

incremented on every change

real(kind=wp), private, allocatable :: t(:)

(capacity): times

Constructor

The Trajectory constructor: Trajectory(...) makes one (see new_trajectory for its arguments).

private function new_trajectory (dof, nopt)

A trajectory with dof (2 or 3, default 3) degrees of freedom and nopt (default 0) optional vectors per position.

Type-Bound Procedures

generic, public :: add => add_point, add_points
procedure, public :: add_attitude
procedure, public :: add_color
procedure, private :: add_point
procedure, private :: add_points
procedure, public :: add_position
procedure, public :: add_time
procedure, public :: attitude
procedure, public :: attitudes
procedure, public :: clear
procedure, public :: color
procedure, public :: colors
procedure, public :: compact
procedure, public :: dof
procedure, public :: generation
procedure, public :: is_empty
procedure, public :: num_attitudes
procedure, public :: num_colors
procedure, public :: num_optionals
procedure, public :: num_points
procedure, public :: num_positions
procedure, public :: num_times
procedure, public :: optional
procedure, public :: point
procedure, public :: point_at
procedure, public :: point_between
procedure, public :: points
procedure, public :: position
procedure, public :: positions
procedure, public :: reserve
procedure, public :: revision
procedure, public :: set_dof
procedure, public :: set_num_optionals
procedure, public :: set_optional
procedure, public :: storage_bytes
procedure, public :: time
procedure, public :: time_distance
procedure, public :: time_fraction
procedure, public :: time_index
procedure, public :: time_range
procedure, public :: times
procedure, public :: verify_data

Functions

private pure function attitude(self, i) result(q)

Attitude i (quaternion [x, y, z, w]).

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(in) :: self
integer, intent(in) :: i

the attitude (1 to num_attitudes)

Return Value real(kind=wp), (4)

private pure function color(self, i) result(c)

Color i ([r, g, b, a]).

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(in) :: self
integer, intent(in) :: i

the color (1 to num_colors)

Return Value real(kind=wp), (4)

private pure function dof(self)

Degrees of freedom (2 or 3) of positions and optionals.

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(in) :: self

Return Value integer

private pure function generation(self)

Number of times the data were cleared (by clear, set_dof or set_num_optionals): while it is unchanged, data were only appended.

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(in) :: self

Return Value integer

private pure function is_empty(self)

True if the trajectory has no times.

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(in) :: self

Return Value logical

private pure function new_capacity(current, needed, exact)

The capacity to grow to for needed points: twice the current, or what is needed and a quarter more (so that appending after a large bulk add doesn't copy everything at once); exact (reserve): what is needed.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: current

current capacity

integer, intent(in) :: needed

points needed

logical, intent(in), optional :: exact

(true: what is needed (default false))

Return Value integer

private pure function new_data_source(src, element, opt, scale) result(s)

A data source (see DataSource); element defaults to 1, opt to 0, scale to 1.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: src

a SOURCE_* constant

integer, intent(in), optional :: element

element (1 to dof, or 1 to 4 for an attitude; default 1)

integer, intent(in), optional :: opt

(0: the position (default), k: optional k)

real(kind=wp), intent(in), optional :: scale

factor the value is multiplied by (default 1)

Return Value type(DataSource)

private function new_trajectory(dof, nopt) result(traj)

A trajectory with dof (2 or 3, default 3) degrees of freedom and nopt (default 0) optional vectors per position.

Arguments

Type IntentOptional Attributes Name
integer, intent(in), optional :: dof

degrees of freedom (2 or 3, default 3)

integer, intent(in), optional :: nopt

optional vectors per position (default 0)

Return Value type(Trajectory)

private pure function num_attitudes(self)

Number of attitudes (at most num_times).

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(in) :: self

Return Value integer

private pure function num_colors(self)

Number of colors (at most num_times).

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(in) :: self

Return Value integer

private pure function num_optionals(self)

Number of optional vectors per position.

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(in) :: self

Return Value integer

private pure function num_points(self, sources)

Number of points available with these sources: the number of times, limited by the positions or attitudes they use; huge() if all are zero.

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(in) :: self
type(DataSource), intent(in) :: sources(3)

where the components come from

Return Value integer

private pure function num_positions(self)

Number of positions (at most num_times).

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(in) :: self

Return Value integer

private pure function num_times(self)

Number of times.

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(in) :: self

Return Value integer

private pure function optional(self, i, k) result(v)

Optional vector k (1 to num_optionals) of position i.

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(in) :: self
integer, intent(in) :: i

the position (1 to num_positions); the optional (1 to num_optionals)

integer, intent(in) :: k

the position (1 to num_positions); the optional (1 to num_optionals)

Return Value real(kind=wp), (3)

public pure function optional_sources(opt, dof, scale) result(s)

The sources of optional opt's x, y, (z) (zero beyond dof, default 3), each times scale (default 1): e.g. a thrust vector stored per point, for set_end_data with relative ends.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: opt

the optional (1 to num_optionals)

integer, intent(in), optional :: dof

degrees of freedom (default 3)

real(kind=wp), intent(in), optional :: scale

factor (default 1)

Return Value type(DataSource), (3)

private pure function point(self, i, sources) result(v)

Point i with components from sources (OpenFrames' getPoint). No checks: use verify_data and num_points first.

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(in) :: self
integer, intent(in) :: i

the point (1 to num_points(sources))

type(DataSource), intent(in) :: sources(3)

where the components come from

Return Value real(kind=wp), (3)

private function point_at(self, t, sources, ok) result(v)

The point at time t (components from sources; default: the position's), linear in time between the points about it; outside the times, the first or last point. ok (optional) false, and v 0, if there is no point (or the search for the time failed).

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(in) :: self
real(kind=wp), intent(in) :: t

the time

type(DataSource), intent(in), optional :: sources(3)

where the components come from (default: the position)

logical, intent(out), optional :: ok

a point was found

Return Value real(kind=wp), (3)

private pure function point_between(self, k, k2, t, sources) result(v)

The point at time t between points k and k2 (components from sources): linear in time, within the two (time_fraction). Point k if k2 isn't a point (beyond the ends, or more times than data).

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(in) :: self
integer, intent(in) :: k

a point (1 to num_points(sources))

integer, intent(in) :: k2

the other point (e.g. k + 1)

real(kind=wp), intent(in) :: t

the time

type(DataSource), intent(in) :: sources(3)

where the components come from

Return Value real(kind=wp), (3)

private pure function position(self, i) result(p)

Position i (z = 0 for a 2-DOF trajectory).

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(in) :: self
integer, intent(in) :: i

the position (1 to num_positions)

Return Value real(kind=wp), (3)

public pure function position_sources(dof) result(s)

The sources of a trajectory's positions: x, y, (z) of the position, and zero for components beyond dof.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: dof

degrees of freedom (2 or 3)

Return Value type(DataSource), (3)

private pure function revision(self)

Number of changes so far (any added, set or cleared data).

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(in) :: self

Return Value integer

private pure function storage_bytes(self) result(b)

The memory the trajectory's data take (bytes), used or not: its storage's capacity (see reserve, compact).

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(in) :: self

Return Value integer(kind=int64)

private pure function time(self, i)

Time i.

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(in) :: self
integer, intent(in) :: i

the time (1 to num_times)

Return Value real(kind=wp)

private pure function time_distance(self, t)

The "distance" from time t to the time range [t0, tf]: > 0 outside it (to the nearer end), 0 at its ends, < 0 inside; huge() without times. (OpenFrames' getTimeDistance.)

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(in) :: self
real(kind=wp), intent(in) :: t

the time

Return Value real(kind=wp)

private pure function time_fraction(self, k, k2, t) result(frac)

The fraction of the way in time from point k to point k2 (any two points: e.g. k + 1, or k - 1 with times running backward) at time t, kept within 0 to 1 (0 if their times are the same). No checks: k and k2 must be times.

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(in) :: self
integer, intent(in) :: k

the points (1 to num_times)

integer, intent(in) :: k2

the points (1 to num_times)

real(kind=wp), intent(in) :: t

the time

Return Value real(kind=wp)

private function time_index(self, t, index) result(status)

Find the interval of the time list containing t, by bisection (times increasing or decreasing). Returns a TIME_ code, or the number of iterations (> 0) when found, with times(index) <= t < times(index+1) for increasing times (>= and > for decreasing). See the TIME_ constants for index in the other cases.

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(in) :: self
real(kind=wp), intent(in) :: t

the time

integer, intent(out) :: index

the interval's first index (see the TIME_* constants)

Return Value integer

private function time_range(self, t0, tf)

The first and last times, ordered (t0 <= tf); false if there are no times.

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(in) :: self
real(kind=wp), intent(out) :: t0

first and last times (t0 <= tf; 0 if no times)

real(kind=wp), intent(out) :: tf

first and last times (t0 <= tf; 0 if no times)

Return Value logical

private pure function verify_data(self, sources)

True if the trajectory has the data the sources refer to (elements and optionals in range).

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(in) :: self
type(DataSource), intent(in) :: sources(3)

where the components come from

Return Value logical


Subroutines

private subroutine add_attitude(self, q, ok)

Add an attitude quaternion [x, y, z, w] for the next time that has none. ok is false if every time already has an attitude.

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(inout) :: self
real(kind=wp), intent(in) :: q(4)

quaternion [x, y, z, w]

logical, intent(out), optional :: ok

false if not added

private subroutine add_color(self, color, ok)

Add a color ([r, g, b], alpha 1, or [r, g, b, a], 0 to 1) for the next time that has none. ok is false if every time already has a color.

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(inout) :: self
real(kind=wp), intent(in) :: color(:)

[r, g, b] or [r, g, b, a] (0 to 1)

logical, intent(out), optional :: ok

false if not added

private subroutine add_point(self, t, pos, att, color)

Add a point: a time with an optional position, attitude and color ([r, g, b] or [r, g, b, a]).

Read more…

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(inout) :: self
real(kind=wp), intent(in) :: t

time

real(kind=wp), intent(in), optional :: pos(:)

position (first dof elements used)

real(kind=wp), intent(in), optional :: att(4)

attitude quaternion [x, y, z, w]

real(kind=wp), intent(in), optional :: color(:)

[r, g, b] or [r, g, b, a] (0 to 1)

private subroutine add_points(self, t, pos, att, color)

Add points in bulk: times t(n), with optional positions pos(dof, n), attitudes att(4, n) and colors color(3 or 4, n). Times, positions, attitudes and colors must all have been complete before (as many of each as times) for the given ones to line up with t.

Read more…

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(inout) :: self
real(kind=wp), intent(in) :: t(:)

(n): times

real(kind=wp), intent(in), optional :: pos(:,:)

(dof, n): positions

real(kind=wp), intent(in), optional :: att(:,:)

(4, n): attitude quaternions [x, y, z, w]

real(kind=wp), intent(in), optional :: color(:,:)

(3 or 4, n): colors [r, g, b(, a)] (0 to 1)

private subroutine add_position(self, pos, ok)

Add a position (the first dof elements of pos are used) for the next time that has none. ok is false if every time already has a position.

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(inout) :: self
real(kind=wp), intent(in) :: pos(:)

position (first dof elements used)

logical, intent(out), optional :: ok

false if not added

private subroutine add_time(self, t)

Add a time at the end of the time list.

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(inout) :: self
real(kind=wp), intent(in) :: t

the time

private subroutine attitudes(self, q)

Pointer to the attitudes (4, num_attitudes), without copying.

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(in), target :: self
real(kind=wp), intent(out), dimension(:,:), pointer :: q

(4, num_attitudes): quaternions [x, y, z, w] (null if none)

private subroutine clear(self)

Remove all points (keeping the memory).

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(inout) :: self

private subroutine colors(self, c)

Pointer to the colors (4, num_colors; single precision, as drawn), without copying.

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(in), target :: self
real(kind=c_float), intent(out), dimension(:,:), pointer :: c

(4, num_colors): colors [r, g, b, a] (null if none)

private subroutine compact(self)

Free the storage not used: each array is reallocated to the points it holds (one copy, an array at a time), and arrays holding none are deallocated. For a trajectory that is complete: growing doubles the storage, so up to about half of it can be unused. The data and what is drawn of them don't change; pointers from times, positions, ... must be fetched again. Points can still be added (storage grows again).

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(inout) :: self

private subroutine grow_attitudes(self, n, exact)

Grow the attitudes' storage to hold at least n.

Arguments

Type IntentOptional Attributes Name
type(Trajectory), intent(inout) :: self
integer, intent(in) :: n

attitudes to hold

logical, intent(in), optional :: exact

(true: exactly n (default false))

private subroutine grow_colors(self, n, exact)

Grow the colors' storage to hold at least n.

Arguments

Type IntentOptional Attributes Name
type(Trajectory), intent(inout) :: self
integer, intent(in) :: n

colors to hold

logical, intent(in), optional :: exact

(true: exactly n (default false))

private subroutine grow_positions(self, n, exact)

Grow the positions' (and optionals') storage to hold at least n.

Arguments

Type IntentOptional Attributes Name
type(Trajectory), intent(inout) :: self
integer, intent(in) :: n

positions to hold

logical, intent(in), optional :: exact

(true: exactly n (default false))

private subroutine grow_times(self, n, exact)

Grow the times' storage to hold at least n (see new_capacity).

Arguments

Type IntentOptional Attributes Name
type(Trajectory), intent(inout) :: self
integer, intent(in) :: n

times to hold

logical, intent(in), optional :: exact

(true: exactly n (default false))

private pure subroutine points(self, i1, i2, sources, v, stride)

Points i1, i1 + stride, ... (up to i2) with components from sources, into v(3, :) (as many columns as points; point for a range, a whole array slice per component). No checks: use verify_data and num_points first.

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(in) :: self
integer, intent(in) :: i1

first and last points (1 to num_points(sources))

integer, intent(in) :: i2

first and last points (1 to num_points(sources))

type(DataSource), intent(in) :: sources(3)

where the components come from

real(kind=wp), intent(out) :: v(:,:)

(3, number of points)

integer, intent(in), optional :: stride

step between points (default 1)

private subroutine positions(self, p)

Pointer to the positions (3, num_positions), without copying.

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(in), target :: self
real(kind=wp), intent(out), dimension(:,:), pointer :: p

(3, num_positions): positions (null if none)

private subroutine reserve(self, n, positions, attitudes, colors)

Reserve memory for n points: times, positions (with their optionals) unless positions is false, and attitudes and colors only if attitudes / colors is true. Optional: storage grows as needed, but reserving avoids reallocations for a known size. It never shrinks the storage (see compact).

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(inout) :: self
integer, intent(in) :: n

number of points

logical, intent(in), optional :: positions

reserve positions (default true)

logical, intent(in), optional :: attitudes

reserve attitudes (default false)

logical, intent(in), optional :: colors

reserve colors (default false)

private subroutine set_dof(self, dof)

Set the degrees of freedom (2 or 3) of positions and optionals; clears the trajectory.

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(inout) :: self
integer, intent(in) :: dof

degrees of freedom (2 or 3)

private subroutine set_num_optionals(self, nopt)

Set the number of optional vectors per position; clears the trajectory.

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(inout) :: self
integer, intent(in) :: nopt

optional vectors per position (>= 0)

private subroutine set_optional(self, index, v, ok)

Set optional vector index (1 to num_optionals) of the most recently added position. ok is false if there is no position or no such optional.

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(inout) :: self
integer, intent(in) :: index

the optional (1 to num_optionals)

real(kind=wp), intent(in) :: v(:)

the vector (its first dof elements are used)

logical, intent(out), optional :: ok

false if not set

private subroutine times(self, t)

Pointer to the times (num_times), without copying.

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(in), target :: self
real(kind=wp), intent(out), dimension(:), pointer :: t

(num_times): times (null if none)

private pure subroutine to_float_rgba(rgba, color)

rgba from [r, g, b] (alpha 1) or [r, g, b, a].

Arguments

Type IntentOptional Attributes Name
real(kind=c_float), intent(out) :: rgba(4)

[r, g, b, a]

real(kind=wp), intent(in) :: color(:)

[r, g, b] or [r, g, b, a] (0 to 1)