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