Reaktoro  v2.11.0
A unified framework for modeling chemically reactive systems
TableUtils.hpp
1 // Reaktoro is a unified framework for modeling chemically reactive systems.
2 //
3 // Copyright © 2014-2024 Allan Leal
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library 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 GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library. 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: Algorithms.hpp:29