bands Module

Band tracer and region outlines.

Outline segments (e0, y0)-(e1, y1) live on a "strip-edge" grid, e indexing model strip edges: e0 == e1 is vertical at edge e0, y0 == y1 && e1 == e0 + 1 horizontal across a time boundary.



Derived Types

type, public ::  tracer_t

Greedy band tracer.

Read more…

Components

Type Visibility Attributes Name Initial
integer(kind=int32), public :: maxbands = 0

Number of band slots.

integer(kind=int32), public, allocatable :: i0(:)

First and last model of the band in each slot.

integer(kind=int32), public, allocatable :: i1(:)

First and last model of the band in each slot.

logical, public, allocatable :: opn(:)

Slot holds an open band; band was extended this step.

logical, public, allocatable :: ext(:)

Slot holds an open band; band was extended this step.

real(kind=real64), public, allocatable :: ylo(:,:)

Lower and upper interface of each band, (slot, model).

real(kind=real64), public, allocatable :: yhi(:,:)

Lower and upper interface of each band, (slot, model).

type, public ::  band_t

Traced band in data coords.

Read more…

Components

Type Visibility Attributes Name Initial
integer(kind=int32), public :: i0 = 0

First and last model of band.

integer(kind=int32), public :: i1 = 0

First and last model of band.

real(kind=real64), public, allocatable :: ylo(:)

Lower and upper interface in each model, i1 - i0 + 1 entries.

real(kind=real64), public, allocatable :: yhi(:)

Lower and upper interface in each model, i1 - i0 + 1 entries.

type, public ::  bandset_t

Growable list of bands.

Components

Type Visibility Attributes Name Initial
integer(kind=int32), public :: nb = 0

Number of bands stored.

type(band_t), public, allocatable :: b(:)

Bands, b(1:nb); grows by array doubling.

type, public ::  chain_t

Outline polyline along a region boundary.

Read more…

Components

Type Visibility Attributes Name Initial
integer(kind=int32), public :: n = 0

Number of points.

integer(kind=int32), public, allocatable :: ei(:)

Strip-edge index of each point.

real(kind=real64), public, allocatable :: y(:)

y coordinate of each point.

type, public ::  chainset_t

Growable list of outline chains.

Components

Type Visibility Attributes Name Initial
integer(kind=int32), public :: nc = 0

Number of chains stored.

type(chain_t), public, allocatable :: c(:)

Chains, c(1:nc); grows by array doubling.


Subroutines

public subroutine tracer_alloc(tr, maxbands, nm)

Allocate tracer w/ maxbands band slots over nm models, all closed.

Arguments

Type IntentOptional Attributes Name
type(tracer_t), intent(out) :: tr

Tracer.

integer(kind=int32), intent(in) :: maxbands

Number of band slots; number of models.

integer(kind=int32), intent(in) :: nm

Number of band slots; number of models.

public subroutine tracer_dealloc(tr)

Free tracer's band slots.

Arguments

Type IntentOptional Attributes Name
type(tracer_t), intent(inout) :: tr

Tracer.

public subroutine tracer_reset(tr)

Begin new feature: close leftover bands without emitting.

Arguments

Type IntentOptional Attributes Name
type(tracer_t), intent(inout) :: tr

Tracer.

public subroutine tracer_step(tr, bs, i, ivlo, ivhi, m)

Feed model i's intervals (ivlo/ivhi, m of them, ascending in y).

Read more…

Arguments

Type IntentOptional Attributes Name
type(tracer_t), intent(inout) :: tr

Tracer.

type(bandset_t), intent(inout) :: bs

Receives bands closed at this model.

integer(kind=int32), intent(in) :: i

Model index; number of intervals.

real(kind=real64), intent(in) :: ivlo(:)

Lower and upper y of each interval, 1:m used.

real(kind=real64), intent(in) :: ivhi(:)

Lower and upper y of each interval, 1:m used.

integer(kind=int32), intent(in) :: m

Model index; number of intervals.

public subroutine tracer_flush(tr, bs)

Store all bands still open at final model.

Arguments

Type IntentOptional Attributes Name
type(tracer_t), intent(inout) :: tr

Tracer.

type(bandset_t), intent(inout) :: bs

Receives stored bands.

private subroutine tracer_close(tr, bs, b)

Store band in slot b to bs and free slot.

Arguments

Type IntentOptional Attributes Name
type(tracer_t), intent(inout) :: tr

Tracer.

type(bandset_t), intent(inout) :: bs

Receives band.

integer(kind=int32), intent(in) :: b

Slot to close.

public subroutine bandset_clear(bs)

Drop every band of a set.

Arguments

Type IntentOptional Attributes Name
type(bandset_t), intent(inout) :: bs

Band set.

private subroutine bandset_append(bs, i0, i1, ylo, yhi)

Append one band, growing by doubling.

Arguments

Type IntentOptional Attributes Name
type(bandset_t), intent(inout) :: bs

Band set.

integer(kind=int32), intent(in) :: i0

First and last model of band.

integer(kind=int32), intent(in) :: i1

First and last model of band.

real(kind=real64), intent(in) :: ylo(:)

Lower and upper interface in each model, i1 - i0 + 1 entries.

real(kind=real64), intent(in) :: yhi(:)

Lower and upper interface in each model, i1 - i0 + 1 entries.

public subroutine seg_append(se0, se1, sy0, sy1, ns, e0, e1, y0, y1)

Append one outline segment, growing by doubling.

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(inout), allocatable :: se0(:)

Strip edge of each segment's first and second end.

integer(kind=int32), intent(inout), allocatable :: se1(:)

Strip edge of each segment's first and second end.

real(kind=real64), intent(inout), allocatable :: sy0(:)

y of each segment's first and second end.

real(kind=real64), intent(inout), allocatable :: sy1(:)

y of each segment's first and second end.

integer(kind=int32), intent(inout) :: ns

Number of segments, incremented.

integer(kind=int32), intent(in) :: e0

Strip edges of new segment's ends.

integer(kind=int32), intent(in) :: e1

Strip edges of new segment's ends.

real(kind=real64), intent(in) :: y0

y of new segment's ends.

real(kind=real64), intent(in) :: y1

y of new segment's ends.

public subroutine symdiff_append(alo, ahi, na, blo, bhi, nb, e, bp, se0, se1, sy0, sy1, ns)

Append vertical outline segments at strip edge e.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: alo(:)

Intervals of the models left (a) and right (b) of the edge.

real(kind=real64), intent(in) :: ahi(:)

Intervals of the models left (a) and right (b) of the edge.

integer(kind=int32), intent(in) :: na

Number of a intervals; number of b intervals; strip edge.

real(kind=real64), intent(in) :: blo(:)

Intervals of the models left (a) and right (b) of the edge.

real(kind=real64), intent(in) :: bhi(:)

Intervals of the models left (a) and right (b) of the edge.

integer(kind=int32), intent(in) :: nb

Number of a intervals; number of b intervals; strip edge.

integer(kind=int32), intent(in) :: e

Number of a intervals; number of b intervals; strip edge.

real(kind=real64), intent(inout) :: bp(:)

Breakpoint scratch, at least 2*(na + nb) long.

integer(kind=int32), intent(inout), allocatable :: se0(:)

Strip edge of each segment's first and second end.

integer(kind=int32), intent(inout), allocatable :: se1(:)

Strip edge of each segment's first and second end.

real(kind=real64), intent(inout), allocatable :: sy0(:)

y of each segment's first and second end.

real(kind=real64), intent(inout), allocatable :: sy1(:)

y of each segment's first and second end.

integer(kind=int32), intent(inout) :: ns

Number of segments, incremented per appended segment.

public subroutine build_chains(cs, se0, se1, sy0, sy1, ns)

Link outline segments into polyline chains by walking shared endpoints.

Read more…

Arguments

Type IntentOptional Attributes Name
type(chainset_t), intent(inout) :: cs

Receives chains.

integer(kind=int32), intent(in) :: se0(:)

Strip edge of each segment's first and second end.

integer(kind=int32), intent(in) :: se1(:)

Strip edge of each segment's first and second end.

real(kind=real64), intent(in) :: sy0(:)

y of each segment's first and second end.

real(kind=real64), intent(in) :: sy1(:)

y of each segment's first and second end.

integer(kind=int32), intent(in) :: ns

Number of segments.

private subroutine chain_push(cei, cy, cn, e, y)

Append one point to growable chain.

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(inout), allocatable :: cei(:)

Strip edge of each point.

real(kind=real64), intent(inout), allocatable :: cy(:)

y of each point.

integer(kind=int32), intent(inout) :: cn

Number of points, incremented.

integer(kind=int32), intent(in) :: e

Strip edge of new point.

real(kind=real64), intent(in) :: y

y of new point.

public subroutine chainset_clear(cs)

Drop every chain of a set.

Arguments

Type IntentOptional Attributes Name
type(chainset_t), intent(inout) :: cs

Chain set.

private subroutine chainset_append(cs, cei, cy, cn)

Store one chain, growing by doubling like bandset_append.

Read more…

Arguments

Type IntentOptional Attributes Name
type(chainset_t), intent(inout) :: cs

Chain set.

integer(kind=int32), intent(in) :: cei(:)

Strip edge of each point; number of points.

real(kind=real64), intent(in) :: cy(:)

y of each point.

integer(kind=int32), intent(in) :: cn

Strip edge of each point; number of points.

private subroutine grow_i32(a, need)

Make room for need entries, keeping contents.

Read more…

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(inout), allocatable :: a(:)

Array.

integer(kind=int32), intent(in) :: need

Number of entries needed.

private subroutine grow_r64(a, need)

Real counterpart of grow_i32.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(inout), allocatable :: a(:)

Array.

integer(kind=int32), intent(in) :: need

Number of entries needed.