Rheolef  7.2
an efficient C++ finite element environment
 
Loading...
Searching...
No Matches
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
26namespace rheolef {
27
28template <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};
53template <class T, class M>
54class space_mult_list : public smart_pointer<space_mult_list_rep<T,M> > {
55public:
56
60 typedef typename rep::size_type size_type;
61 typedef typename rep::const_iterator const_iterator;
62
63// allocators:
64
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// -------------------------------------------------------------
82template <class T, class M>
83inline
84space_mult_list<T,M>
86{
88 Zm.push_back (X);
89 Zm.push_back (Y);
90 return Zm;
91}
92template <class T, class M>
93inline
94space_mult_list<T,M>
96{
98 Zm.push_back (Y);
99 return Zm;
100}
101template <class T, class M>
102inline
103space_mult_list<T,M>&
105{
106 Xm.push_back (Y);
107 return Xm;
108}
109template <class T, class M>
110inline
111space_mult_list<T,M>
113{
114 space_mult_list<T,M> Zm = Ym;
115 Zm.push_front (X);
116 return Zm;
117}
118template <class T, class M>
119space_mult_list<T,M>
120pow (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
field::size_type size_type
Definition branch.cc:430
see the smart_pointer page for the full documentation
the finite element space
Definition space.h:382
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.
space_mult_list< T, M > pow(const space_basic< T, M > &X, size_t n)
Definition space_mult.h:120
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
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