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; }
138 std::ostream&
operator<< (std::ostream& s,
const ScalarMatrixView<K>& a)
146 std::enable_if_t<IsNumber<T>::value,
int> = 0>
149 return ScalarMatrixView<T>{&t};
154 std::enable_if_t<IsNumber<T>::value,
int> = 0>
155 auto asMatrix(
const T& t)
157 return ScalarMatrixView<const T>{&t};
162 std::enable_if_t<not IsNumber<T>::value,
int> = 0>
170 std::enable_if_t<not IsNumber<T>::value,
int> = 0>
171 const T& asMatrix(
const T& t)
181 struct FieldTraits<Impl::ScalarMatrixView<K>> :
public FieldTraits<std::remove_const_t<K>> {};
184 struct DenseMatVecTraits<Impl::ScalarMatrixView<K>>
186 using derived_type = Impl::ScalarMatrixView<K>;
187 using row_type = Impl::ScalarVectorView<K>;
188 using row_reference = row_type&;
189 using const_row_reference =
const row_type&;
190 using value_type = std::remove_const_t<K>;
191 using size_type = std::size_t;
196 struct AutonomousValueType<Impl::ScalarMatrixView<K>>
198 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
std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)
Definition: bigunsignedint.hh:273
Dune namespace.
Definition: alignedallocator.hh:11
constexpr size_type cols() const
number of columns
Definition: densematrix.hh:743
constexpr size_type rows() const
number of rows
Definition: densematrix.hh:737
@ blocklevel
The number of block levels we contain. This is 1.
Definition: densematrix.hh:205
Traits::row_type row_type
The type used to represent a row (must fulfill the Dune::DenseVector interface)
Definition: densematrix.hh:194
Traits::size_type size_type
The type used for the index access and size operation.
Definition: densematrix.hh:191
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:200
Traits::row_reference row_reference
The type used to represent a reference to a row (usually row_type &)
Definition: densematrix.hh:197
T type
Definition: typetraits.hh:501