diff --git a/src/OpenFOAM/containers/Lists/SubList/SubList.H b/src/OpenFOAM/containers/Lists/SubList/SubList.H index b75745382ae4311511302528653550fc7f234cd5..efaff633e7beb31ac58f39e101698da57f417d41 100644 --- a/src/OpenFOAM/containers/Lists/SubList/SubList.H +++ b/src/OpenFOAM/containers/Lists/SubList/SubList.H @@ -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&); }; diff --git a/src/OpenFOAM/containers/Lists/SubList/SubListI.H b/src/OpenFOAM/containers/Lists/SubList/SubListI.H index 90b6ce6d288b3284669f841711ef16cfc5fdd758..2a7f5c19ef09803da4456aecc0ec178d62deca07 100644 --- a/src/OpenFOAM/containers/Lists/SubList/SubListI.H +++ b/src/OpenFOAM/containers/Lists/SubList/SubListI.H @@ -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) { diff --git a/src/OpenFOAM/fields/Fields/Field/SubField.H b/src/OpenFOAM/fields/Fields/Field/SubField.H index ec3d1502953e76df15899dad93642a1d17e502fc..07ecd1443fc936d10ba1815ed075def3b580ee89 100644 --- a/src/OpenFOAM/fields/Fields/Field/SubField.H +++ b/src/OpenFOAM/fields/Fields/Field/SubField.H @@ -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; }; diff --git a/src/OpenFOAM/fields/Fields/Field/SubFieldI.H b/src/OpenFOAM/fields/Fields/Field/SubFieldI.H index 796b2995c2260540d4c0050409aa57a1c76d7c05..8ba1ee8929198fa7ecc24c6a0904b4ac5e94b59a 100644 --- a/src/OpenFOAM/fields/Fields/Field/SubFieldI.H +++ b/src/OpenFOAM/fields/Fields/Field/SubFieldI.H @@ -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]; + } }