draw Module

giza devices and scene drawing.

"Emit clamp box" bounds every vertex handed to giza, CLAMP_SPANS window spans past view on each side; "visible range" ivis0..ivis1 is models whose strips overlap view. draw_scene sets both each render, and writes st device fields and view limits, chs and coords%xoff.



Variables

Type Visibility Attributes Name Initial
integer(kind=int32), private, parameter :: CI_TYPE(0:NCONVTYPES) = [0, 4, 5, 3, 2, 6]

giza colour index of each convection type, by convdata.f90 code.

real(kind=real64), private, parameter :: PDF_WIDTH = 3.5d0

PDF save page width, in inches.

One column wide, golden ratio.

real(kind=real64), private, parameter :: PDF_CHS = 2.0d0

PDF save character height.

giza text scales w/ page height, so this keeps it legible on small page.

character(len=64), private :: xofftxt = ''

Label of coords%xoff, set each render by draw_scene.

real(kind=real64), private, allocatable :: epx(:)

Polygon scratch for emitted vertices, grown by ensure_scratch.

real(kind=real64), private, allocatable :: epy(:)

Polygon scratch for emitted vertices, grown by ensure_scratch.

real(kind=real64), private, parameter :: CLAMP_SPANS = 1.0d3

Emit clamp box reach past each side of view, in window spans.

real(kind=real64), private :: exlo = -huge(1.d0)

x limits of emit clamp box, in world coords.

real(kind=real64), private :: exhi = huge(1.d0)

x limits of emit clamp box, in world coords.

real(kind=real64), private :: eylo = -huge(1.d0)

y limits of emit clamp box, in world coords.

real(kind=real64), private :: eyhi = huge(1.d0)

y limits of emit clamp box, in world coords.

integer(kind=int32), private :: ivis0 = 1

First and last model of visible range.

Band emission, surface line and grid clipped to it, so zoomed redraws scale w/ models on screen, not whole file.

integer(kind=int32), private :: ivis1 = huge(1_int32)

First and last model of visible range.

Band emission, surface line and grid clipped to it, so zoomed redraws scale w/ models on screen, not whole file.


Interfaces

interface

  • private subroutine c_giza_box(xopt, xtick, nxsub, yopt, ytick, nysub) bind(C, name='giza_box')

    Draw frame, ticks and tick labels of plot box.

    Binds giza's C giza_box directly.

    Arguments

    Type IntentOptional Attributes Name
    character(kind=c_char, len=1), intent(in), dimension(*) :: xopt

    x axis options, null-terminated giza_box option string.

    real(kind=c_double), value :: xtick

    x major tick step, in world coords.

    integer(kind=c_int), value :: nxsub

    Minor tick intervals per x step.

    character(kind=c_char, len=1), intent(in), dimension(*) :: yopt

    y axis options, null-terminated giza_box option string.

    real(kind=c_double), value :: ytick

    y major tick step, in world coords.

    integer(kind=c_int), value :: nysub

    Minor tick intervals per y step.


Functions

private pure function ybound_lo() result(v)

Return lower y bound of data, in display units.

Read more…

Arguments

None

Return Value real(kind=real64)

private pure function band_y_visible(bd, j0, j1) result(vis)

Test whether band bd overlaps y window over models j0..j1.

Read more…

Arguments

Type IntentOptional Attributes Name
type(band_t), intent(in) :: bd

Band to test.

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

First model of visible stretch.

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

Last model of visible stretch.

Return Value logical

private pure function clampx(v) result(r)

Clamp world x coord to emit clamp box.

Arguments

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

World x coordinate.

Return Value real(kind=real64)

private pure function clampy(v) result(r)

Clamp world y coord to emit clamp box.

Arguments

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

World y coordinate.

Return Value real(kind=real64)


Subroutines

public subroutine kipp_render()

Render scene to current device.

Read more…

Arguments

None

public subroutine kipp_save(name)

Render once to named PNG, or PDF for .pdf name.

Read more…

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: name

Output file name; .png appended unless it ends in .png or .pdf.

public subroutine kipp_close()

Close open device, if any.

Arguments

None

public subroutine kipp_choose_device()

Choose output device from environment.

Read more…

Arguments

None

private subroutine clamp_view()

Keep view limits inside data.

Read more…

Arguments

None

private pure subroutine clamp1(lo, hi, a, b)

Shift interval [a, b] into [lo, hi], keeping its span.

Read more…

Arguments

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

Lower bound.

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

Upper bound.

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

Lower end of interval.

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

Upper end of interval.

private subroutine set_visible_range()

Set visible range ivis0..ivis1 from view.

Read more…

Arguments

None

private subroutine draw_scene()

Draw one frame of Kippenhahn diagram on current device.

Read more…

Arguments

None

private subroutine draw_models(wx1, wx2, wy1, wy2, vx2)

Draw model-number strip above plot.

Read more…

Arguments

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

Left window edge, in world coords.

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

Right window edge, in world coords.

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

Bottom window edge, in world coords.

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

Top window edge, in world coords.

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

Right edge of plot viewport, as fraction of page width.

private subroutine draw_convection()

Draw convection zones as hatched regions, after Alex Heger's convplot.

Read more…

Arguments

None

private subroutine set_hatch_for_type(t)

Set fill hatch of convection type t.

Read more…

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: t

Convection type code, from convdata.f90.

private subroutine draw_bandset(bs)

Fill each band of bandset as its own polygon.

Arguments

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

Bands to fill.

private subroutine draw_band(bd)

Fill one cached band as single polygon.

Read more…

Arguments

Type IntentOptional Attributes Name
type(band_t), intent(in) :: bd

Band to fill.

private subroutine fill_bandset_linked(bs)

Fill all visible bands of one type as single keyholed polygon.

Read more…

Arguments

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

Bands of one type.

private subroutine draw_chainset(cs)

Stroke cached region outline of one type.

Read more…

Arguments

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

Outline chains of one type.

private subroutine ensure_scratch(need)

Grow polygon scratch epx, epy to hold at least need points.

Read more…

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: need

Number of points needed.

private subroutine draw_field(f)

Fill colour field as nested solid bands shaded by colormap.

Read more…

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: f

Colour field index, as registered in convdata.f90.

private subroutine draw_energy(layer)

Fill energy layer as nested solid bands.

Read more…

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: layer

Energy layer index, as in layers.f90.

private subroutine draw_surface()

Draw surface line over visible range.

Read more…

Arguments

None

private subroutine draw_grid(wx1, wx2, wy1, wy2)

Draw cell and time-boundary grid over visible range.

Read more…

Arguments

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

Left window edge, in world coords.

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

Right window edge, in world coords.

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

Bottom window edge, in world coords.

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

Top window edge, in world coords.

private subroutine grid_edge(x, i, k)

Draw time boundary at world x, spanning extent of models i and k.

Arguments

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

World x coord of boundary.

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

Model on one side of boundary.

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

Model on other side of boundary.

private subroutine grid_strip(xa, xb, c, dyw)

Draw cell faces of one strip as zig-zag polyline.

Read more…

Arguments

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

Left strip edge, in world coords.

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

Right strip edge, in world coords.

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

Cell faces in cgs, centre to surface.

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

Smallest face spacing drawn, in world y units.