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

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