# li-yongcheng/fem-pinn architecture

> Architecture diagram of the GitHub repository li-yongcheng/fem-pinn, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/li-yongcheng/fem-pinn
- Repository: https://github.com/li-yongcheng/fem-pinn

## Overview

FEM-PINN is a GraphGym-based training application for graph-neural-network prediction of engineering-structure performance, demonstrated on a door frame. Its principal workflow is to launch training, load configuration and graph data, build a model, train and evaluate it, and aggregate results across seeds. The repository also supplies example GraphGym extension points for model components and training behavior. The README describes the dataset and prediction goal; sampled source shows orchestration and extension-package imports, but not the implementations of the examples or data-loading internals.

Main entry points: [`custom_graphgym/__init__.py`](https://github.com/li-yongcheng/fem-pinn/blob/main/custom_graphgym/__init__.py) (Custom extensions), [`main.py`](https://github.com/li-yongcheng/fem-pinn/blob/main/main.py) (Training entrypoint), [`custom_graphgym/encoder/example.py`](https://github.com/li-yongcheng/fem-pinn/blob/main/custom_graphgym/encoder/example.py) (Graph encoder), [`custom_graphgym/layer/example.py`](https://github.com/li-yongcheng/fem-pinn/blob/main/custom_graphgym/layer/example.py) (Graph layer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_run["Training workflow"]
  node_main["Training entrypoint<br/>[main.py]"]
  node_graphgym["GraphGym runtime"]
  node_data_module["Data module"]
  node_model_builder["Model builder"]
  node_trainer["Train and evaluate"]
  node_run_aggregation["Run aggregation"]
end

subgraph group_model["Model extensions"]
  node_custom_root["Custom extensions<br/>[__init__.py]"]
  node_encoder["Graph encoder<br/>[example.py]"]
  node_layer["Graph layer<br/>[example.py]"]
  node_network["GNN network<br/>[example.py]"]
  node_stage["Model stage<br/>[example.py]"]
  node_head["Prediction head<br/>[example.py]"]
  node_pooling["Graph pooling<br/>[example.py]"]
end

subgraph group_training["Training extensions"]
  node_config_ext["Custom config<br/>[example.py]"]
  node_loader_ext["Custom loader<br/>[example.py]"]
  node_loss["Custom loss<br/>[example.py]"]
  node_optimizer["Custom optimizer<br/>[example.py]"]
  node_activation["Custom activation<br/>[example.py]"]
  node_transform["Graph transforms"]
end

subgraph group_inputs["Inputs and results"]
  node_dataset[("Graph dataset")]
  node_results["Aggregated results"]
end

node_engineer(("Training user"))

node_engineer -->|"launches"| node_main
node_main -->|"imports"| node_custom_root
node_custom_root -->|"exports"| node_encoder
node_custom_root -->|"exports"| node_layer
node_custom_root -->|"exports"| node_network
node_custom_root -->|"exports"| node_stage
node_custom_root -->|"exports"| node_head
node_custom_root -->|"exports"| node_pooling
node_custom_root -->|"exports"| node_config_ext
node_custom_root -->|"exports"| node_loader_ext
node_custom_root -->|"exports"| node_loss
node_custom_root -->|"exports"| node_optimizer
node_custom_root -->|"exports"| node_activation
node_custom_root -->|"exports"| node_transform
node_main -->|"configures"| node_graphgym
node_main -->|"creates"| node_data_module
node_data_module -.->|"loads"| node_dataset
node_main -->|"creates model"| node_model_builder
node_main -->|"trains"| node_trainer
node_main -->|"aggregates"| node_run_aggregation
node_run_aggregation -.->|"writes"| node_results

click node_main "https://github.com/li-yongcheng/fem-pinn/blob/main/main.py"
click node_custom_root "https://github.com/li-yongcheng/fem-pinn/blob/main/custom_graphgym/__init__.py"
click node_encoder "https://github.com/li-yongcheng/fem-pinn/blob/main/custom_graphgym/encoder/example.py"
click node_layer "https://github.com/li-yongcheng/fem-pinn/blob/main/custom_graphgym/layer/example.py"
click node_network "https://github.com/li-yongcheng/fem-pinn/blob/main/custom_graphgym/network/example.py"
click node_stage "https://github.com/li-yongcheng/fem-pinn/blob/main/custom_graphgym/stage/example.py"
click node_head "https://github.com/li-yongcheng/fem-pinn/blob/main/custom_graphgym/head/example.py"
click node_pooling "https://github.com/li-yongcheng/fem-pinn/blob/main/custom_graphgym/pooling/example.py"
click node_config_ext "https://github.com/li-yongcheng/fem-pinn/blob/main/custom_graphgym/config/example.py"
click node_loader_ext "https://github.com/li-yongcheng/fem-pinn/blob/main/custom_graphgym/loader/example.py"
click node_loss "https://github.com/li-yongcheng/fem-pinn/blob/main/custom_graphgym/loss/example.py"
click node_optimizer "https://github.com/li-yongcheng/fem-pinn/blob/main/custom_graphgym/optimizer/example.py"
click node_activation "https://github.com/li-yongcheng/fem-pinn/blob/main/custom_graphgym/act/example.py"
click node_transform "https://github.com/li-yongcheng/fem-pinn/tree/main/custom_graphgym/transform"
click node_dataset "https://github.com/li-yongcheng/fem-pinn/tree/main/datasets"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_graphgym,node_data_module,node_model_builder,node_trainer,node_run_aggregation,node_engineer toneBlue
class node_custom_root,node_encoder,node_layer,node_network,node_stage,node_head,node_pooling toneAmber
class node_config_ext,node_loader_ext,node_loss,node_optimizer,node_activation,node_transform toneMint
class node_dataset,node_results toneRose
```

## Components

### Training workflow

- [Training entrypoint](https://github.com/li-yongcheng/fem-pinn/blob/main/main.py): `main.py`
- **GraphGym runtime**
- **Data module**
- **Model builder**
- **Train and evaluate**
- **Run aggregation**

### Model extensions

- [Custom extensions](https://github.com/li-yongcheng/fem-pinn/blob/main/custom_graphgym/__init__.py): `custom_graphgym/__init__.py`
- [Graph encoder](https://github.com/li-yongcheng/fem-pinn/blob/main/custom_graphgym/encoder/example.py): `custom_graphgym/encoder/example.py`
- [Graph layer](https://github.com/li-yongcheng/fem-pinn/blob/main/custom_graphgym/layer/example.py): `custom_graphgym/layer/example.py`
- [GNN network](https://github.com/li-yongcheng/fem-pinn/blob/main/custom_graphgym/network/example.py): `custom_graphgym/network/example.py`
- [Model stage](https://github.com/li-yongcheng/fem-pinn/blob/main/custom_graphgym/stage/example.py): `custom_graphgym/stage/example.py`
- [Prediction head](https://github.com/li-yongcheng/fem-pinn/blob/main/custom_graphgym/head/example.py): `custom_graphgym/head/example.py`
- [Graph pooling](https://github.com/li-yongcheng/fem-pinn/blob/main/custom_graphgym/pooling/example.py): `custom_graphgym/pooling/example.py`

### Training extensions

- [Custom config](https://github.com/li-yongcheng/fem-pinn/blob/main/custom_graphgym/config/example.py): `custom_graphgym/config/example.py`
- [Custom loader](https://github.com/li-yongcheng/fem-pinn/blob/main/custom_graphgym/loader/example.py): `custom_graphgym/loader/example.py`
- [Custom loss](https://github.com/li-yongcheng/fem-pinn/blob/main/custom_graphgym/loss/example.py): `custom_graphgym/loss/example.py`
- [Custom optimizer](https://github.com/li-yongcheng/fem-pinn/blob/main/custom_graphgym/optimizer/example.py): `custom_graphgym/optimizer/example.py`
- [Custom activation](https://github.com/li-yongcheng/fem-pinn/blob/main/custom_graphgym/act/example.py): `custom_graphgym/act/example.py`
- [Graph transforms](https://github.com/li-yongcheng/fem-pinn/tree/main/custom_graphgym/transform): `custom_graphgym/transform`

### Inputs and results

- [Graph dataset](https://github.com/li-yongcheng/fem-pinn/tree/main/datasets): `datasets`
- **Aggregated results**

### Other components

- **Training user**

## Connections

- Training user → Training entrypoint: launches (evidence: `README.md`)
- Training entrypoint → Custom extensions: imports (evidence: `main.py`)
- Custom extensions → Graph encoder: exports (evidence: `custom_graphgym/__init__.py`)
- Custom extensions → Graph layer: exports (evidence: `custom_graphgym/__init__.py`)
- Custom extensions → GNN network: exports (evidence: `custom_graphgym/__init__.py`)
- Custom extensions → Model stage: exports (evidence: `custom_graphgym/__init__.py`)
- Custom extensions → Prediction head: exports (evidence: `custom_graphgym/__init__.py`)
- Custom extensions → Graph pooling: exports (evidence: `custom_graphgym/__init__.py`)
- Custom extensions → Custom config: exports (evidence: `custom_graphgym/__init__.py`)
- Custom extensions → Custom loader: exports (evidence: `custom_graphgym/__init__.py`)
- Custom extensions → Custom loss: exports (evidence: `custom_graphgym/__init__.py`)
- Custom extensions → Custom optimizer: exports (evidence: `custom_graphgym/__init__.py`)
- Custom extensions → Custom activation: exports (evidence: `custom_graphgym/__init__.py`)
- Custom extensions → Graph transforms: exports (evidence: `custom_graphgym/__init__.py`)
- Training entrypoint → GraphGym runtime: configures (evidence: `main.py`)
- Training entrypoint → Data module: creates (evidence: `main.py`)
- Data module → Graph dataset: loads
- Training entrypoint → Model builder: creates model (evidence: `main.py`)
- Training entrypoint → Train and evaluate: trains (evidence: `main.py`)
- Training entrypoint → Run aggregation: aggregates (evidence: `main.py`)
- Run aggregation → Aggregated results: writes
