|
5 | 5 | #include <functional>
|
6 | 6 | #include <vector>
|
7 | 7 | #include <nlohmann/json.hpp>
|
8 |
| -//#include "utils.h" |
| 8 | +#include "utils.h" |
9 | 9 | #include "jsonUtils.h"
|
10 | 10 | #include "Mainvars.h"
|
11 | 11 |
|
@@ -682,10 +682,10 @@ n.InternalSetElectricalSynapseWeight(elec_weights[i].w.from, elec_weights[i].to,
|
682 | 682 | }
|
683 | 683 |
|
684 | 684 |
|
685 |
| -void writeParsToJson(wormForJson & w, string file_name) |
| 685 | + |
| 686 | +void writeParsToJson(json & j, wormForJson & w, string file_name) |
686 | 687 | {
|
687 | 688 |
|
688 |
| -json j; |
689 | 689 | {Params<double> par = getBodyParams(w.b);
|
690 | 690 | appendToJson<double>(j["Body"],par);}
|
691 | 691 |
|
@@ -760,6 +760,27 @@ void writeParsToJson(wormForJson & w)
|
760 | 760 | writeParsToJson(w, "worm_data.json");
|
761 | 761 | }
|
762 | 762 |
|
| 763 | + |
| 764 | +void writeParsToJson(wormForJson & w, string file_name) |
| 765 | +{ |
| 766 | +json j; |
| 767 | +writeParsToJson(j,w,file_name); |
| 768 | +} |
| 769 | + |
| 770 | +void writeParsToJson(wormForJson & w, string file_name, vector<doubIntParamsHead> & parvec) |
| 771 | +{ |
| 772 | +json j; |
| 773 | + |
| 774 | +for (size_t i=0;i<parvec.size(); i++) { |
| 775 | +if (strcmp(parvec[i].parDoub.head.c_str(),"NULL")!=0) |
| 776 | +appendToJson<double>(j[parvec[i].parDoub.head],parvec[i].parDoub); |
| 777 | +if (strcmp(parvec[i].parInt.head.c_str(),"NULL")!=0) |
| 778 | +appendToJson<long>(j[parvec[i].parInt.head],parvec[i].parInt); |
| 779 | +} |
| 780 | +writeParsToJson(j,w,file_name); |
| 781 | +} |
| 782 | + |
| 783 | + |
763 | 784 | void readJson(json j, ifstream & ifs)
|
764 | 785 | {
|
765 | 786 | ifs >> j;
|
|
0 commit comments