File pnetcdf.hxx

Parallel NetCDF data format interface.

Records: In netCDF, the time dimension for each dimension must be the same. Hence when a record is appended to a variable, the size of all variables is increased. To work out which record to write to, a map of variable names to record number is kept.

Author
B.Dudson
Date
May 2012

Copyright 2010 B.D.Dudson, S.Farley, M.V.Umansky, X.Q.Xu

Contact: Ben Dudson, bd512@york.ac.uk

This file is part of BOUT++.

BOUT++ is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

BOUT++ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with BOUT++. If not, see http://www.gnu.org/licenses/.

class PncFormat : public DataFormat

Public Functions

PncFormat(Mesh *mesh_in = nullptr)
PncFormat(const char *name, Mesh *mesh_in = nullptr)
PncFormat(const std::string &name, Mesh *mesh_in = nullptr)
~PncFormat()
bool openr(const char *name)
bool openr(const std::string &name, int mype)
bool openw(const char *name, bool append = false)
bool openw(const std::string &name, int mype, bool append = false)
bool is_valid()
void close()
void flush()
const char *filename()
const vector<int> getSize(const char *var)
const vector<int> getSize(const std::string &var)
bool setGlobalOrigin(int x = 0, int y = 0, int z = 0)
bool setRecord(int t)
bool read(int *var, const char *name, int lx = 1, int ly = 0, int lz = 0)
bool read(int *var, const std::string &name, int lx = 1, int ly = 0, int lz = 0)
bool read(BoutReal *var, const char *name, int lx = 1, int ly = 0, int lz = 0)
bool read(BoutReal *var, const std::string &name, int lx = 1, int ly = 0, int lz = 0)
bool write(int *var, const char *name, int lx = 0, int ly = 0, int lz = 0)
bool write(int *var, const std::string &name, int lx = 0, int ly = 0, int lz = 0)
bool write(BoutReal *var, const char *name, int lx = 0, int ly = 0, int lz = 0)
bool write(BoutReal *var, const std::string &name, int lx = 0, int ly = 0, int lz = 0)
bool read_rec(int *var, const char *name, int lx = 1, int ly = 0, int lz = 0)
bool read_rec(int *var, const std::string &name, int lx = 1, int ly = 0, int lz = 0)
bool read_rec(BoutReal *var, const char *name, int lx = 1, int ly = 0, int lz = 0)
bool read_rec(BoutReal *var, const std::string &name, int lx = 1, int ly = 0, int lz = 0)
bool write_rec(int *var, const char *name, int lx = 0, int ly = 0, int lz = 0)
bool write_rec(int *var, const std::string &name, int lx = 0, int ly = 0, int lz = 0)
bool write_rec(BoutReal *var, const char *name, int lx = 0, int ly = 0, int lz = 0)
bool write_rec(BoutReal *var, const std::string &name, int lx = 0, int ly = 0, int lz = 0)
void setLowPrecision()

Private Members

char *fname

Current file name.

int ncfile

ID of netCDF file.

bool valid
int xDim

Dimensions.

int yDim
int zDim
int tDim
int *dimList

List of dimensions (x,y,z)

int recDimList[4]

List of dimensions (t,x,y,z)

bool appending
bool lowPrecision

When writing, down-convert to floats.

int x0
int y0
int z0
int t0

Data origins (global offsets)

std::map<std::string, int> rec_nr
int default_rec