Navigation: Scripting Reference Manual > Functions & Subroutines > ARNCombineIntoMultiSlice

 

ARNCombineIntoMultiSlice

 

Contact Us: fredsupport@photonengr.com

 

Description

This function takes an array of Analysis Results Nodes (ARNs) and combines them together into a single multi-slice ARN, where each slice of the ARN corresponds to one of the ARNs of the input array.  A simple usage of multi-slice ARNs is to be able to read/write a single output file that contains all of the analysis results from a given calculation, rather than reading/writing multiple ARNs individually.

 

Syntax

msARN = ARNCombineIntoMultiSlice( arns(), msName )

 

Parameters

msARN (Long)

Returned node number of the newly created multi-slice ARN.

 

arns() As Long

Array of ARN node numbers indicating the 2D Analysis Results Nodes that will be combined into the resulting multi-slice ARN.

 

msName As String

Supplied name string for the resulting multi-slice ARN.

 

 

Example

The example below performs a raytrace and analysis inside of a loop to generate a number of Analysis Results Nodes.  These ARNs are then Log10 scaled 6 orders of magnitude and combined together into a single multi-slice ARN.  The resulting multi-slice ARN is then saved to an output FRED Grid Data file (FGD file) and also saved to an output video file in the MP4 file format.  Each ARN data grid has resolution 101x81 pixels and the output video file will have final resolution 1000x810 pixels, use auto color-ranging, and have a 1.5 second delay per video frame.

 

Sub Main

 

    ARNDeleteAllNodes()

 

    Dim src As Long, ana As Long

    src = FindFullName( "Optical Sources.Plane Wave Source - SP" )

    ana = FindFullName( "Analysis Surface(s).Focal Plane" )

 

    'Source scan and analysis

    Dim curAng As Double, curArn As Long

    Dim parmString As String

    For curAng = 0 To 25 Step 5

       

        'Set the Plane Wave type source primitive direction

        parmString = "0," & CStr(curAng) & ",SD"

        SourcePrimSetParmValue( src, 5, parmString )

 

        'Raytrace and analyze

        DeleteRays()

        CreateSource( src )

        TraceExisting()

        IrradianceToARN( ana, "Irradiance " & CStr(curAng), curArn )

 

    Next

 

    'Retrieve list of ARNs, Log10 the data and then compile them into a single multi-slice ARN

    Dim arnList() As Long, msArn(0) As Long

    ReDim arnList(ARNGetMaxNodeNum())

    For curArn = 0 To ARNGetMaxNodeNum()

        ARNLog10WithRelativeFloor( curArn, 6, True, False )

        arnList(curArn) = curArn

    Next

    msArn(0) = ARNCombineIntoMultislice( arnList(), "Source Scan Results" )

 

    'Write the multi-slice ARN to an FGD file.

    ARNWriteToFile( msArn(0), GetDocDir() & "\SourceScan.fgd", False, False )

 

    'Write multi-slice ARN out to a video file.

    ARNSaveToVideo( msArn(), 999, 809, 0, 0, 1.5, "Spectrum2", GetDocDir() & "\SourceScan.mp4"  )

 

End Sub

 

 

See Also

All ARN Scripting Commands

 

 

 

 

 

Copyright © Photon Engineering, LLC