source: XIOS/trunk/src/output/netcdf.hpp @ 489

Last change on this file since 489 was 480, checked in by ymipsl, 10 years ago

fix compilation problem while trying to compile with netcdf4 sequential version

YM

File size: 1.6 KB
Line 
1#ifndef __XIOS_NETCDF_HPP__
2#define __XIOS_NETCDF_HPP__
3#include "mpi.hpp"
4#define MPI_INCLUDED
5#include <netcdf.h>
6
7#if defined(USING_NETCDF_INTERNAL)
8  const bool using_netcdf_internal=true ;
9#else
10  const bool using_netcdf_internal=false ;
11#endif
12
13#include "netcdf_version.hpp"
14
15#if NETCDF_VERSION >= 4110
16
17#  if defined(USING_NETCDF_PAR)
18extern "C"
19{
20#  include <netcdf_par.h>
21}
22#  endif
23#endif
24
25#if !defined(USING_NETCDF_PAR)
26  #define NC_INDEPENDENT 0
27  #define NC_COLLECTIVE  1
28#endif
29
30namespace xios
31{
32  inline int nc_create_par(const char *path, int cmode, MPI_Comm comm, MPI_Info info,int *ncidp)
33  {
34#if defined(USING_NETCDF_PAR)
35    return ::nc_create_par(path, cmode, comm, info, ncidp) ;
36#else
37    ERROR("int nc_create_par(const char *path, int cmode, MPI_Comm comm, MPI_Info info,int *ncidp)",
38           << "must not be use with netcdf sequential version") ;
39    return -1 ;
40#endif
41  }
42 
43  inline int nc_open_par(const char *path, int mode, MPI_Comm comm, MPI_Info info,int *ncidp)
44  { 
45#if defined(USING_NETCDF_PAR)
46    return ::nc_open_par(path, mode, comm, info, ncidp) ;
47#else
48    ERROR("int nc_open_par(const char *path, int mode, MPI_Comm comm, MPI_Info info,int *ncidp)",
49           << "must not be use with netcdf sequential version") ;
50    return -1 ;
51#endif
52  }
53 
54  inline int nc_var_par_access(int ncid, int varid, int par_access)
55  {
56#if defined(USING_NETCDF_PAR)
57    return ::nc_var_par_access(ncid, varid, par_access) ;
58#else
59    ERROR("int nc_var_par_access(int ncid, int varid, int par_access)",
60           << "must not be use with netcdf sequential version") ;
61    return -1 ;
62#endif
63  }
64}
65
66
67#endif
Note: See TracBrowser for help on using the repository browser.