24#ifndef DUMUX_COMMON_PARTIAL_HH
25#define DUMUX_COMMON_PARTIAL_HH
30#include <dune/istl/multitypeblockvector.hh>
31#include <dune/common/version.hh>
35#if DUNE_VERSION_GT_REV(DUNE_ISTL,2,6,0)
41template<
class ...Args, std::size_t ...i>
42auto partial(Dune::MultiTypeBlockVector<Args...>& v, Dune::index_constant<i>... indices)
44 return Dune::MultiTypeBlockVector<std::add_lvalue_reference_t<std::decay_t<std::tuple_element_t<indices, std::tuple<Args...>>>>...>(v[indices]...);
50template<
typename ... Args>
53 typedef std::tuple<Args...> ParentType;
55 using ParentType::ParentType;
62 template< std::
size_t index >
63 typename std::tuple_element<index, ParentType>::type&
64 operator[] (
const std::integral_constant< std::size_t, index > indexVariable )
66 DUNE_UNUSED_PARAMETER(indexVariable);
67 return std::get<index>(*
this);
72 template< std::
size_t index >
73 const typename std::tuple_element<index, ParentType>::type&
74 operator[] (
const std::integral_constant< std::size_t, index > indexVariable )
const
76 DUNE_UNUSED_PARAMETER(indexVariable);
77 return std::get<index>(*
this);
81template<
class T>
struct isMultiTypeBlockVector;
91template<
class ...Args, std::size_t ...i>
92auto partial(Dune::MultiTypeBlockVector<Args...>& v, Dune::index_constant<i>... indices)
94 return MultiTypeBlockVectorProxy<std::add_lvalue_reference_t<std::decay_t<std::tuple_element_t<indices, std::tuple<Args...>>>>...>(v[indices]...);
104template<
class ...Args, std::size_t ...i>
105auto partial(std::tuple<Args...>& v, Dune::index_constant<i>... indices)
107 return std::tuple<std::add_lvalue_reference_t<std::decay_t<std::tuple_element_t<indices, std::tuple<Args...>>>>...>(std::get<indices>(v)...);
115template<
class T, std::size_t ...i>
116auto partial(T& t, std::tuple<Dune::index_constant<i>...> indices)
118 return partial(t, Dune::index_constant<i>{}...);
auto partial(Dune::MultiTypeBlockVector< Args... > &v, Dune::index_constant< i >... indices)
a function to get a MultiTypeBlockVector with references to some entries of another MultiTypeBlockVec...
Definition: partial.hh:92
Definition: partial.hh:52
std::tuple_element< index, ParentType >::type & operator[](const std::integral_constant< std::size_t, index > indexVariable)
Random-access operator.
Definition: partial.hh:64
double field_type
Definition: partial.hh:58
MultiTypeBlockVectorProxy< Args... > type
Definition: partial.hh:57
Helper type to determine whether a given type is a Dune::MultiTypeBlockVector.
Definition: vector.hh:34