5#ifndef DUNE_COMMON_SCALARMATRIXVIEW_HH
6#define DUNE_COMMON_SCALARMATRIXVIEW_HH
40 class ScalarMatrixView :
41 public DenseMatrix<ScalarMatrixView<K>>
43 ScalarVectorView<K> data_;
47 friend class ScalarMatrixView;
54 constexpr static int blocklevel = 1;
63 constexpr static int rows = 1;
66 constexpr static int cols = 1;
71 constexpr ScalarMatrixView ()
76 ScalarMatrixView (K* p) :
81 ScalarMatrixView (
const ScalarMatrixView &other) :
87 ScalarMatrixView (ScalarMatrixView &&other) :
93 ScalarMatrixView& operator= (
const ScalarMatrixView& other)
100 ScalarMatrixView& operator= (
const ScalarMatrixView<KK>& other)
108 std::enable_if_t<std::is_convertible<T, K>::value,
int> = 0>
109 inline ScalarMatrixView& operator= (
const T& k)
116 static constexpr size_type mat_rows() {
return 1; }
117 static constexpr size_type mat_cols() {
return 1; }
119 row_reference mat_access ([[maybe_unused]] size_type i)
125 const_row_reference mat_access ([[maybe_unused]] size_type i)
const
134 std::ostream& operator<< (std::ostream& s,
const ScalarMatrixView<K>& a)
142 std::enable_if_t<IsNumber<T>::value,
int> = 0>
145 return ScalarMatrixView<T>{&t};
150 std::enable_if_t<IsNumber<T>::value,
int> = 0>
151 auto asMatrix(
const T& t)
153 return ScalarMatrixView<const T>{&t};
158 std::enable_if_t<not IsNumber<T>::value,
int> = 0>
166 std::enable_if_t<not IsNumber<T>::value,
int> = 0>
167 const T& asMatrix(
const T& t)
182 using derived_type = Impl::ScalarMatrixView<K>;
183 using row_type = Impl::ScalarVectorView<K>;
184 using row_reference = row_type&;
185 using const_row_reference =
const row_type&;
186 using value_type = std::remove_const_t<K>;
187 using size_type = std::size_t;
194 using type = FieldMatrix<std::remove_const_t<K>,1,1>;
Implements a matrix constructed from a given type representing a field and compile-time given number ...
Traits for type conversions and type information.
Documentation of the traits classes you need to write for each implementation of DenseVector or Dense...
Macro for wrapping boundary checks.
Implements a scalar vector view wrapper around an existing scalar.
Implements a matrix constructed from a given type representing a field and a compile-time given numbe...
#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
Traits::row_type row_type
Definition densematrix.hh:174
Traits::size_type size_type
Definition densematrix.hh:171
Traits::const_row_reference const_row_reference
Definition densematrix.hh:180
Traits::row_reference row_reference
Definition densematrix.hh:177
friend class DenseMatrix
Definition densematrix.hh:153
Definition matvectraits.hh:31
Type free of internal references that T can be converted to.
Definition typetraits.hh:509
T type
Definition typetraits.hh:509