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
3cfe894f
Commit
3cfe894f
authored
10 years ago
by
Thomas Jahns
Browse files
Options
Downloads
Patches
Plain Diff
Replace array of resource handles with apply call.
parent
1d9efebb
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/varscan.c
+42
-22
42 additions, 22 deletions
src/varscan.c
src/zaxis.c
+1
-1
1 addition, 1 deletion
src/zaxis.c
src/zaxis.h
+6
-0
6 additions, 0 deletions
src/zaxis.h
with
49 additions
and
23 deletions
src/varscan.c
+
42
−
22
View file @
3cfe894f
...
...
@@ -866,6 +866,33 @@ int zaxisCompare(int zaxisID, int zaxistype, int nlevels, int lbounds, const dou
return
(
differ
);
}
struct
varDefZAxisSearchState
{
int
resIDValue
;
int
zaxistype
;
int
nlevels
;
double
*
levels
;
int
lbounds
;
char
*
longname
,
*
units
;
int
ltype
;
};
static
enum
cdiApplyRet
varDefZAxisSearch
(
int
id
,
void
*
res
,
void
*
data
)
{
struct
varDefZAxisSearchState
*
state
=
data
;
(
void
)
res
;
if
(
zaxisCompare
(
id
,
state
->
zaxistype
,
state
->
nlevels
,
state
->
lbounds
,
state
->
levels
,
state
->
longname
,
state
->
units
,
state
->
ltype
)
==
0
)
{
state
->
resIDValue
=
id
;
return
CDI_APPLY_STOP
;
}
else
return
CDI_APPLY_GO_ON
;
}
int
varDefZaxis
(
int
vlistID
,
int
zaxistype
,
int
nlevels
,
double
*
levels
,
int
lbounds
,
double
*
levels1
,
double
*
levels2
,
int
vctsize
,
double
*
vct
,
char
*
name
,
...
...
@@ -900,29 +927,22 @@ int varDefZaxis(int vlistID, int zaxistype, int nlevels, double *levels, int lbo
if
(
!
zaxisdefined
)
{
reshLock
();
unsigned
nzaxis
=
cdiZaxisCount
();
if
(
nzaxis
>
0
)
{
int
*
zaxisIndexList
;
zaxisIndexList
=
(
int
*
)
xmalloc
((
size_t
)
nzaxis
*
sizeof
(
int
));
cdiZaxisGetIndexList
(
nzaxis
,
zaxisIndexList
);
for
(
unsigned
i
=
0
;
i
<
nzaxis
;
i
++
)
{
zaxisID
=
zaxisIndexList
[
i
];
if
(
zaxisCompare
(
zaxisID
,
zaxistype
,
nlevels
,
lbounds
,
levels
,
longname
,
units
,
ltype1
)
==
0
)
{
zaxisglobdefined
=
1
;
break
;
}
}
free
(
zaxisIndexList
);
}
reshUnlock
();
struct
varDefZAxisSearchState
query
=
{
.
zaxistype
=
zaxistype
,
.
nlevels
=
nlevels
,
.
levels
=
levels
,
.
lbounds
=
lbounds
,
.
longname
=
longname
,
.
units
=
units
,
.
ltype
=
ltype1
,
};
if
((
zaxisglobdefined
=
(
cdiResHFilterApply
(
&
zaxisOps
,
varDefZAxisSearch
,
&
query
)
==
CDI_APPLY_STOP
)))
zaxisID
=
query
.
resIDValue
;
nzaxis
=
(
unsigned
)
vlistptr
->
nzaxis
;
if
(
mode
==
1
)
for
(
unsigned
index
=
0
;
index
<
nzaxis
;
index
++
)
if
(
mode
==
1
&&
zaxisglobdefined
)
for
(
int
index
=
0
;
index
<
nzaxis
;
index
++
)
if
(
vlistptr
->
zaxisIDs
[
index
]
==
zaxisID
)
{
zaxisglobdefined
=
FALSE
;
...
...
This diff is collapsed.
Click to expand it.
src/zaxis.c
+
1
−
1
View file @
3cfe894f
...
...
@@ -94,7 +94,7 @@ static int zaxisGetPackSize ( void * zaxisptr, void *context);
static
void
zaxisPack
(
void
*
zaxisptr
,
void
*
buffer
,
int
size
,
int
*
pos
,
void
*
context
);
static
int
zaxisTxCode
(
void
);
static
const
resOps
zaxisOps
=
{
const
resOps
zaxisOps
=
{
(
int
(
*
)(
void
*
,
void
*
))
zaxisCompareP
,
zaxisDestroyP
,
zaxisPrintP
,
...
...
This diff is collapsed.
Click to expand it.
src/zaxis.h
+
6
−
0
View file @
3cfe894f
#ifndef _ZAXIS_H
#define _ZAXIS_H
#ifndef RESOURCE_HANDLE_H
#include
"resource_handle.h"
#endif
unsigned
cdiZaxisCount
(
void
);
void
cdiZaxisGetIndexList
(
unsigned
numIDs
,
int
IDs
[
numIDs
]);
...
...
@@ -12,4 +16,6 @@ zaxisUnpack(char * unpackBuffer, int unpackBufferSize,
void
zaxisDefLtype2
(
int
zaxisID
,
int
ltype2
);
extern
const
resOps
zaxisOps
;
#endif
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