Reaktoro 
A unified framework for modeling chemically reactive systems
TableUtils.hpp
1 // Reaktoro is a unified framework for modeling chemically reactive systems.
2 //
3 // Copyright (C) 2014-2015 Allan Leal
4 //
5 // This program is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18 #pragma once
19 
20 // C++ includes
21 #include <vector>
22 
23 namespace Reaktoro {
24 
25 template<typename T> using Table1D = std::vector<T>;
26 template<typename T> using Table2D = std::vector<std::vector<T>>;
27 template<typename T> using Table3D = std::vector<std::vector<std::vector<T>>>;
28 
29 template<typename T>
30 auto table1D(unsigned dim1) -> Table1D<T>
31 {
32  return Table1D<T>(dim1);
33 }
34 
35 template<typename T>
36 auto table2D(unsigned dim1, unsigned dim2) -> Table2D<T>
37 {
38  return Table2D<T>(dim1, table1D<T>(dim2));
39 }
40 
41 template<typename T>
42 auto table3D(unsigned dim1, unsigned dim2, unsigned dim3) -> Table3D<T>
43 {
44  return Table3D<T>(dim1, table2D<T>(dim2, dim3));
45 }
46 
47 } // namespace Reaktoro
The namespace containing all components of the Reaktoro library.
Definition: ChemicalScalar.hpp:24