# renatogcruz/generative_design architecture

> Architecture diagram of the GitHub repository renatogcruz/generative_design, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/renatogcruz/generative_design
- Repository: https://github.com/renatogcruz/generative_design

## Overview

##### Project Type and Purpose
- The project is research-focused and serves as both a repository of experiments and a toolset for the generative design of metallic constructions.
- It blends parametric modeling (using tools like Grasshopper for Rhino) with genetic algorithms for structural and environmental optimization. The aim is to explore design spaces (structural weight, energy generation potential, etc.), which is clearly described in the README.

##### File Structure
- Data Inputs: The _inputs directory holds weather data (e.g., .epw), CSV files with module information and profiles—this is your raw data layer.
- Experiment/Discover Modules: The “discover” folder contains multiple experimental setups (for “cedufop”, “sigradi”, etc.) along with their associated assets (HTML, JavaScript libraries like d3.v3.js and kung.js, explorer scripts, results files, etc.). These clearly form separate experimental or simulation modules.
- Models and Final Designs: The “final_model”, “models”, “simple_trusses_models” and “study_models” directories gather various design iterations, Grasshopper (.gh, .ghx) scripts, and outputs, reflecting the implementation of parametric models and optimizations.
- Python Scripts & Supplementary Documents: Files like appendx.py, run-template.py, and the thesis PDF provide additional context or execute parts of the system (likely handling orchestration or processing).

##### Readme Insights – Architectural Concepts and Tools
- The README highlights that the system harnesses genetic algorithms integrated with parametric design strategies, framed within a research context to optimize steel structures.
- There’s an emphasis on tools like Rhino/Grasshopper, Karamba3D, and Ladybug—though many of these are external to the repository, they’re integral to the overall system architecture.

a. Main Components:
- Input Data Layer: Represent the _inputs directory as the collection point for weather data and design parameters.
- Generative Design Engine: This will be the core module where the genetic algorithms are applied to the parametric models; you might denote this as the “Computational Optimization Module”. Underneath, note that there are:
- Parametric design scripts (Grasshopper/gh files in various directories)
- Evolutionary solvers (e.g., the Discover modules and associated Python scripts like run-cedufop.py)
- Experiment Modules: Separate nodes for the different workflows under the “discover” folder (e.g., cedufop mono/duo, sigradi_one/two) can be depicted as distinct but related modules.
- Output / Visualization Layer: This includes the “models”, “final_model”, “simple_trusses_models”, “study_models” folders and the “figures” folder. Also show the visualization libraries (e.g., d3.v3.js, kung.js) that are used in the web-based result presentation (HTML pages, results.tsv files).
- Research and Documentation: Include supporting documentation (thesis PDF, appendx.py, README details) that inform the logic and process flow.

b. Relationships and Interactions:
- Data flows from the Input Data Layer into the Generative Design Engine.
- Within the engine, parameterized inputs are processed via genetic algorithms to produce design iterations.
- These iterations are then channeled to the Experiment Modules for various visualizations and further analysis.
- Results are output to the Output/Visualization Layer.

c. Architectural Patterns:
- Separation of concerns:
- Data Management (inputs)
- Computational Core (optimization engine)
- Presentation Layer (visualizations and experiment-specific modules)
- Integration with external specialized tools (Rhino/Grasshopper) as distinct boundary components.

d. Technologies & Frameworks to Include:
- Python is used for scripting and orchestration.
- Grasshopper (with .gh and .ghx files) for parametric modeling.
- JavaScript libraries such as d3.v3.js and kung.js for visualizing results via the HTML/Browser interface.
- External structural analysis tools (Karamba3D, Ladybug) as part of the design pipeline.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A("Input Data (_inputs)"):::data
    B("Generative Design Engine"):::engine
    A --> B

    B1("cedufop.gh"):::engineScript
    B2("cedufopduo.gh"):::engineScript
    B3("run-cedufop.py"):::engineScript
    B4("run-cedufopduo.py"):::engineScript
    B --> B1
    B --> B2
    B --> B3
    B --> B4

    C("Experiment Modules"):::experiment
    B --> C
    C1("Cedufop mono"):::experiment
    C2("Cedufop multi"):::experiment
    C3("Sigradi one"):::experiment
    C4("Sigradi two"):::experiment
    C --> C1
    C1 --> C2
    C2 --> C3
    C3 --> C4

    D("Output/Visualization"):::visualization
    B --> D
    D1("Final Model"):::visualization
    D2("Models"):::visualization
    D3("Simple Trusses Models"):::visualization
    D4("Study Models"):::visualization
    D5("Figures"):::visualization
    D6("Web Results (index.html)"):::visualization
    D --> D1
    D1 --> D2
    D2 --> D3
    D3 --> D4
    D4 --> D5
    D5 --> D6

    C --> D

    D -. "feedback" .-> B

    E("Research & Documentation"):::documentation
    E1("README.md"):::documentation
    E2("Thesis PDF"):::documentation
    E3("Appendix (appendx.py)"):::documentation
    E4("Run Template (run-template.py)"):::documentation
    E --> E1
    E1 --> E2
    E2 --> E3
    E3 --> E4
    E -. "informs" .-> B

    F("External Tools"):::external
    F1("Rhino/Grasshopper"):::external
    F2("Karamba3D"):::external
    F3("Ladybug"):::external
    F --> F1
    F1 --> F2
    F2 --> F3
    B --- F

    %% Click Events
    click A "https://github.com/renatogcruz/generative_design/tree/master/_inputs/"
    click B1 "https://github.com/renatogcruz/generative_design/blob/master/discover/cedufop.gh"
    click B2 "https://github.com/renatogcruz/generative_design/blob/master/discover/cedufopduo.gh"
    click B3 "https://github.com/renatogcruz/generative_design/blob/master/discover/run-cedufop.py"
    click B4 "https://github.com/renatogcruz/generative_design/blob/master/discover/run-cedufopduo.py"
    click C1 "https://github.com/renatogcruz/generative_design/tree/master/discover/cedufop_mono/"
    click C2 "https://github.com/renatogcruz/generative_design/tree/master/discover/cedufop_multi_inc/"
    click C3 "https://github.com/renatogcruz/generative_design/tree/master/discover/sigradi_one/"
    click C4 "https://github.com/renatogcruz/generative_design/tree/master/discover/sigradi_two/"
    click D1 "https://github.com/renatogcruz/generative_design/tree/master/final_model/"
    click D2 "https://github.com/renatogcruz/generative_design/tree/master/models/"
    click D3 "https://github.com/renatogcruz/generative_design/tree/master/simple_trusses_models/"
    click D4 "https://github.com/renatogcruz/generative_design/tree/master/study_models/"
    click D5 "https://github.com/renatogcruz/generative_design/tree/master/figures/"
    click D6 "https://github.com/renatogcruz/generative_design/blob/master/index.html"
    click E1 "https://github.com/renatogcruz/generative_design/blob/master/README.md"
    click E2 "https://github.com/renatogcruz/generative_design/blob/master/thesis_mecom_renatocruz.pdf"
    click E3 "https://github.com/renatogcruz/generative_design/blob/master/appendx.py"
    click E4 "https://github.com/renatogcruz/generative_design/blob/master/run-template.py"

    %% Styles
    classDef data fill:#a6cee3,stroke:#1f78b4,stroke-width:2px;
    classDef engine fill:#b2df8a,stroke:#33a02c,stroke-width:2px;
    classDef engineScript fill:#33a02c,stroke:#b2df8a,stroke-width:2px;
    classDef experiment fill:#ff7f00,stroke:#e31a1c,stroke-width:2px;
    classDef visualization fill:#fdbf6f,stroke:#ff7f00,stroke-width:2px;
    classDef documentation fill:#cab2d6,stroke:#6a3d9a,stroke-width:2px;
    classDef external fill:#fb9a99,stroke:#e31a1c,stroke-width:2px;
```
