Commit 1f89e656 authored by Henry Weller's avatar Henry Weller
Browse files

SubList, SubField: Added assignment to UList

parent 62b569ee
......@@ -87,6 +87,9 @@ public:
//- Allow cast to a const List<T>&
inline operator const Foam::List<T>&() const;
//- Assignment of all entries to the given list
inline void operator=(const UList<T>&);
//- Assignment of all entries to the given value
inline void operator=(const T&);
};
......
......@@ -87,6 +87,13 @@ inline Foam::SubList<T>::operator const Foam::List<T>&() const
}
template<class T>
inline void Foam::SubList<T>::operator=(const UList<T>& l)
{
UList<T>::assign(l);
}
template<class T>
inline void Foam::SubList<T>::operator=(const T& t)
{
......
......@@ -41,6 +41,7 @@ SourceFiles
#include "SubList.H"
#include "Field.H"
#include "VectorSpace.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -112,6 +113,13 @@ public:
//- Assignment via UList operator. Takes linear time.
inline void operator=(const SubField<Type>&);
//- Assignment via UList operator. Takes linear time.
inline void operator=(const Field<Type>&);
//- Assignment via UList operator. Takes linear time.
template<class Form, direction Ncmpts>
inline void operator=(const VectorSpace<Form, Type, Ncmpts>&);
//- Allow cast to a const Field\<Type\>&
inline operator const Field<Type>&() const;
};
......
......@@ -111,7 +111,29 @@ inline Foam::tmp<Foam::Field<Type>> Foam::SubField<Type>::T() const
template<class Type>
inline void Foam::SubField<Type>::operator=(const SubField<Type>& rhs)
{
UList<Type>::operator=(rhs);
SubList<Type>::operator=(rhs);
}
template<class Type>
inline void Foam::SubField<Type>::operator=(const Field<Type>& rhs)
{
SubList<Type>::operator=(rhs);
InfoInFunction << *this << endl;
}
template<class Type>
template<class Form, Foam::direction Ncmpts>
inline void Foam::SubField<Type>::operator=
(
const VectorSpace<Form, Type, Ncmpts>& rhs
)
{
forAll(rhs, i)
{
this->operator[](i) = rhs[i];
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment