Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
cdo
Commits
ba6b5165
Commit
ba6b5165
authored
Oct 21, 2020
by
Uwe Schulzweida
Browse files
Simplify if statement.
parent
427625e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/Afterburner.cc
View file @
ba6b5165
...
@@ -102,6 +102,13 @@ static int hours[MaxHours + 1];
...
@@ -102,6 +102,13 @@ static int hours[MaxHours + 1];
static
std
::
vector
<
double
>
LevelFound
;
static
std
::
vector
<
double
>
LevelFound
;
static
inline
bool
filetype_is_netcdf
(
int
filetype
)
{
return
filetype
==
CDI_FILETYPE_NC
||
filetype
==
CDI_FILETYPE_NC2
||
filetype
==
CDI_FILETYPE_NC4
||
filetype
==
CDI_FILETYPE_NC4C
||
filetype
==
CDI_FILETYPE_NC5
;
}
static
void
static
void
lprintf
(
FILE
*
fp
)
lprintf
(
FILE
*
fp
)
{
{
...
@@ -588,9 +595,7 @@ static void
...
@@ -588,9 +595,7 @@ static void
after_control
(
struct
Control
*
globs
,
struct
Variable
*
vars
)
after_control
(
struct
Control
*
globs
,
struct
Variable
*
vars
)
{
{
int
i
;
int
i
;
int
nrecs
;
int
nrecs
=
0
;
int64_t
rdate
,
vdate
;
int
rtime
,
vtime
;
int
code
;
int
code
;
RARG
rarg
;
RARG
rarg
;
...
@@ -601,10 +606,13 @@ after_control(struct Control *globs, struct Variable *vars)
...
@@ -601,10 +606,13 @@ after_control(struct Control *globs, struct Variable *vars)
TsID
=
0
;
TsID
=
0
;
bool
righttime
=
false
;
bool
righttime
=
false
;
while
(
(
nrecs
=
streamInqTimestep
(
globs
->
istreamID
,
TsID
))
>
0
)
while
(
true
)
{
{
vdate
=
taxisInqVdate
(
globs
->
taxisID
);
nrecs
=
streamInqTimestep
(
globs
->
istreamID
,
TsID
);
vtime
=
taxisInqVtime
(
globs
->
taxisID
);
if
(
nrecs
<=
0
)
break
;
const
auto
vdate
=
taxisInqVdate
(
globs
->
taxisID
);
const
auto
vtime
=
taxisInqVtime
(
globs
->
taxisID
);
after_setDateTime
(
&
globs
->
StartDate
,
vdate
,
vtime
);
after_setDateTime
(
&
globs
->
StartDate
,
vdate
,
vtime
);
after_setDateTime
(
&
globs
->
NewDate
,
vdate
,
vtime
);
after_setDateTime
(
&
globs
->
NewDate
,
vdate
,
vtime
);
...
@@ -615,25 +623,16 @@ after_control(struct Control *globs, struct Variable *vars)
...
@@ -615,25 +623,16 @@ after_control(struct Control *globs, struct Variable *vars)
break
;
break
;
}
}
if
(
righttime
)
if
(
righttime
)
break
;
break
;
else
TsID
++
;
}
if
(
taxisInqType
(
globs
->
taxisID
)
==
TAXIS_RELATIVE
)
TsID
++
;
{
rdate
=
taxisInqRdate
(
globs
->
taxisID
);
rtime
=
taxisInqRtime
(
globs
->
taxisID
);
}
else
{
rdate
=
after_getDate
(
globs
->
StartDate
);
rtime
=
after_getTime
(
globs
->
StartDate
);
}
}
if
(
ofiletype
==
CDI_FILETYPE_NC
||
ofiletype
==
CDI_FILETYPE_NC2
||
ofiletype
==
CDI_FILETYPE_NC4
const
auto
taxis_is_relative
=
(
taxisInqType
(
globs
->
taxisID
)
==
TAXIS_RELATIVE
);
||
ofiletype
==
CDI_FILETYPE_NC4C
||
ofiletype
==
CDI_FILETYPE_NC5
)
const
auto
rdate
=
taxis_is_relative
?
taxisInqRdate
(
globs
->
taxisID
)
:
after_getDate
(
globs
->
StartDate
);
const
auto
rtime
=
taxis_is_relative
?
taxisInqRtime
(
globs
->
taxisID
)
:
after_getTime
(
globs
->
StartDate
);
if
(
filetype_is_netcdf
(
ofiletype
))
{
{
taxisDefCalendar
(
globs
->
taxisID2
,
CALENDAR_PROLEPTIC
);
taxisDefCalendar
(
globs
->
taxisID2
,
CALENDAR_PROLEPTIC
);
taxisDefType
(
globs
->
taxisID2
,
TAXIS_RELATIVE
);
taxisDefType
(
globs
->
taxisID2
,
TAXIS_RELATIVE
);
...
@@ -1797,8 +1796,7 @@ after_processing(struct Control *globs, struct Variable *vars)
...
@@ -1797,8 +1796,7 @@ after_processing(struct Control *globs, struct Variable *vars)
{
{
if
(
ofiletype
==
CDI_FILETYPE_GRB
)
if
(
ofiletype
==
CDI_FILETYPE_GRB
)
afterAbort
(
"Can't write fourier coefficients to GRIB!"
);
afterAbort
(
"Can't write fourier coefficients to GRIB!"
);
else
if
(
ofiletype
==
CDI_FILETYPE_NC
||
ofiletype
==
CDI_FILETYPE_NC2
||
ofiletype
==
CDI_FILETYPE_NC4
else
if
(
filetype_is_netcdf
(
ofiletype
))
||
ofiletype
==
CDI_FILETYPE_NC4C
||
ofiletype
==
CDI_FILETYPE_NC5
)
afterAbort
(
"Can't write fourier coefficients to NetCDF!"
);
afterAbort
(
"Can't write fourier coefficients to NetCDF!"
);
}
}
...
...
Write
Preview
Markdown
is supported
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