ARTS  2.2.66
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
26 main (int /* argc */, char * /* argv */ [])
27 {
28  // Create binary file
29  Tensor4 v (4,4,4,4);
30 
31  for (Index i = 0; i < 4; i++)
32  for (Index j = 0; j < 4; j++)
33  for (Index k = 0; k < 4; k++)
34  for (Index l = 0; l < 4; l++)
35  v(i, j, k, l) = double (i*4*4*4+j*4*4+k*4+l);
36 
37  xml_write_to_file ("outfile.xml", v, FILE_TYPE_BINARY, 0, Verbosity());
38 
39  // Read binary file
40  Tensor4 w;
41 
42  xml_read_from_file ("outfile.xml", w, Verbosity());
43 
44  cout << w << endl;
45 
46  return (EXIT_SUCCESS);
47 }
48 
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:35
The Tensor4 class.
Definition: matpackIV.h:383
cmplx FADDEEVA() w(cmplx z, double relerr)
Definition: Faddeeva.cc:679
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:831
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:982