Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dumux
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dumux-repositories
dumux
Commits
a94fc6b1
Commit
a94fc6b1
authored
8 years ago
by
Timo Koch
Browse files
Options
Downloads
Patches
Plain Diff
[generalproblem][test] Use new start.hh functionality
parent
34131fce
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!247
Fix/issue 343 starthh
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/common/generalproblem/test_generalproblem2p.cc
+43
-17
43 additions, 17 deletions
test/common/generalproblem/test_generalproblem2p.cc
with
43 additions
and
17 deletions
test/common/generalproblem/test_generalproblem2p.cc
+
43
−
17
View file @
a94fc6b1
...
@@ -23,8 +23,11 @@
...
@@ -23,8 +23,11 @@
*/
*/
#include
<config.h>
#include
<config.h>
#include
"generallensproblem.hh"
#include
<dumux/common/start.hh>
#include
<dumux/common/start.hh>
#include
<dumux/common/defaultusagemessage.hh>
#include
<dumux/common/parameterparser.hh>
#include
"generallensproblem.hh"
////////////////////////
////////////////////////
// the main function
// the main function
...
@@ -50,36 +53,59 @@ void usage(const char *progName, const std::string &errorMsg)
...
@@ -50,36 +53,59 @@ void usage(const char *progName, const std::string &errorMsg)
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
{
Dune
::
ParameterTree
paramTree
;
using
namespace
Dumux
;
std
::
string
s
(
Dumux
::
readOptions_
(
argc
,
argv
,
paramTree
));
if
(
s
.
empty
())
// everything was read correctly
try
{
{
Dune
::
ParameterTree
paramTree
;
// if the user just wanted to see the help / usage message show usage and stop program
if
(
!
ParameterParser
::
parseCommandLineArguments
(
argc
,
argv
,
paramTree
,
usage
))
{
usage
(
argv
[
0
],
defaultUsageMessage
(
argv
[
0
]));
return
0
;
}
// default model type is box
// default model type is box
const
std
::
string
modelType
(
paramTree
.
get
<
std
::
string
>
(
"ModelType"
,
"box"
));
const
std
::
string
modelType
(
paramTree
.
get
<
std
::
string
>
(
"ModelType"
,
"box"
));
if
(
modelType
==
"box"
)
if
(
modelType
==
"box"
)
{
{
typedef
TTAG
(
BoxGeneralLensProblem
)
ProblemTypeTag
;
using
ProblemTypeTag
=
TTAG
(
BoxGeneralLensProblem
);
// avoid unused parameter message
GET_PROP
(
ProblemTypeTag
,
ParameterTree
)
::
runTimeParams
()[
"ModelType"
]
=
"box"
;
GET_PROP
(
ProblemTypeTag
,
ParameterTree
)
::
runTimeParams
()[
"ModelType"
]
=
"box"
;
return
Dumux
::
start
<
ProblemTypeTag
>
(
argc
,
argv
,
usage
);
return
start
<
ProblemTypeTag
>
(
argc
,
argv
,
usage
);
}
}
else
if
(
modelType
==
"cc"
)
else
if
(
modelType
==
"cc"
)
{
{
typedef
TTAG
(
CCGeneralLensProblem
)
ProblemTypeTag
;
using
ProblemTypeTag
=
TTAG
(
CCGeneralLensProblem
);
return
Dumux
::
start
<
ProblemTypeTag
>
(
argc
,
argv
,
usage
);
// avoid unused parameter message
GET_PROP
(
ProblemTypeTag
,
ParameterTree
)
::
runTimeParams
()[
"ModelType"
]
=
"cc"
;
return
start
<
ProblemTypeTag
>
(
argc
,
argv
,
usage
);
}
}
else
if
(
modelType
==
"sequential"
)
else
if
(
modelType
==
"sequential"
)
{
{
typedef
TTAG
(
SequentialGeneralLensProblem
)
ProblemTypeTag
;
using
ProblemTypeTag
=
TTAG
(
SequentialGeneralLensProblem
);
return
Dumux
::
start
<
ProblemTypeTag
>
(
argc
,
argv
,
usage
);
// avoid unused parameter message
GET_PROP
(
ProblemTypeTag
,
ParameterTree
)
::
runTimeParams
()[
"ModelType"
]
=
"sequential"
;
return
start
<
ProblemTypeTag
>
(
argc
,
argv
,
usage
);
}
}
else
else
{
{
Dumux
::
ParameterException
e
(
"Unknown ModelType: "
+
modelType
);
std
::
cerr
<<
ParameterException
(
"Unknown ModelType: "
+
modelType
)
<<
". Abort!"
<<
std
::
endl
std
::
cerr
<<
e
<<
". Abort!"
<<
std
::
endl
<<
"ModelType can be: box (2p box model), cc (2p cc model), sequential (2p impes model)"
<<
std
::
endl
;
<<
"ModelType can be: box (2p box model), cc (2p cc model), sequential (2p impes model)"
<<
std
::
endl
;
exit
(
1
)
;
return
1
;
}
}
}
}
else
catch
(
ParameterException
&
e
)
{
DUNE_THROW
(
Dumux
::
ParameterException
,
"Unknown command line option "
<<
s
);
std
::
cerr
<<
std
::
endl
<<
e
<<
". Abort!"
<<
std
::
endl
;
}
return
1
;
}
catch
(
Dune
::
Exception
&
e
)
{
std
::
cerr
<<
"Dune reported error: "
<<
e
<<
std
::
endl
;
return
3
;
}
catch
(...)
{
std
::
cerr
<<
"Unknown exception thrown!
\n
"
;
return
4
;
}
}
// end main
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment