# plant-root-soil-interactions-modelling/cplantbox architecture

> Architecture diagram of the GitHub repository plant-root-soil-interactions-modelling/cplantbox, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/plant-root-soil-interactions-modelling/cplantbox
- Repository: https://github.com/plant-root-soil-interactions-modelling/cplantbox

## Overview

CPlantBox is a functional-structural plant-modeling toolkit: users define plant structure and parameters, simulate plant development and functions such as water and carbon dynamics, then analyze or visualize the resulting geometry and properties. The central runtime combines a Python binding with structural plant models and functional models; separate applications support plant simulation, RSML inspection, and parameter estimation. The README documents these capabilities, while source-index references and excerpts support only selected internal links; unsampled implementation relationships are not inferred.

Main entry points: [`src/structural/Plant.h`](https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/src/structural/Plant.h) (Plant growth), [`gui/cplantbox/main.py`](https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/gui/cplantbox/main.py) (Plant web app), [`src/structural/SegmentAnalyser.cpp`](https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/src/structural/SegmentAnalyser.cpp) (Segment analysis), [`gui/rsml_viewer/main.py`](https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/gui/rsml_viewer/main.py) (RSML web viewer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_structure["Plant structure"]
  node_binding["Python bindings<br/>[PyPlantBox.cpp]"]
  node_organs["Plant organs<br/>[Organ.h]"]
  node_plant["Plant growth<br/>[Plant.h]"]
  node_mapped["Mapped plant<br/>[MappedOrganism.h]"]
end

subgraph group_function["Plant function"]
  node_hydraulic_params["Hydraulic parameters"]
  node_hydraulics["Water flow"]
  node_photosynthesis["Photosynthesis<br/>[Photosynthesis.h]"]
  node_phloem["Carbon flow<br/>[phloem_flux.py]"]
  node_exudation["Root exudation<br/>[ExudationModel.h]"]
end

subgraph group_analysis["Analysis and exchange"]
  node_segment_analysis["Segment analysis"]
  node_rsml["RSML exchange<br/>[rsml_writer.py]"]
  node_parameters["Parameter tools<br/>[parameters.py]"]
end

subgraph group_apps["User applications"]
  node_cplantbox_app["Plant web app<br/>[main.py]"]
  node_conversions["Plant conversions<br/>[conversions.py]"]
  node_vtk_conversions["VTK conversions<br/>[vtk_conversions.py]"]
  node_visualization["VTK visualization<br/>[vtk_plot.py]"]
  node_rsml_viewer["RSML web viewer<br/>[main.py]"]
  node_viewer_data["Viewer data model<br/>[viewer_data.py]"]
  node_estimate_data["Estimation data<br/>[estimate_data.py]"]
  node_estimate_params["Parameter estimation<br/>[estimate_params.py]"]
end

node_user(("Plant modeler"))

node_user -->|"configures simulation"| node_cplantbox_app
node_user -->|"inspects RSML"| node_rsml_viewer
node_binding -->|"binds API"| node_organs
node_mapped -->|"extends plant"| node_plant
node_mapped -->|"maps parameters"| node_hydraulic_params
node_segment_analysis -->|"uses model"| node_hydraulics
node_segment_analysis -->|"uses parameters"| node_hydraulic_params
node_cplantbox_app -->|"imports"| node_conversions
node_cplantbox_app -->|"imports"| node_vtk_conversions
node_cplantbox_app -.->|"renders results"| node_visualization
node_conversions -->|"uses"| node_vtk_conversions
node_rsml_viewer -->|"loads data"| node_viewer_data
node_rsml_viewer -->|"uses conversion"| node_vtk_conversions
node_estimate_data -->|"imports"| node_estimate_params
node_plant -.->|"supports water dynamics"| node_hydraulics
node_plant -.->|"supports carbon dynamics"| node_photosynthesis
node_plant -.->|"supports carbon flow"| node_phloem
node_plant -.->|"supports soil interaction"| node_exudation
node_plant -.->|"exports plant data"| node_rsml
node_segment_analysis -.->|"visualizes segments"| node_visualization

click node_binding "https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/src/PyPlantBox.cpp"
click node_organs "https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/src/structural/Organ.h"
click node_plant "https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/src/structural/Plant.h"
click node_mapped "https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/src/structural/MappedOrganism.h"
click node_hydraulic_params "https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/src/functional/PlantHydraulicParameters.h"
click node_hydraulics "https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/src/functional/PlantHydraulicModel.h"
click node_photosynthesis "https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/src/functional/Photosynthesis.h"
click node_phloem "https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/src/functional/phloem_flux.py"
click node_exudation "https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/src/functional/ExudationModel.h"
click node_segment_analysis "https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/src/structural/SegmentAnalyser.cpp"
click node_rsml "https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/src/rsml/rsml_writer.py"
click node_parameters "https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/src/tools/parameters.py"
click node_cplantbox_app "https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/gui/cplantbox/main.py"
click node_conversions "https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/gui/cplantbox/conversions.py"
click node_vtk_conversions "https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/gui/cplantbox/vtk_conversions.py"
click node_visualization "https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/src/visualisation/vtk_plot.py"
click node_rsml_viewer "https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/gui/rsml_viewer/main.py"
click node_viewer_data "https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/gui/viewer/viewer_data.py"
click node_estimate_data "https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/gui/estimate/estimate_data.py"
click node_estimate_params "https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/gui/estimate/estimate_params.py"

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_binding,node_organs,node_plant,node_mapped toneBlue
class node_hydraulic_params,node_hydraulics,node_photosynthesis,node_phloem,node_exudation toneAmber
class node_segment_analysis,node_rsml,node_parameters toneMint
class node_cplantbox_app,node_conversions,node_vtk_conversions,node_visualization,node_rsml_viewer,node_viewer_data,node_estimate_data,node_estimate_params toneRose
class node_user toneIndigo
```

## Components

### Plant structure

- [Python bindings](https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/src/PyPlantBox.cpp): `src/PyPlantBox.cpp`
- [Plant organs](https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/src/structural/Organ.h): `src/structural/Organ.h`
- [Plant growth](https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/src/structural/Plant.h): `src/structural/Plant.h`
- [Mapped plant](https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/src/structural/MappedOrganism.h): `src/structural/MappedOrganism.h`

### Plant function

- [Hydraulic parameters](https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/src/functional/PlantHydraulicParameters.h): `src/functional/PlantHydraulicParameters.h`
- [Water flow](https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/src/functional/PlantHydraulicModel.h): `src/functional/PlantHydraulicModel.h`
- [Photosynthesis](https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/src/functional/Photosynthesis.h): `src/functional/Photosynthesis.h`
- [Carbon flow](https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/src/functional/phloem_flux.py): `src/functional/phloem_flux.py`
- [Root exudation](https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/src/functional/ExudationModel.h): `src/functional/ExudationModel.h`

### Analysis and exchange

- [Segment analysis](https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/src/structural/SegmentAnalyser.cpp): `src/structural/SegmentAnalyser.cpp`
- [RSML exchange](https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/src/rsml/rsml_writer.py): `src/rsml/rsml_writer.py`
- [Parameter tools](https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/src/tools/parameters.py): `src/tools/parameters.py`

### User applications

- [Plant web app](https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/gui/cplantbox/main.py): `gui/cplantbox/main.py`
- [Plant conversions](https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/gui/cplantbox/conversions.py): `gui/cplantbox/conversions.py`
- [VTK conversions](https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/gui/cplantbox/vtk_conversions.py): `gui/cplantbox/vtk_conversions.py`
- [VTK visualization](https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/src/visualisation/vtk_plot.py): `src/visualisation/vtk_plot.py`
- [RSML web viewer](https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/gui/rsml_viewer/main.py): `gui/rsml_viewer/main.py`
- [Viewer data model](https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/gui/viewer/viewer_data.py): `gui/viewer/viewer_data.py`
- [Estimation data](https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/gui/estimate/estimate_data.py): `gui/estimate/estimate_data.py`
- [Parameter estimation](https://github.com/plant-root-soil-interactions-modelling/cplantbox/blob/master/gui/estimate/estimate_params.py): `gui/estimate/estimate_params.py`

### Other components

- **Plant modeler**

## Connections

- Plant modeler → Plant web app: configures simulation (evidence: `README.md`)
- Plant modeler → RSML web viewer: inspects RSML (evidence: `README.md`)
- Python bindings → Plant organs: binds API (evidence: `src/PyPlantBox.cpp`)
- Mapped plant → Plant growth: extends plant (evidence: `src/structural/MappedOrganism.h`)
- Mapped plant → Hydraulic parameters: maps parameters (evidence: `src/functional/PlantHydraulicParameters.h`)
- Segment analysis → Water flow: uses model (evidence: `src/structural/SegmentAnalyser.cpp`)
- Segment analysis → Hydraulic parameters: uses parameters (evidence: `src/structural/SegmentAnalyser.cpp`)
- Plant web app → Plant conversions: imports (evidence: `gui/cplantbox/main.py`)
- Plant web app → VTK conversions: imports (evidence: `gui/cplantbox/main.py`)
- Plant web app → VTK visualization: renders results
- Plant conversions → VTK conversions: uses (evidence: `gui/cplantbox/conversions.py`)
- RSML web viewer → Viewer data model: loads data (evidence: `gui/rsml_viewer/main.py`)
- RSML web viewer → VTK conversions: uses conversion (evidence: `gui/rsml_viewer/main.py`)
- Estimation data → Parameter estimation: imports (evidence: `gui/estimate/estimate_data.py`)
- Plant growth → Water flow: supports water dynamics
- Plant growth → Photosynthesis: supports carbon dynamics
- Plant growth → Carbon flow: supports carbon flow
- Plant growth → Root exudation: supports soil interaction
- Plant growth → RSML exchange: exports plant data
- Segment analysis → VTK visualization: visualizes segments
