Skip to content

Commit

Permalink
Merge pull request #35 from HydLa/fix/tmForMaster
Browse files Browse the repository at this point in the history
fix tm option for master
  • Loading branch information
nikosai authored Feb 19, 2024
2 parents 0b12def + fde22c0 commit 82a3b66
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
4 changes: 3 additions & 1 deletion src/core/ProgramOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,9 @@ void ProgramOptions::init_descriptions() {
("dsolve", value<int>()->default_value(0), "")

("tm",
value<std::string>()->default_value("n"),
value<std::vector<std::string>>()
->multitoken()
->default_value(std::vector<string>{"n"}, ""),
"")

("csv",
Expand Down
25 changes: 14 additions & 11 deletions src/core/symbolic_simulate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,19 +114,22 @@ void output_result(Simulator &ss, Opts &opts) {
writer.write(*simulator_, of_name, input_file_name + "_diff");
}

if (cmdline_options.get<std::vector<string>>("tm").at(0) == "s") {
hydla::io::StdProfilePrinter().print_profile(ss.get_profile());
} else if (cmdline_options.get<std::vector<string>>("tm").at(0) == "c") {
std::string csv_name = cmdline_options.get<std::vector<string>>("tm").at(1);
if (csv_name == "") {
hydla::io::CsvProfilePrinter().print_profile(ss.get_profile());
} else {
std::ofstream ofs;
ofs.open(csv_name.c_str());
hydla::io::CsvProfilePrinter(ofs).print_profile(ss.get_profile());
ofs.close();
if (not is_master()) {
if (cmdline_options.get<std::vector<string>>("tm").at(0) == "s") {
hydla::io::StdProfilePrinter().print_profile(ss.get_profile());
} else if (cmdline_options.get<std::vector<string>>("tm").at(0) == "c") {
std::string csv_name = cmdline_options.get<std::vector<string>>("tm").at(1);
if (csv_name == "") {
hydla::io::CsvProfilePrinter().print_profile(ss.get_profile());
} else {
std::ofstream ofs;
ofs.open(csv_name.c_str());
hydla::io::CsvProfilePrinter(ofs).print_profile(ss.get_profile());
ofs.close();
}
}
}

}

void trim_front_and_behind_space(std::string &buffer) {
Expand Down

0 comments on commit 82a3b66

Please sign in to comment.