pyg4ometry.fluka.region¶
Attributes¶
Classes¶
Represents a zone which consists of one or more body intersections |
|
Represents a region which consists of a region name, one or more |
Functions¶
|
|
|
|
|
|
|
|
|
|
|
Convert sympy boolean to fluka region |
|
|
|
Try to generate a sensible name for intermediate |
|
|
|
|
|
|
|
|
Returns a random name that is syntactically correct for use in GDML. |
|
|
aabb should really be a dictionary of |
Module Contents¶
- pyg4ometry.fluka.region.logger¶
- pyg4ometry.fluka.region.bracket_depth(zone)¶
- pyg4ometry.fluka.region.bracket_number(zone)¶
- pyg4ometry.fluka.region.zone_to_sympy(zone)¶
- pyg4ometry.fluka.region.region_to_sympy(region)¶
- pyg4ometry.fluka.region.sympy_to_zone(sympy_expr, freg)¶
- pyg4ometry.fluka.region.sympy_to_region(sympy_expr, freg, regionName='name')¶
Convert sympy boolean to fluka region Must be the OR of multiple convex zones
- pyg4ometry.fluka.region.simplify_region(region)¶
- pyg4ometry.fluka.region._generate_name(typename, index, name, isZone, rootname)¶
Try to generate a sensible name for intermediate Geant4 booleans which have no FLUKA analogue.
- class pyg4ometry.fluka.region.Zone(name=None)¶
Bases:
pyg4ometry.fluka.vis.ViewableMixinRepresents a zone which consists of one or more body intersections and zero or more body subtractions. May also be used to represent subzones, which are zones nested within zones, for example the form +A -B -(+C -D). Once instantiated, intersections and subtractions can be added to this instance with the addIntersection and addSubtraction method.
- Parameters:
name (string) – Optional name for the zone.
- intersections = []¶
- subtractions = []¶
- name¶
- addSubtraction(body)¶
Add a body or subzone as a subtraction to this Zone instance.
- Parameters:
body (Body or Zone) – Body or Zone instance.
- addIntersection(body)¶
Add a body or subzone as an intersection to this Zone instance.
- Parameters:
body – Body or Zone instance.
- Type:
body: Body or Zone
- convertToDNF(fluka_registry)¶
- centre(aabb=None)¶
- rotation()¶
- tbxyz()¶
- static _getSolidFromBoolean(boolean, g4reg, aabb)¶
- mesh(aabb=None)¶
- geant4Solid(reg, aabb=None)¶
Translate this zone to a geant4solid, adding the constituent primitive solids and any Booleans to the Geant4 registry. Returns the geant4 solid equivalent in geometry to this Zone.
- Parameters:
reg (AABB or dict) – The Registry (geant4) instance to which the resulting Geant4 definitions should be added.
aabb – Optional reference AABB or dictionary of body name to AABB instances with which the geant4 solid should be evaluated with respect to. This is the entry point to which solid minimisation can be performed.
- _combine_booleans(body0, start, collection, operation, reg, aabb)¶
- _geant4MultiUnionSubtraction(body0, start, reg, aabb)¶
- dumps()¶
Returns a string of this Zone instance in the equivalent FLUKA syntax.
- dumpsDebug()¶
Returns a string of this Zone instance in the equivalent FLUKA syntax with extra debug information
- withLengthSafety(bigger_flukareg, smaller_flukareg, shrink_intersections)¶
- allBodiesToRegistry(flukaregistry)¶
Add all the bodies that contitute this Zone to the provided FlukaRegistry instance.
- Parameters:
flukaregistry (FlukaRegistry) – FlukaRegistry instance to which constituent bodies will be added.
- bodies()¶
Return the set of unique bodies that constitute this Zone.
- removeBody(name)¶
Remove a body from this zone by name.
- Parameters:
name (string) – The name of the body to be removed.
- makeUnique(nameSuffix, flukaregistry)¶
Get this zone with every constituent body recreated with a unique name by appending nameSuffix.
- Parameters:
nameSuffix – The string to append to the names of the bodies.
flukaregistry – the FlukaRegisytr instance to add the uniquely defined bodies to.
- isNull(aabb=None)¶
- toDNF(name)¶
- isDNF()¶
- leafCount()¶
- class pyg4ometry.fluka.region.Region(name, comment='')¶
Bases:
pyg4ometry.fluka.vis.ViewableMixinRepresents a region which consists of a region name, one or more zones, and a single material. Metadata may be provided with the comment kwarg, which is used when writing to FLUKA to provide contextual information to the physicist.
- Parameters:
- name¶
- zones = []¶
- comment¶
- addZone(zone)¶
Add a Zone instance to this region.
- Parameters:
zone (Zone) – The Zone instance to be added.
- addIntersection(zone)¶
- addSubtraction(zone)¶
- extend(region)¶
- removeNullZones()¶
- convertToDNF(fluka_registry)¶
- centre(aabb=None)¶
- tbxyz()¶
- rotation()¶
- bodies()¶
Return the set of unique bodies that constitute this Zone.
- mesh(aabb=None)¶
- geant4Solid(reg, aabb=None)¶
Get the geant4Solid instance corresponding to this Region.
- dumps()¶
- flukaFreeString()¶
- withLengthSafety(bigger_flukareg, smaller_flukareg)¶
- allBodiesToRegistry(registry)¶
Add all the bodies that constitute this Region to the provided FlukaRegistry instance.
- Parameters:
flukaregistry (FlukaRegistry) – FlukaRegistry instance to which constituent bodies will be added.
- zoneGraph(zoneAABBs=None, aabb=None)¶
- _zoneGraphPycgal()¶
- connectedZones(zoneAABBs=None, aabb=None)¶
- zoneAABBs(aabb=None)¶
- aabb(aabb=None)¶
- removeBody(name)¶
Remove a body from this region by name.
- Parameters:
name (string) – The name of the body to be removed.
- makeUnique(nameSuffix, flukaregistry)¶
Get this Region instance with every constituent body with a unique name by appending nameSuffix to each Body instance.
- Parameters:
nameSuffix – string to append to each Body instance.
flukaregistry – FlukaRegisty instance to add each newly-defined body to.
- isNull(aabb=None)¶
- toDNF(name)¶
- isDNF()¶
- filterNullZones(aabb=None)¶
- leafCount()¶
- simplify()¶
- __repr__()¶
- removeZones(indices)¶
Remove zones by index
- pyg4ometry.fluka.region._get_relative_rot_matrix(first, second)¶
- pyg4ometry.fluka.region._get_relative_translation(first, second, aabb)¶
- pyg4ometry.fluka.region._get_relative_rotation(first, second)¶
- pyg4ometry.fluka.region._getRelativeTransform(first, second, aabb)¶
- pyg4ometry.fluka.region._randomName()¶
Returns a random name that is syntactically correct for use in GDML.
- pyg4ometry.fluka.region._makeWorldLogicalVolume(reg)¶
- pyg4ometry.fluka.region._getAxisAlignedBoundingBox(aabb, boolean)¶
aabb should really be a dictionary of {bodyName: extentInstance}.