Peano
Loading...
Searching...
No Matches
NetCDFWriter.h
Go to the documentation of this file.
1// This file is part of the Peano project. For conditions of distribution and
2// use, please see the copyright notice at www.peano-framework.org
3#pragma once
4
7
8#include <iostream>
9#include <netcdf.h>
10#include <string>
11#include <vector>
12
13namespace toolbox {
14 namespace curvi {
16 public:
17 NetCDFWriter(std::string filename, int a_nz, int a_ny, int a_nx);
18
19 void open(int o_nz = 0, int o_ny = 0, int o_nx = 0, bool open = true, std::string prefix = "");
20
21 void init(int o_nz = 0, int o_ny = 0, int o_nx = 0);
22
23 int addVariable(std::string var_name);
24
25 void write(const size_t* start, const size_t* count, const std::vector<double>& var, int var_id);
26 void write(const size_t* start, const size_t* count, const std::vector<double>& var);
27
28 void close();
29
30 private:
31 std::string m_filename;
32
33 int nx, ny, nz;
34 int ncid;
38 int dims;
39 std::vector<int> dim_ids;
40 };
41 } // namespace curvi
42} // namespace toolbox
void open(int o_nz=0, int o_ny=0, int o_nx=0, bool open=true, std::string prefix="")
void write(const size_t *start, const size_t *count, const std::vector< double > &var)
void init(int o_nz=0, int o_ny=0, int o_nx=0)
NetCDFWriter(std::string filename, int a_nz, int a_ny, int a_nx)
std::vector< int > dim_ids
int addVariable(std::string var_name)
void write(const size_t *start, const size_t *count, const std::vector< double > &var, int var_id)