Navigation: Scripting Reference Manual > Functions & Subroutines > SetSourceDirApodSampledImportFile

 

SetSourceDirApodSampledImportFile

 

Contact Us: fredsupport@photonengr.com

 

Description

This subroutine changes the directional power apodization of a source to the type, "Sampled as a function of spherical angles", sets the polar and azimuthal reference axis direction vectors and populates the sampled table using file data.

 

 

Syntax

SetSourceDirApodSampledImportFile(  srcNode, fileName )

 

 

Parameters

srcNode As Long

Node number of the source whose power direction apodization specification is being modified.

 

fileName As String

Full path to the file being used to set the polar and azimuth reference vectors as well as the sample table.

 

 

Example

The example below demonstrates how to create a source node that generates rays isotropically into a cone and then use file data to specify the source's spherically sampled power apodization settings.

 

Sub Main

 

    'Create the source node

    Dim srcNode As Long

    Dim tEnt As T_ENTITY

    InitEntity( tEnt )

    tEnt.name = "Intensity Apodized"

    srcNode   = AddSource( tEnt )

 

    'Set the positions grid to be 1x1 rays

    Dim xSemi As Double, ySemi As Double, xNum As Long, yNum As Long, isEllipse As Boolean

    GetSourcePosGrid( srcNode, xSemi, ySemi, xNum, yNum, isEllipse )

    xNum = 1

    yNum = 1

    SetSourcePosGrid( srcNode, xSemi, ySemi, xNum, yNum, isEllipse )

 

    'Set the ray directions to be random into a cone.  Power scaling is isotropic, not Lambertian.

    Dim tDirRange As T_SOURCEDIRRANGE

    tDirRange.rayDirCount   = 1000000

    tDirRange.isLambertian  = False

    tDirRange.isElliptical  = True

    tDirRange.semiApeX      = 50

    tDirRange.semiApeY      = 50

    tDirRange.innerSemiApeX = 0.0

    tDirRange.innerSemiApeY = 0.0

    tDirRange.XdirX         = 1.0

    tDirRange.XdirY         = 0.0

    tDirRange.XdirZ         = 0.0

    tDirRange.ZdirX         = 0.0

    tDirRange.ZdirY         = 0.0

    tDirRange.ZdirZ         = 1.0

    SetSourceDirRange( srcNode, tDirRange )

 

    'Specify that the source have a directional apodization applied

    'by loading the distribution from a properly formatted text file

    Dim fName As String

    fName = "C:\temp\sourceIntensityApodization.txt"

    SetSourceDirApodSampledImportFile( srcNode, fName )

 

    'Udpate the FRED document

    Update

 

End Sub

 

 

See Also

Source Script Commands

 

 

 

 

 

Copyright © Photon Engineering, LLC