#include <alsfvm/io/NetCDFMPIWriter.hpp>
|
| NetCDFMPIWriter (const std::string &basefileName, const std::vector< std::string > &groupNames, size_t groupIndex, bool newFile, MPI_Comm mpiCommunicator, MPI_Info mpiInfo) |
| NetCDFMPIWriter constructs a new NetCDFMPIWriter. More...
|
|
virtual | ~NetCDFMPIWriter () |
| We could inherit from this, hence virtual destructor. More...
|
|
virtual void | write (const volume::Volume &conservedVariables, const grid::Grid &grid, const simulator::TimestepInformation ×tepInformation) override |
| write writes the data to disk More...
|
|
| NetCDFWriter (const std::string &basefileName) |
|
virtual | ~NetCDFWriter () |
|
virtual | ~Writer () |
|
virtual void | finalize (const grid::Grid &grid, const simulator::TimestepInformation ×tepInformation) |
| This method should be called at the end of the simulation. More...
|
|
void | addAttributes (const std::string &nameOfAttributes, const boost::property_tree::ptree &attributes) |
|
|
virtual dimension_vector | createDimensions (netcdf_raw_ptr basegroup, const grid::Grid &grid, bool newFile) |
|
virtual std::vector< netcdf_raw_ptr > | makeDataset (netcdf_raw_ptr baseGroup, const volume::Volume &volume, std::array< netcdf_raw_ptr, 3 > dimensions) |
|
virtual void | writeToFile (netcdf_raw_ptr file, const volume::Volume &conservedVariables, const grid::Grid &grid, const simulator::TimestepInformation ×tepInformation, bool newFile) |
|
virtual void | writeMemory (netcdf_raw_ptr baseGroup, netcdf_raw_ptr dataset, const volume::Volume &volume, size_t memoryIndex, const grid::Grid &grid) |
|
virtual void | writeVolume (netcdf_raw_ptr baseGroup, const volume::Volume &volume, std::array< netcdf_raw_ptr, 3 > dimensions, const std::vector< netcdf_raw_ptr > &datasets, const grid::Grid &grid) |
|
void | writeToFile (netcdf_raw_ptr file, const volume::Volume &conservedVariables, const grid::Grid &grid, const simulator::TimestepInformation ×tepInformation) |
|
std::array< netcdf_raw_ptr, 3 > | createDimensions (netcdf_raw_ptr basegroup, const volume::Volume &volume) |
|
void | writeMemory (netcdf_raw_ptr baseGroup, netcdf_raw_ptr dataset, const volume::Volume &volume, size_t memoryIndex) |
|
void | writeVolume (netcdf_raw_ptr baseGroup, const volume::Volume &volume, std::array< netcdf_raw_ptr, 3 > dimensions) |
|
std::pair< netcdf_raw_ptr, netcdf_raw_ptr > | makeDataset (netcdf_raw_ptr baseGroup, const volume::Volume &volume, size_t memoryIndex, std::array< netcdf_raw_ptr, 3 > dimensions) |
|
std::string | getFilename () |
|
void | addFileInformation (netcdf_raw_ptr file) |
| Writes basic Alsvinn info to file. More...
|
|
Writes to the mpi version of netcdf.
- Note
- Due to the new mpi of pNetCDF, this can not be combined in any meaningful way with the old NetCDFWriter class, the code is pretty much disjoint.
-
can easily be read by the netcdf python package, see http://www.hydro.washington.edu/~jhamman/hydro-logic/blog/2013/10/12/plot-netcdf-data/
◆ dimension_vector
◆ NetCDFMPIWriter()
alsfvm::io::NetCDFMPIWriter::NetCDFMPIWriter |
( |
const std::string & |
basefileName, |
|
|
const std::vector< std::string > & |
groupNames, |
|
|
size_t |
groupIndex, |
|
|
bool |
newFile, |
|
|
MPI_Comm |
mpiCommunicator, |
|
|
MPI_Info |
mpiInfo |
|
) |
| |
NetCDFMPIWriter constructs a new NetCDFMPIWriter.
- Parameters
-
basefileName | the basefilename to use (this could be eg. "some_simulation". |
groupNames | names of groups to create in the file (this is especially useful for MPI). If left blank (""), no prefix will be given |
groupIndex | the groupIndex to write to |
newFile | should we create (or overwrite) the file? If false, the file will be opened and fail if it does not exist or if the data does not match (ie. if the sizes mismatch, or if the datasets are named differently) |
mpiCommunicator | the given mpiCommunicator (used for pNETCDF) |
mpiInfo | the mpiInfo (passed to pNetCDF) |
- Note
- Timestep information will be added to the filename, as well as proper extension (.h5).
◆ ~NetCDFMPIWriter()
virtual alsfvm::io::NetCDFMPIWriter::~NetCDFMPIWriter |
( |
| ) |
|
|
inlinevirtual |
We could inherit from this, hence virtual destructor.
◆ createDimensions()
Creates dimensions
- Note
- should only be called once per file
- Parameters
-
basegroup | the basegroup to use (or file) |
grid | the grid from which to extract size information |
newFile | if true, we will create the dimensions, otherwise we will try to open the dimensions from the file |
- Returns
- the dimensions created by netcdf
◆ makeDataset()
Creates or opens a dataset for the given volume
This will create variables for all variables in the volume
- Note
- these should be called before writing data.
- Parameters
-
baseGroup | the file/group to write to |
volume | volume is used for size and name information |
dimensions | the already created dimensions |
- Returns
- a list of pairs where the first member is the file/group id, and the second the dataset. It is ordered according to the volume
◆ write()
write writes the data to disk
This writes the data in the format
<groupName>_<variable_name>
we do not use any groups to store the file at the moment, this is to ensure maximal compatability with pNetCDF.
- Parameters
-
conservedVariables | the conservedVariables to write |
grid | the grid that is used (describes the whole domain) |
timestepInformation | |
Reimplemented from alsfvm::io::NetCDFWriter.
◆ writeMemory()
Writes the given memory to the dataset/variable
- Parameters
-
baseGroup | the basegroup/file to write to |
dataset | the dataset to write to |
volume | the volume is used to get size information |
memoryIndex | the scalar memory index of the volume |
grid | the grid to use |
◆ writeToFile()
Writes to the opened file @note Assumes the file is in define mode
- Parameters
-
file | the filepointer |
conservedVariables | the conservedVariables to write |
grid | the underlying grid |
timestepInformation | the current timestep information |
newFile | is true if the file is created for this iteration, otherwise false |
◆ writeVolume()
Writes the volume (ie looops over all memory areas and writes each memory area)
- Parameters
-
baseGroup | the baseGroup to use |
volume | the volume to use |
dimensions | the given dimensions |
datasets | a list of datasets (produced by makeDataset) that is ordered according to the volume (makeDataset does this automatically) |
grid | the grid to use |
The documentation for this class was generated from the following files:
- /home/docs/checkouts/readthedocs.org/user_builds/alsvinn/checkouts/stable/alsfvm/include/alsfvm/io/NetCDFMPIWriter.hpp
- /home/docs/checkouts/readthedocs.org/user_builds/alsvinn/checkouts/stable/alsfvm/src/io/NetCDFMPIWriter.cpp