NCGroup Class Reference
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
|
Representation of a NetCDF group. More...
#include <nc_interface.H>
Public Member Functions | |
bool | is_root () const |
Is this the NetCDF file (root group)? | |
const NCGroup & | parent () const |
Return parent group, for root it just returns itself. | |
const NCGroup & | root () 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< NCGroup > | all_groups () const |
Return a list of all groups defined in this group. | |
std::vector< NCDim > | all_dims () const |
Return a list of all dimensions defined in this group. | |
std::vector< NCVar > | all_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. | |
Public Attributes | |
const int | ncid |
Identifier used with NetCDF API calls. | |
Protected Member Functions | |
NCGroup (const int id) | |
NCGroup (const int id, const NCGroup *par) | |
Protected Attributes | |
const NCGroup * | m_parent {nullptr} |
Detailed Description
Representation of a NetCDF group.
Constructor & Destructor Documentation
◆ NCGroup() [1/2]
|
inlineexplicitprotected |
◆ NCGroup() [2/2]
|
inlineprotected |
Member Function Documentation
◆ all_dims()
std::vector< NCDim > ncutils::NCGroup::all_dims | ( | ) | const |
Return a list of all dimensions defined in this group.
◆ all_groups()
std::vector< NCGroup > ncutils::NCGroup::all_groups | ( | ) | const |
Return a list of all groups defined in this group.
◆ all_vars()
std::vector< NCVar > ncutils::NCGroup::all_vars | ( | ) | const |
Return a list of all variables defined in this group.
◆ def_array()
NCVar ncutils::NCGroup::def_array | ( | const std::string & | name, |
const nc_type | dtype, | ||
const std::vector< std::string > & | dnames ) const |
Define an array.
◆ def_dim()
NCDim ncutils::NCGroup::def_dim | ( | const std::string & | name, |
const size_t | len ) const |
Define new dimension.
◆ def_group()
NCGroup ncutils::NCGroup::def_group | ( | const std::string & | name | ) | const |
Define new group.
◆ def_scalar()
NCVar ncutils::NCGroup::def_scalar | ( | const std::string & | name, |
const nc_type | dtype ) const |
Define a scalar variable, i.e., 0-dimensional array.
◆ def_var()
|
inline |
Define a variable (wrapper for def_array)
◆ dim()
NCDim ncutils::NCGroup::dim | ( | const std::string & | name | ) | const |
Get the dimension instance by name.
◆ enter_def_mode()
void ncutils::NCGroup::enter_def_mode | ( | ) | const |
Enter definition mode (not needed for NetCDF4 format)
◆ exit_def_mode()
void ncutils::NCGroup::exit_def_mode | ( | ) | const |
Exit definition mode.
◆ full_name()
std::string ncutils::NCGroup::full_name | ( | ) | const |
Full name for this group.
◆ get_attr() [1/4]
std::string ncutils::NCGroup::get_attr | ( | const std::string & | name | ) | const |
◆ get_attr() [2/4]
void ncutils::NCGroup::get_attr | ( | const std::string & | name, |
std::vector< double > & | value ) const |
◆ get_attr() [3/4]
void ncutils::NCGroup::get_attr | ( | const std::string & | name, |
std::vector< float > & | value ) const |
◆ get_attr() [4/4]
void ncutils::NCGroup::get_attr | ( | const std::string & | name, |
std::vector< int > & | value ) const |
◆ group()
NCGroup ncutils::NCGroup::group | ( | const std::string & | name | ) | const |
Get the group by name
Throws error if the group doesn't exist, use has_group
to check
◆ has_attr()
bool ncutils::NCGroup::has_attr | ( | const std::string & | name | ) | const |
Check if an attribute exists.
◆ has_dim()
bool ncutils::NCGroup::has_dim | ( | const std::string & | name | ) | const |
Check if a dimension exists by name.
◆ has_group()
bool ncutils::NCGroup::has_group | ( | const std::string & | name | ) | const |
Check if a group exists.
◆ has_var()
bool ncutils::NCGroup::has_var | ( | const std::string & | name | ) | const |
Check if a variable exists by name.
◆ is_root()
|
inline |
Is this the NetCDF file (root group)?
◆ name()
std::string ncutils::NCGroup::name | ( | ) | const |
Name of this group.
◆ num_attributes()
int ncutils::NCGroup::num_attributes | ( | ) | const |
Number of attributes within this group.
◆ num_dimensions()
int ncutils::NCGroup::num_dimensions | ( | ) | const |
Number of dimensions in this group.
◆ num_groups()
int ncutils::NCGroup::num_groups | ( | ) | const |
Number of sub-groups within this group.
◆ num_variables()
int ncutils::NCGroup::num_variables | ( | ) | const |
Number of variables within this group.
◆ parent()
|
inline |
Return parent group, for root it just returns itself.
◆ put_attr() [1/4]
void ncutils::NCGroup::put_attr | ( | const std::string & | name, |
const std::string & | value ) const |
◆ put_attr() [2/4]
void ncutils::NCGroup::put_attr | ( | const std::string & | name, |
const std::vector< double > & | value ) const |
◆ put_attr() [3/4]
void ncutils::NCGroup::put_attr | ( | const std::string & | name, |
const std::vector< float > & | value ) const |
◆ put_attr() [4/4]
void ncutils::NCGroup::put_attr | ( | const std::string & | name, |
const std::vector< int > & | value ) const |
◆ root()
|
inline |
Return the root (file instance)
◆ var()
NCVar ncutils::NCGroup::var | ( | const std::string & | name | ) | const |
Get the variable instance by name.
Member Data Documentation
◆ m_parent
|
protected |
◆ ncid
const int ncutils::NCGroup::ncid |
Identifier used with NetCDF API calls.
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
Generated by 1.12.0