xopto.mccyl.mcsurface.base module

INTERNAL = 'internal'

Identifier of the internal sample surface.

NONE = 'none'

Identifier used for a surface that is not yet assigned.

OUTER = 'outer'

Identifier of the outer sample surface.

class SurfaceLayoutAny(location: str = 'none')[source]

Bases: xopto.mccyl.mcsurface.base.SurfaceLayoutBase

Base class of surface layouts that can be used for both the outer or internal sample surfaces.

Create a layout for the outer or internal sample surfaces. By default the location is not initialized.

classmethod fromdict(data: dict)xopto.mccyl.mcsurface.base.SurfaceLayoutAny[source]

Create a new instance of a surface layout from a dict. The dict keys must match the parameter names defined by the constructor.

class SurfaceLayoutBase(location: str = 'outer')[source]

Bases: xopto.mcbase.mcobject.McObject

Base class of all the sample surface layouts.

Complex surface layout at the specified sample surface.

Parameters

location (OUTER or INTERNAL) – Location of the sample surface to which the layout applies.

property location: str

Location of the surface layout.

class SurfaceLayoutDefault(location: str = 'none')[source]

Bases: xopto.mccyl.mcsurface.base.SurfaceLayoutAny

Default / dummy layout for the outer or internal sample surface.

Create a layout for the outer or internal sample surfaces. By default the location is not initialized.

cl_declaration(mc: xopto.mcbase.mcobject.McObject)str[source]

Structure that defines the dummy reflector in the Monte Carlo simulator.

cl_implementation(mc: xopto.mcbase.mcobject.McObject)str[source]

OpenCL implementation of the default surface layout

static cl_options(mc: xopto.mcbase.mcobject.McObject)str[source]

Raw OpenCL options of the default detector.

cl_pack(mc: xopto.mcbase.mcobject.McObject, target: Optional[xopto.cl.cltypes.Structure] = None)xopto.cl.cltypes.Structure[source]

Fills the structure (target) with the data required by the Monte Carlo simulator. See the SurfaceLayoutDefault.cl_type() for a detailed list of fields.

Parameters
Returns

target – Filled ctypes structure received as an input argument or a new instance if the input argument target is None.

Return type

cltypes.Structure

cl_type(mc: xopto.mcbase.mcobject.McObject)xopto.cl.cltypes.Structure[source]

Structure that is passed to the Monte carlo simulator kernel.

Parameters

mc (McObject) – A Monte Carlo simulator instance.

Returns

struct – A structure type that represents the surface layout in the Monte Carlo kernel.

The returned structure type implements the following fields:

  • dummy: mc_int_t

    Dummy field of the dummy detector.

Return type

cltypes.Structure

classmethod fromdict(data: dict)xopto.mccyl.mcsurface.base.SurfaceLayoutDefault[source]

Create an instance of SurfaceLayoutDefault from a dictionary.

Parameters

data (dict) – Dictionary created by the SurfaceLayoutDefault.todict() method.

todict()dict[source]

Export object to dict.

class SurfaceLayoutInternal(*args, **kwargs)[source]

Bases: xopto.mccyl.mcsurface.base.SurfaceLayoutBase

Base class of the internal sample surfaces layout.

Create a layout for the internal sample surfaces.

class SurfaceLayoutOuter(*args, **kwargs)[source]

Bases: xopto.mccyl.mcsurface.base.SurfaceLayoutBase

Base class of the outer sample surface layout.

Create a layout for the outer sample surface.

class SurfaceLayouts(outer: Optional[xopto.mccyl.mcsurface.base.SurfaceLayoutOuter] = None, internal: Optional[xopto.mccyl.mcsurface.base.SurfaceLayoutInternal] = None)[source]

Bases: xopto.mcbase.mcobject.McObject

Container of the outer and internal sample surface layouts.

Parameters
cl_declaration(mc: xopto.mcbase.mcobject.McObject)str[source]

Declarations of surface layouts in OpenCL.

cl_implementation(mc: xopto.mcbase.mcobject.McObject)str[source]

Implementation of surface layouts.

cl_options(mc: xopto.mcbase.mcobject.McObject)List[Tuple[str, str]][source]

Returns the OpenCL options of the surface layout.

If the outer and / or internal sample surface layouts are specified (not the dummy default SurfaceLayoutDefault), the corresponding OpenCL options that activate the use of surface layouts are set, i.e. MC_USE_OUTER_SURFACE_LAYOUT for the outer surface and MC_USE_INTERNAL_SURFACE_LAYOUT for the internal surface.

cl_pack(mc: xopto.mcbase.mcobject.McObject, target: Optional[xopto.cl.cltypes.Structure] = None)xopto.cl.cltypes.Structure[source]

Fills the structure (target) with the data required by the Monte Carlo simulator. See the SurfaceLayouts.cl_type() method for a detailed list of fields.

Parameters
Returns

target – Filled structure received as an input argument or a new instance if the input argument target is None.

Return type

cltypes.Structure

cl_type(mc: xopto.mcbase.mcobject.McObject)xopto.cl.cltypes.Structure[source]

Structure that is passed to the OpenCL simulator.

Parameters

mc (McObject) – A Monte Carlo simulator instance.

Returns

struct – A structure type that represents surface layouts in the Monte Carlo kernel.

The returned structure type implements the following fields:

  • outer: SurfaceLayoutOuter

    Layout of the outer sample surface (z = 0).

  • internal: SurfaceLayoutInternal

    Layout of the internal sample surfaces (z = 0).

Return type

cltypes.Structure

property internal: xopto.mcbase.mcobject.McObject

Layouts of the internal sample surfaces.

property outer: xopto.mcbase.mcobject.McObject

Outer sample surface layout.

todict()dict[source]

Export object to dict.

types()tuple[source]

Returns a tuple of surface layout types assigned to this instance.