Jaffgen Command
Overview
jaffgen is the command-line interface for JAFF code generation. It processes template files containing JAFF directives and generates code for chemical reaction networks in multiple programming languages.
Basic Usage
Required Arguments
| Argument | Description |
|---|---|
--network |
Path to chemical reaction network file |
Optional Arguments
| Argument | Description | Default |
|---|---|---|
--outdir |
Output directory for generated files | src/jaff/generated |
--indir |
Directory containing template files (Does recursive templating) | None |
--files |
Individual template files to process | None |
--template |
Name of predefined template collection | None |
--lang |
Default language for files without language detection | Auto-detect |
Input Sources
You can combine multiple input sources in a single command:
1. Template Directory (--indir)
Process all files in a directory:
2. Predefined Templates (--template)
Use built-in template collections from jaff/templates/generator/:
Available Templates:
kokkos_ode- Kokkos-based ODE solver templatesmicrophysics- Microphysics integration templatespython_solve_ivp- Simple initial value proble using pythonfortran_dlsodes- Fortran dlsodes template
3. Individual Files (--files)
Process specific template files:
4. Combined Sources
Mix different input sources:
jaffgen --network networks/test.dat --template microphysics --indir templates/kokkos_ode --files custom.cpp --outdir output/
Language Support
JAFF supports automatic language detection from file extensions. If a file extension is unsupported, you will need to specify the --lang option, the code will crash otherwise
Supported Languages
| Language | Aliases | File Extensions |
|---|---|---|
| C | c |
.c, .h |
| C++ | cxx, cpp, c++ |
.cpp, .cxx, .hpp |
| Fortran | fortran, f90 |
.f90, .F90 |
| Python | python, py |
.py |
| Rust | rust, rs |
.rs |
| Julia | julia, jl |
.jl |
NOTE: The supported extensions are case independent
Specifying Language
Output
Generated files are written to the output directory with the same filename as the template:
Output Directory Behavior:
- If
--outdiris not specified, files are generated injaff/generated/ - The output directory is created if it doesn't exist
- Existing files are overwritten without warning
See Also
- Template Syntax - Complete JAFF template command reference
- Getting Started - Introduction to JAFF
Next: Learn about Template Syntax to create your own templates.