|
Dynamic Neural Field Composer 0.0.0
A C++20 library and interactive application for building and simulating Dynamic Neural Field (DNF) architectures.
|
Serializes and deserializes a Simulation to / from a JSON file. More...
#include <simulation_file_manager.h>
Public Member Functions | |
| void | loadElementsFromJson () const |
Deserialize elements and connections from a JSON file into the simulation. After loading, FieldCoupling elements have their weight directory set to the parent directory of the JSON file and their weights are re-read from there. | |
| void | saveElementsToJson () const |
Serialize all elements and their connections to a JSON file. When filePath is empty the output directory is data/<identifier>/ and FieldCoupling weight matrices are written into the same directory before the JSON is saved. | |
| SimulationFileManager (const std::shared_ptr< Simulation > &simulation, const std::string &filePath={}) | |
| Construct a SimulationFileManager. | |
Serializes and deserializes a Simulation to / from a JSON file.
SimulationFileManager reads and writes every element in the simulation (including parameters and inter-element connections) as a JSON document. This allows pre-designed or evolved architectures to be saved and replayed without re-implementing them in code.
Default output layout when filePath is empty:
When loading, FieldCoupling weight files are resolved relative to the directory that contains the .dnf file (i.e. parent_path(filePath)).
The optional path supplied to this manager has different behavior depending on the operation:
.dnf file path to save to or load from;data/) and a generated <identifier>/<identifier>.dnf file path. | dnf_composer::SimulationFileManager::SimulationFileManager | ( | const std::shared_ptr< Simulation > & | simulation, |
| const std::string & | filePath = {} |
||
| ) |
Construct a SimulationFileManager.
| simulation | The simulation instance to read into or write from. |
| filePath | Optional .dnf file path. When non-empty, it is the file used for both save and load operations. When empty, saveElementsToJson() writes to the default output location using a generated <identifier>.dnf file name, while loadElementsFromJson() expects a concrete .dnf file path to be available at the resolved path. |
| void dnf_composer::SimulationFileManager::loadElementsFromJson | ( | ) | const |
Deserialize elements and connections from a JSON file into the simulation. After loading, FieldCoupling elements have their weight directory set to the parent directory of the JSON file and their weights are re-read from there.
| void dnf_composer::SimulationFileManager::saveElementsToJson | ( | ) | const |
Serialize all elements and their connections to a JSON file. When filePath is empty the output directory is data/<identifier>/ and FieldCoupling weight matrices are written into the same directory before the JSON is saved.