glow.geometry_layouts package
Submodules
glow.geometry_layouts.cells module
Module containing classes providing the means for creating cells from basic geometries in SALOME.
- class Cell(figure: Surface, name: str)[source]
Bases:
ABCAbstract class for representing any cell characterized in terms of its geometric layout and the properties associated to its regions.
The cell geometry layout can be represented in terms of its technological geometry, representing the different zone associated with a material property. Regions can be identified by overlapping circles at any position within the cell’s borders. Typically, they are concentric when representing a fuel pin cell, but no limitation on their positioning is present, provided their radii are compatible with the dimensions of the cell. The technological geometry can be sectorized, i.e. subdivision points on the inner circles can be defined in order to partition the face into subfaces defining the cell sectors. Properties of the technological geometry zones are associated to each of the corresponding sectors.
- Parameters:
center (Tuple[float, float, float]) – The X-Y-Z coordinates of the cell center.
figure (Surface) – The figure representing the cell shape.
name (str) – The name of the cell to be used in the current study.
- cell_type
The type of cell expressed as a value of the
CellTypeenumeration.- Type:
Union[CellType, None]
- face
The face object representing the cell’s technological geometry.
- Type:
Any
- face_entry_id
The ID of the cell face object used in the current SALOME study.
- Type:
Union[str, None]
- figure
The instance of any of the
Surfacesubclasses representing the cell’s main shape.- Type:
- inner_circles
The list of
Circleobjects representing any circular region in the cell’s technological geometry.- Type:
List[Circle]
- is_windmill_applied
Boolean flag stating if the windmill sectorization is applied.
- Type:
bool
- name
The name of the cell to be used in the current SALOME study.
- Type:
str
- regions
The list of
Regionobjects storing information about either the regions of the cell’s technological geometry or the ones resulting from its sectorization.- Type:
List[Region]
- rotation
The rotation angle of the cell, expressed in radians.
- Type:
float
- sectorized_face
The face object providing the cell sectorized geometry representation.
- Type:
Any
- tech_geom_props
A dictionary between the regions of the cell’s technological geometry and the dictionary of property types VS value associated to each zone.
- Type:
Dict[Any, Dict[PropertyType, str]]
- tech_geom_sect_opts
A dictionary between the regions of the cell’s technological geometry and the tuple identifying the associated sectorization options.
- Type:
Dict[Any, Tuple[int, float]]
- displayed_geom
The type of geometry currently displayed in the SALOME viewer.
- Type:
- add_circle(radius: float = 1.0, position: Tuple[float, float, float] | None = None) None[source]
Method that allows to add a circle to the cell’s technological geometry only, if not already present. Given the radius, a corresponding face object is built in the given position within the cell, if any is specified; otherwise the circle is added in the cell center. In any case, a partition operation between the cell’s face and the new circle is performed. The result is a geometric surface that comprises both faces. In addition, the dictionaries associating the regions of the cell’s technological geometry with the properties and with the sectorization options respectively are updated.
- Parameters:
radius (float) – The radius of the circle to add.
position (Union[Tuple[float, float, float], None]) – The X-Y-Z coordinates of the center of the circle to add.
- extract_subfaces() List[Any][source]
Method that extracts the subfaces the cell face is made by. These subfaces are the result of the construction of the cell technological geometry. In addition, the list is ordered in terms of the distances of each subface from the cell center, in ascending order. If no subfaces are found, the entire face of the cell is returned.
- Returns:
A list of all the subfaces that comprise the cell face, sorted in ascending order by means of their distance from the cell center, or the entire cell’s face, if no subfaces are present.
- Return type:
List[Any]
- get_centered_circles() List[Circle][source]
Method that returns a list of the cell-centered
Circleobjects of the cell.- Returns:
A list of
Circleobjects whose centers coincide with the cell’s one.- Return type:
List[Circle]
- get_regions_info() None[source]
Method that retrieves descriptive information about the cell’s region currently selected in the SALOME study.
- remove_circle(radius: float, position: Tuple[float, float, float] | None = None) None[source]
Method that allows to remove a cell-centered circle from the cell’s technological geometry, given the radius and the position of its center. All references to the circle in the cell are removed, which means that the corresponding
Circleobject is removed from the attributeinner_circlesand the whole face object of the cell is re-built. The dictionaries associating the regions of the cell’s technological geometry with the properties and with the sectorization options respectively are updated as well.- Parameters:
radius (float) – The radius of the circle to remove.
position (Union[Tuple[float, float, float], None]) – The X-Y-Z coordinates of the center of the circle to remove.
- restore() None[source]
Method that restores the cell’s geometry layout to a state without any circular region. It removes any inner circle, leaving only the face object obtained from the cell’s external borders. Properties and sectorization options are re-initialized with default values.
- rotate(angle: float) None[source]
Method that rotates all the geometric elements the cell is made of by a given angle in degrees. The cell’s face object is rebuild from the rotated base elements it is made of. The dictionaries associating the cell’s regions with the properties and with the sectorization options are updated with the rotated versions of the regions themselves.
- Parameters:
angle (float) – The angle of rotation in degrees.
- rotate_from_axis(angle: float, axis: Any) None[source]
Method that rotates all the geometrical elements the cell is made of by a given angle in degrees around the given axis object. The cell’s face object is rebuild from the rotated base elements it is made of. The dictionaries associating the cell’s regions with the properties and with the sectorization options are updated with the rotated versions of the regions themselves.
- Parameters:
angle (float) – The angle of rotation in degrees.
axis (Any) – The vector object representing the rotation axis.
- abstractmethod sectorize(sectors_no: List[int], angles: List[float], **kwargs) None[source]
Abstract method to be implemented in subclasses to subdivide the cell technological geometry into sectors. Given the number of sectors for each cell zone and the values of the angles to start the sectorization from, points are built on the geometric surfaces of the cell. Lines are drawn between those points to define the sectors. A partition operation between the cell’s technological geometry and the built lines provides the cell’s sectorized geometry.
- Parameters:
sectors_no (List[int]) – List of integers representing the number of subdivision for each cell zone coming from the technological geometry.
angles (List[float]) – List of angles (in degrees) the sectorization should start from for each cell’s zone coming from the technological geometry.
kwargs (Any) – Additional parameters specific to the type of cell to be sectorized.
- set_properties(properties: Dict[PropertyType, List[str]]) None[source]
Method that allows to set the properties for all the zones the cell is made of (i.e. the technological geometry). The accepted convention considers that the elements in the list for each property represent the values associated to the regions starting from the inmost cell-centered region to the outmost one.
- Parameters:
properties (Dict[PropertyType, List[str]]) – Dictionary collecting the properties for each cell’s region; different types, given by the
PropertyTypeenumeration, can be provided.
- set_region_property(property_type: PropertyType, value: str, region: Any | None = None) None[source]
Method that enables setting the value of a given property type for the cell region passed as an input or the currently selected one in the SALOME study. If none is provided as an input, the currently selected one is used.
- Parameters:
property_type (PropertyType) – The value of the
PropertyTypeenumeration indicating which type of property to assign to the selected region.value (str) – The value of the property type to assign to the selected region.
region (Any | None = None) – The cell’s region of the technological geometry whose property to change. When not provided, the region currently selected is considered.
- Raises:
RuntimeError – If the displayed geometry is not the
TECHNOLOGICALone.RuntimeError – When no region, or more than one, is selected.
RuntimeError – If the indicated region cannot be found among the ones stored in the properties dictionary.
- show(property_type_to_show: PropertyType | None = None, geometry_type_to_show: GeometryType = GeometryType.TECHNOLOGICAL, update_view: bool = True) None[source]
Method that shows the cell and its regions in the current SALOME study. Given the property type, the viewer shows the regions with a color that has been associated to the value of the property type each region has. If
Noneis provided, the regions are shown without any color. By specyfing a type of geometry (as item of the enumerationGeometryType), the corresponding cell’s regions are displayed. By default those of the cell’s technological geometry are shown. If specified, the cell’s regions are simply added to the SALOME study without displaying them in the 3D viewer.- Parameters:
property_type_to_show (Union[PropertyType, None] = None) – The type of property to show for each cell’s region; the viewer shows them in terms of a spefic color associated to the property value each region has.
geometry_type_to_show (GeometryType = GeometryType.TECHNOLOGICAL) – The type of geometry to show: regions are shown accordingly with the selected type.
update_view (bool) – Flag stating if the viewer should be updated by displaying the cell’s regions.
- translate(new_pos: Tuple[float, float, float]) Self[source]
Method that builds a copy of the
Cellinstace calling this method; this copy is translated with respect to the current position of the cell center. All the geometric elements describing the cell’s geometry layout are translated accordingly.- Parameters:
new_pos (Tuple[float, float, float]) – The new position where the cell has to be moved.
- Returns:
A copy of this class instance with all the geometric elements describing the cell’s geometry layout moved accordingly with the new cell center position.
- Return type:
Self
- update_geometry() None[source]
Method for updating the cell’s geometry layout shown in the SALOME study, with the geometric object currently selected in the SALOME Object Browser.
- update_geometry_from_face(geo_type: GeometryType, shape: Any) None[source]
Method for updating the cell’s geometry layout, whose type is provided as first argument, with the geometric shape passed as second argument. A different treatment is provided according to the type of geometry to update:
geo_type = GeometryType.SECTORIZED- the sectorized geometry layout is updated only;geo_type = GeometryType.TECHNOLOGICAL- both technological and sectorized geometry layouts are updated.
- Parameters:
geo_type (GeometryType) – The cell type of geometry to update, as item of the
GeometryTypeenumeration.shape (Any) – The geometric object to update the cell’s layout with.
- VALID_SECTOR_NO_VS_ANGLE: Dict[int, List[float]] = {}
Dictionary providing the number of valid sectors each cell zone could be subdivided VS the accepted angles the sectorization can start from. Values are specific for each type of cell.
- class GenericCell(shape: Any | None = None)[source]
Bases:
CellClass providing the means for interacting with a generic cell built from within SALOME using its GEOM module. Given the face or the compound object either provided when instantiating this class or the one currently selected in the SALOME study, the cell is initialized with the provided shape and all the needed information is extracted.
The cell geometry layout can be represented in terms of its technological geometry, representing the different zone associated with a material property. Regions can be identified by overlapping circles at any position within the cell’s borders. Typically, they are concentric when representing a fuel pin cell, but no limitation on their positioning is present, provided their radii are compatible with the dimensions of the cell. The technological geometry can be sectorized, i.e. subdivision points on the inner circles can be defined in order to partition the face into subfaces defining the cell sectors. Properties of the technological geometry zones are associated to each of the corresponding sectors.
- Parameters:
shape (Union[Any, None] = None) – The geometric shape the cell is based on. Its type must be either
ShapeType.COMPOUNDorShapeType.FACE.
- cell_type
The type of cell expressed as a value of the
CellTypeenumeration.- Type:
Union[CellType, None]
- face
The face object representing the cell’s technological geometry.
- Type:
Any
- face_entry_id
The ID of the cell face object used in the current SALOME study.
- Type:
Union[str, None]
- figure
The instance of any of the
Surfacesubclasses representing the cell’s main shape.- Type:
- inner_circles
The list of
Circleobjects representing any circular region in the cell’s technological geometry.- Type:
List[Circle]
- is_windmill_applied
Boolean flag stating if the windmill sectorization is applied.
- Type:
bool
- name
The name of the cell to be used in the current SALOME study.
- Type:
str
- regions
The list of
Regionobjects storing information about either the regions of the cell’s technological geometry or the ones resulting from its sectorization.- Type:
List[Region]
- rotation
The rotation angle of the cell, expressed in radians.
- Type:
float
- sectorized_face
The face object providing the cell sectorized geometry representation.
- Type:
Any
- tech_geom_props
A dictionary between the regions of the cell’s technological geometry and the dictionary of property types VS value associated to each zone.
- Type:
Dict[Any, Dict[PropertyType, str]]
- tech_geom_sect_opts
A dictionary between the regions of the cell’s technological geometry and the tuple identifying the associated sectorization options.
- Type:
Dict[Any, Tuple[int, float]]
- displayed_geom
The type of geometry of the cell currently displayed.
- Type:
- sectorize(sectors_no: List[int], angles: List[float]) None[source]
Method that subdivides the cell into sectors. Given the number of sectors for each cell zone and the values of the angles to start the sectorization from, points are built on the geometric surfaces of the cell. Lines are drawn between those points to define the sectors. A partition operation between the cell’s technological geometry and the built lines provides the cell’s sectorized geometry.
- Parameters:
sectors_no (List[int]) – List of integers representing the number of subdivision for each cell’s zone coming from the technological geometry.
angles (List[float]) – List of angles (in degrees) the sectorization should start from for each cell’s zone coming from the technological geometry.
- VALID_SECTOR_NO_VS_ANGLE: Dict[int, List[float]] = {1: [0]}
Dictionary providing the number of valid sectors each cell zone could be subdivided VS the accepted angles the sectorization can start from. Values are specific for each type of cell.
- class HexCell(center: Tuple[float, float, float] | None = None, edge_length: float = 1.0, name: str = 'Hexagon')[source]
Bases:
CellClass providing the means for building an hexagonal cell. The cell geometry layout can be represented in terms of its technological geometry, representing the different zone associated with a material property. Regions can be identified by overlapping circles at any position within the cell’s borders. Typically, they are concentric when representing a fuel pin cell, but no limitation on their positioning is present, provided their radii are compatible with the dimensions of the cell. The technological geometry can be sectorized, i.e. subdivision points on the inner circles can be defined in order to partition the face into subfaces defining the cell sectors. Properties of the technological geometry zones are associated to each of the corresponding sectors.
- Parameters:
center (Union[Tuple[float, float, float], None] = None) – The X-Y-Z coordinates of the cell’s center.
edge_length (float = 1.0) – The length of the hexagonal cell’s edge.
name (str = "Hexagon") – The cell’s name in the current SALOME study.
- apothem
The length of the hexagonal cell’s apothem.
- Type:
float
- cell_type
The type of cell expressed as a value of the
CellTypeenumeration.- Type:
Union[CellType, None]
- edge_length
The length of the hexagonal cell’s edge.
- Type:
float
- face
The face object representing the cell’s technological geometry.
- Type:
Any
- face_entry_id
The ID of the cell face object used in the current SALOME study.
- Type:
Union[str, None]
- figure
The instance of any of the
Surfacesubclasses representing the cell’s main shape.- Type:
- inner_circles
The list of
Circleobjects representing any circular region in the cell’s technological geometry.- Type:
List[Circle]
- is_windmill_applied
Boolean flag stating if the windmill sectorization is applied.
- Type:
bool
- name
The name of the cell to be used in the current SALOME study.
- Type:
str
- regions
The list of
Regionobjects storing information about either the regions of the cell’s technological geometry or the ones resulting from its sectorization.- Type:
List[Region]
- rotation
The rotation angle of the cell, expressed in radians.
- Type:
float
- sectorized_face
The face object providing the cell sectorized geometry representation.
- Type:
Any
- tech_geom_props
A dictionary between the regions of the cell’s technological geometry and the dictionary of property types VS value associated to each zone.
- Type:
Dict[Any, Dict[PropertyType, str]]
- tech_geom_sect_opts
A dictionary between the regions of the cell’s technological geometry and the tuple identifying the associated sectorization options.
- Type:
Dict[Any, Tuple[int, float]]
- displayed_geom
The type of geometry of the cell currently displayed.
- Type:
- sectorize(sectors_no: List[int], angles: List[float], **kwargs) None[source]
Method that subdivides the cell into sectors. Given the number of sectors for each cell zone and the values of the angles to start the sectorization from, points are built on the geometric surfaces of the cell. Lines are drawn between those points to define the sectors. A partition operation between the cell’s technological geometry and the built lines provides the cell’s sectorized geometry.
- Parameters:
sectors_no (List[int]) – List of integers representing the number of subdivision for each cell’s zone coming from the technological geometry.
angles (List[float]) – List of angles (in degrees) the sectorization should start from for each cell’s zone coming from the technological geometry.
kwargs (Any) – Additional parameters specific to the hexagonal cell type to be sectorized. Nothing should be passed for a hexagonal cell.
- VALID_SECTOR_NO_VS_ANGLE: Dict[int, List[float]] = {1: [0], 6: [0, 30]}
Dictionary providing the number of valid sectors each cell zone could be subdivided VS the accepted angles the sectorization can start from. Values are specific for a hexagonal cell.
- class RectCell(center: Tuple[float, float, float] | None = None, height_x_width: Tuple[float, float] = (1, 1), rounded_corners: List[Tuple[int, float]] | None = None, name: str = 'Cell')[source]
Bases:
CellClass providing the means for building a cartesian (i.e. rectangular) cell. The cell geometry layout can be represented in terms of its technological geometry, representing the different zone associated with a material property. Regions can be identified by overlapping circles at any position within the cell’s borders. Typically, they are concentric when representing a fuel pin cell, but no limitation on their positioning is present, provided their radii are compatible with the dimensions of the cell. The technological geometry can be sectorized, i.e. subdivision points on the inner circles can be defined in order to partition the face into subfaces defining the cell sectors. Properties of the technological geometry zones are associated to each of the corresponding sectors.
- Parameters:
center (Union[Tuple[float, float, float], None] = None) – The X-Y-Z coordinates of the cell’s center.
height_x_width (Tuple[float, float] = (1, 1)) – A tuple providing the cell height and width.
rounded_corners (Union[List[Tuple[int, float]], None]) – A list of tuples providing the corner index and the curvature radius of the same corner.
name (str = "Cell") – The cell name in the current SALOME study.
- cell_type
The type of cell expressed as a value of the
CellTypeenumeration.- Type:
Union[CellType, None]
- face
The face object providing the cell technological geometry representation.
- Type:
Any
- face_entry_id
The ID of the cell face object used in the current SALOME study.
- Type:
Union[str, None]
- figure
The instance of any of the
Surfacesubclasses representing the cell’s main shape.- Type:
- height
The cell’s height.
- Type:
float
- inner_circles
The list of
Circleobjects representing any circular region in the cell’s technological geometry.- Type:
List[Circle]
- is_windmill_applied
Boolean flag stating if the windmill sectorization is applied.
- Type:
bool
- name
The name of the cell to be used in the current SALOME study.
- Type:
str
- regions
The list of
Regionobjects storing information about either the regions of the cells’ technological geometry or the ones resulting from its sectorization.- Type:
List[Region]
- rotation
The rotation angle of the cell, expressed in radians.
- Type:
float
- sectorized_face
The face object providing the cell sectorized geometry representation.
- Type:
Any
- tech_geom_props
A dictionary between the regions of the cell’s technological geometry and the dictionary of property types VS value associated to each zone.
- Type:
Dict[Any, Dict[PropertyType, str]]
- tech_geom_sect_opts
A dictionary between the regions of the cell’s technological geometry and the tuple identifying the associated sectorization options.
- Type:
Dict[Any, Tuple[int, float]]
- displayed_geom
The type of geometry of the cell currently displayed.
- Type:
- width
The cell’s width.
- Type:
float
- sectorize(sectors_no: List[int], angles: List[float], **kwargs) None[source]
Method that subdivides the cell into sectors. Given the number of sectors for each cell zone and the values of the angles to start the sectorization from, points are built on the geometric surfaces of the cell. Lines are drawn between those points to define the sectors. A partition operation between the cell’s technological geometry and the built lines provides the cell’s sectorized geometry.
- Parameters:
sectors_no (List[int]) – List of integers representing the number of subdivision for each cell’s zone coming from the technological geometry.
angles (List[float]) – List of angles (in degrees) the sectorization should start from for each cell’s zone coming from the technological geometry.
kwargs (Any) – Additional parameters specific to the cartesian cell type to be sectorized (e.g., windmill).
- VALID_SECTOR_NO_VS_ANGLE: Dict[int, List[float]] = {1: [0], 4: [0, 45], 8: [0, 22.5], 16: [0]}
Dictionary providing the number of valid sectors each cell zone could be subdivided VS the accepted angles the sectorization can start from. Values are specific for a cartesian cell.
- class Region(face: Any = None, face_entry_id: str | None = None, inner_point: Any | None = None, name: str | None = None, properties: Dict[PropertyType, str] | None = None)[source]
Bases:
objectGrouping information regarding a generic region of the cell’s or the lattice’s geometry layout.
- reset_color_to_default() None[source]
Method for resetting the region color to the (167, 167, 167) RGB value, which corresponds to light grey.
- set_property_color(color: Tuple[int, int, int]) None[source]
Method for associating a specific RGB color to the region.
- Parameters:
color (Tuple[int, int, int]) – RGB values identifying the color to associate to the region.
- cdg: Any | None
A vertex object representing the GDG of the cell’s region, if any region has been set.
- color: Tuple[int, int, int]
A tuple indicating the RGB color associated to the cell’s region according to the value of the
PropertyTypebeing shown in the SALOME viewer.
- face: Any = None
The face object of the cell’s region.
- face_entry_id: str | None = None
The ID of the cell’s region used in the current SALOME study.
- inner_point: Any | None = None
A vertex object representing a point within the cell’s region.
- name: str | None = None
The name associated to the cell’s region used in the current SALOME study.
- properties: Dict[PropertyType, str] | None = None
A dictionary of property types and value names associated to the cell’s region.
- check_cell_circle_are_cut(cell: Cell) bool[source]
Function that verifies if any of the circular regions of the given
Cellobject have been cut as a result of a modification to the cell’s geometry layout. A cut operation between the compound made by the cell’s centered circular regions and the current state of the cell’s face determines if any circular region has been cut. If the result does not have any face object, it means the circular regions are still a whole.- Parameters:
cell (Cell) – The
Cellobject to check if its circular regions have been cut in the cell’s geometry layout.- Returns:
True, if the cell’s circular regions have been cut,Falseotherwise.- Return type:
bool
- get_region_info(shape: Any, regions: List[Region]) str[source]
Function that, given the shape, retrieves the name of the corresponding
Regionobject and the values of its associated properties, if any is present.- Parameters:
shape (Any) – The geometrical shape to retrieve info about.
regions (List[Region]) – A list of
Regionobjects to search the shape among.
- Returns:
A descriptive string indicating the name of the found region and its associated properties.
- Return type:
str
- Raises:
RuntimeError – If the provided shape does not have any corresponding
Regionobject.
glow.geometry_layouts.geometries module
Module containing classes providing the means for creating basic geometries in SALOME.
- class Circle(center: Tuple[float, float, float] | None = None, normal_vect: Tuple[float, float, float] | None = None, radius: float = 1.0, name: str = 'Circle')[source]
Bases:
SurfaceClass representing a circle surface in SALOME. It is built by providing its center, normal vector and radius: if no center (X-Y-Z coordinates) or normal vector (X-Y-Z components) are provided, the circle is built in the origin, normal to the XY plane.
- Parameters:
center (Union[Tuple[float, float, float], None] = None) – The X-Y-Z coordinates of the circle.
normal_vect (Union[Tuple[float, float, float], None] = None) – The normal vector to the surface of the circle.
radius (float = 1.0) – The radius of the circle
name (str = "Circle") – The name to be assigned to the face when displayed in the current SALOME study.
- o
A vertex object representing the surface center.
- Type:
Any
- borders
A list of edge objects representing the border edges of the surface.
- Type:
List[Any]
- face
A face object representing the geometric surface.
- Type:
Any
- name
The name of the surface when displayed in the SALOME study.
- Type:
str
- face_entry_id
An ID associated to the surface in the SALOME study.
- Type:
Union[str, None]
- vertices
A list of vertex objects representing the vertices of the circle surface (only the circle’s center).
- Type:
List[Any]
- out_circle
An edge object representing the construction circle which the circle surface is inscribed into (i.e. the circle itself).
- Type:
Any
- rotation
The rotation angle of the geometric surface in radians.
- Type:
float
- lx
The characteristic dimension of the circle’s surface along the X-axis.
- Type:
float
- ly
The characteristic dimension of the circle’s surface along the Y-axis.
- Type:
float
- on
A GEOM vector object representing the normal vector to the surface of the circle.
- Type:
Any
- radius
The radius of the circle.
- Type:
float
- class GenericSurface(face: Any, name: str | None = None)[source]
Bases:
SurfaceClass representing a 2D generic surface defined starting from a given face object. Borders and vertices are directly extracted from the shape, whereas no construction circle is declared: this is because the shape might not have a regular geometric shape, hence there could be no circle within which the shape is perfectly inscribed. The characteristic dimensions of the surface are taken from the bounding box enclosing the given surface.
- Parameters:
face (Any) – The face object representing the generic surface.
name (str | None = None) – The name to be assigned to the face when displayed in the current SALOME study.
- o
A vertex object representing the surface center.
- Type:
Any
- borders
A list of edge objects representing the border edges of the surface.
- Type:
List[Any]
- face
A face object representing the geometric surface.
- Type:
Any
- name
The name of the surface when displayed in the SALOME study.
- Type:
str
- face_entry_id
An ID associated to the surface in the SALOME study.
- Type:
Union[str, None]
- vertices
A list of vertex objects representing the vertices of the generic surface.
- Type:
List[Any]
- out_circle
An edge object representing the construction circle which the generic surface is inscribed into.
- Type:
Any
- rotation
The rotation angle of the geometric surface in radians.
- Type:
float
- lx
The characteristic dimension of the generic geometric surface along the X-axis.
- Type:
float
- ly
The characteristic dimension of the generic geometric surface along the Y-axis.
- Type:
float
- update_from_face(face: Any) None[source]
Method for updating the geometric characteristics of the surface from the given face object.
- Parameters:
face (Any) – The new face object to substitute the current face with.
- Raises:
RuntimeError – If the provided shape type is not
ShapeType.FACEorShapeType.COMPOUND.
- class Hexagon(center: Tuple[float, float, float] | None = None, edge_length: float = 1.0, name: str = 'Hexagon')[source]
Bases:
SurfaceClass representing a 2D hexagon surface in SALOME. It is built by providing its center and the length of edge: if no center (X-Y-Z coordinates) is provided, the hexagon is built centered in the XYZ origin.
The hexagon is built by means of a construction circle the hexagon is inscribed into. The convention for numbering the vertices of the hexagon is the following:
3 2 + ————— + / \ / \ 4 + + 1 \ / \ / + ————— + 5 6By default, the hexagon orientation is zero, i.e. the vertices 1 and 4 are horizontally aligned.
- Parameters:
center (Union[Tuple[float, float, float], None] = None) – The X-Y-Z coordinates of the center of the hexagon.
edge_length (float = 1.0) – The lenght of the edge of the hexagon.
name (str = "Hexagon") – The name to be assigned to the face when displayed in the current SALOME study.
- o
A vertex object representing the surface center.
- Type:
Any
- borders
A list of edge objects representing the border edges of the surface.
- Type:
List[Any]
- face
A face object representing the geometric surface.
- Type:
Any
- name
The name of the surface when displayed in the SALOME study.
- Type:
str
- face_entry_id
An ID associated to the surface in the SALOME study.
- Type:
Union[str, None]
- vertices
A list of vertex objects representing the vertices of the hexagon surface.
- Type:
List[Any]
- out_circle
An edge object representing the construction circle which the hexagon surface is inscribed into.
- Type:
Any
- rotation
The rotation angle of the geometric surface in radians.
- Type:
float
- lx
The characteristic dimension of the hexagon surface along the X-axis.
- Type:
float
- ly
The characteristic dimension of the hexagon surface along the Y-axis.
- Type:
float
- radius
The radius of the construction circle the hexagon is inscribed into.
- Type:
float
- apothem
The apothem of the hexagon.
- Type:
float
- update_from_face(face: Any) None[source]
Method for updating the geometrical characteristics of the surface from the given GEOM face object.
- Parameters:
face (Any) – The new face object to substitute the current face with.
- Raises:
RuntimeError – If the provided shape type is not
ShapeType.FACE.RuntimeError – If the provided shape does not represent a hexagon.
- class Rectangle(center: Tuple[float, float, float] | None = None, height: float = 1.0, width: float = 1.0, rounded_corners: List[Tuple[int, float]] | None = None, name: str = 'Rectangle')[source]
Bases:
SurfaceClass representing a 2D rectangle surface in SALOME. It is built by providing its center, height and width: if no center (X-Y-Z coordinates) is provided, the rectangle is built centered in the XYZ origin. By default, its height and width have the same value, thus allowing to represent a square surface. In addition, it supports the presence of rounded corners by providing a list of tuples, where the first element is the ID of the corner, while the second element the radius of the rounded corner.
The convention for numbering the vertices and edges of the rectangle is the following:
3 (2) 2 + <———————— + | ^ | (3) | | | (1) v | + ————————> + 0 (0) 1
- Parameters:
center (Union[Tuple[float, float, float], None] = None) – The X-Y-Z coordinates of the surface center.
height (float = 1.0) – The height of the rectangle.
width (float = 1.0) – The width of the rectangle.
rounded_corners (List[Tuple[int, float]] | None = None) – List of tuples containing the corner ID and the corresponding radius for building a rounded corner.
name (str = "Rectangle") – The name to be assigned to the face when displayed in the current SALOME study.
- o
A vertex object representing the surface center.
- Type:
Any
- borders
A list of edge objects representing the border edges of the surface.
- Type:
List[Any]
- face
A face object representing the geometric surface.
- Type:
Any
- name
The name of the surface when displayed in the SALOME study.
- Type:
str
- face_entry_id
An ID associated to the surface in the SALOME study.
- Type:
Union[str, None]
- vertices
A list of vertex objects representing the vertices of the rectangle surface (i.e. corners and construction points of the arcs).
- Type:
List[Any]
- out_circle
An edge object representing the construction circle which the rectangle surface is inscribed into.
- Type:
Any
- rotation
The rotation angle of the geometric surface in radians.
- Type:
float
- lx
The characteristic dimension of the rectangle surface along the X-axis.
- Type:
float
- ly
The characteristic dimension of the rectangle surface along the Y-axis.
- Type:
float
- show_edges_and_vertices() None[source]
Method that adds the rectangle edges and the vertices at the corners to the current SALOME study.
- update_from_face(face: Any) None[source]
Method for updating the geometrical characteristics of the surface from the given GEOM face object.
- Parameters:
face (Any) – The new face object to substitute the current face with.
- Raises:
RuntimeError – If the provided shape type is not
ShapeType.FACE.RuntimeError – If the provided shape does not represent a rectangle.
- class Surface(center: Tuple[float, float, float] | None = None)[source]
Bases:
ABCAbstract class for representing any geometric surface.
- Parameters:
center (Union[Tuple[float, float, float], None] = None) – The X-Y-Z coordinates of the generic geometric surface.
- o
A vertex object representing the surface center.
- Type:
Any
- borders
A list of edge objects representing the border edges of the surface.
- Type:
List[Any]
- face
A face object representing the geometric surface.
- Type:
Any
- name
The name of the surface when displayed in the SALOME study.
- Type:
str
- face_entry_id
An ID associated to the surface in the SALOME study.
- Type:
Union[str, None]
- vertices
A list of vertex objects representing the vertices of the generic surface.
- Type:
List[Any]
- out_circle
An edge object representing the construction circle which the generic surface is inscribed into.
- Type:
Any
- rotation
The rotation angle of the geometric surface in radians.
- Type:
float
- lx
The characteristic dimension of the generic geometric surface along the X-axis.
- Type:
float
- ly
The characteristic dimension of the generic geometric surface along the Y-axis.
- Type:
float
- rotate(angle: float) None[source]
Method that rotates the surface geometry. The face, its border edges, vertices and construction circle are rotated by the given angle expressed in degrees around the Z-axis.
- Parameters:
angle (float) – The rotation angle in degrees.
- rotate_from_axis(angle: float, axis: Any) None[source]
Method that rotates the surface geometry. The face, its border edges, vertices and construction circle are rotated by the given angle expressed in degrees around the given axis.
- Parameters:
angle (float) – The rotation angle in degrees.
axis (Any) – The vector object representing the rotation axis.
- show_borders() None[source]
Method that adds the surface border edges to the current SALOME study. These edges are added to the Object Browser under the face they refer to only if any face has already been shown.
- Raises:
RuntimeError – If no face has been displayed yet in the SALOME study.
- show_edges_and_vertices() None[source]
Method that adds the edges and the vertices of the geometric surface to the current SALOME study.
- show_face() None[source]
Method that adds the face object corresponding to the geometric surface this class is representing to the current SALOME study.
- translate(new_pos: Tuple[float, float, float]) None[source]
Method that translates the surface geometry to the given position. All the geometrical elements (center, face, its borders, vertices and construction circle) needed to describe the shape are moved accordingly.
- Parameters:
new_pos (Tuple[float, float, float]) – The XYZ coordinates of the new center of the shape.
- build_hexagon(apothem: float, center: Tuple[float, float, float] | None = None) Hexagon[source]
Function that allows to build an hexagon from its apothem. The resulting face is placed at the indicated center, if any, otherwise it is centered in the XYZ space origin.
- Parameters:
apothem (float) – The value of the hexagon apothem.
center (Tuple[float, float, float] | None = None) – The XYZ coordinates of the hexagon center, if any.
- Return type:
A
Hexagonobject with dimensions and center as indicated.
glow.geometry_layouts.lattices module
Module containing classes providing the means for creating lattices from base cells types in SALOME.
- class Lattice(cells: List[Cell] = [], name: str = 'Lattice', center: Tuple[float, float, float] | None = None, boxes_thick: List[float] = [])[source]
Bases:
objectClass that represents a lattice made by a group of cells, either cartesian or hexagonal. Transformation operations (i.e. rotation and translation) are supported; different types of symmetry can be applied depending on the type of the lattice’s cells. Visualization of the geometry layout in the SALOME 3D viewer is available.
- Parameters:
cells (List[Cell] = []) – The list of cells that constitute the lattice, as objects of the
Cellsubclasses.name (str = "Lattice") – The lattice name in the current SALOME study.
center (Tuple[float, float, float] | None, optional) – The coordinates of the lattice center, if any.
boxes_thick (List[float] = []) – Thicknesses of the box layers surrounding the lattice.
- lattice_center
The geometric center of the lattice.
- Type:
Any
- lattice_cells
The list of cells that constitute the lattice, as objects of the
Cellsubclasses.- Type:
List[Cell]
- layers
List of layers that constitute the lattice, each containing a list of cells.
- Type:
List[List[Cell]]
- name
The lattice name in the current SALOME study.
- Type:
str
- lattice_cmpd
A compound object grouping all the faces of the cells in the lattice.
- Type:
Any
- lattice_entry_id
An ID associated to the lattice surface in the current SALOME study.
- Type:
Union[str, None]
- rings_no
Index providing the total number of cells rings around the lattice center.
- Type:
int
- distance
Distance from the lattice origin to the outmost cell CDG.
- Type:
float
- symmetry_type
The type of symmetry currently applied to the lattice.
- Type:
- lx
Characteristic dimension of the lattice along the X-axis.
- Type:
float
- ly
Characteristic dimension of the lattice along the Y-axis.
- Type:
float
- box_layers
Thicknesses of the box layers.
- Type:
List[float]
- lattice_symm
The compound object representing the lattice with applied symmetry.
- Type:
Any | None
- displayed_geom
The type of geometry of the lattice’s cells currently displayed.
- Type:
- is_update_needed
Flag indicating if the lattice geometry needs to be updated by rebuilding the
Regionobjects.- Type:
bool
- add_cell(cell: Cell, position: Tuple[float, float, float]) None[source]
Method that allows to add a new cell to the lattice at the specified position. The cell is added to a new layer.
- Parameters:
cell (Cell) – A cell to add to the current lattice, as object of the
Cellsubclasses.position (Tuple[float, float, float]) – The X-Y-Z coordinates of the position where the cell should be added, i.e. the cell center should be placed at those coordinates. If the tuple is empty, the cell is placed at the position indicated by its center.
- Raises:
RuntimeError – If the cell to add has a
CellTypewhich differs from the one of the cells in the lattice.RuntimeError – If the cell to add has an invalid rotation angle.
- add_ring_of_cells(cell: Cell, ring_indx: int, layer_indx: int | None = None) None[source]
Method that adds a ring of cells of the same type to the lattice at a given ring index and layer. This method iteratively adds the provided
Cellobject at specific construction points determined by the ring_indx parameter, which indicates the ring (distance from the center) where the cells should be placed. Optionally, alayer_indxcan be provided to specify the layer to which the ring of cells is added; if not provided, the cells are added to a new layer.Notes
Index 0 refers to the center cell of the lattice (valid for lattices with hexagonal cells or cartesian ones, the latter if an odd number of cells is provided on the side); indices greater than 0 refer to rings around the center.
The method ensures that the cells to add have the same
CellTypeof the ones in the lattice.
- Parameters:
cell (Cell) – The
Cellinstance to be added repeatedly to form a ring.ring_indx (int) – The index indicating which ring to add the cells to.
layer_indx (int | None = None) – The index of the layer to which the cells are added. If
None, a new layer is created.
- Raises:
RuntimeError – If the cell’s
CellTypedoes not match the one of the lattice cells.RuntimeError – If indicating
0as the ring index where cells should be added.RuntimeError – If the cell to add has an invalid rotation angle.
RuntimeError – If the type of cells of the lattice is not supported.
- add_rings_of_cells(cell: Cell, no_rings: int) None[source]
Method that adds to the lattice several rings of cells of the same type. The cell is provided as an object of one of the
Cellsubclasses, which is iteratively added, for each index of rings, at specific construction points. The rings of cells are added starting from the current maximum value of rings for the lattice and to a new layer.- Parameters:
cell (Cell) – The cell instance to be iteratively added in order to build the rings of cells.
no_rings (int) – The number of rings to add starting from the current maximum value of rings for the lattice.
- Raises:
RuntimeError – If the cell’s
CellTypedoes not match the one of the latticeRuntimeError – If the cell’s
CellTypedoes not match the one of the lattice cells.RuntimeError – If indicating
0as the ring index where cells should be added.RuntimeError – If the cell to add has an invalid rotation angle.
RuntimeError – If the type of cells of the lattice is not supported.
- apply_symmetry(symmetry: SymmetryType) None[source]
Method that modifies the lattice in order to apply the given symmetry type. The symmetry types provided by the
SymmetryTypeenumeration are handled. According to the type, geometry transformations (i.e. cuts) by means of the SALOME GEOM module operations are performed on the lattice’s face.- Parameters:
symmetry (SymmetryType) – The type of symmetry to handle.
- Raises:
RuntimeError – If the type of cells is neither cartesian nor hexagonal.
- build_lattice_box(box_thick: List[float] = []) None[source]
Method that builds the box the lattice is inserted into, given the thickness of each layer. On the basis of the cells type (i.e. cartesian or hexagonal), a proper box is built and used to update the compound of the lattice. Since the method builds a new box for the lattice, any property associated to the regions of a previuosly set box are lost.
Notes
The method accepts that the first value of layers thicknesses could be negative, meaning that the box cuts the outmost ring of cells of the lattice. The other thicknesses values must be positive.
- Parameters:
box_thick (List[float]) – List storing the thickness of each layer of the lattice box.
- build_regions(geo_type: GeometryType = GeometryType.TECHNOLOGICAL) None[source]
Method that extracts all the subfaces from the lattice compound object corresponding to the given type of geometry and builds a
Regionobject for each one. In case any symmetry operation has been applied, this method acts on that result (i.e. the symmetry compound object).Each lattice’s face object position is compared to the regions of each cell: if any match is found, the cell’s region properties are assigned to the
Regionobject being built for the lattice.- Parameters:
geo_type (GeometryType) – The type of geometry identifying which lattice compound to use for building the lattice regions.
- get_regions_info() None[source]
Method for retrieving descriptive information about any of the lattice regions whose corresponding object has been selected in the SALOME study.
- restore_cells(cells: List[Cell], properties: Dict[PropertyType, str], ignore_not_cut: bool = True) None[source]
Method that restores the geometry layout of the given cells by removing any circular region, while setting properties accordingly with the provided dictionary. If any cell has no centered circular regions, the restore operation is not performed. If the
ignore_not_cutboolean flag isTrue, this operation is performed only if the compound made of the circular regions is cut by the cell’s face. Otherwise, ifTrue, all the given cells are restored.- Parameters:
cells (List[Cell]) – List of shallow copies of the ones in the lattice that should be restored.
properties (Dict[PropertyType, str]) – Providing the values for each type of property to assign to the cells being restored.
ignore_not_cut (bool = True) – Boolean flag indicating whether the cells whose circular regions are not cut should also be restored or not.
Notes
This method should be called after building the lattice regions by overlapping all the layers of cells, i.e. after calling either the
showor thebuild_regionsmethods. This method has an effect only if the given list of cells contains shallow copies of the Cell objects included in the presentLatticeinstance.
- rotate(angle: float = 0.0) None[source]
Method that rotates all the lattice’s geometric elements by the given angle in degrees. They are its compound objects representing its full and partial (if any symmetry is applied) geometry layout, the contained cells, including the box, if present, and all the regions.
- Parameters:
angle (float) – The rotation angle in degrees.
- set_lattice_box_properties(properties: Dict[PropertyType, List[str]]) None[source]
Method that allows to set the properties of the lattice box itself and to the area between the cells and the box contour, if any. The assumed convention for the elements in the list is outwards from the lattice center.
- Parameters:
properties (Dict[PropertyType, List[str]]) – Dictionary collecting the properties for each region of the lattice box; different types, provided by the
PropertyTypeenumeration, can be provided.- Raises:
RuntimeError – If no properties are provided.
RuntimeError – If calling this method after directly assigning a lattice’s box instead of providing its layers.
RuntimeError – If there is no correspondence between the number of box regions and that of the properties.
- set_region_property(property_type: PropertyType, value: str, region: Any | None = None) None[source]
Method that allows to set the value of the given type of property for the lattice region which is currently selected in the SALOME study. After applying the modification, when calling the method for showing the lattice in the SALOME 3D viewer, the region is displayed with the color associated to the value of the property type that has been set.
- Parameters:
property_type (PropertyType) – The member of the
PropertyTypeenumeration indicating which type of property to modify for the selected region.value (str) – The value of the property type to assign to the selected region.
region (Any | None = None) – The lattice’s region of the technological geometry whose property to change. When not provided, the region currently selected is considered.
- Raises:
RuntimeError – If the lattice’s geometry layout currently displayed in the SALOME viewer is not the technological one.
RuntimeError – If no region or more than one has been selected.
- set_type_geo(type_geo: LatticeGeometryType) None[source]
Method that sets the geometry type for the lattice, as item of the
LatticeGeometryTypeenumeration. It checks if the provided geometry type is valid for the type of cells of the lattice and the currently applied type of symmetry. In case of types involving TRAN-type of BCs, the assignement is done only if the lattice is either made by a single cell or if enclosed in a box. An exception is raised if the geometry type is not compatible.- Parameters:
type_geo (LatticeGeometryType) – The geometry type to set for the lattice.
- Raises:
RuntimeError – If the given geometry type is not compatible with the type of cells and the applied symmetry type.
- show(property_type_to_show: PropertyType | None = None, geometry_type_to_show: GeometryType = GeometryType.TECHNOLOGICAL) None[source]
Method that allows to show the lattice and its cells’ regions into the current SALOME study. If the whole lattice compound was already present in the study, it is fist removed, to keep only one entry at a time. It is then added to the study together with all the lattice regions, each colored according to the value of the property type provided as input to this method. If no property is selected, the regions are displayed without any colouring.
- Parameters:
property_type_to_show (Union[PropertyType, None] = None) – Either a value of the
PropertyTypeenumeration, indicating the property by which the regions are coloured, orNone.geometry_type_to_show (GeometryType = GeometryType.TECHNOLOGICAL) – The type of geometry to show: regions are shown accordingly with the selected type.
- translate(new_pos: Tuple[float, float, float]) None[source]
Method that translates the lattice’s geometric elements, i.e. its compound objects representing its full and partial (if any symmetry is applied) geometry layout, the contained cells, including the box, if present, and all the regions.
- Parameters:
new_pos (Tuple[float, float, float]) – The X-Y-Z coordinates of the new center of the lattice.
- VALID_CELLS_ANGLES: List[float] = [0.0, 90.0, 180.0, 270.0, 360.0]
- property cells_rot: float | None
Get or set the common rotation angle, in degrees, of the cells belonging to the main pattern of cells in the lattice.
- Parameters:
cells_rot (float) – The rotation angle, in degrees, of the cells belonging to the main pattern of cells in the lattice.
- Returns:
The rotation angle, in degrees, of the cells belonging to the main pattern of cells.
- Return type:
float | None
- property lattice_box: Cell | None
Get or set the
Cellsubclass object providing the lattice’s box.- Parameters:
cell (Cell | None) – An instance of the
Cellsubclass to set the lattice’s box. IfNone, the previous box, if present, is removed.- Returns:
Instance the
Cellsubclass for the lattice’s box, orNoneif get,Noneif set.- Return type:
Cell | None
- Raises:
RuntimeError – If the given cell’s center does not coincide with the lattice’s one.
- property type_geo: LatticeGeometryType | None
Get or set the lattice type of geometry as item of the enumeration
LatticeGeometryType.- Parameters:
type_geo (LatticeGeometryType) – Item of the enumeration
LatticeGeometryTypeto set the lattice type of geometry to.- Returns:
Item of the enumeration
LatticeGeometryTypeif get,Noneif set.- Return type:
LatticeGeometryType | None
- Raises:
RuntimeError – Invalid type of geometry for the current lattice geometry layout.
- get_changed_cells(lattice: Lattice) List[Cell][source]
Function that returns a list of
Cellobjects belonging to the givenLatticeinstance. These cells have their geometry layout changed compared to their original one. For each cell in each layer, the current shape of the cell is built and its area compared with the area of its specific characteristic figure (as aSurfaceinstance). Those showing a different value for the area indicates a change in their geometry layout has occurred and are collected into the returned list.This function retrieves cells that have been modified within the lattice, such as by overlap with a superior layer of cells.
- get_compound_from_geometry(geo_type: GeometryType, lattice_cells: List[Cell]) Any[source]
Function that gets the lattice compound that matches the indicated geometry type.
- Parameters:
geo_type (GeometryType) – The type of geometry of the cells to build a compound from.
lattice_cells (List[Cell]) – The list of cells whose face objects to use to build a compound.
- Returns:
A compound object collecting all the faces, either from the technological geometry or the sectorized one, of the given cells.
- Return type:
Any