A RAII class for managing NETCDF files. The file is kept open while the object exists.
More...
#include <teca_netcdf_util.h>
A RAII class for managing NETCDF files. The file is kept open while the object exists.
◆ netcdf_handle() [1/3]
| teca_netcdf_util::netcdf_handle::netcdf_handle |
( |
int |
h | ) |
|
|
inline |
Initialize with a handle returned from nc_open/nc_create etc.
◆ ~netcdf_handle()
| teca_netcdf_util::netcdf_handle::~netcdf_handle |
( |
| ) |
|
|
inline |
Close the file during destruction.
◆ netcdf_handle() [2/3]
| teca_netcdf_util::netcdf_handle::netcdf_handle |
( |
const netcdf_handle & |
| ) |
|
|
delete |
This is a move only class, and should only be initialized with an valid handle.
◆ netcdf_handle() [3/3]
| teca_netcdf_util::netcdf_handle::netcdf_handle |
( |
netcdf_handle && |
other | ) |
|
|
inline |
Move construction takes ownership from the other object.
◆ close()
| int teca_netcdf_util::netcdf_handle::close |
( |
| ) |
|
◆ create() [1/2]
| int teca_netcdf_util::netcdf_handle::create |
( |
const std::string & |
file_path, |
|
|
int |
mode |
|
) |
| |
Create the file. this can be used from MPI parallel runs, but collective I/O is not possible when a file is created this way. Returns 0 on success.
◆ create() [2/2]
| int teca_netcdf_util::netcdf_handle::create |
( |
MPI_Comm |
comm, |
|
|
const std::string & |
file_path, |
|
|
int |
mode |
|
) |
| |
Create the file. this can be used when collective I/O is desired. the passed in communicator specifies the subset of ranks that will access the file. Calling this when linked to a non-MPI enabled NetCDF install, from a parallel run will, result in an error. Returns 0 on success.
◆ flush()
| int teca_netcdf_util::netcdf_handle::flush |
( |
| ) |
|
◆ get()
| int& teca_netcdf_util::netcdf_handle::get |
( |
| ) |
|
|
inline |
Returns a reference to the handle.
◆ open() [1/2]
| int teca_netcdf_util::netcdf_handle::open |
( |
const std::string & |
file_path, |
|
|
int |
mode |
|
) |
| |
Open the file. this can be used from MPI parallel runs, but collective I/O is not possible when a file is opened this way. Returns 0 on success.
◆ open() [2/2]
| int teca_netcdf_util::netcdf_handle::open |
( |
MPI_Comm |
comm, |
|
|
const std::string & |
file_path, |
|
|
int |
mode |
|
) |
| |
Open the file. this can be used when collective I/O is desired. the passed in communicator specifies the subset of ranks that will access the file. Calling this when linked to a non-MPI enabled NetCDF install, from a parallel run will, result in an error. Returns 0 on success.
◆ operator bool()
| teca_netcdf_util::netcdf_handle::operator bool |
( |
| ) |
const |
|
inline |
Test if the handle is valid.
◆ operator=()
| void teca_netcdf_util::netcdf_handle::operator= |
( |
netcdf_handle && |
other | ) |
|
|
inline |
Move assignment takes ownership from the other object.
The documentation for this class was generated from the following file: