glow.generator package
Submodules
glow.generator.export_data module
Module containing classes that support the export of the geometry layout by providing a mean for storing the needed information about faces, edges and boundaries.
- class BoundaryData(border: Any, type_geo: LayoutGeometryType, layout_o: Any, dimensions: Tuple[float, float])[source]
Bases:
objectClass that provides the data structure for a GEOM edge object being a border of the layout.
- Parameters:
border (Any) – A GEOM edge object representing a border of the layout.
type_geo (LatticeGeometryType) – Providing the layout type of geometry.
layout_o (Any) – A vertex object representing the layout centre point.
dimensions (Tuple[float, float]) – The X-Y characteristic dimensions of the layout the border refers to.
- border
A GEOM edge object representing a border of the layout.
- Type:
Any
- type
Providing the type of BCs.
- Type:
- angle
Angle (in degrees) of the border defined from its origin to its second point, so that it is always positive.
- Type:
float
- edge_indxs
List of the indices of the edges the border is made of.
- Type:
List[int]
- tx
The X-component of the border axis.
- Type:
float
- ty
The Y-component of the border axis.
- Type:
float
- find_edges_on_border(boundaries: Any, id_vs_edge: Dict[str, Any]) None[source]
Method that finds and associates all the GEOM edges related to the layout border this instance refers to. These edges are the ones that are connected to a single face only, as these are the edges on the borders of the layout.
- Parameters:
boundaries (Any) – A GEOM compound object made from the list of GEOM edge objects belonging to the layout boundaries.
id_vs_edge (Dict[Any, str]) – A dictionary of all the layout edge IDs VS the corresponding GEOM edge objects.
- Raises:
RuntimeError – In case the boundary edge is not of type
SEGMENT.
- class EdgeData(edge: Any, *faces: FaceData)[source]
Bases:
objectClass that provides the data representation for an edge object of the layout. It provides an global index allowing to uniquely identify the edge, and two
FaceDataattributes, allowing to identify the face on the left and on the right of the edge. The identification of the left/right faces is performed by building a point on the edge’s normal so that it is sligtly on the left of the edge.- Parameters:
edge (Any) – The GEOM object of type EDGE representing an edge.
faces (Tuple[FaceData, ...]) – Providing the
FaceDataobjects the edge belongs to.
- no
The edge number extracted from the GEOM edge object name.
- Type:
int
- edge
A GEOM object of type EDGE representing an edge.
- Type:
Any
- data
Characteristic data of the given GEOM edge object.
- Type:
Any
- kind
Indicating the type of edge with admitted values being
CIRCLE,ARC_CIRCLE,SEGMENT.- Type:
str
- class FaceData(region: Region, no: int, property_types: List[PropertyType] = <factory>)[source]
Bases:
objectClass that provides a data representation for a face object of the layout, i.e. a
Regionobject, which represents a calculation zone containing a list of properties. This dataclass can be ordered on the basis of thenoattribute, which provides a global index for the faces in the layout.- edge_vs_id: Dict[Any, str]
Dictionary associating the GEOM edge objects of the current face object to the corresponding IDs, based on the edges geometrical characteristics.
- inner_point: Tuple[float, float, float]
XYZ coordinates of a point within the GEOM face object.
- no: int
Global index of the face.
- property_types: List[PropertyType]
List of property types that must be associated with the region.
- sort_index: int
Indicating the attribute used to sort
FaceDataobjects.
- build_edge_id(edge: Any) str[source]
Function that builds a unique ID for a GEOM edge object in the geometry layout to process. This is performed by retrieving characteristic information about the edge in terms of a list containing the type of shape and a series of parameters that describe the shape itself. According to the shape type we could have:
CIRCLE xc yc zc dx dy dz R (X-Y-Z centre coordinates, X-Y-Z normal vector elements, circle radius).
ARC_CIRCLE xc yc zc dx dy dz R x1 y1 z1 x2 y2 z2 (X-Y-Z centre coordinates, X-Y-Z normal vector elements, arc radius, X-Y-Z coordinates of arc starting and ending points).
SEGMENT x1 y1 z1 x2 y2 z2 (X-Y-Z coordinates of segment starting and ending points).
If any shape type other than
CIRCLE,ARC_CIRCLEandSEGMENTis provided, an exception is raised.- Parameters:
edge (Any) – A GEOM edge object to build an ID for.
- Returns:
A string representing the unique ID for the edge.
- Return type:
str
- Raises:
RuntimeError – If the type of the provided edge is not among the allowed
CIRCLE,ARC_CIRCLEandSEGMENT.
- classify_layout_edges(edges: List[Any]) Dict[str, Any][source]
Function that classifies the given layout edges (as GEOM objects) by building a dictionary with keys being a unique ID and values the corresponding GEOM edge object. The IDs are built from the geometric characteristics of the edges; for each edge its
nameinternal attribute is set using a global index over all the layout’s edges.- Parameters:
edges (List[Any]) – A list of the GEOM edge objects to be classified.
- Returns:
A dictionary storing the edges IDs and the corresponding GEOM edges.
- Return type:
Dict[str, Any]
- Raises:
RuntimeError – If any of the elements in the input list is not an edge of the allowed
CIRCLE,ARC_CIRCLEandSEGMENTtypes.
glow.generator.generator module
This module contains the classes that support the generation of the output TDT file containing the geometry representation for further analysis in DRAGON.
- class TdtData(filename: str = PosixPath('/home/runner/work/glow/glow/glow/tdt_layout.dat'), edges: List[EdgeData] = <factory>, faces: List[FaceData] = <factory>, boundaries: List[BoundaryData] = <factory>, type_geo: LayoutGeometryType = LayoutGeometryType.HEXAGON_TRAN, type_sym: SymmetryType = SymmetryType.FULL, albedo: float | None = None, impressions: Tuple[int, int]=(0, 0), precisions: Tuple[float, float]=(1e-05, 1e-05))[source]
Bases:
objectDataclass storing the geometric information, in terms of subfaces, edges and boundaries of the geometry layout, as well as other data providing the type of geometry, of symmetry, and the properties associated to the regions of the geometry.
- albedo: float | None = None
Identifying the value for the albedo applied to the layout’s BCs.
- boundaries: List[BoundaryData]
List of the geometry layout borders, as
BoundaryDataobjects.
- filename: str = PosixPath('/home/runner/work/glow/glow/glow/tdt_layout.dat')
Name of the TDT file to be generated (without the .dat extension).
- impressions: Tuple[int, int] = (0, 0)
Options for printing the geometric data.
- nb_folds: int
The number of times the geometry layout has to be unfolded to replicate the full geometry, if any symmetry is applied.
- precisions: Tuple[float, float] = (1e-05, 1e-05)
Options for the geometric precision of the data.
- properties: Dict[PropertyType, List[str]]
Dictionary with keys the property types and values the list of names for each property the regions of the geometry layout are associated with. Dictionary with keys the property types and values the list of names for each property the regions of the geometry layout are associated with.
- property_ids: Dict[PropertyType, List[int]]
Dictionary with keys the property types and values the list of the IDs for each property the regions of the geometry layout are associated with.
- type_geo: LayoutGeometryType = 9
The type of geometry applied to the geometry layout, as element of the
LatticeGeometryTypeenumeration.
- type_sym: SymmetryType = 0
The type of the symmetry applied to the geometry layout, as element of the
SymmetryTypeenumeration.
glow.generator.geom_extractor module
Module containing the class that deals with the extraction of the geometric information from the geometry layout. The functionalities in this module serve for preparing all the data for the output TDT file generation.
- class LayoutDataExtractor(layout: Fillable, tdt_setup: TdtSetup, compound_to_analyse: Any | None = None)[source]
Bases:
objectClass that extracts the geometric and properties data from a layout, either provided as an instance of the
Fillableclass only, or by additionally indicating a compound object representing a generic portion of theFillableobject.The extraction process relies on determining:
the association of GEOM faces with properties;
the association between GEOM edges and the GEOM faces they belong to;
the information about the borders of the layout in terms of their geometric data and applied BC types.
- Parameters:
layout (Fillable) – A
Fillableinstance storing the geometric and properties data to extract.tdt_setup (TdtSetup) – Dataclass providing the settings for extracting the geometric and properties information from the given layout.
compound_to_analyse (Any | None = None) – The compound object to analyse. If
Noneis provided, the layout given as first parameter is considered instead.
- geometry_layout
A
Fillableinstance storing the geometric and properties data to extract.- Type:
- borders
The list of edge objects representing the borders of the layout.
- Type:
List[Any]
- boundaries
The list of
BoundaryDataobjects storing the geometric and BCs information about the layout’s borders.- Type:
List[BoundaryData]
- subfaces
The list of
FaceDataobjects storing the geometric and properties information about each region of the layout.- Type:
List[FaceData]
- edges
The list of
EdgeDataobjects storing the geometric information about each edge of the layout and the faces they belong to.- Type:
List[EdgeData]
- id_vs_edge
A dictionary of the IDs for the layout’s edges VS the corresponding edge objects.
- Type:
Dict[str, Any]
- layout_edges
The list of the edge objects contained in the layout.
- Type:
List[Any]
- layout_centre
The XYZ coordinates of the whole layout centre.
- Type:
Tuple[float, float, float]
- dimensions
The XY characteristic dimensions of the layout.
- Type:
Tuple[float, float]
- build_boundaries(type_geo: LayoutGeometryType) None[source]
Method that constructs a list of
BoundaryDataobjects representing the layout boundary edges, i.e. those connected to a single face. All the GEOM edges being part of each boundary are associated to the sameBoundaryDataobject.- Parameters:
type_geo (LatticeGeometryType) – Identifying the characteristic value associated to the type of symmetry and tracking.
- build_edges(edge_names_vs_faces: Dict[str, List[Any | FaceData]]) None[source]
Method that builds a list of
EdgeDataobjects from the given dictionary. It associates for each edge name a list containing the corresponding GEOM edge and theFaceDataobjects; the latter represent the faces sharing the same edge.- Parameters:
edge_names_vs_faces (Dict[str, List[Any | FaceData]]) – Dictionary of edge names VS the list with the corresponding GEOM edge and the connected
FaceDataobjects.
- build_edges_and_faces_association() Dict[str, List[FaceData]][source]
Method that associates the faces sharing the same edge with the edge name. These names contain a global index to identify the edge in the layout.
- Returns:
A dictionary whose entries associate a list of adjacent faces (as
FaceDataobjects) to the name of the corresponding shared edge.- Return type:
Dict[str, List[FaceData]]
- build_faces(property_types: List[PropertyType]) None[source]
Method that builds a list of
FaceDataobjects from the GEOM face objects, extracted from the layout regions, and the property values. Each parsedRegionobject corresponds to a region in the analysed layoutaccording to the considered type of geometry. Each region must be associated with a value for the given property type. If not the case, an exception is raised.- Parameters:
property_type (List[PropertyType]) – The list of property types associated to the layout regions.
- Raises:
RuntimeError – If no properties or the indicated one are associated to a layout region.
RuntimeError – If no value for the given property type is associated to a layout region.
- print_log_analysis(edge_name_vs_faces: Dict[str, List[Any]]) None[source]
Method that prints on the stdout the log of the data extraction from the layout.
- Parameters:
edge_name_vs_faces (Dict[str, List[Any]]) – A dictionary of the name of the layout edges VS the GEOM faces connected to it.
- CASES_FOR_TRANSLATION = {LayoutType.GENERIC: [], LayoutType.HEX: [SymmetryType.THIRD, SymmetryType.SIXTH], LayoutType.RECT: [SymmetryType.FULL, SymmetryType.HALF, SymmetryType.DIAG]}
Identifying the symmetry types for each type of layout for which the layout translation should be evaluated.
- analyse_layout(layout: Fillable, tdt_setup: TdtSetup, compound_to_analyse: Any | None = None) LayoutDataExtractor[source]
Function that analyses the given layout to extract the necessary data about the regions and their associated properties, the edges and their association with the faces they belong to. It also extracts information about the edges representing the boundaries of the layout.
If the
compound_to_analyseparameter is provided, it will be the one to be analysed, according to the information stored in the provided layout. In this way, a generic portion of the givenFillableobject can be treated.- Parameters:
layout (Fillable) – The
Fillableobject storing the information about the geometry and the properties of the entire layout.tdt_setup (TdtSetup) – Dataclass providing the settings for extracting the geometric and properties information from the given layout.
compound_to_analyse (Any | None = None) – The compound object to analyse, if present. If
Noneis given, the givenFillableobject is considered instead.
- Returns:
Object collecting all the information about the geometry and the properties extracted from the layout.
- Return type: