4 #ifndef DUNE_FVECTOR_HH
5 #define DUNE_FVECTOR_HH
34 template<
class K,
int SIZE >
class FieldVector;
35 template<
class K,
int SIZE >
44 template<
class K,
int SIZE >
59 template<
typename C,
int SIZE>
71 template<
typename T,
int SIZE>
77 template<
typename T,
int SIZE,
int SIZE1>
89 template<
class K,
int SIZE >
91 public DenseVector< FieldVector<K,SIZE> >
94 typedef DenseVector< FieldVector<K,SIZE> > Base;
109 #if HAVE_INITIALIZER_LIST
118 std::fill(_data.
begin(),_data.
end(),K());
148 assert(x.
size() == SIZE);
154 template<
class K1,
int SIZE1>
161 using Base::operator=;
170 void fill(
const K&
t)
172 for (
int i=0; i<SIZE; i++) _data[i]=t;
187 template<
class K,
int SIZE>
204 typedef K container_type;
205 typedef K value_type;
206 typedef size_t size_type;
212 class FieldVector<K, 1> :
213 public DenseVector< FieldVector<K,1> >
216 typedef DenseVector< FieldVector<K,1> > Base;
240 dune_static_assert(((
bool)IsFieldVectorSizeCorrect<C,1>::value),
"FieldVectors do not match in dimension!");
241 assert(x.size() == 1);
247 : _data( other._data )
275 operator K () {
return _data; }
278 operator K ()
const {
return _data; }
288 inline FieldVector<K,1>
operator+ (
const FieldVector<K,1>& a,
const K b)
295 inline FieldVector<K,1>
operator- (
const FieldVector<K,1>& a,
const K b)
302 inline FieldVector<K,1>
operator* (
const FieldVector<K,1>& a,
const K b)
309 inline FieldVector<K,1>
operator/ (
const FieldVector<K,1>& a,
const K b)
316 inline bool operator> (
const FieldVector<K,1>& a,
const K b)
323 inline bool operator>= (
const FieldVector<K,1>& a,
const K b)
330 inline bool operator< (const FieldVector<K,1>& a,
const K b)
337 inline bool operator<= (const FieldVector<K,1>& a,
const K b)
344 inline bool operator== (
const FieldVector<K,1>& a,
const K b)
351 inline bool operator!= (
const FieldVector<K,1>& a,
const K b)
360 inline FieldVector<K,1>
operator+ (
const K a,
const FieldVector<K,1>& b)
367 inline FieldVector<K,1>
operator- (
const K a,
const FieldVector<K,1>& b)
374 inline FieldVector<K,1>
operator* (
const K a,
const FieldVector<K,1>& b)
381 inline FieldVector<K,1>
operator/ (
const K a,
const FieldVector<K,1>& b)
388 inline bool operator> (
const K a,
const FieldVector<K,1>& b)
395 inline bool operator>= (
const K a,
const FieldVector<K,1>& b)
402 inline bool operator< (const K a, const FieldVector<K,1>& b)
409 inline bool operator<= (const K a, const FieldVector<K,1>& b)
416 inline bool operator== (
const K a,
const FieldVector<K,1>& b)
423 inline bool operator!= (
const K a,
const FieldVector<K,1>& b)
bigunsignedint< k > operator+(const bigunsignedint< k > &x, std::size_t y)
Definition: bigunsignedint.hh:485
std::istream & operator>>(std::istream &is, Pair< T1, T2 > &pair)
Read a pair or tuple.
Definition: tuples.hh:949
bool operator>(const array< T, N > &a, const array< T, N > &b)
Definition: array.hh:139
Definition: ftraits.hh:23
DUNE_CONSTEXPR size_type size() const
Definition: fvector.hh:163
A few common exception classes.
FieldVector(const FieldVector< K1, SIZE1 > &x)
Constructor making vector with identical coordinates.
Definition: fvector.hh:155
derived_type & operator=(const value_type &k)
Assignment operator for scalar.
Definition: densevector.hh:264
Base::value_type value_type
Definition: fvector.hh:103
Dune::array< K, SIZE > container_type
Definition: fvector.hh:39
#define DUNE_UNUSED_PARAMETER(parm)
A macro to mark intentional unused function parameters with.
Definition: unused.hh:18
T t
Definition: alignment.hh:38
Traits::size_type size_type
The type used for the index access and size operation.
Definition: densevector.hh:254
iterator begin()
Definition: array.hh:104
Definition: fvector.hh:67
FieldVector< K, SIZE > derived_type
Definition: fvector.hh:38
FieldVector(const DenseVector< C > &x, typename Dune::enable_if< IsFieldVectorSizeCorrect< C, SIZE >::value >::type *dummy=0)
Copy constructor from a second vector of possibly different type.
Definition: fvector.hh:144
Traits::value_type value_type
export the type representing the field
Definition: densevector.hh:245
#define dune_static_assert(COND, MSG)
Helper template so that compilation fails if condition is not true.
Definition: static_assert.hh:79
K & vec_access(size_type i)
Definition: fvector.hh:167
container_type::size_type size_type
Definition: fvector.hh:41
bigunsignedint< k > operator-(const bigunsignedint< k > &x, std::size_t y)
Definition: bigunsignedint.hh:492
DUNE_CONSTEXPR size_type vec_size() const
Definition: fvector.hh:166
#define DUNE_CONSTEXPR
Definition: constexpr.hh:7
FieldVector(const K &t)
Constructor making vector with identical coordinates.
Definition: fvector.hh:123
TMP to check the size of a DenseVectors statically, if possible.
Definition: fvector.hh:60
Enable typedef if condition is met.
Definition: typetraits.hh:328
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:253
size_type size() const
size method
Definition: densevector.hh:285
Base::size_type size_type
Definition: fvector.hh:102
Traits for type conversions and type information.
Fallback implementation of the C++0x static_assert feature.
iterator end()
Definition: array.hh:114
vector space out of a tensor product of fields.
Definition: densematrix.hh:38
Interface for a class of dense vectors over a given field.
Definition: densevector.hh:17
bigunsignedint< k > operator*(const bigunsignedint< k > &x, std::size_t y)
Definition: bigunsignedint.hh:499
FieldTraits< K >::real_type real_type
Definition: fvector.hh:48
bigunsignedint< k > operator/(const bigunsignedint< k > &x, std::size_t y)
Definition: bigunsignedint.hh:506
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:231
Definition of the DUNE_UNUSED macro for the case that config.h is not available.
T real_type
export the type representing the real type of the field
Definition: ftraits.hh:28
Implements the dense vector interface, with an exchangeable storage class.
std::size_t size_type
Type used for array indices.
Definition: array.hh:59
T field_type
export the type representing the field
Definition: ftraits.hh:26
The size of this vector.
Definition: fvector.hh:99
FieldTraits< K >::field_type field_type
Definition: fvector.hh:47
FieldVector(const FieldVector &x)
Constructor making vector with identical coordinates.
Definition: fvector.hh:129
bool operator>=(const array< T, N > &a, const array< T, N > &b)
Definition: array.hh:151
FieldVector()
Constructor making default-initialized vector.
Definition: fvector.hh:106
Definition: matvectraits.hh:30
Fallback implementation of the std::array class (a static array)
const K & vec_access(size_type i) const
Definition: fvector.hh:168
K value_type
Definition: fvector.hh:40