Skip to content
GitLab
Menu
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
39a2a0fc
Commit
39a2a0fc
authored
Jul 15, 2013
by
Thomas Jahns
🤸
Browse files
Change logic for netCDF file setup.
parent
4c108660
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/cdi_int.c
View file @
39a2a0fc
...
...
@@ -22,9 +22,6 @@
#include
"serialize.h"
#include
"resource_handle.h"
#include
"resource_unpack.h"
#ifdef USE_MPI
#include
"pio_comm.h"
#endif
#if defined (HAVE_LIBCGRIBEX)
#include
"cgribex.h"
...
...
@@ -680,22 +677,17 @@ cdiStreamSetupVlist(stream_t *streamptr, int vlistID, int vlistIDorig)
vlistInqVarMissval
(
vlistID
,
varID
));
}
if
(
namespaceHasLocalFile
(
namespaceGetActive
())
&&
streamptr
->
filemode
==
'w'
)
if
(
streamptr
->
filemode
==
'w'
)
{
if
(
streamptr
->
filetype
==
FILETYPE_NC
||
streamptr
->
filetype
==
FILETYPE_NC2
||
streamptr
->
filetype
==
FILETYPE_NC4
||
streamptr
->
filetype
==
FILETYPE_NC4C
)
{
#if USE_MPI && defined (HAVE_LIBNETCDF) && ! defined (HAVE_PARALLEL_NC4)
int
rank
,
rankOpen
;
if
(
commInqIOMode
()
==
PIO_NONE
||
((
rank
=
commInqRankColl
())
==
(
rankOpen
=
cdiPioSerialOpenFileMap
(
streamptr
->
self
))))
#endif
#ifdef HAVE_LIBNETCDF
cdfDefVars
(
streamptr
);
void
(
*
myCdfDefVars
)(
stream_t
*
streamptr
)
=
namespaceSwitchGet
(
NSSWITCH_CDF_STREAM_SETUP
);
myCdfDefVars
(
streamptr
);
#endif
}
else
if
(
streamptr
->
filetype
==
FILETYPE_GRB
||
...
...
src/namespace.c
View file @
39a2a0fc
...
...
@@ -16,7 +16,8 @@ static int nNamespaces = 1;
static
int
activeNamespace
=
0
;
#ifdef HAVE_LIBNETCDF
#define CDI_NETCDF_SWITCHES nc__create,cdf_def_var_serial,cdfDefTimestep,
#define CDI_NETCDF_SWITCHES nc__create,cdf_def_var_serial,cdfDefTimestep,\
cdfDefVars
#else
#define CDI_NETCDF_SWITCHES
#endif
...
...
src/namespace.h
View file @
39a2a0fc
...
...
@@ -37,6 +37,7 @@ enum namespaceSwitch
NSSWITCH_NC__CREATE
,
NSSWITCH_CDF_DEF_VAR
,
NSSWITCH_CDF_DEF_TIMESTEP
,
NSSWITCH_CDF_STREAM_SETUP
,
#endif
NUM_NAMESPACE_SWITCH
,
};
...
...
src/pio_client.c
View file @
39a2a0fc
...
...
@@ -98,6 +98,11 @@ static void
cdiPioCdfDefTimestepNOP
(
stream_t
*
streamptr
,
int
tsID
)
{
}
static
void
cdiPioClientCdfDefVarsNOP
(
stream_t
*
streamptr
)
{
}
#endif
static
void
...
...
@@ -136,6 +141,7 @@ cdiPioClientSetup(int *pioNamespace_, int *pioNamespace)
namespaceSwitchSet
(
NSSWITCH_STREAM_CLOSE_BACKEND
,
cdiPioClientStreamClose
);
#ifdef HAVE_LIBNETCDF
namespaceSwitchSet
(
NSSWITCH_CDF_DEF_TIMESTEP
,
cdiPioCdfDefTimestepNOP
);
namespaceSwitchSet
(
NSSWITCH_CDF_STREAM_SETUP
,
cdiPioClientCdfDefVarsNOP
);
#endif
pioNamespaceSetActive
(
callerCDINamespace
);
}
...
...
src/pio_server.c
View file @
39a2a0fc
...
...
@@ -426,6 +426,16 @@ void cdiPioCloseFileOnRank(int rank)
--
(
cdiSerialOpenFileCount
[
rank
]);
}
static
void
cdiPioServerCdfDefVars
(
stream_t
*
streamptr
)
{
int
rank
,
rankOpen
;
if
(
commInqIOMode
()
==
PIO_NONE
||
((
rank
=
commInqRankColl
())
==
(
rankOpen
=
cdiPioSerialOpenFileMap
(
streamptr
->
self
))))
cdfDefVars
(
streamptr
);
}
#endif
static
...
...
@@ -927,6 +937,7 @@ void IOServer ()
namespaceSwitchSet
(
NSSWITCH_STREAM_OPEN_BACKEND
,
cdiPioStreamCDFOpenWrap
);
namespaceSwitchSet
(
NSSWITCH_STREAM_CLOSE_BACKEND
,
cdiPioStreamCDFCloseWrap
);
namespaceSwitchSet
(
NSSWITCH_CDF_DEF_TIMESTEP
,
cdiPioCdfDefTimestep
);
namespaceSwitchSet
(
NSSWITCH_CDF_STREAM_SETUP
,
cdiPioServerCdfDefVars
);
#endif
namespaceSwitchSet
(
NSSWITCH_FILE_WRITE
,
cdiPioFileWrite
);
...
...
Write
Preview
Supports
Markdown
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