Class InterpolatedNodalSurface

  • All Implemented Interfaces:
    ParameterizedData, NodalSurface, Surface, Serializable, org.joda.beans.Bean, org.joda.beans.ImmutableBean

    public final class InterpolatedNodalSurface
    extends Object
    implements NodalSurface, org.joda.beans.ImmutableBean, Serializable
    A surface based on interpolation between a number of nodal points.

    This class defines a surface in terms of a fixed number of nodes, referred to as parameters.

    Each node has an x-value and a y-value. The interface is focused on finding the z-value for a given x-value and y-value. An interpolator is used to find z-values for x-values and y-values between two nodes.

    See Also:
    Serialized Form
    • Method Detail

      • of

        public static InterpolatedNodalSurface of​(SurfaceMetadata metadata,
                                                  DoubleArray xValues,
                                                  DoubleArray yValues,
                                                  DoubleArray zValues,
                                                  SurfaceInterpolator interpolator)
        Creates an interpolated surface with metadata.

        The value arrays must be sorted, by x-values then y-values. An exception is thrown if they are not sorted.

        Parameters:
        metadata - the surface metadata
        xValues - the x-values, must be sorted from low to high
        yValues - the y-values, must be sorted from low to high within x
        zValues - the z-values
        interpolator - the interpolator
        Returns:
        the surface
      • ofUnsorted

        public static InterpolatedNodalSurface ofUnsorted​(SurfaceMetadata metadata,
                                                          DoubleArray xValues,
                                                          DoubleArray yValues,
                                                          DoubleArray zValues,
                                                          SurfaceInterpolator interpolator)
        Creates an interpolated surface with metadata, where the values are not sorted.

        The value arrays will be sorted, by x-values then y-values. Both the z-values and parameter metadata will be sorted along with the x and y values.

        Parameters:
        metadata - the surface metadata
        xValues - the x-values
        yValues - the y-values
        zValues - the z-values
        interpolator - the interpolator
        Returns:
        the surface
      • getParameterCount

        public int getParameterCount()
        Description copied from interface: ParameterizedData
        Gets the number of parameters.

        This returns the number of parameters, which can be used to create a loop to access the other methods on this interface.

        Specified by:
        getParameterCount in interface ParameterizedData
        Returns:
        the number of parameters
      • getParameter

        public double getParameter​(int parameterIndex)
        Description copied from interface: ParameterizedData
        Gets the value of the parameter at the specified index.
        Specified by:
        getParameter in interface ParameterizedData
        Parameters:
        parameterIndex - the zero-based index of the parameter to get
        Returns:
        the value of the parameter
      • withParameter

        public InterpolatedNodalSurface withParameter​(int parameterIndex,
                                                      double newValue)
        Description copied from interface: ParameterizedData
        Returns a copy of the data with the value at the specified index altered.

        This instance is immutable and unaffected by this method call.

        Specified by:
        withParameter in interface NodalSurface
        Specified by:
        withParameter in interface ParameterizedData
        Specified by:
        withParameter in interface Surface
        Parameters:
        parameterIndex - the zero-based index of the parameter to get
        newValue - the new value for the specified parameter
        Returns:
        a parameterized data instance based on this with the specified parameter altered
      • withPerturbation

        public InterpolatedNodalSurface withPerturbation​(ParameterPerturbation perturbation)
        Description copied from interface: ParameterizedData
        Returns a perturbed copy of the data.

        The perturbation instance will be invoked once for each parameter in this instance, returning the perturbed value for that parameter. The result of this method is a new instance that is based on those perturbed values.

        This instance is immutable and unaffected by this method call.

        Specified by:
        withPerturbation in interface NodalSurface
        Specified by:
        withPerturbation in interface ParameterizedData
        Specified by:
        withPerturbation in interface Surface
        Parameters:
        perturbation - the perturbation to apply
        Returns:
        a parameterized data instance based on this with the specified perturbation applied
      • zValue

        public double zValue​(double x,
                             double y)
        Description copied from interface: Surface
        Computes the z-value for the specified x-value and y-value.
        Specified by:
        zValue in interface Surface
        Parameters:
        x - the x-value to find the z-value for
        y - the y-value to find the z-value for
        Returns:
        the value at the x/y point
      • zValueParameterSensitivity

        public UnitParameterSensitivity zValueParameterSensitivity​(double x,
                                                                   double y)
        Description copied from interface: Surface
        Computes the sensitivity of the z-value with respect to the surface parameters.

        This returns an array with one element for each x-y parameter of the surface. The array contains one a sensitivity value for each parameter used to create the surface.

        Specified by:
        zValueParameterSensitivity in interface Surface
        Parameters:
        x - the x-value at which the parameter sensitivity is computed
        y - the y-value at which the parameter sensitivity is computed
        Returns:
        the sensitivity at the x/y/ point
      • firstPartialDerivatives

        public ValueDerivatives firstPartialDerivatives​(double x,
                                                        double y)
        Description copied from interface: Surface
        Computes the partial derivatives of the surface.

        The first derivatives are dz/dx and dz/dy. The derivatives are in the following order:

        • [0] derivative with respect to x
        • [1] derivative with respect to y
        Specified by:
        firstPartialDerivatives in interface Surface
        Parameters:
        x - the x-value at which the partial derivative is taken
        y - the y-value at which the partial derivative is taken
        Returns:
        the z-value and it's partial first derivatives
      • withMetadata

        public InterpolatedNodalSurface withMetadata​(SurfaceMetadata metadata)
        Description copied from interface: NodalSurface
        Returns a new surface with the specified metadata.

        This allows the metadata of the surface to be changed while retaining all other information. If parameter metadata is present, the size of the list must match the number of parameters of this surface.

        Specified by:
        withMetadata in interface NodalSurface
        Specified by:
        withMetadata in interface Surface
        Parameters:
        metadata - the new metadata for the surface
        Returns:
        the new surface
      • withZValues

        public InterpolatedNodalSurface withZValues​(DoubleArray zValues)
        Description copied from interface: NodalSurface
        Returns a new surface with the specified values.

        This allows the z-values of the surface to be changed while retaining the same x-values and y-values.

        Specified by:
        withZValues in interface NodalSurface
        Parameters:
        zValues - the new y-values for the surface
        Returns:
        the new surface
      • getMetadata

        public SurfaceMetadata getMetadata()
        Gets the surface metadata.

        The metadata includes an optional list of parameter metadata. If present, the size of the parameter metadata list will match the number of parameters of this surface.

        Specified by:
        getMetadata in interface Surface
        Returns:
        the value of the property, not null
      • getXValues

        public DoubleArray getXValues()
        Gets the array of x-values, one for each point.

        This array will contains at least two elements.

        Specified by:
        getXValues in interface NodalSurface
        Returns:
        the value of the property, not null
      • getYValues

        public DoubleArray getYValues()
        Gets the array of y-values, one for each point.

        This array will contains at least two elements and be of the same length as x-values.

        Specified by:
        getYValues in interface NodalSurface
        Returns:
        the value of the property, not null
      • getZValues

        public DoubleArray getZValues()
        Gets the array of z-values, one for each point.

        This array will contains at least two elements and be of the same length as x-values.

        Specified by:
        getZValues in interface NodalSurface
        Returns:
        the value of the property, not null
      • getInterpolator

        public SurfaceInterpolator getInterpolator()
        Gets the underlying interpolator.
        Returns:
        the value of the property, not null
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object