NCFile Class Reference

AMR-Wind API: ncutils::NCFile Class Reference
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches

#include <nc_interface.H>

Inheritance diagram for ncutils::NCFile:
[legend]
Collaboration diagram for ncutils::NCFile:
[legend]

Public Member Functions

 ~NCFile ()
 
void close ()
 
- Public Member Functions inherited from ncutils::NCGroup
bool is_root () const
 Is this the NetCDF file (root group)?
 
const NCGroupparent () const
 Return parent group, for root it just returns itself.
 
const NCGrouproot () const
 Return the root (file instance)
 
std::string name () const
 Name of this group.
 
std::string full_name () const
 Full name for this group.
 
int num_groups () const
 Number of sub-groups within this group.
 
int num_dimensions () const
 Number of dimensions in this group.
 
int num_variables () const
 Number of variables within this group.
 
int num_attributes () const
 Number of attributes within this group.
 
bool has_group (const std::string &) const
 Check if a group exists.
 
bool has_dim (const std::string &) const
 Check if a dimension exists by name.
 
bool has_var (const std::string &) const
 Check if a variable exists by name.
 
bool has_attr (const std::string &) const
 Check if an attribute exists.
 
NCGroup group (const std::string &) const
 
NCDim dim (const std::string &) const
 Get the dimension instance by name.
 
NCVar var (const std::string &) const
 Get the variable instance by name.
 
NCGroup def_group (const std::string &) const
 Define new group.
 
NCDim def_dim (const std::string &, const size_t len) const
 Define new dimension.
 
NCVar def_scalar (const std::string &name, const nc_type dtype) const
 Define a scalar variable, i.e., 0-dimensional array.
 
NCVar def_array (const std::string &name, const nc_type dtype, const std::vector< std::string > &) const
 Define an array.
 
NCVar def_var (const std::string &name, const nc_type dtype, const std::vector< std::string > &dnames) const
 Define a variable (wrapper for def_array)
 
void put_attr (const std::string &name, const std::string &value) const
 
void put_attr (const std::string &name, const std::vector< double > &value) const
 
void put_attr (const std::string &name, const std::vector< float > &value) const
 
void put_attr (const std::string &name, const std::vector< int > &value) const
 
std::string get_attr (const std::string &name) const
 
void get_attr (const std::string &name, std::vector< double > &value) const
 
void get_attr (const std::string &name, std::vector< float > &value) const
 
void get_attr (const std::string &name, std::vector< int > &value) const
 
std::vector< NCGroupall_groups () const
 Return a list of all groups defined in this group.
 
std::vector< NCDimall_dims () const
 Return a list of all dimensions defined in this group.
 
std::vector< NCVarall_vars () const
 Return a list of all variables defined in this group.
 
void enter_def_mode () const
 Enter definition mode (not needed for NetCDF4 format)
 
void exit_def_mode () const
 Exit definition mode.
 

Static Public Member Functions

static NCFile create (const std::string &name, const int cmode=NC_CLOBBER|NC_NETCDF4)
 
static NCFile open (const std::string &name, const int cmode=NC_NOWRITE)
 
static NCFile create_par (const std::string &name, const int cmode=NC_CLOBBER|NC_NETCDF4|NC_MPIIO, MPI_Comm comm=MPI_COMM_WORLD, MPI_Info info=MPI_INFO_NULL)
 
static NCFile open_par (const std::string &name, const int cmode=NC_NOWRITE, MPI_Comm comm=MPI_COMM_WORLD, MPI_Info info=MPI_INFO_NULL)
 

Protected Member Functions

 NCFile (const int id)
 
- Protected Member Functions inherited from ncutils::NCGroup
 NCGroup (const int id)
 
 NCGroup (const int id, const NCGroup *par)
 

Protected Attributes

bool m_is_open {false}
 
- Protected Attributes inherited from ncutils::NCGroup
const NCGroupm_parent {nullptr}
 

Additional Inherited Members

- Public Attributes inherited from ncutils::NCGroup
const int ncid
 Identifier used with NetCDF API calls.
 

Detailed Description

Representation of a NetCDF file

Provide wrappes to create and open file

Constructor & Destructor Documentation

◆ ~NCFile()

ncutils::NCFile::~NCFile ( )

◆ NCFile()

ncutils::NCFile::NCFile ( const int id)
inlineexplicitprotected

Member Function Documentation

◆ close()

void ncutils::NCFile::close ( )

◆ create()

NCFile ncutils::NCFile::create ( const std::string & name,
const int cmode = NC_CLOBBER | NC_NETCDF4 )
static

◆ create_par()

NCFile ncutils::NCFile::create_par ( const std::string & name,
const int cmode = NC_CLOBBER | NC_NETCDF4 | NC_MPIIO,
MPI_Comm comm = MPI_COMM_WORLD,
MPI_Info info = MPI_INFO_NULL )
static

◆ open()

NCFile ncutils::NCFile::open ( const std::string & name,
const int cmode = NC_NOWRITE )
static

◆ open_par()

NCFile ncutils::NCFile::open_par ( const std::string & name,
const int cmode = NC_NOWRITE,
MPI_Comm comm = MPI_COMM_WORLD,
MPI_Info info = MPI_INFO_NULL )
static

Member Data Documentation

◆ m_is_open

bool ncutils::NCFile::m_is_open {false}
protected

The documentation for this class was generated from the following files:
  • /home/runner/work/amr-wind/amr-wind/amr-wind/utilities/ncutils/nc_interface.H
  • /home/runner/work/amr-wind/amr-wind/amr-wind/utilities/ncutils/nc_interface.cpp