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
| Name | Type | Attributes | Description |
|---|---|---|---|
name | character(len=:) | allocatable | Its name ($grid). |
n | integer(kind=I4P) | Size: N x N x N. | |
lo | real(kind=R8P) | Ranges' starts (x, y, z). | |
hi | real(kind=R8P) | Ranges' ends. | |
ranged | logical | Ranges set. | |
delta | real(kind=R8P) | Spacing. | |
v | real(kind=R4P) | allocatable | Values, x fastest. |
Type-Bound Procedures
| Name | Attributes | Description |
|---|---|---|
resize | pass(self) | Zero values of a new size. |
spacing | pass(self) | Its spacing, once ranged. |
lookup | pass(self) | The value at a point (gnuplot's voxel()). |
cell | pass(self) | The index of a point's grid point, 0 out of the ranges. |
neighbours | pass(self) | The grid points within a radius of a point (vfill). |
above | pass(self) | The grid points above a level (with points|dots). |
isosurface | pass(self) | The facets of a level (marching cubes). |
stats | pass(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
subroutine resize(self, n)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(vgrid_object) | inout | Grid. | |
n | integer(kind=I4P) | in | Size. |
Call graph
spacing
The spacing of the ranged grid: (max - min) / (N - 1) on each axis.
Attributes: pure
subroutine spacing(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(vgrid_object) | inout | Grid. |
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
subroutine neighbours(self, p, radius, grid_units, index, distance, grid_distance)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(vgrid_object) | in | Grid. | |
p | real(kind=R8P) | in | Point. | |
radius | real(kind=R8P) | in | Radius. | |
grid_units | logical | in | Radius in grid units. | |
index | integer(kind=I8P) | out | allocatable | Indices. |
distance | real(kind=R8P) | out | allocatable | Distances. |
grid_distance | real(kind=R8P) | out | allocatable | Grid 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
subroutine above(self, level, every, x, y, z, v)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(vgrid_object) | in | Grid. | |
level | real(kind=R8P) | in | Level. | |
every | integer(kind=I4P) | in | Downsampling. | |
x | real(kind=R8P) | out | allocatable | Points and values. |
y | real(kind=R8P) | out | allocatable | Points and values. |
z | real(kind=R8P) | out | allocatable | Points and values. |
v | real(kind=R8P) | out | allocatable | Points 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
subroutine isosurface(self, level, triangles, x, y, z, nf)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(vgrid_object) | in | Grid. | |
level | real(kind=R8P) | in | Level. | |
triangles | logical | in | Triangles only. | |
x | real(kind=R8P) | out | allocatable | Corners (4, facet). |
y | real(kind=R8P) | out | allocatable | Corners (4, facet). |
z | real(kind=R8P) | out | allocatable | Corners (4, facet). |
nf | integer(kind=I4P) | out | Facets. |
Call graph
stats
The non-zero values' min, max, mean and standard deviation, and the zero count (gnuplot's vgrid_stats).
Attributes: pure
subroutine stats(self, lo, hi, mean, deviation, zeros)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(vgrid_object) | in | Grid. | |
lo | real(kind=R8P) | out | Min and max. | |
hi | real(kind=R8P) | out | Min and max. | |
mean | real(kind=R8P) | out | Mean. | |
deviation | real(kind=R8P) | out | Standard deviation. | |
zeros | integer(kind=I8P) | out | Zero 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)
function cell(self, p) result(k)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(vgrid_object) | in | Grid. | |
p | real(kind=R8P) | in | Point. |
Call graph
lookup
The value at p (gnuplot's voxel(x,y,z)), NaN out of the ranges.
Attributes: pure
Returns: real(kind=R8P)
function lookup(self, p) result(value)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(vgrid_object) | in | Grid. | |
p | real(kind=R8P) | in | Point. |
Call graph