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
libcdi
Commits
eb0165ee
Commit
eb0165ee
authored
Oct 16, 2012
by
Uwe Schulzweida
Browse files
added code to test performance of 2D GRIB container
parent
8cf3ab98
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/gribapi.c
View file @
eb0165ee
...
...
@@ -39,9 +39,12 @@ const char *gribapiLibraryVersion(void)
void
gribContainersNew
(
int
streamID
)
{
stream_t
*
streamptr
;
int
editionNumber
=
2
;
streamptr
=
stream_to_pointer
(
streamID
);
if
(
streamptr
->
filetype
==
FILETYPE_GRB
)
editionNumber
=
1
;
#if defined (HAVE_LIBCGRIBEX)
if
(
streamptr
->
filetype
==
FILETYPE_GRB
)
{
...
...
@@ -49,19 +52,37 @@ void gribContainersNew(int streamID)
else
#endif
{
int
i
,
editionNumber
=
2
;
int
nvars
=
streamptr
->
nvars
;
#if defined (GRIBCONTAINER2D)
gribContainer_t
**
gribContainers
;
gribContainers
=
(
gribContainer_t
**
)
malloc
(
nvars
*
sizeof
(
gribContainer_t
*
));
for
(
int
varID
=
0
;
varID
<
nvars
;
++
varID
)
{
int
nlevs
=
streamptr
->
vars
[
varID
].
nlevs
;
gribContainers
[
varID
]
=
(
gribContainer_t
*
)
malloc
(
nlevs
*
sizeof
(
gribContainer_t
));
for
(
int
levelID
=
0
;
levelID
<
nlevs
;
++
levelID
)
{
gribContainers
[
varID
][
levelID
].
gribHandle
=
gribHandleNew
(
editionNumber
);
gribContainers
[
varID
][
levelID
].
init
=
FALSE
;
}
}
streamptr
->
gribContainers
=
(
void
**
)
gribContainers
;
#else
gribContainer_t
*
gribContainers
;
gribContainers
=
(
gribContainer_t
*
)
malloc
(
nvars
*
sizeof
(
gribContainer_t
));
if
(
streamptr
->
filetype
==
FILETYPE_GRB
)
editionNumber
=
1
;
for
(
int
varID
=
0
;
varID
<
nvars
;
++
varID
)
{
gribContainers
[
varID
].
gribHandle
=
gribHandleNew
(
editionNumber
);
gribContainers
[
varID
].
init
=
FALSE
;
}
gribContainers
=
(
gribContainer_t
*
)
malloc
(
streamptr
->
nvars
*
sizeof
(
gribContainer_t
));
streamptr
->
gribContainers
=
(
void
*
)
gribContainers
;
for
(
i
=
0
;
i
<
streamptr
->
nvars
;
++
i
)
{
gribContainers
[
i
].
gribHandle
=
gribHandleNew
(
editionNumber
);
gribContainers
[
i
].
init
=
FALSE
;
}
#endif
}
}
...
...
@@ -74,14 +95,31 @@ void gribContainersDelete(int streamID)
if
(
streamptr
->
gribContainers
)
{
int
i
;
int
nvars
=
streamptr
->
nvars
;
#if defined (GRIBCONTAINER2D)
gribContainer_t
**
gribContainers
=
(
gribContainer_t
**
)
streamptr
->
gribContainers
;
for
(
int
varID
=
0
;
varID
<
nvars
;
++
varID
)
{
int
nlevs
=
streamptr
->
vars
[
varID
].
nlevs
;
for
(
int
levelID
=
0
;
levelID
<
nlevs
;
++
levelID
)
{
gribHandleDelete
(
gribContainers
[
varID
][
levelID
].
gribHandle
);
}
free
(
gribContainers
[
varID
]);
}
#else
gribContainer_t
*
gribContainers
=
(
gribContainer_t
*
)
streamptr
->
gribContainers
;
for
(
i
=
0
;
i
<
streamptr
->
nvars
;
++
i
)
for
(
i
nt
varID
=
0
;
varID
<
nvars
;
++
varID
)
{
gribHandleDelete
(
gribContainers
[
i
].
gribHandle
);
gribHandleDelete
(
gribContainers
[
varID
].
gribHandle
);
}
free
(
streamptr
->
gribContainers
);
#endif
free
(
gribContainers
);
streamptr
->
gribContainers
=
NULL
;
}
}
...
...
src/stream_grb.c
View file @
eb0165ee
...
...
@@ -554,8 +554,13 @@ int grbWriteVarSliceDP(int streamID, int varID, int levelID, const double *data,
else
#endif
{
#if defined (GRIBCONTAINER2D)
gribContainer_t
**
gribContainers
=
(
gribContainer_t
**
)
streamptr
->
gribContainers
;
gc
=
(
void
*
)
&
gribContainers
[
varID
][
levelID
];
#else
gribContainer_t
*
gribContainers
=
(
gribContainer_t
*
)
streamptr
->
gribContainers
;
gc
=
(
void
*
)
&
gribContainers
[
varID
];
#endif
}
if
(
streamptr
->
comptype
==
COMPRESS_JPEG
)
...
...
src/stream_int.c
View file @
eb0165ee
...
...
@@ -618,7 +618,7 @@ void streamPrintP ( void * streamptr, FILE * fp )
fprintf
(
fp
,
"curfile = %d
\n
"
,
sp
->
curfile
);
fprintf
(
fp
,
"nfiles = %d
\n
"
,
sp
->
nfiles
);
fprintf
(
fp
,
"// char **fnames;
\n
"
);
fprintf
(
fp
,
"// void
*gribContainers;
\n
"
);
fprintf
(
fp
,
"// void
*
*gribContainers;
\n
"
);
fprintf
(
fp
,
"vlistIDorig = %d
\n
"
,
sp
->
vlistIDorig
);
}
...
...
src/stream_int.h
View file @
eb0165ee
...
...
@@ -186,7 +186,6 @@ typedef struct {
int
gridID
;
int
zaxisID
;
int
tsteptype
;
/* TSTEP_* */
int
nlevel
;
}
svarinfo_t
;
...
...
@@ -246,7 +245,11 @@ typedef struct {
int
curfile
;
int
nfiles
;
char
**
fnames
;
#if defined (GRIBCONTAINER2D)
void
**
gribContainers
;
#else
void
*
gribContainers
;
#endif
int
vlistIDorig
;
}
stream_t
;
...
...
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