Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
f731b4a4
Commit
f731b4a4
authored
Apr 22, 2014
by
Thomas Jahns
🤸
Browse files
Refactor cdiCheckZaxis.
parent
52f445c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/zaxis.c
View file @
f731b4a4
...
...
@@ -1050,43 +1050,36 @@ int zaxisInqSize(int zaxisID)
void
cdiCheckZaxis
(
int
zaxisID
)
{
int
size
,
i
,
found
;
zaxis_t
*
zaxisptr
=
reshGetVal
(
zaxisID
,
&
zaxisOps
);
zaxis_check_ptr
(
zaxisID
,
zaxisptr
);
if
(
zaxisInqType
(
zaxisID
)
==
ZAXIS_GENERIC
)
{
size
=
zaxisptr
->
size
;
int
size
=
zaxisptr
->
size
;
if
(
size
>
1
)
{
/* check direction */
if
(
!
zaxisptr
->
direction
)
{
found
=
0
;
for
(
i
=
1
;
i
<
size
;
i
++
)
if
(
zaxisptr
->
vals
[
i
]
>
zaxisptr
->
vals
[
i
-
1
]
)
found
++
;
if
(
found
==
size
-
1
)
int
ups
=
0
,
downs
=
0
;
for
(
int
i
=
1
;
i
<
size
;
i
++
)
{
ups
+=
(
zaxisptr
->
vals
[
i
]
>
zaxisptr
->
vals
[
i
-
1
]);
downs
+=
(
zaxisptr
->
vals
[
i
]
<
zaxisptr
->
vals
[
i
-
1
]);
}
if
(
ups
==
size
-
1
)
{
zaxisptr
->
direction
=
LevelUp
;
}
else
else
if
(
downs
==
size
-
1
)
{
found
=
0
;
for
(
i
=
1
;
i
<
size
;
i
++
)
if
(
zaxisptr
->
vals
[
i
]
<
zaxisptr
->
vals
[
i
-
1
]
)
found
++
;
if
(
found
==
size
-
1
)
{
zaxisptr
->
direction
=
LevelDown
;
}
zaxisptr
->
direction
=
LevelDown
;
}
else
/* !zaxisptr->direction */
{
Warning
(
"Direction undefined for zaxisID %d"
,
zaxisID
);
}
}
/* check consistent */
if
(
!
zaxisptr
->
direction
)
{
Warning
(
"Direction undefined for zaxisID %d"
,
zaxisID
);
}
}
}
...
...
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