66 if ((retval = nc_def_dim(ncid,
"nrows", m.
nrows(), &ncdims[0])))
68 if ((retval = nc_def_dim(ncid,
"ncols", m.
ncols(), &ncdims[1])))
70 if ((retval = nc_def_var(ncid,
"Matrix", NC_DOUBLE, 2, &ncdims[0], &varid)))
72 if ((retval = nc_enddef(ncid)))
nca_error(retval,
"nc_enddef");
73 if ((retval = nc_put_var_double(ncid, varid, m.
get_c_array())))
87 Index npages, nrows, ncols;
92 t.
resize(npages, nrows, ncols);
105 int ncdims[3], varid;
106 if ((retval = nc_def_dim(ncid,
"npages", t.
npages(), &ncdims[0])))
108 if ((retval = nc_def_dim(ncid,
"nrows", t.
nrows(), &ncdims[1])))
110 if ((retval = nc_def_dim(ncid,
"ncols", t.
ncols(), &ncdims[2])))
112 if ((retval = nc_def_var(ncid,
"Tensor3", NC_DOUBLE, 3, &ncdims[0], &varid)))
114 if ((retval = nc_enddef(ncid)))
nca_error(retval,
"nc_enddef");
115 if ((retval = nc_put_var_double(ncid, varid, t.
get_c_array())))
129 Index nbooks, npages, nrows, ncols;
135 t.
resize(nbooks, npages, nrows, ncols);
148 int ncdims[4], varid;
149 if ((retval = nc_def_dim(ncid,
"nbooks", t.
nbooks(), &ncdims[0])))
151 if ((retval = nc_def_dim(ncid,
"npages", t.
npages(), &ncdims[1])))
153 if ((retval = nc_def_dim(ncid,
"nrows", t.
nrows(), &ncdims[2])))
155 if ((retval = nc_def_dim(ncid,
"ncols", t.
ncols(), &ncdims[3])))
157 if ((retval = nc_def_var(ncid,
"Tensor4", NC_DOUBLE, 4, &ncdims[0], &varid)))
159 if ((retval = nc_enddef(ncid)))
nca_error(retval,
"nc_enddef");
160 if ((retval = nc_put_var_double(ncid, varid, t.
get_c_array())))
174 Index nshelves, nbooks, npages, nrows, ncols;
181 t.
resize(nshelves, nbooks, npages, nrows, ncols);
194 int ncdims[5], varid;
195 if ((retval = nc_def_dim(ncid,
"nshelves", t.
nshelves(), &ncdims[0])))
197 if ((retval = nc_def_dim(ncid,
"nbooks", t.
nbooks(), &ncdims[1])))
199 if ((retval = nc_def_dim(ncid,
"npages", t.
npages(), &ncdims[2])))
201 if ((retval = nc_def_dim(ncid,
"nrows", t.
nrows(), &ncdims[3])))
203 if ((retval = nc_def_dim(ncid,
"ncols", t.
ncols(), &ncdims[4])))
205 if ((retval = nc_def_var(ncid,
"Tensor5", NC_DOUBLE, 5, &ncdims[0], &varid)))
207 if ((retval = nc_enddef(ncid)))
nca_error(retval,
"nc_enddef");
208 if ((retval = nc_put_var_double(ncid, varid, t.
get_c_array())))
239 if ((retval = nc_def_dim(ncid,
"nelem", v.
nelem(), &ncdim)))
241 if ((retval = nc_def_var(ncid,
"Vector", NC_DOUBLE, 1, &ncdim, &varid)))
243 if ((retval = nc_enddef(ncid)))
nca_error(retval,
"nc_enddef");
244 if ((retval = nc_put_var_double(ncid, varid, v.
get_c_array())))
254 #define TMPL_NC_READ_WRITE_FILE_DUMMY(what) \
255 void nca_write_to_file(const int, const what&, const Verbosity&) \
257 throw runtime_error("NetCDF support not yet implemented for this type!"); \
259 void nca_read_from_file(const int, what&, const Verbosity&) \
261 throw runtime_error("NetCDF support not yet implemented for this type!"); \
267 #undef TMPL_NC_READ_WRITE_FILE_DUMMY