Skip to content
GitLab
Menu
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
d5eb0bc2
Commit
d5eb0bc2
authored
Jan 27, 2020
by
Timo Koch
Browse files
[cleanup] use std::string::empty for better readability
parent
4de7e8c7
Changes
11
Hide whitespace changes
Inline
Side-by-side
dumux/common/loggingparametertree.hh
View file @
d5eb0bc2
...
...
@@ -84,7 +84,7 @@ public:
bool
hasKeyInGroup
(
const
std
::
string
&
key
,
const
std
::
string
&
groupPrefix
)
const
{
if
(
groupPrefix
==
""
)
if
(
groupPrefix
.
empty
()
)
return
hasKey
(
key
);
if
(
hasKey
(
key
))
...
...
@@ -206,7 +206,7 @@ public:
const
std
::
string
&
key
,
const
std
::
string
&
defaultValue
)
const
{
if
(
groupPrefix
==
""
)
if
(
groupPrefix
.
empty
()
)
return
get
(
key
,
defaultValue
);
// first, look for the compound key
...
...
@@ -315,7 +315,7 @@ public:
const
std
::
string
&
key
,
const
T
&
defaultValue
)
const
{
if
(
groupPrefix
==
""
)
if
(
groupPrefix
.
empty
()
)
return
get
<
T
>
(
key
,
defaultValue
);
// first, look for the compound key
...
...
@@ -386,7 +386,7 @@ public:
T
getFromGroup
(
const
std
::
string
&
groupPrefix
,
const
std
::
string
&
key
)
const
{
if
(
groupPrefix
==
""
)
if
(
groupPrefix
.
empty
()
)
return
get
<
T
>
(
key
);
// first, look for the compound key
...
...
dumux/common/parameters.hh
View file @
d5eb0bc2
...
...
@@ -122,7 +122,7 @@ public:
parameterFileName
=
commandLineArgs
.
get
<
std
::
string
>
(
"ParameterFile"
,
parameterFileName
);
// otherwise use the default name (executable name + .input)
if
(
parameterFileName
==
""
)
if
(
parameterFileName
.
empty
()
)
{
parameterFileName
=
[
&
](){
std
::
string
defaultName
=
std
::
string
(
argv
[
0
])
+
".input"
;
...
...
@@ -139,7 +139,7 @@ public:
}();
// if no parameter file was given and also no default names where found, continue without
if
(
parameterFileName
==
""
)
if
(
parameterFileName
.
empty
()
)
{
if
(
mpiHelper
.
size
()
>
1
)
std
::
cout
<<
"Rank "
<<
mpiHelper
.
rank
()
<<
": "
;
...
...
@@ -392,7 +392,7 @@ private:
//! recursively merge all elements
static
void
mergeTreeImpl_
(
Dune
::
ParameterTree
&
target
,
const
Dune
::
ParameterTree
&
source
,
bool
overwrite
,
const
std
::
string
&
group
)
{
const
auto
prefix
=
group
==
""
?
""
:
group
+
"."
;
const
auto
prefix
=
group
.
empty
()
?
""
:
group
+
"."
;
for
(
const
auto
&
key
:
source
.
getValueKeys
())
if
(
overwrite
||
!
target
.
hasKey
(
key
))
target
[
prefix
+
key
]
=
source
[
key
];
...
...
@@ -412,7 +412,7 @@ void setParam(Dune::ParameterTree& params,
const
std
::
string
&
key
,
const
std
::
string
&
value
)
{
if
(
group
==
""
)
if
(
group
.
empty
()
)
params
[
key
]
=
value
;
else
params
[
group
+
"."
+
key
]
=
value
;
...
...
dumux/io/grid/gridmanager_alu.hh
View file @
d5eb0bc2
...
...
@@ -119,7 +119,7 @@ public:
// Didn't find a way to construct the grid
else
{
const
auto
prefix
=
modelParamGroup
==
""
?
modelParamGroup
:
modelParamGroup
+
"."
;
const
auto
prefix
=
modelParamGroup
.
empty
()
?
modelParamGroup
:
modelParamGroup
+
"."
;
DUNE_THROW
(
ParameterException
,
"Please supply one of the parameters "
<<
prefix
+
"Grid.UpperRight"
<<
", or a grid file in "
<<
prefix
+
"Grid.File"
);
...
...
dumux/io/grid/gridmanager_foam.hh
View file @
d5eb0bc2
...
...
@@ -85,7 +85,7 @@ public:
// Didn't find a way to construct the grid
else
{
const
auto
prefix
=
modelParamGroup
==
""
?
modelParamGroup
:
modelParamGroup
+
"."
;
const
auto
prefix
=
modelParamGroup
.
empty
()
?
modelParamGroup
:
modelParamGroup
+
"."
;
DUNE_THROW
(
ParameterException
,
"Please supply one of the parameters "
<<
prefix
+
"Grid.UpperRight"
<<
", or a grid file in "
<<
prefix
+
"Grid.File"
);
...
...
dumux/io/grid/gridmanager_mmesh.hh
View file @
d5eb0bc2
...
...
@@ -109,7 +109,7 @@ public:
// Didn't find a way to construct the grid
else
{
const
auto
prefix
=
modelParamGroup
==
""
?
modelParamGroup
:
modelParamGroup
+
"."
;
const
auto
prefix
=
modelParamGroup
.
empty
()
?
modelParamGroup
:
modelParamGroup
+
"."
;
DUNE_THROW
(
ParameterException
,
"Please supply one of the parameters "
<<
prefix
+
"Grid.UpperRight"
<<
", or a grid file in "
<<
prefix
+
"Grid.File"
);
...
...
dumux/io/grid/gridmanager_oned.hh
View file @
d5eb0bc2
...
...
@@ -93,7 +93,7 @@ public:
// Didn't find a way to construct the grid
else
{
const
auto
prefix
=
modelParamGroup
==
""
?
modelParamGroup
:
modelParamGroup
+
"."
;
const
auto
prefix
=
modelParamGroup
.
empty
()
?
modelParamGroup
:
modelParamGroup
+
"."
;
DUNE_THROW
(
ParameterException
,
"Please supply one of the parameters "
<<
prefix
+
"Grid.RightBoundary"
<<
", or "
<<
prefix
+
"Grid.Coordinates"
...
...
dumux/io/grid/gridmanager_sp.hh
View file @
d5eb0bc2
...
...
@@ -94,7 +94,7 @@ public:
}
else
{
const
auto
prefix
=
paramGroup
==
""
?
paramGroup
:
paramGroup
+
"."
;
const
auto
prefix
=
paramGroup
.
empty
()
?
paramGroup
:
paramGroup
+
"."
;
DUNE_THROW
(
ParameterException
,
"Please supply a grid file in "
<<
prefix
<<
"Grid.File or "
<<
prefix
<<
"Grid.UpperRight/Cells."
);
}
}
...
...
dumux/io/grid/gridmanager_sub.hh
View file @
d5eb0bc2
...
...
@@ -127,7 +127,7 @@ public:
<<
"Use Dune::VTKWriter to write out your grid manually."
<<
std
::
endl
;
const
auto
postfix
=
getParamFromGroup
<
std
::
string
>
(
paramGroup
,
"Problem.Name"
,
""
);
const
std
::
string
name
=
postfix
==
""
?
"subgrid"
:
"subgrid_"
+
postfix
;
const
std
::
string
name
=
postfix
.
empty
()
?
"subgrid"
:
"subgrid_"
+
postfix
;
Dune
::
DGFWriter
<
typename
Grid
::
LeafGridView
>
writer
(
subgridPtr
->
leafGridView
());
writer
.
write
(
name
+
".dgf"
);
}
...
...
@@ -140,7 +140,7 @@ public:
<<
"Use Dune::VTKWriter to write out your grid manually."
<<
std
::
endl
;
const
auto
postfix
=
getParamFromGroup
<
std
::
string
>
(
paramGroup
,
"Problem.Name"
,
""
);
const
std
::
string
name
=
postfix
==
""
?
"subgrid"
:
"subgrid_"
+
postfix
;
const
std
::
string
name
=
postfix
.
empty
()
?
"subgrid"
:
"subgrid_"
+
postfix
;
Dune
::
VTKWriter
<
typename
Grid
::
LeafGridView
>
vtkWriter
(
subgridPtr
->
leafGridView
());
vtkWriter
.
write
(
name
);
}
...
...
dumux/io/grid/gridmanager_ug.hh
View file @
d5eb0bc2
...
...
@@ -96,7 +96,7 @@ public:
// Didn't find a way to construct the grid
else
{
const
auto
prefix
=
modelParamGroup
==
""
?
modelParamGroup
:
modelParamGroup
+
"."
;
const
auto
prefix
=
modelParamGroup
.
empty
()
?
modelParamGroup
:
modelParamGroup
+
"."
;
DUNE_THROW
(
ParameterException
,
"Please supply one of the parameters "
<<
prefix
+
"Grid.UpperRight"
<<
", or a grid file in "
<<
prefix
+
"Grid.File"
);
...
...
dumux/io/grid/gridmanager_yasp.hh
View file @
d5eb0bc2
...
...
@@ -100,7 +100,7 @@ public:
// Didn't find a way to construct the grid
else
{
const
auto
prefix
=
modelParamGroup
==
""
?
modelParamGroup
:
modelParamGroup
+
"."
;
const
auto
prefix
=
modelParamGroup
.
empty
()
?
modelParamGroup
:
modelParamGroup
+
"."
;
DUNE_THROW
(
ParameterException
,
"Please supply one of the parameters "
<<
prefix
+
"Grid.UpperRight"
<<
", or a grid file in "
<<
prefix
+
"Grid.File"
);
...
...
dumux/multidomain/staggeredcouplingmanager.hh
View file @
d5eb0bc2
...
...
@@ -208,7 +208,7 @@ public:
constexpr
auto
prefix
=
isCellCenter
?
"CellCenter"
:
"Face"
;
try
{
if
(
paramGroup
==
""
)
if
(
paramGroup
.
empty
()
)
return
NumericEpsilon
<
typename
Traits
::
Scalar
,
numEq
>
(
prefix
);
else
return
NumericEpsilon
<
typename
Traits
::
Scalar
,
numEq
>
(
paramGroup
+
"."
+
prefix
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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