18 for (
int i = 1; i < argc; ++i)
19 tokens.push_back(std::string(argv[i]));
23 getParametersFilename()
25 std::string parameters_filename;
29 if (cmdOptionExists(
"-i"))
31 parameters_filename = getCmdOption(
"-i");
32 if (dealii::Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)
34 std::cout <<
"Using the input parameter file: " << parameters_filename
40 throw(
"Invalid command line option given. The only argument should "
41 "be to specify the input file name.");
46 if (cmdOptionExists(
"-i"))
48 parameters_filename =
"parameters.prm";
49 std::ifstream ifs_prm(parameters_filename);
50 std::ifstream ifs_in(
"parameters.in");
51 if (!ifs_prm && ifs_in)
52 throw(
"The previous extension .in for the parameters file is no "
53 "longer accepted. Please rename parameters.in as "
55 if (dealii::Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)
57 std::cout <<
"Using the input parameter file: " << parameters_filename
63 throw(
"Invalid command line option given. The only argument should "
64 "be to specify the input file name.");
69 parameters_filename =
"parameters.prm";
70 std::ifstream ifs_prm(parameters_filename);
71 std::ifstream ifs_in(
"parameters.in");
72 if (!ifs_prm && ifs_in)
73 throw(
"The previous extension .in for the parameters file is no longer "
74 "accepted. Please rename parameters.in as parameters.prm");
75 if (dealii::Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)
77 std::cout <<
"Using the input parameter file: " << parameters_filename
83 throw(
"Too many command line arguments were given. The only argument "
84 "should be to specify the input file name.");
87 return parameters_filename;
92 std::vector<std::string> tokens;
95 getCmdOption(
const std::string &option)
const
97 std::vector<std::string>::const_iterator itr;
98 itr = std::find(tokens.begin(), tokens.end(), option);
99 if (itr != tokens.end() && ++itr != tokens.end())
103 static const std::string empty_string(
"");
108 cmdOptionExists(
const std::string &option)
const
110 return std::find(tokens.begin(), tokens.end(), option) != tokens.end();