9 #if defined( MOAB_HAVE_NETCDFPAR ) && defined( MOAB_HAVE_TEMPESTREMAP )
10 #include "netcdf_par.h"
11 #include "netcdfcpp.h"
13 class ParNcFile :
public NcFile
16 ParNcFile( MPI_Comm comm,
19 FileMode fmode = ReadOnly,
20 FileFormat fformat = Classic )
21 : NcFile(), m_comm( comm )
23 NcError err( NcError::silent_nonfatal );
25 int mode = NC_NOWRITE;
30 if( fformat == Offset64Bits ) mode |= NC_64BIT_OFFSET;
32 else if( fformat == Netcdf4 )
34 else if( fformat == Netcdf4Classic )
35 mode |= NC_NETCDF4 | NC_CLASSIC_MODEL;
46 status = NcError::set_err( nc_open_par( path, mode, comm, comm_info, &the_id ) );
47 if( status != NC_NOERR )
49 NcError::set_err( status );
59 status = NcError::set_err( nc_create_par( path, mode, comm, comm_info, &the_id ) );
60 if( status != NC_NOERR )
62 NcError::set_err( status );
74 dimensions =
new NcDim*[NC_MAX_DIMS];
75 variables =
new NcVar*[NC_MAX_VARS];
77 for( i = 0; i < num_dims(); i++ )
78 dimensions[i] =
new NcDim(
this, i );
79 for( i = 0; i < num_vars(); i++ )
80 variables[i] =
new NcVar(
this, i );
81 globalv =
new NcVar(
this, ncGlobal );
91 virtual ~ParNcFile(
void ){};
93 NcBool enable_var_par_access( NcVar* var,
bool is_independent =
true )
96 status = NcError::set_err(
97 nc_var_par_access( the_id, var->id(), ( is_independent ? NC_INDEPENDENT : NC_COLLECTIVE ) ) );
98 if( status != NC_NOERR )
100 NcError::set_err( status );
108 static const int ncGlobal = NC_GLOBAL;
109 static const int ncBad = -1;