ARTS 2.5.4 (git: 31ce4f0e)
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
25int 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}
The global header file for ARTS.
The Tensor4 class.
Definition: matpackIV.h:429
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
constexpr Numeric k
Boltzmann constant convenience name [J/K].
constexpr Numeric l(const Index p0, const Index n, const Numeric x, const SortedVectorType &xi, const Index j, const std::pair< Numeric, Numeric > cycle={ -180, 180}) noexcept
int main(int, char *[])
#define v
#define w
This file contains basic functions to handle XML data files.
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.h:172
void xml_read_from_file(const String &filename, T &type, const Verbosity &verbosity)
Reads data from XML file.
Definition: xml_io.h:151
@ FILE_TYPE_BINARY
Definition: xml_io_base.h:45