42 lines
899 B
C++
42 lines
899 B
C++
#pragma once
|
|
|
|
#include "dynamic_grid.hpp"
|
|
#include "solver.hpp"
|
|
#include "rules.hpp"
|
|
|
|
#include <boost/archive/text_oarchive.hpp>
|
|
#include <boost/archive/text_iarchive.hpp>
|
|
#include <boost/serialization/serialization.hpp>
|
|
|
|
#include <fstream>
|
|
|
|
template <typename Grid>
|
|
struct AnalyzedGrid {
|
|
Grid grid;
|
|
Solution<Grid> analysis;
|
|
BasicRules rules;
|
|
|
|
private:
|
|
friend class boost::serialization::access;
|
|
template<class Archive>
|
|
void serialize(Archive & ar, const unsigned int /*version*/){
|
|
ar & grid & analysis.solution_traces;
|
|
}
|
|
};
|
|
|
|
inline auto grid_from_file(std::string file_path){
|
|
std::ifstream file(file_path);
|
|
boost::archive::text_iarchive ar(file);
|
|
|
|
AnalyzedGrid<DynamicGrid> ret;
|
|
ar >> ret;
|
|
return ret;
|
|
}
|
|
|
|
inline auto grid_to_file(AnalyzedGrid<DynamicGrid> const & grid, std::string file_path){
|
|
std::ofstream file(file_path);
|
|
boost::archive::text_oarchive ar(file);
|
|
|
|
ar << grid;
|
|
}
|
|
|