Skip to content
Snippets Groups Projects
Commit 0b717dcc authored by Christian Engwer's avatar Christian Engwer
Browse files

specilization for FieldVector<K,1>

[[Imported from SVN: r3648]]
parent 0716cac6
No related branches found
No related tags found
No related merge requests found
......@@ -35,11 +35,15 @@ struct Indent
}
void operator ++ ()
{
#ifdef DUNE_VVERBOSE
i += 3;
#endif
};
void operator -- ()
{
#ifdef DUNE_VVERBOSE
i -= 3;
#endif
};
};
......@@ -47,7 +51,9 @@ extern Indent INDENT;
inline std::ostream & operator << (std::ostream & s, const Indent & i)
{
#ifdef DUNE_VVERBOSE
for (int n = 0; n < i.i; n++) s << " ";
#endif
return s;
}
......@@ -174,6 +180,18 @@ namespace Dune {
enum { value=true };
};
template <class K>
struct isEndOfExpressionRecusion< FieldVector<K,1> >
{
enum { value=true };
};
template <class K>
struct isEndOfExpressionRecusion< std::complex<K> >
{
enum { value=true };
};
template <>
struct isEndOfExpressionRecusion<int>
{
......
......@@ -47,6 +47,14 @@ operator OP (const Expression<A> & a, const Vector<B> & b)
return Expression< ExpressionOpExpression<A, ConstRef<B> > >(ex);
}
// Expression op FieldVector<K,1>
template <class A, class K>
K operator OP (const Expression<A> & a,
const Expression< ConstRef< FieldVector<K,1> > >& b)
{
return a OP b[0];
}
// Vector op Expression
template <class A, class B>
Expression< ExpressionOpExpression< ConstRef<A>, B> >
......@@ -57,6 +65,14 @@ operator OP (const Vector<A> & a, const Expression<B> & b)
return Expression< ExpressionOpExpression<ConstRef<A>, B> >(ex);
}
// FieldVector<K,1> op Expression
template <class K, class B>
K operator OP (const Expression< ConstRef< FieldVector<K,1> > > & a,
const Expression<B> & b)
{
return a[0] OP b;
}
// Vector op Vector
template <class V>
Expression< ExpressionOpExpression< ConstRef<V>, ConstRef<V> > >
......@@ -68,6 +84,14 @@ operator OP (const Vector<V> & a, const Vector<V> & b)
return Expression< ExpressionOpExpression< ConstRef<V>, ConstRef<V> > >(ex);
}
// FieldVector<K,1> op FieldVector<K,1>
template <class K>
K operator OP (const Expression< ConstRef< FieldVector<K,1> > > & a,
const Expression< ConstRef< FieldVector<K,1> > > & b)
{
return a[0] OP b[0];
}
// TypeTraits
template<class A, class B>
struct BlockExpression< ExpressionOpExpression<A,B> >
......
......@@ -26,6 +26,14 @@ private:
const field_type lambda;
};
// Scalar op FieldVector<K,1>
template <class K>
K operator OP (const Expression< ConstRef< FieldVector<K,1> > > & a,
const K & lambda)
{
return a[0] OP lambda;
}
// Vector op Scalar
template <class A>
Expression< ExpressionOpScalar<ConstRef<A> > >
......@@ -108,6 +116,14 @@ private:
const field_type lambda;
};
// Scalar op FieldVector<K,1>
template <class K>
K operator OP (const K & lambda,
const Expression< ConstRef< FieldVector<K,1> > > & a)
{
return lambda OP a[0];
}
// Scalar op Vector
template <class A>
Expression< ScalarOpExpression<ConstRef<A> > >
......@@ -128,13 +144,6 @@ operator OP (const typename FieldType<A>::type & lambda, const Expression<A> & a
}
// TypeTraits
/*
template<class K, int N>
struct BlockExpression< ExprTmpl::ScalarOpExpression< ExprTmpl::ConstRef< FieldVector<K,N> > > >
{
typedef K type;
};
*/
template <class Ex>
struct BlockExpression< ExprTmpl::ScalarOpExpression<Ex> >
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment