tNC4_Serial.cc - pism - [fork] customized build of PISM, the parallel ice sheet model (tillflux branch)
(HTM) git clone git://src.adamsgaard.dk/pism
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
tNC4_Serial.cc (1471B)
---
1 // Copyright (C) 2012, 2013, 2014, 2015, 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 #include "PISMNC4_Serial.hh"
20
21 // The following is a stupid kludge necessary to make NetCDF 4.x work in
22 // serial mode in an MPI program:
23 #ifndef MPI_INCLUDED
24 #define MPI_INCLUDED 1
25 #endif
26 #include <netcdf.h>
27
28 namespace pism {
29 namespace io {
30
31 int NC4_Serial::open_impl(const std::string &fname, IO_Mode mode) {
32 int open_mode = mode == PISM_READONLY ? NC_NOWRITE : NC_WRITE;
33
34 int stat = nc_open(fname.c_str(), open_mode, &m_file_id);
35 check(PISM_ERROR_LOCATION, stat);
36 }
37
38 int NC4_Serial::create_impl(const std::string &fname) {
39 int stat = nc_create(fname.c_str(), NC_NETCDF4, &m_file_id);
40 check(PISM_ERROR_LOCATION, stat);
41 }
42
43 } // end of namespace io
44 } // end of namespace pism