5#ifndef DUNE_COMMON_SCALARVECTORVIEW_HH
6#define DUNE_COMMON_SCALARVECTORVIEW_HH
36 class ScalarVectorView :
37 public DenseVector<ScalarVectorView<K>>
40 using Base = 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)
116 K& operator[] ([[maybe_unused]] size_type i)
123 const K& operator[] ([[maybe_unused]] size_type i)
const
134 struct DenseMatVecTraits< Impl::ScalarVectorView<K> >
136 using derived_type = Impl::ScalarVectorView<K>;
137 using value_type = std::remove_const_t<K>;
138 using size_type = std::size_t;
142 struct FieldTraits< Impl::ScalarVectorView<K> > :
public FieldTraits<std::remove_const_t<K>> {};
145 struct AutonomousValueType<Impl::ScalarVectorView<K>>
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)
size_type size() const
size method
Definition: densevector.hh:336
Traits::size_type size_type
The type used for the index access and size operation.
Definition: densevector.hh:259
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:43
#define DUNE_ASSERT_BOUNDS(cond)
If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do nothing.
Definition: boundschecking.hh:30
Documentation of the traits classes you need to write for each implementation of DenseVector or Dense...
Dune namespace.
Definition: alignedallocator.hh:13