gensec.io_yaml

YAML input loader.

Reads a YAML file describing materials, section geometry, and (optionally) load demands, and returns fully constructed GenSec objects ready for analysis. Supports both the legacy rectangular format and the generic section format with parametric shapes or custom polygons.

See YAML input reference for the full input specification.

YAML input loader for GenSec.

Reads a YAML file describing materials, section geometry, and (optionally) load demands, and returns fully constructed GenSec objects ready for analysis.

Section geometry format

The section block supports two modes:

Legacy rectangular (backward-compatible):

section:
  B: 300
  H: 600
  bulk_material: concrete_1
  n_fibers_y: 100
  n_fibers_x: 1
  rebars:
    - y: 40
      As: 942.5
      material: steel_1

Generic section (new):

section:
  shape: tee            # or: rect, circle, annulus, h, box,
                         #     single_tee, double_tee, custom
  params:
    bf: 800
    hf: 150
    bw: 300
    hw: 450
  bulk_material: concrete_1
  mesh_size: 15
  mesh_method: grid      # or: triangle
  rebars:
    - y: 40
      x: 150
      As: 942.5
      material: steel_1

Custom polygon (arbitrary vertex list):

section:
  shape: custom
  params:
    exterior: [[0,0], [300,0], [300,600], [0,600]]
    holes:
      - [[50,50], [250,50], [250,150], [50,150]]
  bulk_material: concrete_1
  mesh_size: 10
  mesh_method: triangle
  rebars: []

The YAML parser detects which mode to use:

  • If shape is present → generic section.

  • If B and H are present without shape → legacy rectangular (wrapped via RectSection).

load_yaml(
filepath,
)

Load a GenSec input file and return constructed objects.

Detects whether the section block uses the legacy rectangular format (B + H) or the new generic format (shape).

Parameters:

filepath (str or pathlib.Path)

Returns:

Keys: 'materials', 'section' (GenericSection or RectSection), 'demands', 'combinations', 'output_options'.

Return type:

dict