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");
164 using Base::operator=;
189 template<
class K,
int SIZE>
190 inline std::istream &operator>> ( std::istream &in,
206 typedef K container_type;
207 typedef K value_type;
208 typedef size_t size_type;
214 class FieldVector<K, 1> :
215 public DenseVector< FieldVector<K,1> >
218 typedef DenseVector< FieldVector<K,1> > Base;
226 typedef typename Base::size_type size_type;
229 typedef K& reference;
232 typedef const K& const_reference;
237 constexpr FieldVector ()
243 typename EnableIf =
typename std::enable_if<
244 std::is_convertible<T, K>::value &&
245 ! std::is_same<K, DenseVector<typename FieldTraits<T>::field_type>
249 FieldVector (
const T& k) : _data(k) {}
253 FieldVector (
const DenseVector<C> & x)
255 static_assert(((bool)IsFieldVectorSizeCorrect<C,1>::value),
"FieldVectors do not match in dimension!");
256 assert(x.size() == 1);
261 FieldVector (
const FieldVector &other )
262 : Base(), _data( other._data )
266 FieldVector (std::initializer_list<K>
const &l)
268 assert(l.size() == 1);
274 typename EnableIf =
typename std::enable_if<
275 std::is_convertible<T, K>::value &&
276 ! std::is_same<K, DenseVector<typename FieldTraits<T>::field_type>
280 inline FieldVector& operator= (
const T& k)
287 constexpr size_type
size ()
const {
return 1; }
288 K & operator[](size_type i)
294 const K & operator[](size_type i)
const
304 operator K& () {
return _data; }
307 operator const K& ()
const {
return _data; }
315 inline bool operator> (
const FieldVector<K,1>& a,
const FieldVector<K,1>& b)
322 inline bool operator>= (
const FieldVector<K,1>& a,
const FieldVector<K,1>& b)
329 inline bool operator< (
const FieldVector<K,1>& a,
const FieldVector<K,1>& b)
336 inline bool operator<= (
const FieldVector<K,1>& a,
const FieldVector<K,1>& b)
345 inline FieldVector<K,1> operator+ (
const FieldVector<K,1>& a,
const K b)
352 inline FieldVector<K,1> operator- (
const FieldVector<K,1>& a,
const K b)
359 inline FieldVector<K,1> operator* (
const FieldVector<K,1>& a,
const K b)
366 inline FieldVector<K,1> operator/ (
const FieldVector<K,1>& a,
const K b)
373 inline bool operator> (
const FieldVector<K,1>& a,
const K b)
380 inline bool operator>= (
const FieldVector<K,1>& a,
const K b)
387 inline bool operator< (
const FieldVector<K,1>& a,
const K b)
394 inline bool operator<= (
const FieldVector<K,1>& a,
const K b)
401 inline bool operator== (
const FieldVector<K,1>& a,
const K b)
408 inline bool operator!= (
const FieldVector<K,1>& a,
const K b)
417 inline FieldVector<K,1> operator+ (
const K a,
const FieldVector<K,1>& b)
424 inline FieldVector<K,1> operator- (
const K a,
const FieldVector<K,1>& b)
431 inline FieldVector<K,1> operator* (
const K a,
const FieldVector<K,1>& b)
438 inline FieldVector<K,1> operator/ (
const K a,
const FieldVector<K,1>& b)
445 inline bool operator> (
const K a,
const FieldVector<K,1>& b)
452 inline bool operator>= (
const K a,
const FieldVector<K,1>& b)
459 inline bool operator< (
const K a,
const FieldVector<K,1>& b)
466 inline bool operator<= (
const K a,
const FieldVector<K,1>& b)
473 inline bool operator== (
const K a,
const FieldVector<K,1>& b)
480 inline bool operator!= (
const K a,
const FieldVector<K,1>& b)
#define DUNE_ASSERT_BOUNDS(cond)
Definition boundschecking.hh:20
Traits for type conversions and type information.
A few common exception classes.
Type traits to determine the type of reals (when working with complex numbers)
Definition of the DUNE_UNUSED macro for the case that config.h is not available.
#define DUNE_UNUSED_PARAMETER(parm)
A macro to mark intentionally unused function parameters with.
Definition unused.hh:18
Implements the dense vector interface, with an exchangeable storage class.
Dune namespace.
Definition alignment.hh:11
constexpr auto size(const Dune::FieldVector< T, i > *, const PriorityTag< 5 > &) -> decltype(std::integral_constant< std::size_t, i >())
Definition hybridutilities.hh:22
vector space out of a tensor product of fields.
Definition fvector.hh:93
constexpr FieldVector()
Constructor making default-initialized vector.
Definition fvector.hh:113
const value_type & const_reference
The type used for const references to the vector entry.
Definition fvector.hh:110
@ dimension
The size of this vector.
Definition fvector.hh:100
Base::size_type size_type
Definition fvector.hh:103
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
FieldVector(const K &t)
Constructor making vector with identical coordinates.
Definition fvector.hh:118
FieldVector(std::initializer_list< K > const &l)
Construct from a std::initializer_list.
Definition fvector.hh:128
FieldVector(const FieldVector &x)
Copy constructor.
Definition fvector.hh:124
constexpr size_type size() const
Definition fvector.hh:167
K & operator[](size_type i)
Definition fvector.hh:168
value_type & reference
The type used for references to the vector entry.
Definition fvector.hh:107
FieldVector(const FieldVector< K1, SIZE1 > &x)
Constructor making vector with identical coordinates.
Definition fvector.hh:158
Base::value_type value_type
Definition fvector.hh:104
const K & operator[](size_type i) const
Definition fvector.hh:172
Interface for a class of dense vectors over a given field.
Definition densevector.hh:235
Traits::value_type value_type
export the type representing the field
Definition densevector.hh:257
Iterator begin()
begin iterator
Definition densevector.hh:308
size_type size() const
size method
Definition densevector.hh:297
Traits::size_type size_type
The type used for the index access and size operation.
Definition densevector.hh:266
T field_type
export the type representing the field
Definition ftraits.hh:26
T real_type
export the type representing the real type of the field
Definition ftraits.hh:28
K value_type
Definition fvector.hh:41
std::array< K, SIZE > container_type
Definition fvector.hh:40
container_type::size_type size_type
Definition fvector.hh:42
FieldVector< K, SIZE > derived_type
Definition fvector.hh:39
FieldTraits< K >::real_type real_type
Definition fvector.hh:49
FieldTraits< K >::field_type field_type
Definition fvector.hh:48
TMP to check the size of a DenseVectors statically, if possible.
Definition fvector.hh:62
@ value
Definition fvector.hh:68
Definition matvectraits.hh:29