5#ifndef DUNE_COMMON_SCALARMATRIXVIEW_HH
6#define DUNE_COMMON_SCALARMATRIXVIEW_HH
40 class ScalarMatrixView :
41 public DenseMatrix<ScalarMatrixView<K>>
43 ScalarVectorView<K> data_;
44 using Base = DenseMatrix<ScalarMatrixView<K>>;
47 friend class ScalarMatrixView;
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; }
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)
177 struct FieldTraits<Impl::ScalarMatrixView<K>> :
public FieldTraits<std::remove_const_t<K>> {};
180 struct DenseMatVecTraits<Impl::ScalarMatrixView<K>>
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;
192 struct AutonomousValueType<Impl::ScalarMatrixView<K>>
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.
Macro for wrapping boundary checks.
Documentation of the traits classes you need to write for each implementation of DenseVector or Dense...
Implements a matrix constructed from a given type representing a field and a compile-time given numbe...
Implements a scalar vector view wrapper around an existing scalar.
#define DUNE_ASSERT_BOUNDS(cond)
If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do nothing.
Definition: boundschecking.hh:30
std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)
Definition: bigunsignedint.hh:278
Dune namespace.
Definition: alignedallocator.hh:13
constexpr size_type cols() const
number of columns
Definition: densematrix.hh:715
constexpr size_type rows() const
number of rows
Definition: densematrix.hh:709
static constexpr int blocklevel
The number of block levels we contain. This is the leaf, that is, 1.
Definition: densematrix.hh:178
Traits::row_type row_type
The type used to represent a row (must fulfill the Dune::DenseVector interface)
Definition: densematrix.hh:169
Traits::size_type size_type
The type used for the index access and size operation.
Definition: densematrix.hh:166
Traits::const_row_reference const_row_reference
The type used to represent a reference to a constant row (usually const row_type &)
Definition: densematrix.hh:175
Traits::row_reference row_reference
The type used to represent a reference to a row (usually row_type &)
Definition: densematrix.hh:172
T type
Definition: typetraits.hh:501