Dynamic Neural Field Composer 0.0.0
A C++20 library and interactive application for building and simulating Dynamic Neural Field (DNF) architectures.
Loading...
Searching...
No Matches
simulation_file_manager.h
Go to the documentation of this file.
1#pragma once
2
3#include <iostream>
4#include <nlohmann/json.hpp>
5#include <filesystem>
6#include <cmath>
7
8#include "tools/utils.h"
34#include "elements/resize.h"
35#include "elements/resize_2d.h"
36#include "elements/collapse.h"
37#include "elements/expand.h"
38
42
43namespace dnf_composer
44{
45 using json = nlohmann::json;
46
72 {
73 private:
74 std::shared_ptr<Simulation> simulation;
75 std::string filePath;
76 public:
85 SimulationFileManager(const std::shared_ptr<Simulation>& simulation, const std::string& filePath = {});
86
91 void saveElementsToJson() const;
92
96 void loadElementsFromJson() const;
97
98 private:
99 static json elementToJson(const std::shared_ptr<element::Element>& element);
100 void jsonToElements(const json& jsonElements) const;
101 };
102}
Serializes and deserializes a Simulation to / from a JSON file.
Definition simulation_file_manager.h:72
void saveElementsToJson() const
Serialize all elements and their connections to a JSON file. When filePath is empty the output direct...
Definition simulation_file_manager.cpp:17
void loadElementsFromJson() const
Deserialize elements and connections from a JSON file into the simulation. After loading,...
Definition simulation_file_manager.cpp:52
Definition application.h:20
nlohmann::json json
Definition simulation_file_manager.h:45