Navigation: Scripting Reference Manual > Functions & Subroutines > ARNInterpolateCellValue2D

 

ARNInterpolateCellValue2D

 

Contact Us: fredsupport@photonengr.com

 

Description

Given physical locations along the A and B axes of an ARN, this subroutine uses bilinear interpolation to extract the corresponding interpolated value from the ARN data.  For arrays with three dimensions, the interpolation result is returned as an array whose values correspond to each index in the third dimension of the ARN.  For example, a scalar field calculation will return a data array having dimensions M x N x 1 (zero-based), with the 0th index of the third dimension being the Real values and the 1st index of the third dimension being the Imaginary values.  Calling ARNInterpolateCellValue2D on this data array would return a result array with two values, the first value being the interpolated Real and the second value being the interpolated Imaginary.

 

 

Syntax

ARNInterpolateCellValue2D( arnNode, aVal, bVal, result(), obFlag )

 

 

Parameters

arnNode As Long

The node number of the ARN being queried.

 

aVal As Double

Physical value along the A axis of the ARN at which the data is being interpolated.

 

bVal As Double

Physical value along the B axis of the ARN at which the data is being interpolated.

 

result()

After the subroutine has been called, this variable stores the interpolation results.

 

obFlag As Boolean

After the subroutine has been called, this variable indicates whether the specified A,B value pair lies outside of the bounds of either the A or B axis and therefore cannot be interpolated.

 

 

Example

The following script queries an ARN for the interpolated value at a designated (A,B) location in the data grid and prints a summary of the interpolation results to the output window.

Sub Main

 

    Dim arnNode As Long, curInd As Long

    Dim aVal As Double, bVal As Double

    Dim result() As Double

    Dim obFlag As Boolean

 

    arnNode = ARNFindName( "Irradiance 2" )

    aVal    = 0.5/Sqr(2)

    bVal    = 0.5/Sqr(2)

    ARNInterpolateCellValue2D( arnNode, aVal, bVal, result(), obFlag )

 

    Print "---------------"

    Print "ARN Queried: "      & Chr(9) & ARNGetName( arnNode )

    Print "Calculation Type: " & Chr(9) & ARNGetPhysicalMeaning( arnNode )

    Print "Axis (A,B):"        & Chr(9) & "(" & aVal & ", " & bVal & ")"

    For curInd = 0 To UBound(result)

        Print "Result[" & curInd & "]:" & Chr(9) & result(curInd)

    Next

    Print "Out of bounds?:"    & Chr(9) & obFlag

    Print "---------------"

 

End Sub

 

 

See Also

ARN Script Commands

 

 

 

 

 

Copyright © Photon Engineering, LLC