NetDEM v1.0
Loading...
Searching...
No Matches
utils_macros.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <array>
4#include <cmath>
5#include <list>
6#include <tuple>
7#include <vector>
8
9namespace netdem {
10
11using size_t = std::size_t;
12
13using Vec2i = std::array<int, 2>;
14using Vec3i = std::array<int, 3>;
15using Vec4i = std::array<int, 4>;
16
17using Vec2d = std::array<double, 2>;
18using Vec3d = std::array<double, 3>;
19using Vec4d = std::array<double, 4>;
20
21using Mat2d = std::array<std::array<double, 2>, 2>;
22using Mat3d = std::array<std::array<double, 3>, 3>;
23
24template <size_t N> using VecNi = std::array<int, N>;
25template <size_t N> using VecNd = std::array<double, N>;
26template <size_t Nr, size_t Nc>
27using MatNd = std::array<std::array<double, Nc>, Nr>;
28
29using VecXd = std::vector<double>;
30
31template <typename T> using VecXT = std::vector<T>;
32template <typename T, size_t N> using VecNT = std::array<T, N>;
33
34template <typename T> using List = std::list<T>;
35
36struct PairHash {
37 template <class T1, class T2>
38 int operator()(const std::pair<T1, T2> &p) const {
39 auto h1 = std::hash<T1>{}(p.first);
40 auto h2 = std::hash<T2>{}(p.second);
41
42 return h1 ^ h2;
43 }
44};
45
46} // namespace netdem
Definition bond_entry.hpp:7
std::array< std::array< double, 3 >, 3 > Mat3d
Definition utils_macros.hpp:22
std::array< double, 2 > Vec2d
Definition utils_macros.hpp:17
std::vector< T > VecXT
Definition utils_macros.hpp:31
std::array< int, 4 > Vec4i
Definition utils_macros.hpp:15
std::array< double, 3 > Vec3d
Definition utils_macros.hpp:18
std::array< std::array< double, Nc >, Nr > MatNd
Definition utils_macros.hpp:27
std::array< double, N > VecNd
Definition utils_macros.hpp:25
std::array< int, 3 > Vec3i
Definition utils_macros.hpp:14
std::vector< double > VecXd
Definition utils_macros.hpp:29
std::array< int, 2 > Vec2i
Definition utils_macros.hpp:13
std::list< T > List
Definition utils_macros.hpp:34
std::array< double, 4 > Vec4d
Definition utils_macros.hpp:19
std::size_t size_t
Definition utils_macros.hpp:11
std::array< T, N > VecNT
Definition utils_macros.hpp:32
std::array< std::array< double, 2 >, 2 > Mat2d
Definition utils_macros.hpp:21
std::array< int, N > VecNi
Definition utils_macros.hpp:24
Definition utils_macros.hpp:36
int operator()(const std::pair< T1, T2 > &p) const
Definition utils_macros.hpp:38