UQTk: Uncertainty Quantification Toolkit  3.1.1
arrayio.h
Go to the documentation of this file.
1 /* =====================================================================================
2 
3  The UQ Toolkit (UQTk) version 3.1.1
4  Copyright (2021) NTESS
5  https://www.sandia.gov/UQToolkit/
6  https://github.com/sandialabs/UQTk
7 
8  Copyright 2021 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
9  Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government
10  retains certain rights in this software.
11 
12  This file is part of The UQ Toolkit (UQTk)
13 
14  UQTk is open source software: you can redistribute it and/or modify
15  it under the terms of BSD 3-Clause License
16 
17  UQTk is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  BSD 3 Clause License for more details.
21 
22  You should have received a copy of the BSD 3 Clause License
23  along with UQTk. If not, see https://choosealicense.com/licenses/bsd-3-clause/.
24 
25  Questions? Contact the UQTk Developers at <uqtk-developers@software.sandia.gov>
26  Sandia National Laboratories, Livermore, CA, USA
27 ===================================================================================== */
30 
31 #ifndef ARRAYIO_H
32 #define ARRAYIO_H
33 
34 #include <iostream>
35 #include <fstream>
36 #include <sstream>
37 #include <stdlib.h>
38 
39 #include "Array1D.h"
40 #include "Array2D.h"
41 
42 
46 template <typename T> void read_datafile(Array2D<T> &data, const char *filename);
47 
53 template <typename T> void read_datafileVS(Array2D<T> &data, const char *filename);
54 
60 template <typename T> void read_datafileVS(std::vector<T> &data, int &nrows, int &ncols, const char *filename);
61 
65 template <typename T> void read_datafile_1d(Array1D<T>& data, const char* filename);
66 
72 template <typename T> void read_datafileVS(Array1D<T> &data, const char *filename);
73 
76 template <typename T>
77 void write_datafile(const Array2D<T> &data, const char *filename, const char *action);
78 
81 template <typename T>
82 void write_datafile(const Array2D<T> &data, const char *filename);
83 
86 template <typename T>
87 void write_datafile(const std::vector<T> &data, const int &nrows, const int &ncols, const char *storage, const char *filename, const char *action);
88 
92 template <typename T>
93 void write_datafile_size(const Array2D<T> &data, const char *filename);
94 
97 template <typename T> void write_datafile_1d(const Array1D<T>& data, const char* filename);
98 
99 #endif // ARRAYIO_H
1D Array class for any type T
2D Array class for any type T
void read_datafile_1d(Array1D< T > &data, const char *filename)
Read a data from filename in a vector form and store it in a 1d array data of typename T.
Definition: arrayio.cpp:271
void read_datafile(Array2D< T > &data, const char *filename)
Read a datafile from filename in a matrix form and store it in the 2d array data of typename T.
Definition: arrayio.cpp:38
void write_datafile(const Array2D< T > &data, const char *filename, const char *action)
Write/append the contents of a 2d array data of typename T to file filename in a matrix form.
Definition: arrayio.cpp:441
void write_datafile_size(const Array2D< T > &data, const char *filename)
Write to file filename the number of rows and number of columns on the first line,...
Definition: arrayio.cpp:364
void write_datafile_1d(const Array1D< T > &data, const char *filename)
Write the contents of a 1d array data of typename T to file filename in a vector form.
Definition: arrayio.cpp:569
void read_datafileVS(Array2D< T > &data, const char *filename)
Read a datafile from filename in a matrix form and store it in the 2d array data if typename T.
Definition: arrayio.cpp:94
Stores data of any type T in a 1D array.
Definition: Array1D.h:61
Stores data of any type T in a 2D array.
Definition: Array2D.h:60