tNC4File.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
---
tNC4File.hh (4736B)
---
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 _PISMNC4FILE_H_
20 #define _PISMNC4FILE_H_
21
22 #include "NCFile.hh"
23
24 namespace pism {
25 namespace io {
26
27 class NC4File : public NCFile
28 {
29 public:
30 NC4File(MPI_Comm com, unsigned int compression_level);
31 virtual ~NC4File();
32
33 protected:
34 // implementations:
35 // open/create/close
36
37 virtual void sync_impl() const;
38
39 virtual void close_impl();
40
41 // redef/enddef
42 virtual void enddef_impl() const;
43
44 virtual void redef_impl() const;
45
46 // dim
47 virtual void def_dim_impl(const std::string &name, size_t length) const;
48
49 virtual void inq_dimid_impl(const std::string &dimension_name, bool &exists) const;
50
51 virtual void inq_dimlen_impl(const std::string &dimension_name, unsigned int &result) const;
52
53 virtual void inq_unlimdim_impl(std::string &result) const;
54
55 // var
56 virtual void def_var_chunking_impl(const std::string &name,
57 std::vector<size_t> &dimensions) const;
58
59 virtual void def_var_impl(const std::string &name,
60 IO_Type nctype, const std::vector<std::string> &dims) const;
61
62 virtual void get_vara_double_impl(const std::string &variable_name,
63 const std::vector<unsigned int> &start,
64 const std::vector<unsigned int> &count,
65 double *ip) const;
66
67 virtual void put_vara_double_impl(const std::string &variable_name,
68 const std::vector<unsigned int> &start,
69 const std::vector<unsigned int> &count,
70 const double *op) const;
71
72 virtual void get_varm_double_impl(const std::string &variable_name,
73 const std::vector<unsigned int> &start,
74 const std::vector<unsigned int> &count,
75 const std::vector<unsigned int> &imap, double *ip) const;
76
77 virtual void inq_nvars_impl(int &result) const;
78
79 virtual void inq_vardimid_impl(const std::string &variable_name, std::vector<std::string> &result) const;
80
81 virtual void inq_varnatts_impl(const std::string &variable_name, int &result) const;
82
83 virtual void inq_varid_impl(const std::string &variable_name, bool &exists) const;
84
85 virtual void inq_varname_impl(unsigned int j, std::string &result) const;
86
87 // att
88 virtual void get_att_double_impl(const std::string &variable_name, const std::string &att_name, std::vector<double> &result) const;
89
90 virtual void get_att_text_impl(const std::string &variable_name, const std::string &att_name, std::string &result) const;
91
92 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;
93
94 virtual void put_att_text_impl(const std::string &variable_name, const std::string &att_name, const std::string &value) const;
95
96 virtual void inq_attname_impl(const std::string &variable_name, unsigned int n, std::string &result) const;
97
98 virtual void inq_atttype_impl(const std::string &variable_name, const std::string &att_name, IO_Type &result) const;
99
100 // misc
101 virtual void set_fill_impl(int fillmode, int &old_modep) const;
102
103 virtual void del_att_impl(const std::string &variable_name, const std::string &att_name) const;
104 protected:
105 virtual void set_access_mode(int varid, bool mapped) const;
106 virtual void get_put_var_double(const std::string &variable_name,
107 const std::vector<unsigned int> &start,
108 const std::vector<unsigned int> &count,
109 const std::vector<unsigned int> &imap, double *ip,
110 bool get,
111 bool mapped) const;
112 unsigned int m_compression_level;
113
114 int get_varid(const std::string &variable_name) const;
115 };
116
117 } // end of namespace io
118 } // end of namespace pism
119
120 #endif /* _PISMNC4FILE_H_ */