3#ifndef DUNE_COMMON_SCALARVECTORVIEW_HH
4#define DUNE_COMMON_SCALARVECTORVIEW_HH
34 class ScalarVectorView :
35 public DenseVector<ScalarVectorView<K>>
38 using Base = DenseVector<ScalarVectorView<K>>;
41 friend class ScalarVectorView;
54 using reference = std::decay_t<K>&;
57 using const_reference =
const K&;
62 constexpr ScalarVectorView ()
67 ScalarVectorView (K* p) :
72 ScalarVectorView (
const ScalarVectorView &other) :
78 ScalarVectorView (ScalarVectorView &&other) :
80 dataP_( other.dataP_ )
84 ScalarVectorView& operator= (
const ScalarVectorView& other)
88 *dataP_ = *(other.dataP_);
93 ScalarVectorView& operator= (
const ScalarVectorView<KK>& other)
97 *dataP_ = *(other.dataP_);
103 std::enable_if_t<std::is_convertible<T, K>::value,
int> = 0>
104 inline ScalarVectorView& operator= (
const T& k)
117 K& operator[] (size_type i)
125 const K& operator[] (size_type i)
const
137 struct DenseMatVecTraits< Impl::ScalarVectorView<K> >
139 using derived_type = Impl::ScalarVectorView<K>;
140 using value_type = std::remove_const_t<K>;
141 using size_type = std::size_t;
145 struct FieldTraits< Impl::ScalarVectorView<K> > :
public FieldTraits<std::remove_const_t<K>> {};
148 struct AutonomousValueType<Impl::ScalarVectorView<K>>
150 using type = FieldVector<std::remove_const_t<K>,1>;
167 inline std::istream &
operator>> ( std::istream &in, ScalarVectorView<K> &v )
178 std::enable_if_t<IsNumber<T>::value,
int> = 0>
181 return ScalarVectorView<T>{&t};
186 std::enable_if_t<IsNumber<T>::value,
int> = 0>
187 auto asVector(
const T& t)
189 return ScalarVectorView<const T>{&t};
194 std::enable_if_t<not IsNumber<T>::value,
int> = 0>
202 std::enable_if_t<not IsNumber<T>::value,
int> = 0>
203 const T& asVector(
const T& t)
size_type size() const
size method
Definition: densevector.hh:337
Traits::size_type size_type
The type used for the index access and size operation.
Definition: densevector.hh:257
Implements the dense vector interface, with an exchangeable storage class.
Traits for type conversions and type information.
Implements a vector constructed from a given type representing a field and a compile-time given size.
Stream & operator>>(Stream &stream, std::tuple< Ts... > &t)
Read a std::tuple.
Definition: streamoperators.hh:41
#define DUNE_ASSERT_BOUNDS(cond)
If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do nothing.
Definition: boundschecking.hh:28
#define DUNE_UNUSED_PARAMETER(parm)
A macro to mark intentionally unused function parameters with.
Definition: unused.hh:25
Documentation of the traits classes you need to write for each implementation of DenseVector or Dense...
Dune namespace.
Definition: alignedallocator.hh:14