Navigation: Scripting Reference Manual > Functions & Subroutines > MPCGetRaySumMode

 

MPCGetRaySumMode

 

Contact Us: fredsupport@photonengr.com

 

Description

This subroutine retrieves the state of the MPC Coherent Ray Summation mode as well as the state of the Single precision mode flag when coherent ray summation was last active.

 

Syntax

MPCGetRaySumMode( isActive, isSingle )

 

 

Parameters

isActive As Boolean

If True, then MPC coherent ray summation mode is currently active.  If False, then the MPC coherent ray summation mode is not active and coherent field summation calculations will be performed on the CPU.

 

isSingle As Boolean

When isActive = True, the isSingle argument indicates whether single precision mode is being used.  When isActive = False, the isSingle argument indicates whether single precision mode was toggled when the MPC coherent ray summation mode was last activated.

 

Example

The following example performs irradiance calculations using the CPU and GPU (in single precision mode), differences the two results and then displays the residual.

 

Sub Main

          

    'Document cleanup

    EnableTextPrinting(True)

    DeleteRays()

    ARNDeleteAllNodes()

    ClearOutputWindow()

 

    'Source and analysis surface used

    Dim src As Long, ana As Long

    src = FindFullName( "Optical Sources.Laser Diode Beam (coherent) 1" )

    ana = FindFullName( "Analysis Surface(s).Source Analysis Small" )

 

    'Turn off GPU field summation, perform raytrace and analysis

    Dim cpuARN As Long

    Print "CPU Start: " & Time()

    MPCSetRaySumMode( False, False )

    EnableTextPrinting(False)

    DeleteRays()

    CreateSource( src )

    TraceExisting()

    IrradianceToARN( ana, "CPU Irradiance", cpuARN )

    EnableTextPrinting(True)

    Print "CPU End: " & Time()

 

    'Turn on GPU field summation, repeat raytrace and analysis

    Dim gpuARN As Long, wantSingle As Boolean

    wantSingle = False 'True for single precision mode

    Print "GPU Single?: " & wantSingle

    Print "GPU Start: " & Time()

    MPCSetRaySumMode( True, wantSingle )

    EnableTextPrinting(False)

    DeleteRays()

    CreateSource( src )

    TraceExisting()

    IrradianceToARN( ana, "GPU Irradiance", gpuARN )

    EnableTextPrinting(True)

    Print "GPU End: " & Time()

 

    'Take the difference of the two ARNs and display the residual

    Dim resARN As Long

    resARN = ARNCreateCopy( gpuARN, "Residual" )

    ARNLinearCombination( -1, resARN, 1, cpuARN )

    ARNDisplayInChart( resARN, "" )

 

End Sub

 

 

See Also

MPCAdvancedRaytrace

MPCGetSimpleTraceMode

MPCInitAdvancedRaytrace

T_MPCADVANCEDRAYTRACE

MPCRaytrace

MPCSetRaySumMode

MPCSetSimpleTraceMode

 

 

 

 

 

Copyright © Photon Engineering, LLC