SubList, SubField: Added assignment to UList

This commit is contained in:
Henry Weller
2016-03-19 21:19:14 +00:00
parent e809171540
commit 9dc14af017
4 changed files with 41 additions and 1 deletions

View File

@ -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&);
};

View File

@ -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)
{

View File

@ -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;
};

View File

@ -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];
}
}