Skip to content

foresight_contour ​

foresight_contour, gnuplot's contour lines of a surface grid.

A port of gnuplot 6.0's contour.c: each cell of the grid split into two triangles (edges in gnuplot's list order), the edges crossing a level traced through the triangles, from the boundary first (open lines) then inside (closed ones); each line in linear segments, a cubic spline through its points or a B-spline approximation of them; lines cut into chunks of at most 99 points, the last one starting the next; the list built last first, as gnuplot's (its table and drawing order). The levels: auto N (gnuplot's quantize_normal_tics of the z extent, guide 2 (N + 1)), discrete z1, z2, ..., incremental start, step[, end].

Source: src/lib/foresight_contour.F90

Dependencies

Contents ​

Variables ​

NameTypeAttributesDescription
CONTOUR_LINEARinteger(kind=I4P)parameterset cntrparam linear.
CONTOUR_CUBICinteger(kind=I4P)parametercubicspline.
CONTOUR_BSPLINEinteger(kind=I4P)parameterbspline.
LEVELS_AUTOinteger(kind=I4P)parameterlevels auto N.
LEVELS_DISCRETEinteger(kind=I4P)parameterlevels discrete z1, z2, ....
LEVELS_INCREMENTALinteger(kind=I4P)parameterlevels incremental start, step[, end].
MAX_POINTSinteger(kind=I4P)parametergnuplot's MAX_POINTS_PER_CNTR: chunks of 99 points.
EPSreal(kind=R8P)parametergnuplot's EPSILON: two points are the same.
BOUNDARYinteger(kind=I4P)parameterAn edge of one triangle.
DIAGONALinteger(kind=I4P)parameterThe diagonal of a cell.

Derived Types ​

contour_object ​

Contour settings of a panel (gnuplot set contour, set cntrparam, set cntrlabel).

Components

NameTypeAttributesDescription
onlogicalContours drawn (set contour).
placecharacter(len=7)base, surface or both.
kindinteger(kind=I4P)Interpolation.
levels_kindinteger(kind=I4P)Levels kind.
levelsinteger(kind=I4P)Levels of auto (about), or of incremental with an end.
listreal(kind=R8P)allocatablediscrete levels, or incremental start and step.
orderinteger(kind=I4P)B-spline order, 2 to 10.
npointsinteger(kind=I4P)Points per interval of the splines.
firstlinetypeinteger(kind=I4P)Linetype of the first level, else the surface's + 1.
sortedlogicalLevels sorted high to low.
formatcharacter(len=64)Label format (set cntrlabel format).
onecolorlogicalAll levels in the surface's color, one key entry (onecolor).
label_startinteger(kind=I4P)First labelled point of with labels (start).
label_intervalinteger(kind=I4P)Points between labels (interval).

tracer ​

The triangulation of a grid and the lines traced on it (gnuplot's contour.c state).

Components

NameTypeAttributesDescription
settingstype(contour_object)Settings.
nxinteger(kind=I4P)Points per row.
vxreal(kind=R8P)allocatableVertices, (row - 1) nx + point.
vyreal(kind=R8P)allocatableVertices, (row - 1) nx + point.
vzreal(kind=R8P)allocatableVertices, (row - 1) nx + point.
vinlogicalallocatableVertex in range, defined.
vdeflogicalallocatableVertex in range, defined.
unit_xreal(kind=R8P)Grid extent along x.
unit_yreal(kind=R8P)Grid extent along y.
evinteger(kind=I4P)allocatableEdge vertices (2, edge).
epinteger(kind=I4P)allocatableEdge triangles (2, edge), 0 for none.
eposinteger(kind=I4P)allocatableEdge position: 1 inner, BOUNDARY, DIAGONAL.
activelogicalallocatableEdge crossing the current level.
peinteger(kind=I4P)allocatableTriangle edges (3, triangle).
hprevinteger(kind=I4P)allocatableHorizontal edges of the previous and current rows.
hrowinteger(kind=I4P)allocatableHorizontal edges of the previous and current rows.
htriinteger(kind=I4P)allocatableTriangle of each upper edge of the current row.
neinteger(kind=I4P)Edges.
npinteger(kind=I4P)Triangles.
nactiveinteger(kind=I4P)Active edges.
pxreal(kind=R8P)allocatablePoints of the line being traced.
pyreal(kind=R8P)allocatablePoints of the line being traced.
nptinteger(kind=I4P)Its points.
curreal(kind=R8P)gnuplot's crnt_cntr.
ncurinteger(kind=I4P)Its points.
kxreal(kind=R8P)allocatableChunks made (in making order), NaN separated, their level.
kyreal(kind=R8P)allocatableChunks made (in making order), NaN separated, their level.
kzreal(kind=R8P)allocatableChunks made (in making order), NaN separated, their level.
nkinteger(kind=I4P)Rows made.
kfirstinteger(kind=I4P)allocatableFirst and last row of each chunk.
klastinteger(kind=I4P)allocatableFirst and last row of each chunk.
knewlogicalallocatableChunk flagged new level.
nchunksinteger(kind=I4P)Chunks made.

Subroutines ​

contour_levels ​

The levels of the contours of a surface of heights zmin to zmax (its defined points), as gnuplot's contour(): auto levels at the multiples of a round step within the extent, incremental from start by step (a factor on a log z axis, zlog), discrete as given; sorted high to low with sorted.

Attributes: pure

fortran
subroutine contour_levels(settings, zmin, zmax, zlog, levels)

Arguments

NameTypeIntentAttributesDescription
settingstype(contour_object)inSettings.
zminreal(kind=R8P)inLowest height.
zmaxreal(kind=R8P)inHighest height.
zloglogicalinA log z axis.
levelsreal(kind=R8P)outallocatableLevels.

Call graph

contour_lines ​

The contour lines of a grid of size(gx, 1) points per row and size(gx, 2) rows (gnuplot's iso-curves in their list order), as gnuplot's contour(): the grid triangulated over its points in range (inrange), its extent over the defined ones, the levels of contour_levels; the chunks of the lines in gnuplot's order (the last made first), as rows cx, cy (a NaN row after each chunk), cz their level; chunk_level the level of each chunk, new_level true on the first chunk of each level (its key entry, its table header).

fortran
subroutine contour_lines(gx, gy, gz, inrange, defined, settings, zlog, cx, cy, cz, chunk_level, new_level)

Arguments

NameTypeIntentAttributesDescription
gxreal(kind=R8P)inAbscissae (point, row).
gyreal(kind=R8P)inOrdinates.
gzreal(kind=R8P)inHeights.
inrangelogicalinPoints in range (gnuplot's INRANGE).
definedlogicalinPoints defined.
settingstype(contour_object)inSettings.
zloglogicalinA log z axis.
cxreal(kind=R8P)outallocatableLine abscissae, NaN after each chunk.
cyreal(kind=R8P)outallocatableLine ordinates.
czreal(kind=R8P)outallocatableTheir level.
chunk_levelreal(kind=R8P)outallocatableLevel of each chunk.
new_levellogicaloutallocatableFirst chunk of its level.

Call graph

new_triangle ​

gnuplot's add_poly: a triangle of the edges a, b, c if all three exist (an upper edge numbered later, -1); each numbered edge told the triangle.

fortran
subroutine new_triangle(st, a, b, c)

Arguments

NameTypeIntentAttributesDescription
sttype(tracer)inoutTriangulation.
ainteger(kind=I4P)inFirst edge.
binteger(kind=I4P)inSecond edge.
cinteger(kind=I4P)inThird edge.

Call graph

Edge e told of the newest triangle.

fortran
subroutine link(st, e)

Arguments

NameTypeIntentAttributesDescription
sttype(tracer)inoutTriangulation.
einteger(kind=I4P)inEdge.

trace ​

gnuplot's trace_contour: the line from edge e_start through the triangles to a boundary edge or back to it, its points (px, py, npt) on the non-diagonal edges, nearby ones merged; none on a dead end.

fortran
subroutine trace(st, e_start, z, isclosed)

Arguments

NameTypeIntentAttributesDescription
sttype(tracer)inoutTriangulation and line.
e_startinteger(kind=I4P)inFirst edge.
zreal(kind=R8P)inLevel.
isclosedlogicalinLooking for closed lines.

Call graph

edge_point ​

gnuplot's update_cntr_pt: where edge e crosses level z, linearly.

Attributes: pure

fortran
subroutine edge_point(st, e, z, qx, qy)

Arguments

NameTypeIntentAttributesDescription
sttype(tracer)inTriangulation.
einteger(kind=I4P)inEdge.
zreal(kind=R8P)inLevel.
qxreal(kind=R8P)outAbscissa.
qyreal(kind=R8P)outOrdinate.

Call graph

put_line ​

gnuplot's put_contour: the traced line as it is, through a cubic spline, or approximated by a B-spline.

fortran
subroutine put_line(st, z, isclosed)

Arguments

NameTypeIntentAttributesDescription
sttype(tracer)inoutLine and chunks.
zreal(kind=R8P)inLevel.
isclosedlogicalinA closed line.

Call graph

add_point ​

gnuplot's add_cntr_point: a point of the current chunk, a full chunk ended and its last point the next's first.

fortran
subroutine add_point(st, x, y, z)

Arguments

NameTypeIntentAttributesDescription
sttype(tracer)inoutChunks.
xreal(kind=R8P)inAbscissa.
yreal(kind=R8P)inOrdinate.
zreal(kind=R8P)inLevel.

Call graph

end_chunk ​

gnuplot's end_crnt_cntr: the current chunk kept, a NaN row after it.

fortran
subroutine end_chunk(st, z)

Arguments

NameTypeIntentAttributesDescription
sttype(tracer)inoutChunks.
zreal(kind=R8P)inLevel.

Call graph

put_cubic ​

gnuplot's put_contour_cubic: a cubic spline through the points, parameter the length of the stroke in grid units, npoints points per interval.

fortran
subroutine put_cubic(st, z, isclosed)

Arguments

NameTypeIntentAttributesDescription
sttype(tracer)inoutLine and chunks.
zreal(kind=R8P)inLevel.
isclosedlogicalinA closed line.

Call graph

cubic_points ​

gnuplot's intp_cubic_spline: n_intpol points of the spline, evenly in its parameter.

fortran
subroutine cubic_points(st, n, qx, qy, d2x, d2y, dt, n_intpol, z)

Arguments

NameTypeIntentAttributesDescription
sttype(tracer)inoutChunks.
ninteger(kind=I4P)inPoints.
qxreal(kind=R8P)inPoints.
qyreal(kind=R8P)inPoints.
d2xreal(kind=R8P)inSecond derivatives, interval lengths.
d2yreal(kind=R8P)inSecond derivatives, interval lengths.
dtreal(kind=R8P)inSecond derivatives, interval lengths.
n_intpolinteger(kind=I4P)inPoints made.
zreal(kind=R8P)inLevel.

Call graph

put_bspline ​

gnuplot's put_contour_bspline and gen_bspline_approx: the B-spline of order order (less than the points) through the points as control points, open or (closed) float knots, npoints points per section.

fortran
subroutine put_bspline(st, z, isclosed)

Arguments

NameTypeIntentAttributesDescription
sttype(tracer)inoutLine and chunks.
zreal(kind=R8P)inLevel.
isclosedlogicalinA closed line.

Call graph

cubic_spline ​

gnuplot's gen_cubic_spline: the second derivatives d2x, d2y at the points and the interval lengths dt of the cubic spline through them (parameter the stroke length in grid units), right sides cut at cusps beyond 90 degrees; ok false if the system has no solution.

Attributes: pure

fortran
subroutine cubic_spline(n, qx, qy, d2x, d2y, dt, isclosed, unit_x, unit_y, ok)

Arguments

NameTypeIntentAttributesDescription
ninteger(kind=I4P)inPoints (at least 3).
qxreal(kind=R8P)inPoints.
qyreal(kind=R8P)inPoints.
d2xreal(kind=R8P)inoutSecond derivatives, interval lengths (n + 1).
d2yreal(kind=R8P)inoutSecond derivatives, interval lengths (n + 1).
dtreal(kind=R8P)inoutSecond derivatives, interval lengths (n + 1).
isclosedlogicalinA closed line (first point = last).
unit_xreal(kind=R8P)inGrid extent.
unit_yreal(kind=R8P)inGrid extent.
oklogicaloutSolved.

Call graph

cholesky ​

gnuplot's solve_cubic_1: the Cholesky decomposition of the cyclic tridiagonal matrix m (n >= 1).

Attributes: pure

fortran
subroutine cholesky(m, n, ok)

Arguments

NameTypeIntentAttributesDescription
mreal(kind=R8P)inoutMatrix (3, row), decomposed.
ninteger(kind=I4P)inSize.
oklogicaloutPositive definite.

Call graph

cholesky_solve ​

gnuplot's solve_cubic_2: x overwritten by the solution of the decomposed system with right side x.

Attributes: pure

fortran
subroutine cholesky_solve(m, x, n)

Arguments

NameTypeIntentAttributesDescription
mreal(kind=R8P)inDecomposed matrix.
xreal(kind=R8P)inoutRight side, solution.
ninteger(kind=I4P)inSize.

Call graph

bspline_point ​

gnuplot's eval_bspline (de Boor): the point at t of the B-spline blending the control points from first, knot index j.

Attributes: pure

fortran
subroutine bspline_point(t, qx, qy, first, n, order, j, isclosed, x, y)

Arguments

NameTypeIntentAttributesDescription
treal(kind=R8P)inParameter.
qxreal(kind=R8P)inControl points.
qyreal(kind=R8P)inControl points.
firstinteger(kind=I4P)inFirst control point to blend.
ninteger(kind=I4P)inControl points.
orderinteger(kind=I4P)inOrder.
jinteger(kind=I4P)inKnot index.
isclosedlogicalinFloat knots.
xreal(kind=R8P)outAbscissa.
yreal(kind=R8P)outOrdinate.

Call graph

Functions ​

quantize ​

gnuplot's quantize_normal_tics: a step about arg / guide (a round number).

Attributes: pure

Returns: real(kind=R8P)

fortran
function quantize(arg, guide) result(step)

Arguments

NameTypeIntentAttributesDescription
argreal(kind=R8P)inExtent.
guideinteger(kind=I4P)inSteps wanted.

Call graph

new_edge ​

gnuplot's add_edge to the main list: an edge of the vertices a, b if both are in range, else 0.

Returns: integer(kind=I4P)

fortran
function new_edge(st, a, b) result(e)

Arguments

NameTypeIntentAttributesDescription
sttype(tracer)inoutTriangulation.
ainteger(kind=I4P)inFirst vertex.
binteger(kind=I4P)inSecond vertex.

Call graph

same_point ​

gnuplot's fuzzy_equal: two points within EPS of the grid extent.

Attributes: pure

Returns: logical

fortran
function same_point(st, ax, ay, bx, by) result(yes)

Arguments

NameTypeIntentAttributesDescription
sttype(tracer)inGrid extent.
axreal(kind=R8P)inThe points.
ayreal(kind=R8P)inThe points.
bxreal(kind=R8P)inThe points.
byreal(kind=R8P)inThe points.

Call graph

knot_value ​

gnuplot's fetch_knot: knot i (from 0) of the uniform knot vector, open (the first and last order equal) or float (closed lines).

Attributes: pure

Returns: real(kind=R8P)

fortran
function knot_value(isclosed, n, order, i) result(t)

Arguments

NameTypeIntentAttributesDescription
isclosedlogicalinFloat knots.
ninteger(kind=I4P)inControl points.
orderinteger(kind=I4P)inOrder.
iinteger(kind=I4P)inKnot.

Call graph

Released under the GPL v3, BSD 2-Clause, BSD 3-Clause or MIT License.