Skip to content
Snippets Groups Projects
Commit 833be98c authored by Philipp Nuske's avatar Philipp Nuske
Browse files

changed default name of input file to <programname>.input

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@7740 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent 4ae6366b
No related branches found
No related tags found
No related merge requests found
...@@ -361,7 +361,7 @@ std::string usageTextBlock() ...@@ -361,7 +361,7 @@ std::string usageTextBlock()
"\t-parameterFile FILENAME File with parameter definitions\n" "\t-parameterFile FILENAME File with parameter definitions\n"
"\t-restart RESTARTTIME Restart simulation from a restart file\n" "\t-restart RESTARTTIME Restart simulation from a restart file\n"
"\n" "\n"
"For the case of no arguments given, the input parameter file is expected to be named './parameter.input' \n" "For the case of no arguments given, the input parameter file is expected to be named './<programname>.input' \n"
"\n"; "\n";
} }
...@@ -400,12 +400,18 @@ int start_(int argc, ...@@ -400,12 +400,18 @@ int start_(int argc,
// case print the usage message // case print the usage message
if (argc == 1) { if (argc == 1) {
std::cout<< "\nNo parameter file given. \n" std::cout<< "\nNo parameter file given. \n"
<< "Defaulting to './parameter.input' for input file.\n"; << "Defaulting to '"
<<argv[0]
<<".input' for input file.\n";
std::ifstream parameterFile; std::ifstream parameterFile;
// check whether the parameter file exists. // check whether the parameter file exists.
parameterFile.open("parameter.input"); std::string defaultName = argv[0];
defaultName += ".input";
parameterFile.open(defaultName);
if (not parameterFile.is_open()){ if (not parameterFile.is_open()){
std::cout<< "\n\t -> Could not open file './parameter.input'. <- \n\n\n\n"; std::cout<< "\n\t -> Could not open file '"
<<defaultName
<<"'. <- \n\n\n\n";
usage(argv[0], usageTextBlock()); usage(argv[0], usageTextBlock());
return 1; return 1;
} }
...@@ -436,8 +442,11 @@ int start_(int argc, ...@@ -436,8 +442,11 @@ int start_(int argc,
// read input file, but do not overwrite options specified // read input file, but do not overwrite options specified
// on the command line, since the latter have precedence. // on the command line, since the latter have precedence.
std::string inputFileName ; std::string inputFileName ;
if(argc==1) // if there are no arguments given (and there is a file ./parameter.input) we use it as input file if(argc==1) // if there are no arguments given (and there is a file ./<programname>.input) we use it as input file
inputFileName="parameter.input"; {
inputFileName = argv[0];
inputFileName += ".input";
}
else else
inputFileName = GET_RUNTIME_PARAM(TypeTag, std::string, parameterFile); // otherwise we read from the command line inputFileName = GET_RUNTIME_PARAM(TypeTag, std::string, parameterFile); // otherwise we read from the command line
......
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