3#ifndef DUNE_ISTL_MULTITYPEBLOCKVECTOR_HH
4#define DUNE_ISTL_MULTITYPEBLOCKVECTOR_HH
10#include <dune/common/dotproduct.hh>
11#include <dune/common/ftraits.hh>
12#include <dune/common/hybridutilities.hh>
18 template <
typename... Args >
19 class MultiTypeBlockVector;
37 template <
typename Arg0,
typename... Args>
52 template <
typename...
Args >
54 :
public std::tuple<Args...>
57 typedef std::tuple<
Args...> tupleType;
75 static constexpr std::size_t
size()
77 return sizeof...(Args);
85 return sizeof...(Args);
106 template< std::
size_t index >
107 typename std::tuple_element<index,tupleType>::type&
111 return std::get<index>(*
this);
119 template< std::
size_t index >
120 const typename std::tuple_element<index,tupleType>::type&
124 return std::get<index>(*
this);
131 Dune::Hybrid::forEach(*
this, [&](
auto&& entry) {
142 (*this)[i] +=
newv[i];
152 (*this)[i] -=
newv[i];
168 Dune::Hybrid::forEach(*
this, [&](
auto&& entry) {
174 Dune::Hybrid::forEach(*
this, [&](
auto&& entry) {
180 Dune::Hybrid::forEach(*
this, [&](
auto&& entry) {
188 return a + (*this)[i]*
newv[i];
195 return a + (*this)[i].dot(
newv[i]);
204 return a + entry.two_norm2();
226 forEach(*
this, [&](
auto&& entry) {
227 real_type
entryNorm = entry.infinity_norm();
234 forEach(*
this, [&](
auto&& entry) {
245 template<
typename Ta>
249 (*this)[i].axpy(a,
y[i]);
259 template <
typename... Args>
263 s <<
"\t(" << i <<
"):\n" << v[i] <<
"\n";
Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a generic way.
FieldTraits< Arg0 >::field_type field_type
Definition multitypeblockvector.hh:40
FieldTraits< Arg0 >::real_type real_type
Definition multitypeblockvector.hh:41
void operator=(const T &newval)
Assignment operator.
Definition multitypeblockvector.hh:130
FieldTraits< field_type >::real_type two_norm() const
Compute the Euclidean norm.
Definition multitypeblockvector.hh:210
static constexpr std::size_t size()
Return the number of vector entries.
Definition multitypeblockvector.hh:75
field_type dot(const type &newv) const
Definition multitypeblockvector.hh:192
void axpy(const Ta &a, const type &y)
Axpy operation on this vector (*this += a * y)
Definition multitypeblockvector.hh:246
std::tuple_element< index, tupleType >::type & operator[](const std::integral_constant< std::size_t, index > indexVariable)
Random-access operator.
Definition multitypeblockvector.hh:108
MultiTypeBlockVector< Args... > type
Definition multitypeblockvector.hh:63
void operator-=(const type &newv)
Definition multitypeblockvector.hh:149
int count()
Definition multitypeblockvector.hh:83
void operator*=(const int &w)
Definition multitypeblockvector.hh:167
field_type operator*(const type &newv) const
Definition multitypeblockvector.hh:185
void operator+=(const type &newv)
Definition multitypeblockvector.hh:139
FieldTraits< field_type >::real_type infinity_norm() const
Compute the maximum norm.
Definition multitypeblockvector.hh:214
double field_type
The type used for scalars.
Definition multitypeblockvector.hh:72
FieldTraits< field_type >::real_type two_norm2() const
Compute the squared Euclidean norm.
Definition multitypeblockvector.hh:201
Definition basearray.hh:19
std::ostream & operator<<(std::ostream &s, const BlockVector< K, A > &v)
Send BlockVector to an output stream.
Definition bvector.hh:632
Statistics about compression achieved in implicit mode.
Definition bcrsmatrix.hh:81
A Vector class to support different block types.
Definition multitypeblockvector.hh:55