Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libcdi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mpim-sw
libcdi
Commits
1d9efebb
Commit
1d9efebb
authored
10 years ago
by
Thomas Jahns
Browse files
Options
Downloads
Patches
Plain Diff
Replace list of grids with call to resh apply.
parent
03519605
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/grid.c
+1
-1
1 addition, 1 deletion
src/grid.c
src/grid.h
+3
-0
3 additions, 0 deletions
src/grid.h
src/varscan.c
+28
-23
28 additions, 23 deletions
src/varscan.c
with
32 additions
and
24 deletions
src/grid.c
+
1
−
1
View file @
1d9efebb
...
...
@@ -56,7 +56,7 @@ static void gridPack ( void * gridptr, void * buff, int size,
int
*
position
,
void
*
context
);
static
int
gridTxCode
(
void
);
static
const
resOps
gridOps
=
{
const
resOps
gridOps
=
{
gridCompareP
,
gridDestroyP
,
gridPrintP
,
...
...
This diff is collapsed.
Click to expand it.
src/grid.h
+
3
−
0
View file @
1d9efebb
...
...
@@ -2,6 +2,7 @@
#define _GRID_H
#include
"cdi.h"
#include
"resource_handle.h"
typedef
unsigned
char
mask_t
;
...
...
@@ -95,6 +96,8 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
int
*
unpackBufferPos
,
int
originNamespace
,
void
*
context
,
int
force_id
);
extern
const
resOps
gridOps
;
#endif
/*
* Local Variables:
...
...
This diff is collapsed.
Click to expand it.
src/varscan.c
+
28
−
23
View file @
1d9efebb
...
...
@@ -2,12 +2,14 @@
# include "config.h"
#endif
#include
<stdbool.h>
#include
<string.h>
#include
<math.h>
#include
"cdi.h"
#include
"cdi_int.h"
#include
"dmemory.h"
#include
"resource_handle.h"
#include
"varscan.h"
#include
"vlist.h"
#include
"grid.h"
...
...
@@ -741,6 +743,25 @@ void varDefZAxisReference(int nhlev, int nvgrid, unsigned char uuid[CDI_UUID_SIZ
memcpy
(
uuidVGrid
,
uuid
,
CDI_UUID_SIZE
);
}
struct
varDefGridSearchState
{
int
resIDValue
;
const
grid_t
*
queryKey
;
};
static
enum
cdiApplyRet
varDefGridSearch
(
int
id
,
void
*
res
,
void
*
data
)
{
struct
varDefGridSearchState
*
state
=
data
;
(
void
)
res
;
if
(
gridCompare
(
id
,
state
->
queryKey
)
==
0
)
{
state
->
resIDValue
=
id
;
return
CDI_APPLY_STOP
;
}
else
return
CDI_APPLY_GO_ON
;
}
int
varDefGrid
(
int
vlistID
,
const
grid_t
*
grid
,
int
mode
)
{
...
...
@@ -751,10 +772,7 @@ int varDefGrid(int vlistID, const grid_t *grid, int mode)
int
gridglobdefined
=
FALSE
;
int
griddefined
;
int
gridID
=
CDI_UNDEFID
;
vlist_t
*
vlistptr
;
int
*
gridIndexList
;
vlistptr
=
vlist_to_pointer
(
vlistID
);
vlist_t
*
vlistptr
=
vlist_to_pointer
(
vlistID
);
griddefined
=
FALSE
;
unsigned
ngrids
=
(
unsigned
)
vlistptr
->
ngrids
;
...
...
@@ -775,25 +793,13 @@ int varDefGrid(int vlistID, const grid_t *grid, int mode)
if
(
!
griddefined
)
{
ngrids
=
cdiGridCount
();
if
(
ngrids
>
0
)
{
gridIndexList
=
(
int
*
)
xmalloc
((
size_t
)
ngrids
*
sizeof
(
int
));
cdiGridGetIndexList
(
ngrids
,
gridIndexList
);
for
(
unsigned
i
=
0
;
i
<
ngrids
;
i
++
)
{
gridID
=
gridIndexList
[
i
];
if
(
gridCompare
(
gridID
,
grid
)
==
0
)
{
gridglobdefined
=
TRUE
;
break
;
}
}
free
(
gridIndexList
);
}
struct
varDefGridSearchState
query
=
{
.
queryKey
=
grid
};
if
((
gridglobdefined
=
(
cdiResHFilterApply
(
&
gridOps
,
varDefGridSearch
,
&
query
)
==
CDI_APPLY_STOP
)))
gridID
=
query
.
resIDValue
;
ngrids
=
(
unsigned
)
vlistptr
->
ngrids
;
if
(
mode
==
1
)
if
(
mode
==
1
&&
gridglobdefined
)
for
(
unsigned
index
=
0
;
index
<
ngrids
;
index
++
)
if
(
vlistptr
->
gridIDs
[
index
]
==
gridID
)
{
...
...
@@ -953,7 +959,6 @@ int varDefZaxis(int vlistID, int zaxistype, int nlevels, double *levels, int lbo
zaxisDefLtype
(
zaxisID
,
ltype1
);
}
nzaxis
=
vlistptr
->
nzaxis
;
vlistptr
->
zaxisIDs
[
nzaxis
]
=
zaxisID
;
vlistptr
->
nzaxis
++
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment