PyPO User Manual
BeamInit.h File Reference

Initialize beam objects. More...

#include <iostream>
#include <array>
#include <cmath>
#include <complex>
#include "Utils.h"
#include "Structs.h"
#include "InterfaceReflector.h"

Go to the source code of this file.

Macros

#define M_PI   3.14159265358979323846
 
#define __BeamInit_h
 

Functions

template<typename T , typename U , typename V >
void initFrame (T rdict, U *fr)
 
template<typename T , typename U , typename V >
void initRTGauss (T grdict, U *fr)
 
template<typename T >
pdfGauss (std::vector< T > vars, std::vector< T > scales)
 
template<typename T , typename U , typename V , typename W , typename G >
void initGauss (T gdict, U refldict, V *res_field, V *res_current)
 
template<typename T , typename U , typename V , typename W , typename G >
void initScalarGauss (T sgdict, U refldict, V *res_field)
 
template<typename T , typename U , typename V , typename W >
void calcJM (T *res_field, T *res_current, V refldict, int mode)
 

Detailed Description

Initialize beam objects.

Initializes ray-trace frames, PO beams, and custom beams.

Function Documentation

◆ calcJM()

template<typename T , typename U , typename V , typename W >
void calcJM ( T *  res_field,
T *  res_current,
refldict,
int  mode 
)

Calculate currents from electromagnetic field.

Calculate the J and M vectorial currents given a vectorial E and H field. Can calculate full currents, PMC and PEC surfaces.

Parameters
res_fieldPointer to c2Bundle or c2Bundlef object.
res_currentPointer to c2Bundle or c2Bundlef object.
refldictreflparams or reflparamsf object corresponding to surface on which to calculate currents.
modeHow to calculate currents. 0 is full currents, 1 is PMC and 2 is PEC.
See also
c2Bundle
c2Bundlef
reflparams
reflparamsf

◆ initFrame()

template<typename T , typename U , typename V >
void initFrame ( rdict,
U *  fr 
)

Initialize ray-trace frame from RTDict or RTDictf.

Takes an RTDict or RTDictf and generates a frame object, which can be used to initialize a ray-trace.

Parameters
rdictRTDict or RTDictf object from which to generate a frame.
frPointer to cframe or cframef object.
See also
RTDict
RTDictf
cframe
cframef

◆ initGauss()

template<typename T , typename U , typename V , typename W , typename G >
void initGauss ( gdict,
refldict,
V *  res_field,
V *  res_current 
)

Initialize Gaussian beam from GPODict or GPODictf.

The generated Gaussian has E-field and magnetic currents only. This is what you want as a source in PO calculations.

Takes a GPODict or GPODictf and generates two c2Bundle or c2Bundlef objects, which contain the field and associated currents and are allocated to passed pointer arguments.

Parameters
gdictGPODict or GPODictf object from which to generate a Gaussian beam.
refldictreflparams or reflparamsf object corresponding to surface on which to generate the Gaussian beam.
res_fieldPointer to c2Bundle or c2Bundlef object.
res_currentPointer to c2Bundle or c2Bundlef object.
See also
GPODict
GPODictf
reflparams
reflparamsf
c2Bundle
c2Bundlef

◆ initRTGauss()

template<typename T , typename U , typename V >
void initRTGauss ( grdict,
U *  fr 
)

Initialize Gaussian ray-trace frame from RTDict or RTDictf.

Takes a GRTDict or GRTDictf and generates a frame object, which can be used to initialize a Gaussian ray-trace.

Parameters
grdictGRTDict or GRTDictf object from which to generate a frame.
frPointer to cframe or cframef object.
See also
GRTDict
GRTDictf
cframe
cframef

◆ initScalarGauss()

template<typename T , typename U , typename V , typename W , typename G >
void initScalarGauss ( sgdict,
refldict,
V *  res_field 
)

Initialize scalar Gaussian beam from GPODict or GPODictf.

Takes a ScalarGPODict or ScalarGPODictf and generates an arrC1 or arrC1f object.

Parameters
gdictScalarGPODict or ScalarGPODictf object from which to generate a Gaussian beam.
refldictreflparams or reflparamsf object corresponding to surface on which to generate the Gaussian beam.
res_fieldPointer to arrC1 or arrC1f object.
See also
ScalarGPODict
ScalarGPODictf
reflparams
reflparamsf
arrC1
arrC1f

◆ pdfGauss()

template<typename T >
T pdfGauss ( std::vector< T >  vars,
std::vector< T >  scales 
)

Probability density function for drawing ray positions and tilts from Gaussian.

The density function is used for generating Gaussian ray-trace beams. Using rejection sampling, the method draws samples from the Gaussian pdf.

Parameters
varsVector of length 4, containing the xy positions and tilts of the ray to be checked.
scalesVector of length 4 containing the scale factors along xy and tilts