Rheolef  7.1
an efficient C++ finite element environment
pair_with_linear_algebra.h
Go to the documentation of this file.
1 #ifndef PAIR_WITH_LINEAR_ALGEBRA_H
2 #define PAIR_WITH_LINEAR_ALGEBRA_H
3 
24 namespace rheolef { namespace details {
25 
26 template<class T1, class T2>
27 struct pair_with_linear_algebra: std::pair<T1,T2> {
28  typedef std::pair<T1,T2> base;
29  pair_with_linear_algebra (const T1& f=T1(), const T2& s=T2());
31  template<class T0>
33 };
34 template<class T1, class T2>
35 inline
37  : base(f,s)
38 {
39 }
40 template<class T1, class T2>
41 inline
43  : base(x)
44 {
45 }
46 template<class T1, class T2>
47 template<class T0>
48 inline
51  base::first *= k;
52  base::second *= k;
53  return *this;
54 }
55 template<class T1, class T2>
56 inline
59  return pair_with_linear_algebra<T1,T2> (-x.first, -x.second);
60 }
61 template<class T0, class T1, class T2>
62 inline
63 pair_with_linear_algebra<T1, T2>
65  return pair_with_linear_algebra<T1,T2> (k*x.first, k*x.second);
66 }
67 template<class T1, class T2>
68 inline
69 pair_with_linear_algebra<T1, T2>
71  return pair_with_linear_algebra<T1,T2> (x.first + y.first, x.second + y.second);
72 }
73 template<class T1, class T2>
74 inline
75 pair_with_linear_algebra<T1, T2>
77  return pair_with_linear_algebra<T1,T2> (x.first - y.first, x.second - y.second);
78 }
79 
80 }} // namespace rheolef::details
81 #endif // PAIR_WITH_LINEAR_ALGEBRA_H
rheolef::details::pair_with_linear_algebra::base
std::pair< T1, T2 > base
Definition: pair_with_linear_algebra.h:28
rheolef::details::operator+
pair_with_linear_algebra< T1, T2 > operator+(const pair_with_linear_algebra< T1, T2 > &x, const pair_with_linear_algebra< T1, T2 > &y)
Definition: pair_with_linear_algebra.h:70
rheolef::details::operator-
pair_with_linear_algebra< T1, T2 > operator-(const pair_with_linear_algebra< T1, T2 > &x)
Definition: pair_with_linear_algebra.h:58
rheolef
This file is part of Rheolef.
Definition: compiler_eigen.h:37
rheolef::details::pair_with_linear_algebra::operator*=
pair_with_linear_algebra< T1, T2 > & operator*=(const T0 &k)
Definition: pair_with_linear_algebra.h:50
rheolef::details::pair_with_linear_algebra
Definition: pair_with_linear_algebra.h:27
rheolef::details::pair_with_linear_algebra::pair_with_linear_algebra
pair_with_linear_algebra(const T1 &f=T1(), const T2 &s=T2())
Definition: pair_with_linear_algebra.h:36
f
Definition: cavity_dg.h:29
rheolef::details::pair_with_linear_algebra::pair_with_linear_algebra
pair_with_linear_algebra(const pair_with_linear_algebra< T1, T2 > &)
Definition: pair_with_linear_algebra.h:42
rheolef::details::operator*
pair_with_linear_algebra< T1, T2 > operator*(const T0 &k, const pair_with_linear_algebra< T1, T2 > &x)
Definition: pair_with_linear_algebra.h:64