Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dumux-repositories
dumux
Commits
836b7f21
Commit
836b7f21
authored
Jan 27, 2016
by
Kilian Weishaupt
Browse files
Merge branch 'bugfix/pass-negative-values' into 'master'
Bugfix/pass negative values See merge request
!53
parents
496eb859
ea601ec3
Changes
1
Hide whitespace changes
Inline
Side-by-side
dumux/common/start.hh
View file @
836b7f21
...
...
@@ -62,29 +62,30 @@ NEW_PROP_TAG(TimeManager);
std
::
string
readOptions_
(
int
argc
,
char
**
argv
,
Dune
::
ParameterTree
&
paramTree
)
{
// All command line options need to start with '-'
for
(
int
i
=
1
;
i
<
argc
;
++
i
)
{
if
(
argv
[
i
][
0
]
!=
'-'
)
{
if
(
i
==
1
)
{
// try to pass first argument as parameter file
paramTree
[
"ParameterFile"
]
=
argv
[
1
];
continue
;
}
else
{
std
::
ostringstream
oss
;
oss
<<
"
\n
-> Command line argument "
<<
i
<<
" (='"
<<
argv
[
i
]
<<
"') is invalid. <-
\n\n\n\n
"
;
return
oss
.
str
();
}
for
(
int
i
=
1
;
i
<
argc
;
++
i
)
{
if
(
argv
[
i
][
0
]
!=
'-'
&&
i
==
1
)
{
// try to pass first argument as parameter file
paramTree
[
"ParameterFile"
]
=
argv
[
1
];
continue
;
}
// read a -MyOpt VALUE option
std
::
string
paramName
=
argv
[
i
]
+
1
;
std
::
ostringstream
oss
;
if
(
argv
[
i
][
0
]
!=
'-'
)
{
oss
<<
"
\n
-> Command line argument "
<<
i
<<
" (='"
<<
argv
[
i
]
<<
"') is invalid. <-
\n\n\n\n
"
;
return
oss
.
str
();
}
if
(
argc
==
i
+
1
||
argv
[
i
+
1
][
0
]
==
'-'
)
{
std
::
ostringstream
oss
;
oss
<<
"
\n
-> No argument given for parameter '"
<<
argv
[
i
]
<<
"'! <-
\n\n\n\n
"
;
if
(
i
+
1
==
argc
)
{
oss
<<
"
\n
-> No argument
2
given for parameter '"
<<
argv
[
i
]
<<
"'! <-
\n\n\n\n
"
;
return
oss
.
str
();
}
// read a -MyOpt VALUE option
std
::
string
paramName
=
argv
[
i
]
+
1
;
std
::
string
paramValue
=
argv
[
i
+
1
];
++
i
;
// In the case of '-MyOpt VALUE' each pair counts as two arguments
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment