Skip to content

foresight_voxel ​

foresight_voxel, gnuplot 6.0's voxel grids (set vgrid, vfill, voxel(), with isosurface).

A voxel grid is N x N x N values (single precision, as gnuplot's t_voxel) at evenly spaced points of its ranges (set vxrange, ... or the fixed x, y and z ranges when first used), as gnuplot's voxelgrid.c: a point is looked up at the grid point of indices ceil((x - min) / delta), vfill adds a density to the grid points within a radius of each data point, splot $grid with points|dots draws the grid points above a level and with isosurface the surface of a level by marching cubes (vplot.c, gnuplot's tables).

Source: src/lib/foresight_voxel.F90

Dependencies

Contents ​

Derived Types ​

vgrid_object ​

A voxel grid.

Components

NameTypeAttributesDescription
namecharacter(len=:)allocatableIts name ($grid).
ninteger(kind=I4P)Size: N x N x N.
loreal(kind=R8P)Ranges' starts (x, y, z).
hireal(kind=R8P)Ranges' ends.
rangedlogicalRanges set.
deltareal(kind=R8P)Spacing.
vreal(kind=R4P)allocatableValues, x fastest.

Type-Bound Procedures

NameAttributesDescription
resizepass(self)Zero values of a new size.
spacingpass(self)Its spacing, once ranged.
lookuppass(self)The value at a point (gnuplot's voxel()).
cellpass(self)The index of a point's grid point, 0 out of the ranges.
neighbourspass(self)The grid points within a radius of a point (vfill).
abovepass(self)The grid points above a level (with points|dots).
isosurfacepass(self)The facets of a level (marching cubes).
statspass(self)Non-zero values' min, max, mean, deviation; zero count.

Subroutines ​

resize ​

n x n x n zero values (kept when the size is the same, as gnuplot's set vgrid).

Attributes: pure

fortran
subroutine resize(self, n)

Arguments

NameTypeIntentAttributesDescription
selfclass(vgrid_object)inoutGrid.
ninteger(kind=I4P)inSize.

Call graph

spacing ​

The spacing of the ranged grid: (max - min) / (N - 1) on each axis.

Attributes: pure

fortran
subroutine spacing(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(vgrid_object)inoutGrid.

neighbours ​

The grid points within radius of p (gnuplot's modify_voxels): the brick of floor(radius / delta) points on each side of the nearest one (floor(radius) with grid_units, vgfill), those within the radius (in user or grid units) and the nearest one always; their indices, distances and grid distances.

Attributes: pure

fortran
subroutine neighbours(self, p, radius, grid_units, index, distance, grid_distance)

Arguments

NameTypeIntentAttributesDescription
selfclass(vgrid_object)inGrid.
preal(kind=R8P)inPoint.
radiusreal(kind=R8P)inRadius.
grid_unitslogicalinRadius in grid units.
indexinteger(kind=I8P)outallocatableIndices.
distancereal(kind=R8P)outallocatableDistances.
grid_distancereal(kind=R8P)outallocatableGrid distances.

Call graph

above ​

The grid points of values above level (gnuplot's vplot_points: x outermost, then y, then z), every every-th on each axis (pointinterval, 0 or 1 for all).

Attributes: pure

fortran
subroutine above(self, level, every, x, y, z, v)

Arguments

NameTypeIntentAttributesDescription
selfclass(vgrid_object)inGrid.
levelreal(kind=R8P)inLevel.
everyinteger(kind=I4P)inDownsampling.
xreal(kind=R8P)outallocatablePoints and values.
yreal(kind=R8P)outallocatablePoints and values.
zreal(kind=R8P)outallocatablePoints and values.
vreal(kind=R8P)outallocatablePoints and values.

Call graph

isosurface ​

The facets of the surface of level (gnuplot's vplot_isosurface and tessellate_one_cube): each voxel cube's corner pattern (a corner below the level inside) cut by gnuplot's tables, its edges at the level by linear interpolation; quadrangles and triangles (gnuplot's default, set isosurface mixed) or triangles only (triangles). Facets of 4 corners each (a triangle repeats its third), nf of them, in gnuplot's order.

Attributes: pure

fortran
subroutine isosurface(self, level, triangles, x, y, z, nf)

Arguments

NameTypeIntentAttributesDescription
selfclass(vgrid_object)inGrid.
levelreal(kind=R8P)inLevel.
triangleslogicalinTriangles only.
xreal(kind=R8P)outallocatableCorners (4, facet).
yreal(kind=R8P)outallocatableCorners (4, facet).
zreal(kind=R8P)outallocatableCorners (4, facet).
nfinteger(kind=I4P)outFacets.

Call graph

stats ​

The non-zero values' min, max, mean and standard deviation, and the zero count (gnuplot's vgrid_stats).

Attributes: pure

fortran
subroutine stats(self, lo, hi, mean, deviation, zeros)

Arguments

NameTypeIntentAttributesDescription
selfclass(vgrid_object)inGrid.
loreal(kind=R8P)outMin and max.
hireal(kind=R8P)outMin and max.
meanreal(kind=R8P)outMean.
deviationreal(kind=R8P)outStandard deviation.
zerosinteger(kind=I8P)outZero values.

Call graph

Functions ​

cell ​

The index (1 based) of the grid point of p (indices ceil((p - min) / delta), gnuplot's), 0 out of the ranges.

Attributes: pure

Returns: integer(kind=I8P)

fortran
function cell(self, p) result(k)

Arguments

NameTypeIntentAttributesDescription
selfclass(vgrid_object)inGrid.
preal(kind=R8P)inPoint.

Call graph

lookup ​

The value at p (gnuplot's voxel(x,y,z)), NaN out of the ranges.

Attributes: pure

Returns: real(kind=R8P)

fortran
function lookup(self, p) result(value)

Arguments

NameTypeIntentAttributesDescription
selfclass(vgrid_object)inGrid.
preal(kind=R8P)inPoint.

Call graph

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