Navigation: Scripting Reference Manual > Functions & Subroutines > ARNComputeIntegral

 

ARNComputeIntegral

 

Contact Us: fredsupport@photonengr.com

 

Description

Returns the integral value of the data array in a 2D ARN of data type Double.  The returned value represents the summation of each cell's value multiplied by its pixel "area" and is equivalent to the Integral value reported in the output window when using the Show Statistics option from the Chart viewer (right mouse click option in a chart window).

 

Syntax

dIntegral = ARNComputeIntegral( arn )

 

Parameters

dIntegral (Double)

Return value corresponding to the integral value in the 2D ARN data.

 

arn As long

Node number of the ARN whose integral is being computed.

 

Example

The following example performs a raytrace, calculates a vector field,extracts the X, Y and Z field component data and reports the integrated energy value for each component.

 

Sub Main

          

    DeleteRays()

    ARNDeleteAllNodes()

    CreateSource( FindFullName( "Optical Sources.Laser Beam - Vector" ) )

    TraceExisting()

 

    'Calculate vector field and store in an arn

    Dim ana As Long, varn As Long

    ana = FindFullName( "Analysis Surface(s).Detector Entity 1 - Ana Hi-res asymmetric" )

    VectorFieldToARN( ana, "Vector Field", varn )

 

    'Extract X, Y and Z field component data to their own 2D complex ARNs

    Dim xfield As Long, yfield As Long, zfield As Long

    xfield = ARNCreate2DComplexFromComplex3D( varn, 0 ) '0 = X field component

    yfield = ARNCreate2DComplexFromComplex3D( varn, 1 ) '1 = Y field component

    zfield = ARNCreate2DComplexFromComplex3D( varn, 2 ) '2 = Z field component

 

    'Rename the field component ARNs

    ARNSetName( xfield, "X complex field" )

    ARNSetName( yfield, "Y complex field" )

    ARNSetName( zfield, "Z complex field" )

 

    'Extract the Energy from each X, Y, Z field component

    Dim xenergy As Long, yenergy As Long, zenergy As Long

    xenergy = ARNCreate2DDoubleFromComplex( xfield, 0 ) '0 for Energy

    yenergy = ARNCreate2DDoubleFromComplex( yfield, 0 ) '0 for Energy

    zenergy = ARNCreate2DDoubleFromComplex( zfield, 0 ) '0 for Energy

 

    'Integrate the energy total for each component

    Dim xtot As Double, ytot As Double, ztot As Double

    xtot = ARNComputeIntegral( xenergy )

    ytot = ARNComputeIntegral( yenergy )

    ztot = ARNComputeIntegral( zenergy )

 

    'Report results

    Print ""

    Print "Total energy in X = " & xtot

    Print "Total energy in Y = " & ytot

    Print "Total energy in Z = " & ztot

 

End Sub

 

See Also

All ARN Scripting Commands

 

 

 

 

 

Copyright © Photon Engineering, LLC