Rheolef  7.2
an efficient C++ finite element environment
space_mult.h
Go to the documentation of this file.
1 #ifndef _RHEOLEF_SPACE_MULT_H
2 #define _RHEOLEF_SPACE_MULT_H
23 
24 #include "rheolef/space.h"
25 
26 namespace rheolef {
27 
28 template <class T, class M>
31  typedef typename std::list<space_basic<T,M> >::size_type size_type;
32  typedef typename std::list<space_basic<T,M> >::const_iterator const_iterator;
33 
34 // allocators:
35 
37 
38 // accessors:
39 
40  size_type size() const { return _l.size(); }
41  const_iterator begin() const { return _l.begin(); }
42  const_iterator end() const { return _l.end(); }
43 
44 // modifiers:
45 
46  void push_back (const value_type& X) const { _l.push_back(X); }
47  void push_front(const value_type& X) const { _l.push_front(X); }
48 
49 // data:
50  // as mult_list is a unique temporary, avoid list copy by allowing modifs
51  mutable std::list<space_basic<T,M> > _l;
52 };
53 template <class T, class M>
54 class space_mult_list : public smart_pointer<space_mult_list_rep<T,M> > {
55 public:
56 
60  typedef typename rep::size_type size_type;
62 
63 // allocators:
64 
65  space_mult_list() : smart_pointer<rep>(new_macro(rep)) {}
66 
67 // accessors:
68 
69  size_type size() const { return base::data().size(); }
70  const_iterator begin() const { return base::data().begin(); }
71  const_iterator end() const { return base::data().end(); }
72 
73 // modifiers:
74 
75  void push_back (const value_type& X) const { base::data().push_back(X); }
76  void push_front(const value_type& X) const { base::data().push_front(X); }
77 
78 };
79 // -------------------------------------------------------------
80 // space expression: multiplication
81 // -------------------------------------------------------------
82 template <class T, class M>
83 inline
84 space_mult_list<T,M>
86 {
88  Zm.push_back (X);
89  Zm.push_back (Y);
90  return Zm;
91 }
92 template <class T, class M>
93 inline
94 space_mult_list<T,M>
96 {
97  space_mult_list<T,M> Zm = Xm;
98  Zm.push_back (Y);
99  return Zm;
100 }
101 template <class T, class M>
102 inline
103 space_mult_list<T,M>&
105 {
106  Xm.push_back (Y);
107  return Xm;
108 }
109 template <class T, class M>
110 inline
111 space_mult_list<T,M>
113 {
114  space_mult_list<T,M> Zm = Ym;
115  Zm.push_front (X);
116  return Zm;
117 }
118 template <class T, class M>
119 space_mult_list<T,M>
120 pow (const space_basic<T,M>& X, size_t n)
121 {
123  for (size_t i = 0; i < n; i++) {
124  Ym.push_back (X);
125  }
126  return Ym;
127 }
128 
129 } // namespace rheolef
130 #endif // _RHEOLEF_SPACE_MULT_H
see the smart_pointer page for the full documentation
rep::const_iterator const_iterator
Definition: space_mult.h:61
const_iterator begin() const
Definition: space_mult.h:70
void push_front(const value_type &X) const
Definition: space_mult.h:76
size_type size() const
Definition: space_mult.h:69
void push_back(const value_type &X) const
Definition: space_mult.h:75
space_mult_list_rep< T, M > rep
Definition: space_mult.h:57
smart_pointer< rep > base
Definition: space_mult.h:58
rep::size_type size_type
Definition: space_mult.h:60
const_iterator end() const
Definition: space_mult.h:71
space_basic< T, M > value_type
Definition: space_mult.h:59
This file is part of Rheolef.
std::enable_if< details::is_rheolef_arithmetic< U >::value,ad3_basic< T > & >::type operator*=(ad3_basic< T > &a, const U &b)
Definition: ad3.h:367
csr< T, sequential > operator*(const T &lambda, const csr< T, sequential > &a)
Definition: csr.h:437
space_mult_list< T, M > pow(const space_basic< T, M > &X, size_t n)
Definition: space_mult.h:120
const_iterator begin() const
Definition: space_mult.h:41
void push_front(const value_type &X) const
Definition: space_mult.h:47
size_type size() const
Definition: space_mult.h:40
void push_back(const value_type &X) const
Definition: space_mult.h:46
std::list< space_basic< T, M > >::const_iterator const_iterator
Definition: space_mult.h:32
std::list< space_basic< T, M > >::size_type size_type
Definition: space_mult.h:31
std::list< space_basic< T, M > > _l
Definition: space_mult.h:51
const_iterator end() const
Definition: space_mult.h:42
space_basic< T, M > value_type
Definition: space_mult.h:30