Loading...
Searching...
No Matches
space_mult.h
Go to the documentation of this file.
#ifndef _RHEOLEF_SPACE_MULT_H
#define _RHEOLEF_SPACE_MULT_H
#include "rheolef/space.h"
namespace rheolef {
template <class T, class M>
struct space_mult_list_rep {
typedef space_basic<T,M> value_type;
typedef typename std::list<space_basic<T,M> >::size_type size_type;
typedef typename std::list<space_basic<T,M> >::const_iterator const_iterator;
// allocators:
space_mult_list_rep() : _l() {}
// accessors:
size_type size() const { return _l.size(); }
const_iterator begin() const { return _l.begin(); }
const_iterator end() const { return _l.end(); }
// modifiers:
void push_back (const value_type& X) const { _l.push_back(X); }
void push_front(const value_type& X) const { _l.push_front(X); }
// data:
// as mult_list is a unique temporary, avoid list copy by allowing modifs
mutable std::list<space_basic<T,M> > _l;
};
template <class T, class M>
class space_mult_list : public smart_pointer<space_mult_list_rep<T,M> > {
public:
typedef space_mult_list_rep<T,M> rep;
typedef smart_pointer<rep> base;
typedef space_basic<T,M> value_type;
typedef typename rep::size_type size_type;
typedef typename rep::const_iterator const_iterator;
// allocators:
space_mult_list() : smart_pointer<rep>(new_macro(rep)) {}
// accessors:
size_type size() const { return base::data().size(); }
const_iterator begin() const { return base::data().begin(); }
const_iterator end() const { return base::data().end(); }
// modifiers:
void push_back (const value_type& X) const { base::data().push_back(X); }
void push_front(const value_type& X) const { base::data().push_front(X); }
};
// -------------------------------------------------------------
// space expression: multiplication
// -------------------------------------------------------------
template <class T, class M>
inline
space_mult_list<T,M>
operator* (const space_basic<T,M>& X, const space_basic<T,M>& Y)
{
space_mult_list<T,M> Zm;
Zm.push_back (X);
Zm.push_back (Y);
return Zm;
}
template <class T, class M>
inline
space_mult_list<T,M>
operator* (const space_mult_list<T,M>& Xm, const space_basic<T,M>& Y)
{
space_mult_list<T,M> Zm = Xm;
Zm.push_back (Y);
return Zm;
}
template <class T, class M>
inline
space_mult_list<T,M>&
operator*= (space_mult_list<T,M>& Xm, const space_basic<T,M>& Y)
{
Xm.push_back (Y);
return Xm;
}
template <class T, class M>
inline
space_mult_list<T,M>
operator* (const space_basic<T,M>& X, const space_mult_list<T,M>& Ym)
{
space_mult_list<T,M> Zm = Ym;
Zm.push_front (X);
return Zm;
}
template <class T, class M>
space_mult_list<T,M>
pow (const space_basic<T,M>& X, size_t n)
{
space_mult_list<T,M> Ym;
for (size_t i = 0; i < n; i++) {
Ym.push_back (X);
}
return Ym;
}
} // namespace rheolef
#endif // _RHEOLEF_SPACE_MULT_H
size_type
field::size_type size_type
Definition branch.cc:430
rheolef::smart_pointer
see the smart_pointer page for the full documentation
Definition smart_pointer.h:351
rheolef::space_basic
the finite element space
Definition space.h:382
rheolef::space_mult_list
Definition space_mult.h:54
rheolef::space_mult_list::const_iterator
rep::const_iterator const_iterator
Definition space_mult.h:61
rheolef::space_mult_list::begin
const_iterator begin() const
Definition space_mult.h:70
rheolef::space_mult_list::push_front
void push_front(const value_type &X) const
Definition space_mult.h:76
rheolef::space_mult_list::size
size_type size() const
Definition space_mult.h:69
rheolef::space_mult_list::push_back
void push_back(const value_type &X) const
Definition space_mult.h:75
rheolef::space_mult_list::rep
space_mult_list_rep< T, M > rep
Definition space_mult.h:57
rheolef::space_mult_list::base
smart_pointer< rep > base
Definition space_mult.h:58
rheolef::space_mult_list::size_type
rep::size_type size_type
Definition space_mult.h:60
rheolef::space_mult_list::end
const_iterator end() const
Definition space_mult.h:71
rheolef::space_mult_list::value_type
space_basic< T, M > value_type
Definition space_mult.h:59
rheolef::space_mult_list::space_mult_list
space_mult_list()
Definition space_mult.h:65
rheolef
This file is part of Rheolef.
Definition compiler_eigen.h:39
rheolef::pow
space_mult_list< T, M > pow(const space_basic< T, M > &X, size_t n)
Definition space_mult.h:120
rheolef::operator*=
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
rheolef::operator*
csr< T, sequential > operator*(const T &lambda, const csr< T, sequential > &a)
Definition csr.h:437
rheolef::space_mult_list_rep
Definition space_mult.h:29
rheolef::space_mult_list_rep::begin
const_iterator begin() const
Definition space_mult.h:41
rheolef::space_mult_list_rep::push_front
void push_front(const value_type &X) const
Definition space_mult.h:47
rheolef::space_mult_list_rep::size
size_type size() const
Definition space_mult.h:40
rheolef::space_mult_list_rep::push_back
void push_back(const value_type &X) const
Definition space_mult.h:46
rheolef::space_mult_list_rep::const_iterator
std::list< space_basic< T, M > >::const_iterator const_iterator
Definition space_mult.h:32
rheolef::space_mult_list_rep::size_type
std::list< space_basic< T, M > >::size_type size_type
Definition space_mult.h:31
rheolef::space_mult_list_rep::space_mult_list_rep
space_mult_list_rep()
Definition space_mult.h:36
rheolef::space_mult_list_rep::_l
std::list< space_basic< T, M > > _l
Definition space_mult.h:51
rheolef::space_mult_list_rep::end
const_iterator end() const
Definition space_mult.h:42
rheolef::space_mult_list_rep::value_type
space_basic< T, M > value_type
Definition space_mult.h:30