glow.generator package

Submodules

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 = '/home/runner/work/glow/glow/glow/tdt_lattice.dat', edges: ~typing.List[~glow.generator.geom_extractor.Edge] = <factory>, faces: ~typing.List[~glow.generator.geom_extractor.Face] = <factory>, boundaries: ~typing.List[~glow.generator.geom_extractor.Boundary] = <factory>, type_geo: ~glow.support.types.LatticeGeometryType = LatticeGeometryType.HEXAGON_TRAN, type_sym: ~glow.support.types.SymmetryType = SymmetryType.FULL, albedo: float | None = None, impressions: ~typing.Tuple[int, int] = (0, 0), precisions: ~typing.Tuple[float, float] = (1e-05, 1e-05))[source]

Bases: object

Dataclass 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 lattice’s BCs.

boundaries: List[Boundary]

List of the geometry layout borders, as Boundary objects.

edges: List[Edge]

List of the geometry layout edges, as Edge objects.

faces: List[Face]

List of the geometry layout regions, as Face objects.

filename: str = '/home/runner/work/glow/glow/glow/tdt_lattice.dat'

Name of the file in the TDT format 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: List[str]

List of the names of the properties the regions of the geometry layout are associated with.

property_ids: List[int]

List of the IDs of the properties in the geometry layout.

type_geo: LatticeGeometryType = 9

The type of geometry applied to the geometry layout, as element of the LatticeGeometryType enumeration.

type_sym: SymmetryType = 0

The type of the symmetry applied to the geometry layout, as element of the SymmetryType enumeration.

write_tdt_file(tdt_data: TdtData) None[source]

Function that writes the output file with the characteristics of the geometry layout in the TDT format.

Parameters:

tdt_data (TdtData) – The instance of the TdtData class storing the information of the lattice geometry.

glow.generator.geom_extractor module

Module containing classes that deals with the extraction of the geometric information from the lattice built in SALOME. The functionalities in this module serve for preparing all the data for the output TDT file generation.

class Boundary(border: Any, type_geo: LatticeGeometryType, lattice_o: Any, dimensions: Tuple[float, float])[source]

Bases: object

Class that provides the data structure for a GEOM edge object being a border of the lattice.

Parameters:
  • border (Any) – A GEOM edge object representing a border of the lattice.

  • type_geo (LatticeGeometryType) – Providing the lattice type of geometry.

  • lattice_o (Any) – A vertex object representing the lattice center point.

  • dimensions (Tuple[float, float]) – The X-Y characteristic dimensions of the lattice the border refers to.

border

A GEOM edge object representing a border of the lattice.

Type:

Any

type

Providing the type of BCs.

Type:

BoundaryType

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 lattice 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 lattice.

Parameters:
  • boundaries (Any) – A GEOM compound object made from the list of GEOM edge objects belonging to the lattice boundaries.

  • id_vs_edge (Dict[Any, str]) – A dictionary of all the lattice edge IDs VS the corresponding GEOM edge objects.

Raises:

RuntimeError – In case the boundary edge is not of type SEGMENT.

get_bc_type_number() int[source]

Method that returns the index associated to the BC type in the corresponding instance attribute dictionary.

Returns:

An integer describing the type for the BC this class instance refers to.

Return type:

int

class Edge(edge: Any, *faces: Face)[source]

Bases: object

Class that provides a data representation for an edge of a face in the lattice. It provides an global index allowing to uniquely identify the edge, and two Face attributes, allowing to identify the face on the left and 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[Face, ...]) – Providing the Face objects 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

right

A Face object providing the information for the face to the right of the edge, or None if the edge does not have any face on its right.

Type:

Face | None

left

A Face object providing the information for the face to the left of the edge, or None if the edge does not have any face on its left.

Type:

Face | None

class Face(face: Any, property: str)[source]

Bases: object

Class that provides a data representation for a subface of the lattice, which represents a calculation zone containing a list of properties. This dataclass can be ordered on the basis of the no attribute, which provides a global index for the faces in the lattice.

edge_vs_id: Dict[Any, str]

Dictionary associating the GEOM edge objects of the lattice subface to the corresponding ID, based on the edge geometrical characteristics.

face: Any

A GEOM face object representing a region of the lattice.

inner_point: Tuple[float, float, float]

XYZ coordinates of a point within the GEOM face object.

no: int

Global index of the face.

property: str

The value of the property associated to the region.

sort_index: int

Indicating the attribute used to sort Face objects.

class LatticeDataExtractor(lattices: List[Lattice], geom_type: GeometryType, compound_to_analyse: Any | None, type_geo: LatticeGeometryType)[source]

Bases: object

Class that extracts the geometric data from a layout coming either from a given list of lattices or from the compound object representing their portion. These data is used for generating the output TDT file. The process relies on determining:

  • the association of faces with properties;

  • the association between edges and the faces they belong to;

  • the geometric data and BC types applied on the lattices/compound borders.

Parameters:
  • lattices (List[Lattice]) – A list of Lattice instances storing the geometric information to extract.

  • geom_type (GeometryType) – The type of geometry of the cells in the lattices. This setting is used to extract the regions matching the geometry types.

  • compound_to_analyse (Any | None = None) – The compound object to analyse. If None is provided, the lattices are considered instead.

  • type_geo (LatticeGeometryType) – Identifying the value for the typegeo related to the layout.

lattices

The list of Lattice objects storing the geometric information to extract.

Type:

List[Lattice]

borders

The list of edge objects representing the borders of the layout.

Type:

List[Any]

boundaries

The list of Boundary objects storing the geometric and BCs information about the layout’s borders.

Type:

List[Boundary]

subfaces

The list of Face objects storing the geometric information about each region of the layout.

Type:

List[Face]

edges

The list of Edge objects storing the geometric information about each edge of the layout and the faces they belong to.

Type:

List[Edge]

id_vs_edge

A dictionary of the IDs for the layout’s edges VS the corresponding edge objects.

Type:

Dict[str, Any]

lattice_edges

The list of the edge objects contained in the layout.

Type:

List[Any]

type_geo

Identifying the value for the typegeo related to the layout.

Type:

LatticeGeometryType

layout_center

The XYZ coordinates of the whole layout center.

Type:

Tuple[float, float, float]

dimensions

The XY characteristic dimensions of the layout.

Type:

Tuple[float, float]

build_boundaries() None[source]

Method that constructs a list of Boundary objects 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 same Boundary object.

build_edges(edge_names_vs_faces: Dict[str, List[Any | Face]]) None[source]

Method that builds a list of Edge objects from the given dictionary. It associates for each edge name a list containing the corresponding GEOM edge and the Face objects; the latter represent the faces sharing the same edge.

Parameters:

edge_names_vs_faces (Dict[str, List[Any | Face]]) – Dictionary of edge names VS the list with the corresponding GEOM edge and the connected Face objects.

build_edges_and_faces_association() Dict[str, List[Face]][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 lattice.

Returns:

A dictionary whose entries associate a list of adjacent faces (as Face objects) to the name of the corresponding shared edge.

Return type:

Dict[str, List[Face]]

build_faces(property_type: PropertyType) None[source]

Method that builds a list of Face objects from the GEOM face objects, extracted from the layout regions, and the property values. Each region in the layout corresponds to a region in a cell, according to the type of geometry (either technological or sectorized). Each region must be associated with a value for the given property type. If not the case, an exception is raised.

Parameters:

property_type (PropertyType = PropertyType.MATERIAL) – The type of property associated to the layout regions.

Raises:
  • RuntimeError – If no properties 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 = {CellType.HEX: [SymmetryType.THIRD, SymmetryType.SIXTH], CellType.RECT: [SymmetryType.FULL, SymmetryType.HALF]}

Identifying the symmetry types for each type of lattice cells for which the lattice translation should be evaluated.

analyse_lattice(lattices: List[Lattice], tdt_config: TdtSetup, compound_to_analyse: Any | None = None) LatticeDataExtractor[source]

Function that performs the lattice analysis to extract the necessary information 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 lattice boundaries.

If the compound_to_export parameter is provided, it will be the one to be analysed, according to the information stored in the provided lattices. In this way, a colorset of the lattices can be treated.

Parameters:
  • lattice (List[Lattice]) – The object storing the information about the geometry and the properties of the lattices.

  • tdt_config (TdtSetup) – Dataclass providing the settings for extracting the geometry information from the lattice layout and the properties assigned to its regions.

  • compound_to_analyse (Any | None = None) – The compound object to analyse, if present. If None is given, the lattices are considered instead.

Returns:

Object collecting all the information about the geometry and the properties extracted from the layout.

Return type:

LatticeDataExtractor

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 center 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 center 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_CIRCLE and SEGMENT is 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_CIRCLE and SEGMENT.

classify_lattice_edges(edges: List[Any]) Dict[str, Any][source]

Function that classifies the given lattice 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 name internal attribute is set using a global index over all the lattice’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_CIRCLE and SEGMENT types.