URI:
       tNC3File.hh - pism - [fork] customized build of PISM, the parallel ice sheet model (tillflux branch)
  HTML git clone git://src.adamsgaard.dk/pism
   DIR Log
   DIR Files
   DIR Refs
   DIR LICENSE
       ---
       tNC3File.hh (4207B)
       ---
            1 // Copyright (C) 2012, 2013, 2014, 2015, 2017, 2019 PISM Authors
            2 //
            3 // This file is part of PISM.
            4 //
            5 // PISM is free software; you can redistribute it and/or modify it under the
            6 // terms of the GNU General Public License as published by the Free Software
            7 // Foundation; either version 3 of the License, or (at your option) any later
            8 // version.
            9 //
           10 // PISM is distributed in the hope that it will be useful, but WITHOUT ANY
           11 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
           12 // FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
           13 // details.
           14 //
           15 // You should have received a copy of the GNU General Public License
           16 // along with PISM; if not, write to the Free Software
           17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
           18 
           19 #ifndef _PISMNC3FILE_H_
           20 #define _PISMNC3FILE_H_
           21 
           22 #include "NCFile.hh"
           23 
           24 namespace pism {
           25 namespace io {
           26 
           27 class NC3File : public NCFile
           28 {
           29 public:
           30   NC3File(MPI_Comm com);
           31   virtual ~NC3File();
           32 
           33   std::string get_format() const;
           34 
           35 protected:
           36   // implementations:
           37   // open/create/close
           38   void open_impl(const std::string &filename, IO_Mode mode);
           39 
           40   void create_impl(const std::string &filename);
           41 
           42   void sync_impl() const;
           43 
           44   void close_impl();
           45 
           46   // redef/enddef
           47   void enddef_impl() const;
           48 
           49   void redef_impl() const;
           50 
           51   // dim
           52   void def_dim_impl(const std::string &name, size_t length) const;
           53 
           54   void inq_dimid_impl(const std::string &dimension_name, bool &exists) const;
           55 
           56   void inq_dimlen_impl(const std::string &dimension_name, unsigned int &result) const;
           57 
           58   void inq_unlimdim_impl(std::string &result) const;
           59 
           60   // var
           61   void def_var_impl(const std::string &name, IO_Type nctype, const std::vector<std::string> &dims) const;
           62 
           63   void get_vara_double_impl(const std::string &variable_name,
           64                       const std::vector<unsigned int> &start,
           65                       const std::vector<unsigned int> &count,
           66                       double *ip) const;
           67 
           68   void put_vara_double_impl(const std::string &variable_name,
           69                       const std::vector<unsigned int> &start,
           70                       const std::vector<unsigned int> &count,
           71                       const double *op) const;
           72 
           73   void get_varm_double_impl(const std::string &variable_name,
           74                       const std::vector<unsigned int> &start,
           75                       const std::vector<unsigned int> &count,
           76                       const std::vector<unsigned int> &imap,
           77                       double *ip) const;
           78 
           79   void inq_nvars_impl(int &result) const;
           80 
           81   void inq_vardimid_impl(const std::string &variable_name, std::vector<std::string> &result) const;
           82 
           83   void inq_varnatts_impl(const std::string &variable_name, int &result) const;
           84 
           85   void inq_varid_impl(const std::string &variable_name, bool &exists) const;
           86 
           87   void inq_varname_impl(unsigned int j, std::string &result) const;
           88 
           89   // att
           90   void get_att_double_impl(const std::string &variable_name, const std::string &att_name, std::vector<double> &result) const;
           91 
           92   void get_att_text_impl(const std::string &variable_name, const std::string &att_name, std::string &result) const;
           93 
           94   void put_att_double_impl(const std::string &variable_name, const std::string &att_name, IO_Type xtype, const std::vector<double> &data) const;
           95 
           96   void put_att_text_impl(const std::string &variable_name, const std::string &att_name, const std::string &value) const;
           97 
           98   void inq_attname_impl(const std::string &variable_name, unsigned int n, std::string &result) const;
           99 
          100   void inq_atttype_impl(const std::string &variable_name, const std::string &att_name, IO_Type &result) const;
          101 
          102   // misc
          103   void set_fill_impl(int fillmode, int &old_modep) const;
          104 
          105   void del_att_impl(const std::string &variable_name, const std::string &att_name) const;
          106 private:
          107   int m_rank;
          108 
          109   void get_var_double(const std::string &variable_name,
          110                      const std::vector<unsigned int> &start,
          111                      const std::vector<unsigned int> &count,
          112                      const std::vector<unsigned int> &imap, double *ip,
          113                      bool transposed) const;
          114 
          115   int get_varid(const std::string &variable_name) const;
          116   };
          117 
          118 } // end of namespace io
          119 } // end of namespace pism
          120 
          121 #endif /* _PISMNC3FILE_H_ */