# liufengyinxue/herbivore_plant architecture

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

- Interactive diagram: https://gitdiagram.com/liufengyinxue/herbivore_plant
- Repository: https://github.com/liufengyinxue/herbivore_plant

## Overview

Herbivore_plant is a set of numerical herbivore–plant simulation implementations and spatial-pattern analysis tools, rather than one integrated application. Users run the model in MATLAB, CuPy/Jupyter, or PyOpenCL/Jupyter; the MATLAB movie script is documented for viewing a simulation, while the MATLAB analysis scripts calculate pattern statistics. Separate archives provide wavelength and sheep point-pattern analysis procedures. The README documents these roles, but no source excerpts were provided, so the graph does not infer calls or data transfers between components or inspect archive contents.

Main entry points: [`Grazing_GPU.m`](https://github.com/liufengyinxue/herbivore_plant/blob/main/Grazing_GPU.m) (MATLAB GPU model), [`Herbivore_Plant_cupy.ipynb`](https://github.com/liufengyinxue/herbivore_plant/blob/main/Herbivore_Plant_cupy.ipynb) (CuPy model), [`Grazing_CPU_movie.m`](https://github.com/liufengyinxue/herbivore_plant/blob/main/Grazing_CPU_movie.m) (MATLAB movie), [`Herbivore_Plant_pyopencl.ipynb`](https://github.com/liufengyinxue/herbivore_plant/blob/main/Herbivore_Plant_pyopencl.ipynb) (PyOpenCL model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_simulation["Simulation"]
  node_matlab_movie["MATLAB movie"]
  node_matlab_gpu["MATLAB GPU model<br/>[Grazing_GPU.m]"]
  node_cupy_model["CuPy model"]
  node_opencl_model["PyOpenCL model"]
end

subgraph group_pattern["Pattern analysis"]
  node_structure_factor["Structure factors"]
  node_density_fluctuation["Density fluctuation"]
  node_wavelength_analysis["Wavelength analysis"]
end

subgraph group_image["Image analysis"]
  node_sheep_analysis["Sheep point patterns<br/>[Imageanalysis.zip]"]
end

node_user(("Researcher"))
node_simulation_data["Simulation data"]

node_user -->|"runs to view"| node_matlab_movie
node_user -->|"runs to generate"| node_matlab_gpu
node_user -->|"runs to generate"| node_cupy_model
node_user -->|"runs to produce"| node_opencl_model
node_matlab_gpu -->|"generates"| node_simulation_data
node_cupy_model -->|"generates"| node_simulation_data
node_user -->|"runs to calculate"| node_structure_factor
node_user -->|"runs to calculate"| node_density_fluctuation
node_user -->|"follows procedures"| node_wavelength_analysis
node_user -->|"follows procedures"| node_sheep_analysis

click node_matlab_movie "https://github.com/liufengyinxue/herbivore_plant/blob/main/Grazing_CPU_movie.m"
click node_matlab_gpu "https://github.com/liufengyinxue/herbivore_plant/blob/main/Grazing_GPU.m"
click node_cupy_model "https://github.com/liufengyinxue/herbivore_plant/blob/main/Herbivore_Plant_cupy.ipynb"
click node_opencl_model "https://github.com/liufengyinxue/herbivore_plant/blob/main/Herbivore_Plant_pyopencl.ipynb"
click node_structure_factor "https://github.com/liufengyinxue/herbivore_plant/blob/main/Circularly_averaged_structure_factor_raster.m"
click node_density_fluctuation "https://github.com/liufengyinxue/herbivore_plant/blob/main/Raster_TL_DF_Convolution.m"
click node_wavelength_analysis "https://github.com/liufengyinxue/herbivore_plant/blob/main/Spatial_wavelength.zip"
click node_sheep_analysis "https://github.com/liufengyinxue/herbivore_plant/blob/main/Imageanalysis.zip"

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_matlab_movie,node_matlab_gpu,node_cupy_model,node_opencl_model toneBlue
class node_structure_factor,node_density_fluctuation,node_wavelength_analysis toneAmber
class node_sheep_analysis toneMint
class node_user,node_simulation_data toneIndigo
```

## Components

### Simulation

- [MATLAB movie](https://github.com/liufengyinxue/herbivore_plant/blob/main/Grazing_CPU_movie.m): `Grazing_CPU_movie.m`
- [MATLAB GPU model](https://github.com/liufengyinxue/herbivore_plant/blob/main/Grazing_GPU.m): `Grazing_GPU.m`
- [CuPy model](https://github.com/liufengyinxue/herbivore_plant/blob/main/Herbivore_Plant_cupy.ipynb): `Herbivore_Plant_cupy.ipynb`
- [PyOpenCL model](https://github.com/liufengyinxue/herbivore_plant/blob/main/Herbivore_Plant_pyopencl.ipynb): `Herbivore_Plant_pyopencl.ipynb`

### Pattern analysis

- [Structure factors](https://github.com/liufengyinxue/herbivore_plant/blob/main/Circularly_averaged_structure_factor_raster.m): `Circularly_averaged_structure_factor_raster.m`
- [Density fluctuation](https://github.com/liufengyinxue/herbivore_plant/blob/main/Raster_TL_DF_Convolution.m): `Raster_TL_DF_Convolution.m`
- [Wavelength analysis](https://github.com/liufengyinxue/herbivore_plant/blob/main/Spatial_wavelength.zip): `Spatial_wavelength.zip`

### Image analysis

- [Sheep point patterns](https://github.com/liufengyinxue/herbivore_plant/blob/main/Imageanalysis.zip): `Imageanalysis.zip`

### Other components

- **Researcher**
- **Simulation data**

## Connections

- Researcher → MATLAB movie: runs to view (evidence: `README.md`)
- Researcher → MATLAB GPU model: runs to generate (evidence: `README.md`)
- Researcher → CuPy model: runs to generate (evidence: `README.md`)
- Researcher → PyOpenCL model: runs to produce (evidence: `README.md`)
- MATLAB GPU model → Simulation data: generates (evidence: `README.md`)
- CuPy model → Simulation data: generates (evidence: `README.md`)
- Researcher → Structure factors: runs to calculate (evidence: `README.md`)
- Researcher → Density fluctuation: runs to calculate (evidence: `README.md`)
- Researcher → Wavelength analysis: follows procedures (evidence: `README.md`)
- Researcher → Sheep point patterns: follows procedures (evidence: `README.md`)
