5#ifndef DUNE_COMMON_SCALARVECTORVIEW_HH
6#define DUNE_COMMON_SCALARVECTORVIEW_HH
36 class ScalarVectorView :
37 public DenseVector<ScalarVectorView<K>>
43 friend class ScalarVectorView;
47 constexpr static int dimension = 1;
53 using reference = std::decay_t<K>&;
56 using const_reference =
const K&;
61 constexpr ScalarVectorView ()
66 ScalarVectorView (K* p) :
71 ScalarVectorView (
const ScalarVectorView &other) :
77 ScalarVectorView (ScalarVectorView &&other) :
79 dataP_( other.dataP_ )
83 ScalarVectorView& operator= (
const ScalarVectorView& other)
87 *dataP_ = *(other.dataP_);
92 ScalarVectorView& operator= (
const ScalarVectorView<KK>& other)
96 *dataP_ = *(other.dataP_);
102 std::enable_if_t<std::is_convertible<T, K>::value,
int> = 0>
103 inline ScalarVectorView& operator= (
const T& k)
110 static constexpr size_type
size ()
116 K& operator[] ([[maybe_unused]] size_type i)
123 const K& operator[] ([[maybe_unused]] size_type i)
const
136 using derived_type = Impl::ScalarVectorView<K>;
137 using value_type = std::remove_const_t<K>;
138 using size_type = std::size_t;
147 using type = FieldVector<std::remove_const_t<K>,1>;
164 inline std::istream &operator>> ( std::istream &in, ScalarVectorView<K> &v )
175 std::enable_if_t<IsNumber<T>::value,
int> = 0>
178 return ScalarVectorView<T>{&t};
183 std::enable_if_t<IsNumber<T>::value,
int> = 0>
184 auto asVector(
const T& t)
186 return ScalarVectorView<const T>{&t};
191 std::enable_if_t<not IsNumber<T>::value,
int> = 0>
199 std::enable_if_t<not IsNumber<T>::value,
int> = 0>
200 const T& asVector(
const T& t)
Documentation of the traits classes you need to write for each implementation of DenseVector or Dense...
Traits for type conversions and type information.
Implements the dense vector interface, with an exchangeable storage class.
Implements a vector constructed from a given type representing a field and a compile-time given size.
#define DUNE_ASSERT_BOUNDS(cond)
If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do nothing.
Definition boundschecking.hh:30
Dune namespace.
Definition alignedallocator.hh:13
size_type size() const
Definition densevector.hh:336
Traits::size_type size_type
Definition densevector.hh:259
constexpr DenseVector()=default
Definition matvectraits.hh:31
Type free of internal references that T can be converted to.
Definition typetraits.hh:531
T type
Definition typetraits.hh:531