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 >
94 std::array<K,SIZE> _data;
120 std::fill(_data.begin(),_data.end(),t);
130 assert(l.size() == dimension);
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");
161 for (size_type i = 0; i<SIZE; i++)
164 using Base::operator=;
167 static constexpr size_type
size () {
return SIZE; }
190 template<
class K,
int SIZE>
207 typedef K container_type;
215 class FieldVector<K, 1> :
238 constexpr FieldVector ()
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>
250 FieldVector (
const T& k) : _data(k) {}
257 assert(x.
size() == 1);
262 FieldVector (
const FieldVector &other )
263 : Base(), _data( other._data )
267 FieldVector (std::initializer_list<K>
const &l)
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>
281 inline FieldVector& operator= (
const T& k)
288 static constexpr size_type size () {
return 1; }
290 K & operator[](size_type i)
296 const K & operator[](size_type i)
const 306 operator K& () {
return _data; }
309 operator const K& ()
const {
return _data; }
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)
389 inline bool operator< (const FieldVector<K,1>& a,
const K b)
396 inline bool operator<= (const FieldVector<K,1>& a,
const K 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)
FieldTraits< K >::field_type field_type
Definition: fvector.hh:48
K value_type
Definition: fvector.hh:41
#define DUNE_UNUSED_PARAMETER(parm)
A macro to mark intentionally unused function parameters with.
Definition: unused.hh:25
T real_type
export the type representing the real type of the field
Definition: ftraits.hh:28
static constexpr size_type size()
Definition: fvector.hh:167
Base::size_type size_type
Definition: fvector.hh:103
const K & operator[](size_type i) const
Definition: fvector.hh:173
bigunsignedint< k > operator-(const bigunsignedint< k > &x, std::uintmax_t y)
Definition: bigunsignedint.hh:536
size_type size() const
size method
Definition: densevector.hh:297
FieldVector(const FieldVector< K1, SIZE1 > &x)
Constructor making vector with identical coordinates.
Definition: fvector.hh:158
bigunsignedint< k > operator/(const bigunsignedint< k > &x, std::uintmax_t y)
Definition: bigunsignedint.hh:550
std::array< K, SIZE > container_type
Definition: fvector.hh:40
Definition of the DUNE_UNUSED macro for the case that config.h is not available.
Macro for wrapping boundary checks.
container_type::size_type size_type
Definition: fvector.hh:42
Implements the dense vector interface, with an exchangeable storage class.
FieldVector(const K &t)
Constructor making vector with identical coordinates.
Definition: fvector.hh:118
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
FieldVector(std::initializer_list< K > const &l)
Construct from a std::initializer_list.
Definition: fvector.hh:128
FieldVector< K, SIZE > derived_type
Definition: fvector.hh:39
Stream & operator>>(Stream &stream, std::tuple< Ts... > &t)
Read a std::tuple.
Definition: streamoperators.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:675
TMP to check the size of a DenseVectors statically, if possible.
Definition: fvector.hh:61
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
#define DUNE_ASSERT_BOUNDS(cond)
If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do nothing.
Definition: boundschecking.hh:28
vector space out of a tensor product of fields.
Definition: densematrix.hh:40
A few common exception classes.
Dune namespace.
Definition: alignedallocator.hh:9
Definition: ftraits.hh:23
Interface for a class of dense vectors over a given field.
Definition: densevector.hh:19
Definition: matvectraits.hh:29
bigunsignedint< k > operator+(const bigunsignedint< k > &x, std::uintmax_t y)
Definition: bigunsignedint.hh:529
Traits::value_type value_type
export the type representing the field
Definition: densevector.hh:257
Traits::size_type size_type
The type used for the index access and size operation.
Definition: densevector.hh:266
Base::value_type value_type
Definition: fvector.hh:104
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
value_type & reference
The type used for references to the vector entry.
Definition: fvector.hh:107
T field_type
export the type representing the field
Definition: ftraits.hh:26
FieldTraits< K >::real_type real_type
Definition: fvector.hh:49
constexpr FieldVector()
Constructor making default-initialized vector.
Definition: fvector.hh:113
K & operator[](size_type i)
Definition: fvector.hh:169
const value_type & const_reference
The type used for const references to the vector entry.
Definition: fvector.hh:110
Iterator begin()
begin iterator
Definition: densevector.hh:308
bigunsignedint< k > operator*(const bigunsignedint< k > &x, std::uintmax_t y)
Definition: bigunsignedint.hh:543
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
Traits for type conversions and type information.
FieldVector(const FieldVector &x)
Copy constructor.
Definition: fvector.hh:124
Type traits to determine the type of reals (when working with complex numbers)