PyPO User Manual
BindUtils.py File Reference

Utilities for the ctypes interface. More...

Functions

def PyPO.BindUtils.sfieldConv (field, c_field, size, ct_t)
 Convert a PyPO scalarfield object to a ctypes struct. More...
 
def PyPO.BindUtils.arrC1ToObj (res, shape, np_t)
 Convert a ctypes arrC1 or arrC1f struct to a PyPO scalarfield. More...
 
def PyPO.BindUtils.c2BundleToObj (res, shape, obj_t, np_t)
 Convert a ctypes c2Bundle or c2Bundlef to a PyPO fields or currents object. More...
 
def PyPO.BindUtils.c4BundleToObj (res, shape, np_t)
 Convert a ctypes c4Bundle or c4Bundlef to a PyPO fields and currents object. More...
 
def PyPO.BindUtils.c2rBundleToObj (res, shape, np_t)
 Convert a ctypes c2rBundle or c2rBundlef to a PyPO fields and rfield object. More...
 
def PyPO.BindUtils.allocate_arrC1 (res, size, ct_t)
 allocate a ctypes arrC1 or arrC1f struct. More...
 
def PyPO.BindUtils.allocate_c2Bundle (res, size, ct_t)
 allocate a ctypes c2Bundle or c2Bundlef struct. More...
 
def PyPO.BindUtils.allocate_c4Bundle (res, size, ct_t)
 allocate a ctypes c4Bundle or c4Bundlef struct. More...
 
def PyPO.BindUtils.allocate_c2rBundle (res, size, ct_t)
 allocate a ctypes c2rBundle or c2rBundlef struct. More...
 
def PyPO.BindUtils.allfill_reflparams (inp, reflparams_py, ct_t)
 Allocate and fill ctypes reflparams or reflparamsf from a reflDict. More...
 
def PyPO.BindUtils.allocate_reflcontainer (res, size, ct_t)
 Allocate ctypes reflcontainer or reflcontainerf. More...
 
def PyPO.BindUtils.allocate_cframe (res, size, ct_t)
 Allocate a ctypes cframe or cframef struct. More...
 
def PyPO.BindUtils.allfill_cframe (res, frame_py, size, ct_t)
 Allocate and fill a ctypes cframe or cframef struct. More...
 
def PyPO.BindUtils.allfill_c2Bundle (res, obj_py, size, ct_t)
 Allocate and fill a ctypes c2Bundle or c2Bundleff struct. More...
 
def PyPO.BindUtils.allfill_RTDict (res, rdict_py, ct_t)
 Allocate and fill an RTDict struct, for generating a tubular ray-trace frame. More...
 
def PyPO.BindUtils.allfill_GRTDict (res, grdict_py, ct_t)
 Allocate and fill a GRTDict, for generating a Gaussian ray-trace frame. More...
 
def PyPO.BindUtils.allfill_GPODict (res, gdict_py, ct_t)
 Allocate and fill a GPODict, for generating a Gaussian beam field and current. More...
 
def PyPO.BindUtils.allfill_SGPODict (res, sgdict_py, ct_t)
 Allocate and fill a ScalarGPODict, for generating a scalar Gaussian beam field. More...
 
def PyPO.BindUtils.allfill_mat4D (mat, ct_t)
 Allocate and fill a 4D matrix for transforming frames and fields/currents. More...
 
def PyPO.BindUtils.creflToObj (res, shape, np_t)
 Convert a reflector grids struct to a PyPO grids object. More...
 
def PyPO.BindUtils.frameToObj (res, np_t, shape)
 Convert a cframe struct to a PyPO frame object. More...
 

Detailed Description

Utilities for the ctypes interface.

These methods are mostly for allocating and deallocating data. Also, Python types and PyPO objects are converted to ctypes structs here and vice versa. After converting to a ctypes struct, the struct is passed to the C/C++ source code and converted to a proper C/C++ struct for further usage.

Function Documentation

◆ allfill_c2Bundle()

def PyPO.BindUtils.allfill_c2Bundle (   res,
  obj_py,
  size,
  ct_t 
)

Allocate and fill a ctypes c2Bundle or c2Bundleff struct.

Parameters
resA ctypes c2Bundle or c2Bundlef struct.
obj_pya PyPO fields or currents object.
sizeNumber of points in struct.
ct_tType of point in struct.
See also
c2Bundle
c2Bundlef
fields
currents

◆ allfill_cframe()

def PyPO.BindUtils.allfill_cframe (   res,
  frame_py,
  size,
  ct_t 
)

Allocate and fill a ctypes cframe or cframef struct.

Parameters
resA ctypes cframe or cframef struct.
frame_pyA PyPO frame object.
sizeNumber of points in struct.
ct_tType of point in struct.
See also
cframe
cframef
frame

◆ allfill_GPODict()

def PyPO.BindUtils.allfill_GPODict (   res,
  gdict_py,
  ct_t 
)

Allocate and fill a GPODict, for generating a Gaussian beam field and current.

Parameters
resA GPODict or GPODictf struct.
gdict_pyA GPODict.
ct_tType of field in struct.
See also
GPODict
GPODictf

◆ allfill_GRTDict()

def PyPO.BindUtils.allfill_GRTDict (   res,
  grdict_py,
  ct_t 
)

Allocate and fill a GRTDict, for generating a Gaussian ray-trace frame.

Parameters
resA GRTDict or GRTDictf struct.
grdict_pyA GRTDict.
ct_tType of field in struct.
See also
GRTDict
GRTDictf

◆ allfill_mat4D()

def PyPO.BindUtils.allfill_mat4D (   mat,
  ct_t 
)

Allocate and fill a 4D matrix for transforming frames and fields/currents.

Parameters
matMatrix containing transformation.
ct_tType of field in matrix.
Returns
c_mat The ctypes representation of the matrix.

◆ allfill_reflparams()

def PyPO.BindUtils.allfill_reflparams (   inp,
  reflparams_py,
  ct_t 
)

Allocate and fill ctypes reflparams or reflparamsf from a reflDict.

Parameters
inpA ctypes reflparams or reflparamsf struct.
reflparams_pyPyPO reflDict dictionary.
ct_tType of point in struct.
See also
reflparams
reflparamsf
reflDict

◆ allfill_RTDict()

def PyPO.BindUtils.allfill_RTDict (   res,
  rdict_py,
  ct_t 
)

Allocate and fill an RTDict struct, for generating a tubular ray-trace frame.

Parameters
resA RTDict or RTDictf struct.
rdict_pyA TubeRTDict.
ct_tType of point in struct.
See also
RTDict
RTDictf

◆ allfill_SGPODict()

def PyPO.BindUtils.allfill_SGPODict (   res,
  sgdict_py,
  ct_t 
)

Allocate and fill a ScalarGPODict, for generating a scalar Gaussian beam field.

Parameters
resA ScalarGPODict or ScalarGPODictf struct.
sgdict_pyA GPODict.
ct_tType of field in struct.
See also
ScalarGPODict
ScalarGPODictf

◆ allocate_arrC1()

def PyPO.BindUtils.allocate_arrC1 (   res,
  size,
  ct_t 
)

allocate a ctypes arrC1 or arrC1f struct.

Struct is then passed to and filled by the C/C++ code.

Parameters
resThe arrC1 or arrC1f struct.
sizeNumber of points in struct.
ct_tType of point in struct.
See also
arrC1
arrC1f

◆ allocate_c2Bundle()

def PyPO.BindUtils.allocate_c2Bundle (   res,
  size,
  ct_t 
)

allocate a ctypes c2Bundle or c2Bundlef struct.

Struct is then passed to and filled by the C/C++ code.

Parameters
resThe c2Bundle or c2Bundlef struct.
sizeNumber of points in struct.
ct_tType of point in struct.
See also
c2Bundle
c2Bundlef

◆ allocate_c2rBundle()

def PyPO.BindUtils.allocate_c2rBundle (   res,
  size,
  ct_t 
)

allocate a ctypes c2rBundle or c2rBundlef struct.

Struct is then passed to and filled by the C/C++ code.

Parameters
resThe c2rBundle or c2rBundlef struct.
sizeNumber of points in struct.
ct_tType of point in struct.
See also
c2rBundle
c2rBundlef

◆ allocate_c4Bundle()

def PyPO.BindUtils.allocate_c4Bundle (   res,
  size,
  ct_t 
)

allocate a ctypes c4Bundle or c4Bundlef struct.

Struct is then passed to and filled by the C/C++ code.

Parameters
resThe c4Bundle or c4Bundlef struct.
sizeNumber of points in struct.
ct_tType of point in struct.
See also
c4Bundle
c4Bundlef

◆ allocate_cframe()

def PyPO.BindUtils.allocate_cframe (   res,
  size,
  ct_t 
)

Allocate a ctypes cframe or cframef struct.

Parameters
resA ctypes cframe or cframef struct.
sizeNumber of points in struct.
ct_tType of point in struct.
See also
cframe
cframef

◆ allocate_reflcontainer()

def PyPO.BindUtils.allocate_reflcontainer (   res,
  size,
  ct_t 
)

Allocate ctypes reflcontainer or reflcontainerf.

Parameters
resA ctypes reflcontainer or reflcontainerf struct.
sizeNumber of points on reflector.
ct_tType of point in struct.
See also
reflcontainer
reflcontainerf
reflDict

◆ arrC1ToObj()

def PyPO.BindUtils.arrC1ToObj (   res,
  shape,
  np_t 
)

Convert a ctypes arrC1 or arrC1f struct to a PyPO scalarfield.

Parameters
resAn arrC1 or arrC1f struct containing the scalarfield.
shapeThe shape of the scalarfield.
np_tType of data in numpy array to be filled.
Returns
res PyPO scalarfield object.
See also
arrC1
arrC1f
scalarfield

◆ c2BundleToObj()

def PyPO.BindUtils.c2BundleToObj (   res,
  shape,
  obj_t,
  np_t 
)

Convert a ctypes c2Bundle or c2Bundlef to a PyPO fields or currents object.

Parameters
resA c2Bundle or c2Bundlef struct.
shapeShape of the fields or currents object.
obj_tWhether to convert to a fields or currents object.
np_tType of data in numpy array to be filled.
Returns
out A fields or currents object filled with incoming EH fields or JM currents..
See also
c2Bundle
c2Bundlef
fields
currents

◆ c2rBundleToObj()

def PyPO.BindUtils.c2rBundleToObj (   res,
  shape,
  np_t 
)

Convert a ctypes c2rBundle or c2rBundlef to a PyPO fields and rfield object.

The rfield will be filled by the calculated Poynting vectors.

Parameters
resA c2Bundle or c2rBundlef struct.
shapeShape of the fields and rfield object.
np_tType of data in numpy array to be filled.
Returns
out1 A fields object filled with reflected EH fields.
out2 An rfield object filled with reflected Poynting vectors.
See also
c2rBundle
c2rBundlef
fields
rfields

◆ c4BundleToObj()

def PyPO.BindUtils.c4BundleToObj (   res,
  shape,
  np_t 
)

Convert a ctypes c4Bundle or c4Bundlef to a PyPO fields and currents object.

Parameters
resA c4Bundle or c4Bundlef struct.
shapeShape of the fields and currents object.
np_tType of data in numpy array to be filled.
Returns
out1 A fields object filled with incoming EH fields.
out2 A currents object filled with JM currents.
See also
c4Bundle
c4Bundlef
fields
currents

◆ creflToObj()

def PyPO.BindUtils.creflToObj (   res,
  shape,
  np_t 
)

Convert a reflector grids struct to a PyPO grids object.

Parameters
resA reflcontainer or reflcontainerf struct.
shapeShape of the reflector grid.
np_tType of field in PyPO object.
Returns
out The grids as PyPO object.
See also
reflcontainer
reflcontainerf
reflGrids

◆ frameToObj()

def PyPO.BindUtils.frameToObj (   res,
  np_t,
  shape 
)

Convert a cframe struct to a PyPO frame object.

Parameters
resA cframe or cframef struct.
np_tType of field in PyPO frame object.
shapeShape of resulting PyPO frame.
Returns
out PyPO frame object.
See also
cframe
cframef
frame

◆ sfieldConv()

def PyPO.BindUtils.sfieldConv (   field,
  c_field,
  size,
  ct_t 
)

Convert a PyPO scalarfield object to a ctypes struct.

@params field A PyPO scalarfield object. @params c_field A ctypes arrC1 or arrC1f struct.

Parameters
sizeNumber of points in fields object.
ct_tType of the floating point numbers for ctypes.
See also
scalarfield
arrC1
arrC1f