Skip to content
Snippets Groups Projects
Commit d6e8dea4 authored by Santiago Ospina De Los Ríos's avatar Santiago Ospina De Los Ríos
Browse files

Add help functions to executables

parent b89f990a
No related branches found
No related tags found
1 merge request!49Resolve "Finish installation and usage instruction on the documentation"
......@@ -25,20 +25,20 @@
#include <dune/common/parametertreeparser.hh>
#include <ctime>
#include <vector>
statuc std::string string_help =
static std::string string_help =
"Usage: dune-copasi-md CONFIG_FILE\n"
"\n"
"Execute numerical simulation of reaction-diffusion systems on multiple\n"
"compartments. The CONFIG_FILE follows is a DUNE INI file with the\n"
"parameters to perform the simulation.\n"
"compartments. The CONFIG_FILE is a DUNE INI file with the\n"
"parameters to perform the simulation.\n";
int
main(int argc, char** argv)
{
std::vector<std::string> cmd_line_args(argv, argv+argc);
// Read and parse ini file
if (cmd_line_args.size() != 2) {
std::cerr << string_help;
return 1;
......@@ -53,8 +53,8 @@ main(int argc, char** argv)
// initialize mpi
auto& mpi_helper = Dune::MPIHelper::instance(argc, argv);
// Read and parse ini file
const std::string config_filename = cmd_line_args[0];
Dune::ParameterTree config;
Dune::ParameterTreeParser::readINITree(config_filename, config);
......
......@@ -25,10 +25,28 @@
#include <dune/common/parametertreeparser.hh>
#include <ctime>
#include <vector>
static std::string string_help =
"Usage: dune-copasi-sd CONFIG_FILE\n"
"\n"
"Execute numerical simulation of reaction-diffusion systems on single\n"
"compartments. The CONFIG_FILE is a DUNE INI file with the\n"
"parameters to perform the simulation.\n";
int
main(int argc, char** argv)
{
std::vector<std::string> cmd_line_args(argv, argv+argc);
if (cmd_line_args.size() != 2) {
std::cerr << string_help;
return 1;
} else if (cmd_line_args[0] == "--help" or cmd_line_args[0] == "-h") {
std::cout << string_help;
return 0;
}
auto stime_c = std::chrono::system_clock::now();
int end_code = 0;
......@@ -36,12 +54,7 @@ main(int argc, char** argv)
auto& mpi_helper = Dune::MPIHelper::instance(argc, argv);
// Read and parse ini file
if (argc != 2)
DUNE_THROW(Dune::IOError, "Wrong number of arguments");
const std::string config_filename = argv[1];
Dune::ParameterTree config;
Dune::ParameterTreeParser::readINITree(config_filename, config);
const std::string config_filename = cmd_line_args[0];
// initialize loggers
auto comm = mpi_helper.getCollectiveCommunication();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment