ARTS  2.3.1285(git:92a29ea9-dirty)
test_binaryio.cc
Go to the documentation of this file.
1 /* Copyright (C) 2003-2012 Oliver Lemke <olemke@core-dump.info>
2 
3  This program is free software; you can redistribute it and/or
4  modify it under the terms of the GNU General Public License as
5  published by the Free Software Foundation; either version 2 of the
6  License, or (at your option) any later version.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
16  USA. */
17 
18 #include <cstdlib>
19 #include <iostream>
20 
21 #include "arts.h"
22 #include "matpackIV.h"
23 #include "xml_io.h"
24 
25 int main(int /* argc */, char* /* argv */[]) {
26  // Create binary file
27  Tensor4 v(4, 4, 4, 4);
28 
29  for (Index i = 0; i < 4; i++)
30  for (Index j = 0; j < 4; j++)
31  for (Index k = 0; k < 4; k++)
32  for (Index l = 0; l < 4; l++)
33  v(i, j, k, l) = double(i * 4 * 4 * 4 + j * 4 * 4 + k * 4 + l);
34 
35  xml_write_to_file("outfile.xml", v, FILE_TYPE_BINARY, 0, Verbosity());
36 
37  // Read binary file
38  Tensor4 w;
39 
40  xml_read_from_file("outfile.xml", w, Verbosity());
41 
42  cout << w << endl;
43 
44  return (EXIT_SUCCESS);
45 }
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
The Tensor4 class.
Definition: matpackIV.h:421
cmplx FADDEEVA() w(cmplx z, double relerr)
Definition: Faddeeva.cc:680
This file contains basic functions to handle XML data files.
The global header file for ARTS.
void xml_read_from_file(const String &filename, T &type, const Verbosity &verbosity)
Reads data from XML file.
Definition: xml_io.cc:901
int main(int, char *[])
void xml_write_to_file(const String &filename, const T &type, const FileType ftype, const Index no_clobber, const Verbosity &verbosity)
Write data to XML file.
Definition: xml_io.cc:972