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
b7c8a6e8
Commit
b7c8a6e8
authored
Jan 29, 2020
by
Uwe Schulzweida
Browse files
USE_TIMECACHE: cleanup.
parent
f7ee4f43
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/basetime.h
View file @
b7c8a6e8
...
...
@@ -4,7 +4,7 @@
#include
<stdbool.h>
//#define USE_TIMECACHE 1
#define MAX_TIMECACHE_SIZE 1024
#define MAX_TIMECACHE_SIZE 1024
*1024
typedef
struct
{
size_t
size
;
...
...
src/stream_cdf_i.c
View file @
b7c8a6e8
...
...
@@ -4209,21 +4209,17 @@ double get_timevalue(int fileID, int nctimevarid, int tsID, timecache_t *tcache)
if
(
tcache
->
size
==
0
||
(
tsID
<
tcache
->
startid
||
tsID
>
(
tcache
->
startid
+
tcache
->
size
-
1
))
)
{
size_t
maxvals
=
MAX_TIMECACHE_SIZE
;
tcache
->
startid
=
(
tsID
/
MAX_TIMECACHE_SIZE
)
*
MAX_TIMECACHE_SIZE
;
if
(
(
tcache
->
startid
+
maxvals
)
>
tcache
->
maxvals
)
maxvals
=
(
tcache
->
maxvals
)
%
MAX_TIMECACHE_SIZE
;
if
(
maxvals
>
tcache
->
maxvals
)
maxvals
=
tcache
->
maxvals
;
tcache
->
startid
=
tsID
;
//tcache->startid = (tsID/MAX_TIMECACHE_SIZE)*MAX_TIMECACHE_SIZE;
//if ( (tcache->startid + maxvals) > tcache->maxvals ) maxvals = (tcache->maxvals)%MAX_TIMECACHE_SIZE;
tcache
->
size
=
maxvals
;
//fprintf(stderr, "fill time cache: %d %d %d %d %d\n", tcache->maxvals, tsID, tcache->startid, tcache->startid+maxvals-1, maxvals);
//cdf_get_vara_double(fileID, nctimevarid, &tcache->startid, &maxvals, tcache->cache);
size_t
index
=
tcache
->
startid
;
for
(
size_t
ival
=
0
;
ival
<
maxvals
;
++
ival
)
{
cdf_get_var1_double
(
fileID
,
nctimevarid
,
&
index
,
&
timevalue
);
tcache
->
cache
[
ival
]
=
timevalue
;
index
++
;
}
cdf_get_vara_double
(
fileID
,
nctimevarid
,
&
tcache
->
startid
,
&
maxvals
,
tcache
->
cache
);
}
timevalue
=
tcache
->
cache
[
tsID
%
MAX_TIMECACHE_SIZE
];
//timevalue = tcache->cache[tsID%MAX_TIMECACHE_SIZE];
timevalue
=
tcache
->
cache
[
tsID
];
}
else
{
...
...
@@ -4268,7 +4264,7 @@ int cdfInqTimestep(stream_t * streamptr, int tsID)
#ifdef USE_TIMECACHE
if
(
streamptr
->
basetime
.
timevar_cache
==
NULL
)
{
streamptr
->
basetime
.
timevar_cache
=
(
timecache_t
*
)
Malloc
(
MAX_TIMECACHE_SIZE
*
sizeof
(
timecache_t
));
streamptr
->
basetime
.
timevar_cache
=
(
timecache_t
*
)
Malloc
(
sizeof
(
timecache_t
));
streamptr
->
basetime
.
timevar_cache
->
size
=
0
;
streamptr
->
basetime
.
timevar_cache
->
maxvals
=
streamptr
->
ntsteps
;
}
...
...
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