memea::gds

Function augment_dims

Source
pub fn augment_dims(
    map: &HashMap<String, Vec<GdsElement>>,
    cell: &str,
    w: Float,
    h: Float,
    units: f64,
    verbose: bool,
) -> Result<Dims, MemeaError>
Expand description

Augments component dimensions with enclosure data from GDS layout.

This function looks up a cell in the GDS library hashmap and computes the required enclosure margins by analyzing the cell’s geometry. It returns a complete Dims structure with both core dimensions and enclosure requirements.

§Arguments

  • map - HashMap of cell names to GDS elements (from hash_lib)
  • cell - Name of the cell to analyze
  • w - Core component width in micrometers
  • h - Core component height in micrometers
  • units - GDS unit conversion factor
  • verbose - Whether to show detailed computation output

§Returns

  • Ok(Dims) - Complete dimensions with enclosure data
  • Err(MemeaError) - Error during geometry analysis

§Examples

use memea::gds::{hash_lib, augment_dims};
use gds21::GdsLibrary;

let library = GdsLibrary::load("cells.gds").expect("Failed to load GDS");
let cell_map = hash_lib(library);
let units = 1e-9; // 1 nm database units

let dims = augment_dims(&cell_map, "sram_6t", 0.5, 0.8, units, true)
    .expect("Failed to compute dimensions");
println!("Cell area: {:.2} μm²", dims.area((1, 1)));