xopto.mcml.mcsurface.base module¶
- BOTTOM = 'bottom'¶
Identifier of the bottom sample surface.
- NONE = 'none'¶
Identifier used for a surface that is not yet assigned.
- class SurfaceLayoutAny(location: str = 'none')[source]¶
Bases:
xopto.mcml.mcsurface.base.SurfaceLayoutBase
Base class of surface layouts that can be used for both the top or bottom sample surface.
Create a layout for the top or bottom sample surface. By default the location is not initialized.
- classmethod fromdict(data: dict) → xopto.mcml.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 = 'top')[source]¶
Bases:
xopto.mcbase.mcobject.McObject
Base class of all the sample surface layouts.
Complex surface layout at the specified sample surface.
- Parameters
location (TOP or BOTTOM) – Location of the sample surface to which the layout applies.
- property location: str¶
Location of the surface layout.
- class SurfaceLayoutBottom(*args, **kwargs)[source]¶
Bases:
xopto.mcml.mcsurface.base.SurfaceLayoutBase
Base class of the bottom sample surface layout.
Create a layout for the bottom sample surface.
- class SurfaceLayoutDefault(location: str = 'none')[source]¶
Bases:
xopto.mcml.mcsurface.base.SurfaceLayoutAny
Default / dummy layout for the top or bottom sample surface.
Create a layout for the top or bottom sample surface. 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
mc (mcobject.McObject) – Monte Carlo simulator instance.
target (cltypes.Structure) – Structure that is filled with the source data.
- Returns
target – Filled ctypes structure received as an input argument or a new instance if the input argument target is None.
- Return type
- 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
- classmethod fromdict(data: dict) → xopto.mcml.mcsurface.base.SurfaceLayoutDefault[source]¶
Create an instance of
SurfaceLayoutDefault
from a dictionary.- Parameters
data (dict) – Dictionary created by the
SurfaceLayoutDefault.todict()
method.
- class SurfaceLayoutTop(*args, **kwargs)[source]¶
Bases:
xopto.mcml.mcsurface.base.SurfaceLayoutBase
Base class of the top sample surface layout.
Create a layout for the top sample surface.
- class SurfaceLayouts(top: Optional[xopto.mcml.mcsurface.base.SurfaceLayoutTop] = None, bottom: Optional[xopto.mcml.mcsurface.base.SurfaceLayoutBottom] = None)[source]¶
Bases:
xopto.mcbase.mcobject.McObject
Container of the top and bottom sample surface layouts.
- Parameters
top (SurfaceLayoutTop or SurfaceLayoutAny) – Layout of the top sample surface.
bottom (SurfaceLayoutBottom or SurfaceLayoutAny) – Layout at the bottom sample surface.
- property bottom: xopto.mcbase.mcobject.McObject¶
Bottom sample surface layout.
- 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 top and / or bottom 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_TOP_SURFACE_LAYOUT for the top surface and MC_USE_BOTTOM_SURFACE_LAYOUT for the bottom 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
mc (mcobject.McObject) – Monte Carlo simulator instance.
target (cltypes.Structure) – Ctypes structure that is filled with the source data.
- Returns
target – Filled structure received as an input argument or a new instance if the input argument target is None.
- Return type
- 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:
- top: SurfaceLayoutTop
Layout of the top sample surface (z = 0).
- bottom: SurfaceLayoutBottom
Layout of the bottom sample surface (z = 0).
- Return type
- property top: xopto.mcbase.mcobject.McObject¶
Top sample surface layout.
- TOP = 'top'¶
Identifier of the top sample surface.