3 #ifndef DUNE_COMMON_SCALARMATRIXVIEW_HH
4 #define DUNE_COMMON_SCALARMATRIXVIEW_HH
38 class ScalarMatrixView :
39 public DenseMatrix<ScalarMatrixView<K>>
41 ScalarVectorView<K> data_;
42 using Base = DenseMatrix<ScalarMatrixView<K>>;
45 friend class ScalarMatrixView;
75 constexpr ScalarMatrixView ()
80 ScalarMatrixView (K* p) :
85 ScalarMatrixView (
const ScalarMatrixView &other) :
91 ScalarMatrixView (ScalarMatrixView &&other) :
97 ScalarMatrixView& operator= (
const ScalarMatrixView& other)
104 ScalarMatrixView& operator= (
const ScalarMatrixView<KK>& other)
112 std::enable_if_t<std::is_convertible<T, K>::value,
int> = 0>
113 inline ScalarMatrixView& operator= (
const T& k)
120 static constexpr
size_type mat_rows() {
return 1; }
121 static constexpr
size_type mat_cols() {
return 1; }
140 std::ostream&
operator<< (std::ostream& s,
const ScalarMatrixView<K>& a)
148 std::enable_if_t<IsNumber<T>::value,
int> = 0>
151 return ScalarMatrixView<T>{&t};
156 std::enable_if_t<IsNumber<T>::value,
int> = 0>
157 auto asMatrix(
const T& t)
159 return ScalarMatrixView<const T>{&t};
164 std::enable_if_t<not IsNumber<T>::value,
int> = 0>
172 std::enable_if_t<not IsNumber<T>::value,
int> = 0>
173 const T& asMatrix(
const T& t)
183 struct FieldTraits<Impl::ScalarMatrixView<K>> :
public FieldTraits<std::remove_const_t<K>> {};
186 struct DenseMatVecTraits<Impl::ScalarMatrixView<K>>
188 using derived_type = Impl::ScalarMatrixView<K>;
189 using row_type = Impl::ScalarVectorView<K>;
190 using row_reference = row_type&;
191 using const_row_reference =
const row_type&;
192 using value_type = std::remove_const_t<K>;
193 using size_type = std::size_t;
198 struct AutonomousValueType<Impl::ScalarMatrixView<K>>
200 using type = FieldMatrix<std::remove_const_t<K>,1,1>;
Macro for wrapping boundary checks.
Implements a matrix constructed from a given type representing a field and a compile-time given numbe...
Implements a matrix constructed from a given type representing a field and compile-time given number ...
Documentation of the traits classes you need to write for each implementation of DenseVector or Dense...
Implements a scalar vector view wrapper around an existing scalar.
Traits for type conversions and type information.
#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
std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)
Definition: bigunsignedint.hh:273
Dune namespace.
Definition: alignedallocator.hh:14
size_type cols() const
number of columns
Definition: densematrix.hh:742
size_type rows() const
number of rows
Definition: densematrix.hh:736
@ blocklevel
The number of block levels we contain. This is 1.
Definition: densematrix.hh:204
Traits::row_type row_type
The type used to represent a row (must fulfill the Dune::DenseVector interface)
Definition: densematrix.hh:193
Traits::size_type size_type
The type used for the index access and size operation.
Definition: densematrix.hh:190
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:199
Traits::row_reference row_reference
The type used to represent a reference to a row (usually row_type &)
Definition: densematrix.hh:196
T type
Definition: typetraits.hh:582