Grid Surface Class
Definition
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.1.0
public abstract class GridSurface : Surface- Derived
Remarks
The GridSurface class performs interpolation on rectilinear grids where each axis has its own coordinate vector. Grid points are defined by the Cartesian product of these axis coordinates, and function values are stored in row-major order.
A rectilinear grid (also called a product grid) consists of independent coordinate vectors for each dimension. Unlike regular grids, rectilinear grids allow non-uniform spacing along each axis while maintaining axis-aligned structure.
Interpolation methods:
- Nearest-neighbor (CreateNearest): Returns the value at the closest grid point. Fast but discontinuous.
- Linear (multilinear) (CreateLinear): Performs bilinear (2D), trilinear (3D), or multilinear (N-D) interpolation within each grid cell. Continuous but with discontinuous first derivatives at cell boundaries.
- Cubic spline (CreateCubic): Uses specialized 2D/3D cubic surfaces based on CubicSpline with full CubicSplineKind options. Available only for 2D and 3D grids.
- Tensor-product splines (CreateCubicTensorSpline, CreateTensorSpline): Uses N-dimensional tensor-product interpolation with pluggable 1D spline kernels (ISplineKernel1D). Works for any dimension and supports custom kernels via SplineKernels.
Array dimension order: Values are stored in row-major (C-style) order where the last dimension varies fastest. For 2D grids: values[i, j] = f(xAxis[i], yAxis[j]). For 3D grids: values[i, j, k] = f(xAxis[i], yAxis[j], zAxis[k]).
Boundary conditions and extrapolation: The class distinguishes between construction-time GridBoundaryCondition (which affects how tensor-product splines handle out-of-range samples during stencil assembly) and evaluation-time ExtrapolationMode (which controls behavior for query points outside the grid domain). Each surface has a DefaultExtrapolationMode, and evaluation methods support per-call extrapolation mode overrides.
Creating instances: Do not instantiate concrete subclasses directly. Instead, use the static factory methods on GridSurface: CreateNearest(IReadOnlyList<IReadOnlyList<Double>>, IReadOnlyList<Double>, ExtrapolationMode), CreateLinear(IReadOnlyList<IReadOnlyList<Double>>, IReadOnlyList<Double>, ExtrapolationMode), CreateCubic(IReadOnlyList<IReadOnlyList<Double>>, IReadOnlyList<Double>, ExtrapolationMode), CreateCubicTensorSpline(IReadOnlyList<IReadOnlyList<Double>>, IReadOnlyList<Double>, GridBoundaryCondition, ExtrapolationMode), and CreateTensorSpline(IReadOnlyList<IReadOnlyList<Double>>, IReadOnlyList<Double>, ISplineKernel1D, GridBoundaryCondition, ExtrapolationMode).
Properties
| Dimension |
Gets the number of dimensions of the input space.
(Inherited from Surface) |
| Values | Gets a read-only span containing the values of at the data points. |
Methods
| Create | Creates a specialized cubic spline grid surface for 2D or 3D interpolation. |
| Create | Creates a grid surface for N-dimensional interpolation using tensor-product cubic splines. |
| Create | Creates a linear (multilinear) grid surface for N-dimensional interpolation. |
| Create | Creates a nearest-neighbor grid surface for N-dimensional interpolation. |
| Create | Creates a grid surface for N-dimensional interpolation using tensor-product splines with a custom 1D spline kernel. |
| Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) |
| Evaluate(Double[]) |
Evaluates the surface at the specified point.
(Inherited from Surface) |
| Evaluate( |
Evaluates the surface at the specified point.
(Inherited from Surface) |
| Evaluate( |
Evaluates the surface at the specified point.
(Overrides Surface.Evaluate(ReadOnlySpan<Double>)) |
| Evaluate( |
Evaluates the surface at multiple points specified by a list of vectors.
(Inherited from Surface) |
| Evaluate( | Evaluates the surface at the specified point. |
| Evaluate( |
Evaluates the surface at multiple points specified by a read-only span of vectors.
(Inherited from Surface) |
| Evaluate( |
Evaluates the surface at multiple points stored in column-major layout.
(Inherited from Surface) |
| Evaluate | Evaluates the surface at the specified point. |
| Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object) |
| Get | Serves as the default hash function. (Inherited from Object) |
| Get | Gets the Type of the current instance. (Inherited from Object) |
| Gradient( |
Computes the gradient of the surface at the specified point.
(Inherited from Surface) |
| Gradient( |
Computes the gradient of a 2D surface at the specified point.
(Inherited from Surface) |
| Gradient( |
Computes the gradient of the scalar field at the specified point.
(Overrides Surface.Gradient(ReadOnlySpan<Double>, Span<Double>)) |
| Gradient( |
Computes the gradient of the surface at the specified point.
(Inherited from Surface) |
| Gradient( | |
| Gradient | |
| Gradients( |
Computes the gradients of the surface at multiple points.
(Inherited from Surface) |
| Gradients( |
Computes the gradients of the surface at multiple points.
(Inherited from Surface) |
| Hessian |
Computes the Hessian matrix of the surface at the specified point.
(Inherited from Surface) |
| Memberwise | Creates a shallow copy of the current Object. (Inherited from Object) |
| ToString | Returns a string that represents the current object. (Inherited from Object) |