diff --git a/src/OpenFOAM/containers/Lists/SubList/SubList.H b/src/OpenFOAM/containers/Lists/SubList/SubList.H index b75745382..efaff633e 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& inline operator const Foam::List&() const; + //- Assignment of all entries to the given list + inline void operator=(const UList&); + //- 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 90b6ce6d2..2a7f5c19e 100644 --- a/src/OpenFOAM/containers/Lists/SubList/SubListI.H +++ b/src/OpenFOAM/containers/Lists/SubList/SubListI.H @@ -87,6 +87,13 @@ inline Foam::SubList::operator const Foam::List&() const } +template +inline void Foam::SubList::operator=(const UList& l) +{ + UList::assign(l); +} + + template inline void Foam::SubList::operator=(const T& t) { diff --git a/src/OpenFOAM/fields/Fields/Field/SubField.H b/src/OpenFOAM/fields/Fields/Field/SubField.H index ec3d15029..07ecd1443 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&); + //- Assignment via UList operator. Takes linear time. + inline void operator=(const Field&); + + //- Assignment via UList operator. Takes linear time. + template + inline void operator=(const VectorSpace&); + //- Allow cast to a const Field\& inline operator const Field&() const; }; diff --git a/src/OpenFOAM/fields/Fields/Field/SubFieldI.H b/src/OpenFOAM/fields/Fields/Field/SubFieldI.H index 796b2995c..8ba1ee892 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::SubField::T() const template inline void Foam::SubField::operator=(const SubField& rhs) { - UList::operator=(rhs); + SubList::operator=(rhs); +} + + +template +inline void Foam::SubField::operator=(const Field& rhs) +{ + SubList::operator=(rhs); + InfoInFunction << *this << endl; +} + + +template +template +inline void Foam::SubField::operator= +( + const VectorSpace& rhs +) +{ + forAll(rhs, i) + { + this->operator[](i) = rhs[i]; + } }