PISM, A Parallel Ice Sheet Model  stable v2.1-1-g6902d5502 committed by Ed Bueler on 2023-12-20 08:38:27 -0800
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
pism::io::NCFile Class Referenceabstract

The PISM wrapper for a subset of the NetCDF C API. More...

#include <NCFile.hh>

+ Inheritance diagram for pism::io::NCFile:

Public Types

typedef std::shared_ptr< NCFilePtr
 

Public Member Functions

 NCFile (MPI_Comm com)
 
virtual ~NCFile ()=default
 
void open (const std::string &filename, io::Mode mode)
 
void create (const std::string &filename)
 
void sync () const
 
void close ()
 
void enddef () const
 
void redef () const
 
void def_dim (const std::string &name, size_t length) const
 
void inq_dimid (const std::string &dimension_name, bool &exists) const
 
void inq_dimlen (const std::string &dimension_name, unsigned int &result) const
 
void inq_unlimdim (std::string &result) const
 
void def_var (const std::string &name, io::Type nctype, const std::vector< std::string > &dims) const
 
void def_var_chunking (const std::string &name, std::vector< size_t > &dimensions) const
 
void get_vara_double (const std::string &variable_name, const std::vector< unsigned int > &start, const std::vector< unsigned int > &count, double *ip) const
 
void put_vara_double (const std::string &variable_name, const std::vector< unsigned int > &start, const std::vector< unsigned int > &count, const double *op) const
 
void write_darray (const std::string &variable_name, const Grid &grid, unsigned int z_count, bool time_dependent, unsigned int record, const double *input)
 
void get_varm_double (const std::string &variable_name, const std::vector< unsigned int > &start, const std::vector< unsigned int > &count, const std::vector< unsigned int > &imap, double *ip) const
 
void inq_nvars (int &result) const
 
void inq_vardimid (const std::string &variable_name, std::vector< std::string > &result) const
 
void inq_varnatts (const std::string &variable_name, int &result) const
 
void inq_varid (const std::string &variable_name, bool &result) const
 
void inq_varname (unsigned int j, std::string &result) const
 
void set_compression_level (int level) const
 
void get_att_double (const std::string &variable_name, const std::string &att_name, std::vector< double > &result) const
 
void get_att_text (const std::string &variable_name, const std::string &att_name, std::string &result) const
 
void put_att_double (const std::string &variable_name, const std::string &att_name, io::Type xtype, const std::vector< double > &data) const
 
void put_att_text (const std::string &variable_name, const std::string &att_name, const std::string &value) const
 
void inq_attname (const std::string &variable_name, unsigned int n, std::string &result) const
 
void inq_atttype (const std::string &variable_name, const std::string &att_name, io::Type &result) const
 
void set_fill (int fillmode, int &old_modep) const
 
std::string filename () const
 
void del_att (const std::string &variable_name, const std::string &att_name) const
 

Protected Member Functions

virtual void open_impl (const std::string &filename, io::Mode mode)=0
 
virtual void create_impl (const std::string &filename)=0
 
virtual void sync_impl () const =0
 
virtual void close_impl ()=0
 
virtual void enddef_impl () const =0
 
virtual void redef_impl () const =0
 
virtual void def_dim_impl (const std::string &name, size_t length) const =0
 
virtual void inq_dimid_impl (const std::string &dimension_name, bool &exists) const =0
 
virtual void inq_dimlen_impl (const std::string &dimension_name, unsigned int &result) const =0
 
virtual void inq_unlimdim_impl (std::string &result) const =0
 
virtual void def_var_impl (const std::string &name, io::Type nctype, const std::vector< std::string > &dims) const =0
 
virtual void def_var_chunking_impl (const std::string &name, std::vector< size_t > &dimensions) const
 
virtual void get_vara_double_impl (const std::string &variable_name, const std::vector< unsigned int > &start, const std::vector< unsigned int > &count, double *ip) const =0
 
virtual void put_vara_double_impl (const std::string &variable_name, const std::vector< unsigned int > &start, const std::vector< unsigned int > &count, const double *op) const =0
 
virtual void write_darray_impl (const std::string &variable_name, const Grid &grid, unsigned int z_count, bool time_dependent, unsigned int record, const double *input)
 
virtual void get_varm_double_impl (const std::string &variable_name, const std::vector< unsigned int > &start, const std::vector< unsigned int > &count, const std::vector< unsigned int > &imap, double *ip) const =0
 
virtual void inq_nvars_impl (int &result) const =0
 
virtual void inq_vardimid_impl (const std::string &variable_name, std::vector< std::string > &result) const =0
 
virtual void inq_varnatts_impl (const std::string &variable_name, int &result) const =0
 
virtual void inq_varid_impl (const std::string &variable_name, bool &exists) const =0
 
virtual void inq_varname_impl (unsigned int j, std::string &result) const =0
 
virtual void set_compression_level_impl (int level) const =0
 
virtual void get_att_double_impl (const std::string &variable_name, const std::string &att_name, std::vector< double > &result) const =0
 
virtual void get_att_text_impl (const std::string &variable_name, const std::string &att_name, std::string &result) const =0
 
virtual void put_att_double_impl (const std::string &variable_name, const std::string &att_name, io::Type xtype, const std::vector< double > &data) const =0
 
virtual void put_att_text_impl (const std::string &variable_name, const std::string &att_name, const std::string &value) const =0
 
virtual void inq_attname_impl (const std::string &variable_name, unsigned int n, std::string &result) const =0
 
virtual void inq_atttype_impl (const std::string &variable_name, const std::string &att_name, io::Type &result) const =0
 
virtual void set_fill_impl (int fillmode, int &old_modep) const =0
 
virtual void del_att_impl (const std::string &variable_name, const std::string &att_name) const =0
 

Protected Attributes

MPI_Comm m_com
 
int m_file_id
 
std::string m_filename
 

Private Attributes

bool m_define_mode
 

Detailed Description

The PISM wrapper for a subset of the NetCDF C API.

The goal of this class is to hide the fact that we need to communicate data to and from the processor zero. Using this wrapper we should be able to write code that looks good and works both on 1-processor and multi-processor systems.

Moreover, this way we can switch underlying I/O implementations.

Notes:

Definition at line 59 of file NCFile.hh.


The documentation for this class was generated from the following files: