1 #ifndef DUNE_FEM_VECTOR_INLINE_HH 2 #define DUNE_FEM_VECTOR_INLINE_HH 15 template<
class Traits >
17 inline typename Traits :: VectorType &
24 template<
class Traits >
25 inline typename Traits :: VectorType &
32 template<
class Traits >
33 inline typename Traits :: VectorType &
40 template<
class Traits >
41 inline const typename Traits :: FieldType &
44 CHECK_INTERFACE_IMPLEMENTATION( asImp()[ index ] );
45 return asImp()[ index ];
48 template<
class Traits >
49 inline typename Traits :: FieldType &
52 CHECK_INTERFACE_IMPLEMENTATION( asImp()[ index ] );
53 return asImp()[ index ];
56 template<
class Traits >
58 inline typename Traits :: VectorType &
61 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION( asImp().
operator+=( v.
asImp() ) );
65 template<
class Traits >
67 inline typename Traits :: VectorType &
70 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION( asImp().
operator-=( v.
asImp() ) );
74 template<
class Traits >
75 inline typename Traits :: VectorType &
78 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION( asImp().
operator*=( s ) );
82 template<
class Traits >
84 inline typename Traits :: VectorType &
88 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION( asImp().add( s, v.
asImp() ) );
92 template<
class Traits >
96 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION( asImp().assign( v.
asImp() ) );
99 template<
class Traits >
102 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION( asImp().assign( s ) );
105 template<
class Traits >
108 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION( asImp().clear() );
111 template<
class Traits >
112 inline typename Traits :: ConstIteratorType
115 CHECK_INTERFACE_IMPLEMENTATION( asImp().begin() );
116 return asImp().begin();
119 template<
class Traits >
120 inline typename Traits :: IteratorType
123 CHECK_INTERFACE_IMPLEMENTATION( asImp().begin() );
124 return asImp().begin();
127 template<
class Traits >
128 inline typename Traits :: ConstIteratorType
131 CHECK_INTERFACE_IMPLEMENTATION( asImp().end() );
132 return asImp().end();
135 template<
class Traits >
136 inline typename Traits :: IteratorType
139 CHECK_INTERFACE_IMPLEMENTATION( asImp().end() );
140 return asImp().end();
143 template<
class Traits >
146 CHECK_INTERFACE_IMPLEMENTATION( asImp().size() );
147 return asImp().size();
155 template<
class Traits1,
class Traits2 >
162 const unsigned int size = u.
size();
163 assert( size == v.
size() );
165 FieldType result = 0;
166 for(
unsigned int i = 0; i < size; ++i )
167 result += u[ i ] * v[ i ];
184 template<
class StreamTraits,
class VectorTraits >
186 operator<< ( OutStreamInterface< StreamTraits > &out,
192 const ConstIteratorType end = v.
end();
193 for( ConstIteratorType it = v.begin(); it != end; ++it )
208 template<
class StreamTraits,
class VectorTraits >
216 const IteratorType end = v.
end();
217 for( IteratorType it = v.
begin(); it != end; ++it )
231 template<
class Traits >
235 const unsigned int size = v.
size();
240 for(
unsigned int i = 1; i < size; ++i )
241 out <<
", " << v[ i ];
248 inline void match ( std :: istream &in,
char excepted )
253 in.clear( std :: ios_base :: badbit );
270 template<
class Traits >
274 const unsigned int size = v.
size();
279 for(
unsigned int i = 0; i < size; ++i )
281 match( in, expected );
296 #endif // #ifndef DUNE_FEM_VECTOR_INLINE_HH ConstIteratorType begin() const
obtain begin iterator
Definition: vector_inline.hh:113
unsigned int size() const
Returns the vector's size.
Definition: vector_inline.hh:144
void match(std::istream &in, char excepted)
Definition: vector_inline.hh:248
VectorType & operator-=(const VectorInterface< T > &v)
Subtract another vector from this one.
InStreamInterface< StreamTraits > & operator>>(InStreamInterface< StreamTraits > &in, DiscreteFunctionInterface< Impl > &df)
read a discrete function from an input stream
Definition: discretefunction_inline.hh:395
VectorType & operator=(const VectorInterface< T > &v)
Assign another vector to this one.
void clear()
initialize the vector to 0
Definition: vector_inline.hh:106
const FieldType & operator[](unsigned int index) const
Returns a const reference to the field indexed by index.
Definition: vector_inline.hh:42
ConstIteratorType end() const
obtain end iterator
Definition: vector_inline.hh:129
Definition: coordinate.hh:4
abstract interface for an input stream
Definition: streams.hh:177
void assign(const VectorInterface< T > &v)
copy another vector to this one
Definition: vector_inline.hh:94
Double operator*(const Double &a, const Double &b)
Definition: double.hh:495
Definition: vector.hh:142
An abstract vector interface.
Definition: vector.hh:37
VectorType & operator+=(const VectorInterface< T > &v)
Add another vector to this one.
VectorType & addScaled(const FieldType s, const VectorInterface< T > &v)
Add a multiple of another vector to this one.
OutStreamInterface< StreamTraits > & operator<<(OutStreamInterface< StreamTraits > &out, const DiscreteFunctionInterface< Impl > &df)
write a discrete function into an output stream
Definition: discretefunction_inline.hh:375
static const VectorInterfaceArrayTraits< VT >::ArrayType & asImp(const ThisType &other)
Definition: bartonnackmaninterface.hh:27
VectorType & operator*=(const FieldType s)
Multiply this vector by a scalar.
Definition: vector_inline.hh:76
abstract interface for an output stream
Definition: streams.hh:44
A vector using a DynamicArray as storage.
Definition: vector.hh:542
Traits::FieldType FieldType
field type for the vector
Definition: vector.hh:55