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
d313e344
Commit
d313e344
authored
Jul 18, 2016
by
Uwe Schulzweida
Browse files
Added function reshGetTxCode().
parent
3dcd8e5b
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/resource_handle.c
View file @
d313e344
...
...
@@ -379,17 +379,15 @@ static listElem_t *
reshGetElem
(
const
char
*
caller
,
const
char
*
expressionString
,
cdiResH
resH
,
const
resOps
*
ops
)
{
listElem_t
*
listElem
;
int
nsp
;
namespaceTuple_t
nspT
;
xassert
(
ops
);
LIST_INIT
(
1
);
LIST_LOCK
();
nsp
=
namespaceGetActive
();
int
nsp
=
namespaceGetActive
();
nspT
=
namespaceResHDecode
(
resH
);
namespaceTuple_t
nspT
=
namespaceResHDecode
(
resH
);
assert
(
nspT
.
idx
>=
0
);
if
(
nspT
.
nsp
==
nsp
&&
...
...
@@ -583,9 +581,35 @@ void reshPackBufferDestroy ( char ** buffer )
/**************************************************************/
int
reshGetTxCode
(
cdiResH
resH
)
{
int
type
=
0
;
LIST_LOCK
();
int
nsp
=
namespaceGetActive
();
namespaceTuple_t
nspT
=
namespaceResHDecode
(
resH
);
assert
(
nspT
.
idx
>=
0
);
if
(
nspT
.
nsp
==
nsp
&&
nspT
.
idx
<
resHList
[
nsp
].
size
)
{
listElem_t
*
listElem
=
resHList
[
nsp
].
resources
+
nspT
.
idx
;
xassert
(
listElem
->
res
.
v
.
ops
);
type
=
listElem
->
res
.
v
.
ops
->
valTxCode
();
}
LIST_UNLOCK
();
return
type
;
}
/**************************************************************/
int
reshPackBufferCreate
(
char
**
packBuffer
,
int
*
packBufferSize
,
void
*
context
)
{
int
i
,
packBufferPos
=
0
;
int
packBufferPos
=
0
;
int
end
=
END
;
xassert
(
packBuffer
);
...
...
@@ -603,7 +627,7 @@ int reshPackBufferCreate(char **packBuffer, int *packBufferSize, void *context)
}
listElem_t
*
r
=
resHList
[
nsp
].
resources
;
for
(
i
=
0
;
i
<
resHList
[
nsp
].
size
;
i
++
)
for
(
int
i
=
0
;
i
<
resHList
[
nsp
].
size
;
i
++
)
if
(
r
[
i
].
status
&
RESH_SYNC_BIT
)
{
if
(
r
[
i
].
status
==
RESH_DESYNC_DELETED
)
...
...
@@ -630,6 +654,7 @@ int reshPackBufferCreate(char **packBuffer, int *packBufferSize, void *context)
LIST_UNLOCK
();
serializePack
(
&
end
,
1
,
DATATYPE_INT
,
pB
,
pBSize
,
&
packBufferPos
,
context
);
return
packBufferPos
;
}
...
...
src/resource_handle.h
View file @
d313e344
...
...
@@ -99,6 +99,7 @@ enum reshListMismatch {
int
reshListCompare
(
int
nsp0
,
int
nsp1
);
void
reshListPrint
(
FILE
*
fp
);
int
reshGetTxCode
(
cdiResH
resH
);
#endif
/*
...
...
src/stream_cdf_i.c
View file @
d313e344
...
...
@@ -2382,7 +2382,7 @@ bool cdf_set_unstructured_par(ncvar_t *ncvar, grid_t *grid, int xdimid, int ydim
static
void
cdf_read_mapping_atts
(
int
ncid
,
int
gmapvarid
,
int
projID
,
const
char
*
varname
)
{
nc_type
atttype
;
nc_type
att
r
type
;
size_t
attlen
;
char
attname
[
CDI_MAX_NAME
];
enum
{
attstringlen
=
8192
};
char
attstring
[
attstringlen
];
...
...
@@ -2403,26 +2403,28 @@ void cdf_read_mapping_atts(int ncid, int gmapvarid, int projID, const char *varn
{
cdf_inq_attname
(
ncid
,
gmapvarid
,
iatt
,
attname
);
cdf_inq_attlen
(
ncid
,
gmapvarid
,
attname
,
&
attlen
);
cdf_inq_atttype
(
ncid
,
gmapvarid
,
attname
,
&
atttype
);
cdf_inq_atttype
(
ncid
,
gmapvarid
,
attname
,
&
att
r
type
);
if
(
xtypeIsInt
(
atttype
)
)
if
(
xtypeIsInt
(
att
r
type
)
)
{
int
attint
[
attlen
];
cdfGetAttInt
(
ncid
,
gmapvarid
,
attname
,
(
int
)
attlen
,
attint
);
printf
(
"atttype: %d attname: %s attr: %d
\n
"
,
atttype
,
attname
,
attint
[
0
]);
printf
(
"att
r
type: %d attname: %s attr: %d
\n
"
,
att
r
type
,
attname
,
attint
[
0
]);
}
else
if
(
xtypeIsFloat
(
atttype
)
)
else
if
(
xtypeIsFloat
(
att
r
type
)
)
{
double
attflt
[
attlen
];
cdfGetAttDouble
(
ncid
,
gmapvarid
,
attname
,
(
int
)
attlen
,
attflt
);
printf
(
"atttype: %d attname: %s attr: %g
\n
"
,
atttype
,
attname
,
attflt
[
0
]);
printf
(
"att
r
type: %d attname: %s attr: %g
\n
"
,
att
r
type
,
attname
,
attflt
[
0
]);
int
datatype
=
(
attrtype
==
NC_FLOAT
)
?
DATATYPE_FLT32
:
DATATYPE_FLT64
;
// gridDefAttFlt(projID, attname, datatype, (int)attlen, attflt);
int
varID
=
vlistDefVar
(
projID
,
CDI_UNDEFID
,
CDI_UNDEFID
,
CDI_UNDEFID
);
printf
(
"varID = %d
\n
"
,
varID
);
// vlistDefAttFlt(projID, varID, attname, datatype, (int)attlen, attflt);
}
else
if
(
xtypeIsText
(
atttype
)
&&
strcmp
(
attname
,
"grid_mapping_name"
)
)
else
if
(
xtypeIsText
(
att
r
type
)
&&
strcmp
(
attname
,
"grid_mapping_name"
)
)
{
cdfGetAttText
(
ncid
,
gmapvarid
,
attname
,
attstringlen
,
attstring
);
printf
(
"atttype: %d attname: %s attr: %s
\n
"
,
atttype
,
attname
,
attstring
);
printf
(
"att
r
type: %d attname: %s attr: %s
\n
"
,
att
r
type
,
attname
,
attstring
);
}
}
}
...
...
src/vlist_var.c
View file @
d313e344
...
...
@@ -134,6 +134,7 @@ void vlistCheckVarID(const char *caller, int vlistID, int varID)
int
vlistDefVarTiles
(
int
vlistID
,
int
gridID
,
int
zaxisID
,
int
tsteptype
,
int
tilesetID
)
{
// printf("ObjID %d TxCode: %d\n", vlistID, reshGetTxCode(vlistID));
vlist_t
*
vlistptr
=
vlist_to_pointer
(
vlistID
);
if
(
CDI_Debug
)
Message
(
"gridID = %d zaxisID = %d tsteptype = %d"
,
gridID
,
zaxisID
,
tsteptype
);
...
...
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