> Note that GridFire is still very early in development and is not ready for scientific use. The API is not stable and
> the reults are not yet validated. We are actively working on improving the library and once it is tested and validated
> we will release a stable version.
## Design
GridFire uses a "graph-first" design to represent the nuclear network. Specifically, internally the network is
represented as a directed hypergraph where nodes are nuclides and edges are reactions. This design allows for very straightforward
and efficient evolution of the network topology.
## Current Features
- **Reaclib Support**: GridFire uses reaclib coefficients statically compiled into the binary to evaluate reation rates. We bundle a script which can be used to generate the header files where these are stored.
- **Auto Differentiation**: GridFire uses [CppAD](https://github.com/coin-or/CppAD) to generate analytic Jacobians for stiff network evaluation.
- **Dynamic Network Topology**: GridFire supports dynamic network topology, allowing for the addition and removal of nuclides and reactions during runtime.
- **Dynamic Stiff Detection**: GridFire uses a heuristic stiff detection algorithm to determine the stiffness of the network at runtime.
## Planned Features
### High Priority
- **Reverse Reactions**: Currently, GridFire only supports forward reactions. Very soon we will add support for reverse reactions.
- **Weak Reactions**: GridFire will eventually support weak reactions, allowing for a more complete nuclear network evolution.
- **Python Bindings**: We plan to add Python bindings to GridFire, allowing for easy integration with Python-based workflows.
### Low Priority
- **GPU and Multi-Core Support**: We plan to add support for GPU and multi-core execution, allowing for faster network evolution.
- **Topology Optimization**: We plan to add support for topology optimization, allowing for more efficient network evolution.
- **Real-Time Network Visualization**: We plan to add support for real-time network visualization, allowing for better understanding of the network evolution.
## Building
GridFire uses meson as its build system. The minimum required version is 1.5.0. To build GridFire, you will need to have the following dependencies installed:
- C++ compiler supporting at least C++20 (though we test against C++23, and it is **strongly** recommended to use C++23)
- [Meson](https://mesonbuild.com/) build system (`apt install meson` or `brew install meson` or `pip install "meson>=1.5.0"`)
- [Ninja](https://ninja-build.org/) build system (`apt install ninja-build` or `brew install ninja` or `pip install ninja`)
- (_optional to have preinstalled_) [Boost](https://www.boost.org/) libraries (`apt install libboost-all-dev` or `brew install boost`)
Boost is labeled as optional because if GridFire cannot find boost during installation it will ask the user if they want
to install it, and then it will take care of that insallation.
Once at least the C++ compiler, meson, and ninja are installed, you can build GridFire by running the following commands in the root directory of the repository:
```bash
meson setup build --buildtype=release
meson compile -C build
meson install -C build
```
Running the first command will create a `build` directory in the root of the repository, which will contain all the
build files. The second command will compile the library and the third command will install it to your system.
When installing GridFire it will generate a `pkg-config` file which can be used to link against the library in other
projects.
### Linking Against GridFire
The easiest way, by far, to link against GridFire is to use `pkg-config`. This will automatically handle all the
library and include flags for you. Further, the `pkg-config` file will also include the required information on
the libcomposition library so that you do not need to also manually link against it.
| `gridfire::GraphNetwork` | A general nuclear network which uses a directed hypergraph to represent the network topology. This is the main network implemented in GridFire and is the one you will most likely use. | `REACLIB` |
| `gridfire::StaticGraphNetwork` | A less general version of `gridfire::GraphNetwork` which uses a static graph to represent the network topology. That is to say that new species cannot be added or removed after instatiation of the network. | `REACLIB_STATIC` |
| `gridfire::Approx8Network` | A specialized network for the approximate 8 species network used in stellar nucleosynthesis. This is a reimplimentation of the network developed by Frank Timmes' for MESA | `APPROX8` |
| `gridfire::Network` | A virtual base class for all networks in GridFire. This is not meant to be used directly; rather, all networks in GridFire should subclass `gridfire::Network` and implement the required `evaluate` method. | `DEFAULT` |
Regardless of the network you chose, the interface is the same. You will need to create a `gridfire::NetIn` object
which contains the initial state of the network, including the composition, temperature, density, energy, initial time
step, and maximum time. You will then pass this object to the `evaluate` method of the network you chose. The `evaluate`
method will return a `gridfire::NetOut` object which contains the updated state of the network.
A simple example of how to use `gridfire::GraphNetwork` is shown below (note that `composition.h` is a header file
provided by libcomposition, which means your compiler must be able to find its header and library files. The pkg-config
file generated during the installation of GridFire will take care of this for you, so you can use `pkg-config` to