Skip to content
GitLab
Menu
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
e1380948
Commit
e1380948
authored
Mar 08, 2017
by
Thomas Jahns
🤸
Browse files
Fix representation of three-state struct member.
parent
7e1944c8
Changes
2
Show whitespace changes
Inline
Side-by-side
src/grid.c
View file @
e1380948
...
@@ -1910,7 +1910,7 @@ void gridChangeType(int gridID, int gridtype)
...
@@ -1910,7 +1910,7 @@ void gridChangeType(int gridID, int gridtype)
static
static
void
grid_check_cyclic
(
grid_t
*
gridptr
)
void
grid_check_cyclic
(
grid_t
*
gridptr
)
{
{
gridptr
->
isCyclic
=
FALSE
;
gridptr
->
isCyclic
=
0
;
enum
{
numVertices
=
4
};
enum
{
numVertices
=
4
};
size_t
xsize
=
gridptr
->
x
.
size
>=
0
?
(
size_t
)
gridptr
->
x
.
size
:
0
,
size_t
xsize
=
gridptr
->
x
.
size
>=
0
?
(
size_t
)
gridptr
->
x
.
size
:
0
,
ysize
=
gridptr
->
y
.
size
>=
0
?
(
size_t
)
gridptr
->
y
.
size
:
0
;
ysize
=
gridptr
->
y
.
size
>=
0
?
(
size_t
)
gridptr
->
y
.
size
:
0
;
...
@@ -1929,7 +1929,7 @@ void grid_check_cyclic(grid_t *gridptr)
...
@@ -1929,7 +1929,7 @@ void grid_check_cyclic(grid_t *gridptr)
double
x0
=
2
*
xvals
[
xsize
-
1
]
-
xvals
[
xsize
-
2
]
-
360
;
double
x0
=
2
*
xvals
[
xsize
-
1
]
-
xvals
[
xsize
-
2
]
-
360
;
if
(
IS_NOT_EQUAL
(
xvals
[
0
],
xvals
[
xsize
-
1
])
)
if
(
IS_NOT_EQUAL
(
xvals
[
0
],
xvals
[
xsize
-
1
])
)
if
(
fabs
(
x0
-
xvals
[
0
])
<
0
.
01
*
xinc
)
gridptr
->
isCyclic
=
TRUE
;
if
(
fabs
(
x0
-
xvals
[
0
])
<
0
.
01
*
xinc
)
gridptr
->
isCyclic
=
1
;
}
}
}
}
else
if
(
gridptr
->
type
==
GRID_CURVILINEAR
)
else
if
(
gridptr
->
type
==
GRID_CURVILINEAR
)
...
@@ -1958,7 +1958,7 @@ void grid_check_cyclic(grid_t *gridptr)
...
@@ -1958,7 +1958,7 @@ void grid_check_cyclic(grid_t *gridptr)
nc
+=
fabs
(
x0
-
val1
)
<
0
.
5
*
xinc
;
nc
+=
fabs
(
x0
-
val1
)
<
0
.
5
*
xinc
;
}
}
gridptr
->
isCyclic
=
nc
>
ysize
/
2
?
TRUE
:
FALSE
;
gridptr
->
isCyclic
=
nc
>
ysize
/
2
;
}
}
if
(
xbounds
&&
xsize
>
1
)
if
(
xbounds
&&
xsize
>
1
)
...
@@ -4183,7 +4183,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
...
@@ -4183,7 +4183,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
gridP
->
lcc
.
projflag
=
intBuffer
[
GRID_PACK_INT_IDX_LCC_PROJFLAG
];
gridP
->
lcc
.
projflag
=
intBuffer
[
GRID_PACK_INT_IDX_LCC_PROJFLAG
];
gridP
->
lcc
.
scanflag
=
(
short
)
intBuffer
[
GRID_PACK_INT_IDX_LCC_SCANFLAG
];
gridP
->
lcc
.
scanflag
=
(
short
)
intBuffer
[
GRID_PACK_INT_IDX_LCC_SCANFLAG
];
gridP
->
lcc
.
defined
=
(
short
)
intBuffer
[
GRID_PACK_INT_IDX_LCC_DEFINED
];
gridP
->
lcc
.
defined
=
(
short
)
intBuffer
[
GRID_PACK_INT_IDX_LCC_DEFINED
];
gridP
->
isCyclic
=
(
s
hort
)
intBuffer
[
GRID_PACK_INT_IDX_IS_CYCLIC
];
gridP
->
isCyclic
=
(
s
igned
char
)
intBuffer
[
GRID_PACK_INT_IDX_IS_CYCLIC
];
gridP
->
x
.
flag
=
(
short
)
intBuffer
[
GRID_PACK_INT_IDX_X_FLAG
];
gridP
->
x
.
flag
=
(
short
)
intBuffer
[
GRID_PACK_INT_IDX_X_FLAG
];
gridP
->
y
.
flag
=
(
short
)
intBuffer
[
GRID_PACK_INT_IDX_Y_FLAG
];
gridP
->
y
.
flag
=
(
short
)
intBuffer
[
GRID_PACK_INT_IDX_Y_FLAG
];
gridP
->
gme
.
nd
=
intBuffer
[
GRID_PACK_INT_IDX_GME_ND
];
gridP
->
gme
.
nd
=
intBuffer
[
GRID_PACK_INT_IDX_GME_ND
];
...
...
src/grid.h
View file @
e1380948
...
@@ -92,7 +92,6 @@ struct grid_t {
...
@@ -92,7 +92,6 @@ struct grid_t {
double
*
area
;
double
*
area
;
struct
grid_lcc_t
lcc
;
struct
grid_lcc_t
lcc
;
struct
grid_gme_t
gme
;
struct
grid_gme_t
gme
;
short
isCyclic
;
/* TRUE for global cyclic grids */
int
number
,
position
;
/* parameter for GRID_REFERENCE */
int
number
,
position
;
/* parameter for GRID_REFERENCE */
int
trunc
;
/* parameter for GRID_SPECTEAL */
int
trunc
;
/* parameter for GRID_SPECTEAL */
int
nvertex
;
int
nvertex
;
...
@@ -102,6 +101,11 @@ struct grid_t {
...
@@ -102,6 +101,11 @@ struct grid_t {
int
nrowlon
;
int
nrowlon
;
int
size
;
int
size
;
int
np
;
/* number of parallels between a pole and the equator */
int
np
;
/* number of parallels between a pole and the equator */
signed
char
isCyclic
;
/* three possible states:
* -1 if unknown,
* 0 if found not cyclic, or
* 1 for global cyclic grids
*/
bool
lcomplex
;
bool
lcomplex
;
bool
hasdims
;
bool
hasdims
;
/* Some models deliver wind U,V relative to the grid-cell */
/* Some models deliver wind U,V relative to the grid-cell */
...
...
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