Skip to content

Commit

Permalink
adding helper function which choses the output stream / file
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Voigt authored and Alexander Voigt committed Oct 14, 2016
1 parent 6e14311 commit 46d3413
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
6 changes: 1 addition & 5 deletions templates/run.cpp.in
Expand Up @@ -113,11 +113,7 @@ int main(int argc, char* argv[])
slha_io.set_extra(model, scales, observables);
}

if (slha_output_file == "-") {
slha_io.write_to_stream(std::cout);
} else {
slha_io.write_to_file(slha_output_file);
}
slha_io.write_to(slha_output_file);
}

if (!database_output_file.empty() &&
Expand Down
13 changes: 9 additions & 4 deletions templates/slha_io.cpp.in
Expand Up @@ -184,13 +184,18 @@ void @ModelName@_slha_io::set_pmns(
}

/**
* Write SLHA object to file.
* Write SLHA object to given output. If output == "-", then the SLHA
* object is written to std::cout. Otherwise, output is interpreted
* as a file name
*
* @param file_name file name
* @param output "-" for cout, or file name
*/
void @ModelName@_slha_io::write_to_file(const std::string& file_name)
void @ModelName@_slha_io::write_to(const std::string& output)
{
slha_io.write_to_file(file_name);
if (output == "-")
write_to_stream(std::cout);
else
write_to_file(output);
}

/**
Expand Down
3 changes: 2 additions & 1 deletion templates/slha_io.hpp.in
Expand Up @@ -83,7 +83,8 @@ public:
void set_spinfo(const Problems<@ModelName@_info::NUMBER_OF_PARTICLES>&);
void set_spinfo(const std::vector<std::string>&, const std::vector<std::string>&);
void set_print_imaginary_parts_of_majorana_mixings(bool);
void write_to_file(const std::string&);
void write_to(const std::string&);
void write_to_file(const std::string& file_name) { slha_io.write_to_file(file_name); }
void write_to_stream(std::ostream& ostr = std::cout) { slha_io.write_to_stream(ostr); }

static void fill_minpar_tuple(@ModelName@_input_parameters&, int, double);
Expand Down

0 comments on commit 46d3413

Please sign in to comment.