glow.support package
Submodules
glow.support.types module
Module containing enumeration classes for expressing different types (e.g. BCs, geometry, etc.) used throughout the code.
- class BoundaryType(*values)[source]
Bases:
EnumEnumeration for defining the types of the lattice’s boundary condition applied to the borders of its geometry layout.
- AXIAL_SYMMETRY: int = 4
Indicating an axial symmetry BC.
- CENTRAL_SYMMETRY: int = 5
Indicating a central symmetry BC.
- REFL: int = 1
Indicating a specular reflection BC.
- ROTATION: int = 3
Indicating a rotation BC.
- TRANSLATION: int = 2
Indicating a translation BC.
- VOID: int = 0
Indicating a vacuum + albedo BC.
- class CellType(*values)[source]
Bases:
EnumEnumeration for defining the geometric types of cells.
- HEX: int = 1
Identifying a hexagonal cell.
- RECT: int = 0
Identifying a cartesian (i.e. rectangular) cell.
- class EdgeType(*values)[source]
Bases:
EnumEnumeration for identifying each type of edge object with an index.
- ARC_CIRCLE: int = 3
Identifying an arc of circle-type edge.
- CIRCLE: int = 2
Identifying a circle-type edge.
- SEGMENT: int = 1
Identifying a segment-type edge.
- class GeometryType(*values)[source]
Bases:
EnumEnumeration for defining either the lattice or the single cell geometry type.
- SECTORIZED: int = 1
Identifying the cell/lattice sectorized geometry.
- TECHNOLOGICAL: int = 0
Identifying the cell/lattice technological geometry.
- class LatticeGeometryType(*values)[source]
Bases:
EnumEnumeration for defining the lattice’s geometry types. Values higher than 2, i.e.
ROTATION, refer to geometry layouts for which a cycling tracking needs to be applied (TSPC type). The values from0to2included, refer to geometry layouts for which a uniform tracking needs to be applied (TISO type).- HEXAGON_TRAN: int = 9
Hexagonal geometry with translations on all sides.
- ISOTROPIC: int = 0
Generic geometry with vacuum or isotropic reflection.
- R120: int = 11
Lozenge geometry with rotation and translation.
- RA60: int = 10
Isosceles triangle geometry with rotation and translation.
- RECTANGLE_EIGHT: int = 7
1/8 rectangular assembly with symmetries on all sides.
- RECTANGLE_SYM: int = 6
Rectangular geometry with symmetry on all sides.
- RECTANGLE_TRAN: int = 5
Rectangular geometry with translation on all sides.
- ROTATION: int = 2
Generic geometry with rotation of angle 2*pi/n, n>1.
- S30: int = 12
Triangle geometry identifying a symmetry of 1/12 of an assembly.
- SA60: int = 8
Isosceles triangle geometry with symmetries on all sides.
- SYMMETRIES_TWO: int = 1
Generic geometry with symmetries of two axis of angle pi/n, n>0.
- class PropertyType(*values)[source]
Bases:
EnumEnumeration for defining the property types that can be associated to each cell/lattice region.
- MATERIAL: int = 0
Identifying the material property type.
- class SymmetryType(*values)[source]
Bases:
EnumEnumeration for defining the lattice’s symmetry types.
- EIGHTH: int = 8
Identifying an eighth of the lattice.
- FULL: int = 0
Identifying a complete lattice.
- HALF: int = 2
Identifying an half of the lattice.
- QUARTER: int = 4
Identifying a quarter of the lattice.
- SIXTH: int = 6
Identifying a sixth of the lattice.
- THIRD: int = 3
Identifying a third of the lattice.
- TWELFTH: int = 12
Identifying an twelfth of the lattice.
glow.support.utility module
Module containing utility functions to support the construction and analysis of the geometry layouts.
- are_same_shapes(shape1: Any, shape2: Any, shapes_type: ShapeType) bool[source]
Function that determines whether two shapes are the same based on their geometric properties (perimeter, area and volume), a cut operation, and the shape type.
- Parameters:
shape1 (Any) – The first shape to compare.
shape2 (Any) – The second shape to compare.
shapes_type (ShapeType) – The type of sub-shapes to check for after the cut operation.
- Returns:
Trueif the two shapes are considered the same (i.e., they have the same geometric properties and the cut result does not contain any sub-shapes of the specified type),Falseotherwise.- Return type:
bool
- Raises:
RuntimeError – If the two shapes are not of the same type.
- build_compound_borders(cmpd: Any) List[Any][source]
Function that extracts the external borders of the given compound object and returns them as a list of edge objects.
- Parameters:
cmpd (Any) – The compound object whose borders to extract.
- Returns:
A list of edge objects representing the given compound external boundary.
- Return type:
List[Any]
- Raises:
RuntimeError – If no closed boundaries could be extracted from the given compound object.
- build_contiguous_edges(vertices: List[Any]) List[Any][source]
Function that builds a list of contiguous edge objects each sharing one of the vertices to form a closed path.
- Parameters:
vertices (List[Any]) – List of vertex objects representing the start-end points of the contiguous edges.
- Returns:
The list of contiguous edge objects.
- Return type:
List[Any]
- Raises:
RuntimeError – If less than 3 vertices are provided.
RuntimeError – If two consecutive vertices in the list are the same, as no edge could be built from them.
- check_shape_expected_types(shape: Any, expected_types: List[ShapeType]) None[source]
Function that checks if the type of the given shape matches any of the expected types.
- Parameters:
shape (Any) – The shape object whose type is to be checked.
expected_types (List[ShapeType]) – A list of expected shape types.
- Raises:
RuntimeError – If the type of the shape is not in the list of expected types.
- check_type_geo_consistency(type_geo: LatticeGeometryType, cell_type: CellType, symmetry_type: SymmetryType) None[source]
Function that checks if the given type of geometry is valid for the indicated type of cell and the type of symmetry.
- Parameters:
type_geo (LatticeGeometryType) – The type of geometry of the lattice.
cell_type (CellType) – The type of cell.
symmetry_type (SymmetryType) – The type of symmetry.
- Raises:
RuntimeError – If the given lattice type of geometry does not match with the indicated cell and symmetry types.
- compute_point_by_reference(point: Any, ref_point: Any, new_ref_coords: Tuple[float, float, float]) Tuple[float, float, float][source]
Function that calculates the new coordinates of the given vertex object so that it keeps the same relative vector (i.e., same distance and direction) from a reference point which is moved in another position. The coordinates of the reference point before and after its translation are provided.
- Parameters:
point (Any) – The vertex object whose new coordinates must be evaluated.
ref_point (Any) – The reference vertex object the point is relative to.
new_ref_coords (Tuple[float, float, float]) – The XYZ coordinates of the reference point after translation.
- Returns:
The new coordinates of the given point so that it preserves its relative position with respect to its translated reference point.
- Return type:
Tuple[float, float, float]
- generate_unique_random_colors(no_colors: int) List[Tuple[int, int, int]][source]
Function for generating a specified number of random unique RGB colors.
- Parameters:
no_colors (int) – The number of RGB colors to generate.
- Returns:
A list of tuples, each providing the 3 integer values identifying an RGB color.
- Return type:
List[Tuple[int, int, int]]
- Raises:
RuntimeError – If requesting more colors than the ones available.
- get_angle_between_points(point1: Tuple[float, float, float], point2: Tuple[float, float, float]) float[source]
Function that, given two points, calculates the angle between the line connecting the two points and the X-axis.
- Parameters:
point1 (Tuple[float, float, float]) – First point.
point2 (Tuple[float, float, float]) – Second point.
- Returns:
The angle, in radians, between the line connecting the two points and the X-axis.
- Return type:
float
- get_id_from_name(name: str) int[source]
Function that extracts the index of the shape whose name is provided. The shape’s name must be defined as
<name>_<id>.- Parameters:
name (str) – The name of the shape in the SALOME viewer.
- Raises:
RuntimeError – If no integer index can be extracted from the given name.
- Returns:
An integer being the global index associated to the shape whose name is given as input.
- Return type:
int
- get_id_from_shape(shape: Any) int[source]
Function that extracts the index of the given shape from its name. The shape’s name must have been previously assigned as
<name>_<id>.- Parameters:
shape (Any) – The generic GEOM shape object to get its ID, if any.
- Raises:
RuntimeError – If no name has been assigned to the shape, or no integer index can be extracted from the shape’s name.
- Returns:
An integer being the global index associated to the given shape.
- Return type:
int
- is_collinear(edge: Any, collinear_edges: List[Any]) bool[source]
Function that determines whether the given edge is collinear with a group of collinear edges. Collinearity is determined by checking if the angle between the edge and any edge in the group is close to
0orpi, and if the minimum distance between the edge and the infinite axis defined by the group is close to zero.- Parameters:
edge (Any) – The edge to check for collinearity.
group_of_collinear_edges (List[Any]) – A list of edges that are collinear.
- Returns:
True if the edge is collinear with the group, False otherwise.
- Return type:
bool
- make_infinite_axis(edge, length=1e6) Any[source]
Function that creates an infinite-like axis along the direction of the given edge.
It computes the direction vector of the provided edge and extends it in both directions by a specified length, resulting in a much longer edge that simulates an infinite axis.
- Parameters:
edge (Any) – The edge object from which to derive the axis direction.
length (float, optional) – The distance to extend the axis in both directions from the edge’s endpoints. Default is 1e6.
- Returns:
An edge object resulting from extending the given edge along its direction vector.
- Return type:
Any
Notes
The function assumes that the edge lies in the XY plane (Z=0).
- retrieve_selected_object(error_msg: str) Any[source]
Function that retrieves the geometrical object currently selected in the SALOME study. If more than one or none is selected, an exception with the given message is raised.
- Parameters:
error_msg (str) – The error message to display when the incorrect number of shapes is selected.
- Returns:
The GEOM object currently selected in the SALOME study.
- Return type:
Any
- sort_vertices_radially(vertices) List[Any][source]
Function that sorts a list of vertices in radial order around their centroid. The function computes the centroid of the given vertices, then sorts them based on the angle each vertex makes with respect to the centroid.
- Parameters:
vertices (list) – A list of vertex objects to be sorted.
- Returns:
A list of vertex objects sorted in radial order around the centroid.
- Return type:
List[Any]
- translate_wrt_reference(shape: Any, old_ref_point: Any, new_ref_coords: Tuple[float, float, float]) Any[source]
Function that translates a geometric shape so that it keeps its relative distance from a reference point, whose previous position is provided as a vertex object, while its new position by means of its XYZ coordinates.
- Parameters:
shape (Any) – The geometric shape to be translated.
old_ref_point (Any) – A vertex object identifying the previous reference point of the shape.
new_ref_coords (Tuple[float, float, float]) – The coordinates of the reference point for the shape after its translation.
- Returns:
The given shape translated so that it keeps its relative distance from the new reference point.
- Return type:
Any