Go to the documentation of this file.
3 #ifndef DUNE_FVECTOR_HH
4 #define DUNE_FVECTOR_HH
13 #include <initializer_list>
35 template<
class K,
int SIZE >
class FieldVector;
36 template<
class K,
int SIZE >
42 typedef typename container_type::size_type
size_type;
45 template<
class K,
int SIZE >
60 template<
typename C,
int SIZE>
72 template<
typename T,
int SIZE>
78 template<
typename T,
int SIZE,
int SIZE1>
90 template<
class K,
int SIZE >
92 public DenseVector< FieldVector<K,SIZE> >
94 std::array<K,SIZE> _data;
95 typedef DenseVector< FieldVector<K,SIZE> > Base;
120 std::fill(_data.begin(),_data.end(),t);
131 std::copy_n(l.begin(), std::min(
static_cast<std::size_t
>(
dimension),
152 assert(x.
size() == SIZE);
153 std::copy_n(x.
begin(), std::min(
static_cast<std::size_t
>(SIZE),x.
size()), _data.begin());
157 template<
class K1,
int SIZE1>
160 static_assert(SIZE1 == SIZE,
"FieldVector in constructor has wrong size");
164 using Base::operator=;
190 template<
class K,
int SIZE>
207 typedef K container_type;
208 typedef K value_type;
209 typedef size_t size_type;
215 class FieldVector<K, 1> :
216 public DenseVector< FieldVector<K,1> >
219 typedef DenseVector< FieldVector<K,1> > Base;
244 typename EnableIf =
typename std::enable_if<
245 std::is_convertible<T, K>::value &&
246 ! std::is_same<K, DenseVector<typename FieldTraits<T>::field_type>
257 assert(x.size() == 1);
263 : Base(), _data( other._data )
269 assert(l.size() == 1);
275 typename EnableIf =
typename std::enable_if<
276 std::is_convertible<T, K>::value &&
277 ! std::is_same<K, DenseVector<typename FieldTraits<T>::field_type>
306 operator K& () {
return _data; }
309 operator const K& ()
const {
return _data; }
317 inline bool operator> (
const FieldVector<K,1>& a,
const FieldVector<K,1>& b)
324 inline bool operator>= (
const FieldVector<K,1>& a,
const FieldVector<K,1>& b)
331 inline bool operator< (
const FieldVector<K,1>& a,
const FieldVector<K,1>& b)
338 inline bool operator<= (
const FieldVector<K,1>& a,
const FieldVector<K,1>& b)
347 inline FieldVector<K,1>
operator+ (
const FieldVector<K,1>& a,
const K b)
354 inline FieldVector<K,1>
operator- (
const FieldVector<K,1>& a,
const K b)
361 inline FieldVector<K,1>
operator* (
const FieldVector<K,1>& a,
const K b)
368 inline FieldVector<K,1>
operator/ (
const FieldVector<K,1>& a,
const K b)
375 inline bool operator> (
const FieldVector<K,1>& a,
const K b)
382 inline bool operator>= (
const FieldVector<K,1>& a,
const K b)
389 inline bool operator< (
const FieldVector<K,1>& a,
const K b)
396 inline bool operator<= (
const FieldVector<K,1>& a,
const K b)
403 inline bool operator== (
const FieldVector<K,1>& a,
const K b)
410 inline bool operator!= (
const FieldVector<K,1>& a,
const K b)
419 inline FieldVector<K,1>
operator+ (
const K a,
const FieldVector<K,1>& b)
426 inline FieldVector<K,1>
operator- (
const K a,
const FieldVector<K,1>& b)
433 inline FieldVector<K,1>
operator* (
const K a,
const FieldVector<K,1>& b)
440 inline FieldVector<K,1>
operator/ (
const K a,
const FieldVector<K,1>& b)
447 inline bool operator> (
const K a,
const FieldVector<K,1>& b)
454 inline bool operator>= (
const K a,
const FieldVector<K,1>& b)
461 inline bool operator< (
const K a,
const FieldVector<K,1>& b)
468 inline bool operator<= (
const K a,
const FieldVector<K,1>& b)
475 inline bool operator== (
const K a,
const FieldVector<K,1>& b)
482 inline bool operator!= (
const K a,
const FieldVector<K,1>& b)
EnableIfInterOperable< T1, T2, bool >::type operator<(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
Comparison operator.
Definition: iteratorfacades.hh:629
std::array< K, SIZE > container_type
Definition: fvector.hh:40
#define DUNE_UNUSED_PARAMETER(parm)
A macro to mark intentionally unused function parameters with.
Definition: unused.hh:25
A few common exception classes.
EnableIfInterOperable< T1, T2, bool >::type operator>(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
Comparison operator.
Definition: iteratorfacades.hh:675
Dune namespace.
Definition: alignedallocator.hh:9
FieldVector(const DenseVector< C > &x, typename std::enable_if< IsFieldVectorSizeCorrect< C, SIZE >::value >::type *dummy=0)
Copy constructor from a second vector of possibly different type.
Definition: fvector.hh:148
FieldTraits< K >::real_type real_type
Definition: fvector.hh:49
bigunsignedint< k > operator-(const bigunsignedint< k > &x, std::uintmax_t y)
Definition: bigunsignedint.hh:536
Definition of the DUNE_UNUSED macro for the case that config.h is not available.
@ value
Definition: fvector.hh:68
bigunsignedint< k > operator*(const bigunsignedint< k > &x, std::uintmax_t y)
Definition: bigunsignedint.hh:543
Traits::value_type value_type
export the type representing the field
Definition: densevector.hh:257
bigunsignedint< k > operator+(const bigunsignedint< k > &x, std::uintmax_t y)
Definition: bigunsignedint.hh:529
Base::value_type value_type
Definition: fvector.hh:104
FieldVector(std::initializer_list< K > const &l)
Construct from a std::initializer_list.
Definition: fvector.hh:128
K value_type
Definition: fvector.hh:41
EnableIfInterOperable< T1, T2, bool >::type operator<=(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
Comparison operator.
Definition: iteratorfacades.hh:652
Base::size_type size_type
Definition: fvector.hh:103
EnableIfInterOperable< T1, T2, bool >::type operator==(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
Checks for equality.
Definition: iteratorfacades.hh:233
bigunsignedint< k > operator/(const bigunsignedint< k > &x, std::uintmax_t y)
Definition: bigunsignedint.hh:550
T real_type
export the type representing the real type of the field
Definition: ftraits.hh:28
FieldVector< K, SIZE > derived_type
Definition: fvector.hh:39
EnableIfInterOperable< T1, T2, bool >::type operator!=(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
Checks for inequality.
Definition: iteratorfacades.hh:255
FieldVector(const K &t)
Constructor making vector with identical coordinates.
Definition: fvector.hh:118
Iterator begin()
begin iterator
Definition: densevector.hh:308
constexpr FieldVector()
Constructor making default-initialized vector.
Definition: fvector.hh:113
@ dimension
The size of this vector.
Definition: fvector.hh:100
value_type & reference
The type used for references to the vector entry.
Definition: fvector.hh:107
Type traits to determine the type of reals (when working with complex numbers)
Macro for wrapping boundary checks.
const K & operator[](size_type i) const
Definition: fvector.hh:173
K & operator[](size_type i)
Definition: fvector.hh:169
static constexpr size_type size()
Definition: fvector.hh:167
Implements the dense vector interface, with an exchangeable storage class.
Definition: ftraits.hh:23
const typedef value_type & const_reference
The type used for const references to the vector entry.
Definition: fvector.hh:110
FieldVector(const FieldVector< K1, SIZE1 > &x)
Constructor making vector with identical coordinates.
Definition: fvector.hh:158
Stream & operator>>(Stream &stream, std::tuple< Ts... > &t)
Read a std::tuple.
Definition: streamoperators.hh:41
Interface for a class of dense vectors over a given field.
Definition: densevector.hh:19
T field_type
export the type representing the field
Definition: ftraits.hh:26
FieldTraits< K >::field_type field_type
Definition: fvector.hh:48
#define DUNE_ASSERT_BOUNDS(cond)
If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do nothing.
Definition: boundschecking.hh:28
Traits::size_type size_type
The type used for the index access and size operation.
Definition: densevector.hh:266
container_type::size_type size_type
Definition: fvector.hh:42
size_type size() const
size method
Definition: densevector.hh:297
vector space out of a tensor product of fields.
Definition: densematrix.hh:40
FieldVector(const FieldVector &x)
Copy constructor.
Definition: fvector.hh:124
Traits for type conversions and type information.
Definition: matvectraits.hh:29
EnableIfInterOperable< T1, T2, bool >::type operator>=(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
Comparison operator.
Definition: iteratorfacades.hh:697
TMP to check the size of a DenseVectors statically, if possible.
Definition: fvector.hh:61