diff --git a/applications/test/IndirectList/IndirectListTest.C b/applications/test/IndirectList/IndirectListTest.C index 44589f57c0791819534d2da3e48fae156faeec86..5fe724cc1b128870e00b08d9387b8662ff254d7f 100644 --- a/applications/test/IndirectList/IndirectListTest.C +++ b/applications/test/IndirectList/IndirectListTest.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -30,6 +30,15 @@ Description using namespace Foam; +template<class ListType> +void printInfo(const ListType& lst) +{ + Info<< "addr: " << lst.addressing() << nl + << "list: " << lst << nl + << endl; +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Main program: @@ -42,8 +51,7 @@ int main(int argc, char *argv[]) completeList[i] = 0.1*i; } - Info<< "raw : " << completeList << nl - << endl; + Info<< "raw : " << completeList << nl << endl; List<label> addresses(5); @@ -53,11 +61,9 @@ int main(int argc, char *argv[]) addresses[3] = 8; addresses[4] = 5; - IndirectList<double> idl(completeList, addresses); + IndirectList<double> idl1(completeList, addresses); - Info<< "addr: " << idl.addressing() << nl - << "list: " << idl() << nl - << endl; + printInfo(idl1); addresses[4] = 1; addresses[3] = 0; @@ -65,11 +71,26 @@ int main(int argc, char *argv[]) addresses[1] = 8; addresses[0] = 5; - idl.resetAddressing(addresses.xfer()); + idl1.resetAddressing(addresses.xfer()); - Info<< "addr: " << idl.addressing() << nl - << "list: " << idl() << nl - << endl; + printInfo(idl1); + + // test copying + UIndirectList<double> uidl1(idl1); + IndirectList<double> idl2(uidl1); + IndirectList<double> idl3(idl2); + + printInfo(uidl1); + + idl1.resetAddressing(List<label>()); +// idl2.resetAddressing(List<label>()); + + Info<<"after resetAddressing:" << nl << endl; + + printInfo(uidl1); + printInfo(idl1); + printInfo(idl2); + printInfo(idl3); Info<< "End\n" << endl; diff --git a/applications/test/IndirectList2/IndirectList2.H b/applications/test/IndirectList2/IndirectList2.H deleted file mode 100644 index 3eb11d0e0498c2fb445b19bd79f26ec862b16951..0000000000000000000000000000000000000000 --- a/applications/test/IndirectList2/IndirectList2.H +++ /dev/null @@ -1,164 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -Class - Foam::IndirectList2 - -Description - A List with indirect addressing. - -SourceFiles - IndirectListI.H - -\*---------------------------------------------------------------------------*/ - -#ifndef IndirectList2_H -#define IndirectList2_H - -#include "UIndirectList.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class IndirectListAddressing Declaration -\*---------------------------------------------------------------------------*/ - -//- A helper class for storing addresses. -class IndirectListAddressing -{ - // Private data - - //- Storage for the list addressing - List<label> addressing_; - - - // Private Member Functions - - //- Disallow default bitwise copy construct - IndirectListAddressing(const IndirectListAddressing&); - - //- Disallow default bitwise assignment - void operator=(const IndirectListAddressing&); - - -protected: - - // Constructors - - //- Construct by copying the addressing array - explicit inline IndirectListAddressing(const UList<label>& addr); - - //- Construct by transferring addressing array - explicit inline IndirectListAddressing(const Xfer<List<label> >& addr); - - - // Member Functions - - // Access - - //- Return the list addressing - inline const List<label>& addressing() const; - - // Edit - - //- Reset addressing - inline void resetAddressing(const UList<label>&); - inline void resetAddressing(const Xfer<List<label> >&); - -}; - - -/*---------------------------------------------------------------------------*\ - Class IndirectList2 Declaration -\*---------------------------------------------------------------------------*/ - -template<class T> -class IndirectList2 -: - private IndirectListAddressing, - public UIndirectList<T> -{ - // Private Member Functions - - //- Disable default assignment operator - void operator=(const IndirectList2<T>&); - - //- Disable assignment from UIndirectList - void operator=(const UIndirectList<T>&); - - -public: - - // Constructors - - //- Construct given the complete list and the addressing array - inline IndirectList2(const UList<T>&, const UList<label>&); - - //- Construct given the complete list and by transferring addressing - inline IndirectList2(const UList<T>&, const Xfer<List<label> >&); - - //- Copy constructor - inline IndirectList2(const IndirectList2<T>&); - - //- Construct from UIndirectList - explicit inline IndirectList2(const UIndirectList<T>&); - - - // Member Functions - - - // Access - - //- Return the list addressing - using UIndirectList<T>::addressing; - - - // Edit - - //- Reset addressing - using IndirectListAddressing::resetAddressing; - - - // Member Operators - - //- Assignment operator - using UIndirectList<T>::operator=; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "IndirectList2I.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/test/IndirectList2/IndirectList2I.H b/applications/test/IndirectList2/IndirectList2I.H deleted file mode 100644 index 66b4e0de844533dea90142dff515e3c70991d76e..0000000000000000000000000000000000000000 --- a/applications/test/IndirectList2/IndirectList2I.H +++ /dev/null @@ -1,136 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - - -inline Foam::IndirectListAddressing::IndirectListAddressing -( - const UList<label>& addr -) -: - addressing_(addr) -{} - - -inline Foam::IndirectListAddressing::IndirectListAddressing -( - const Xfer<List<label> >& addr -) -: - addressing_(addr) -{} - - -template<class T> -inline Foam::IndirectList2<T>::IndirectList2 -( - const UList<T>& completeList, - const UList<label>& addr -) -: - IndirectListAddressing(addr), - UIndirectList<T> - ( - completeList, - IndirectListAddressing::addressing() - ) -{} - - -template<class T> -inline Foam::IndirectList2<T>::IndirectList2 -( - const UList<T>& completeList, - const Xfer<List<label> >& addr -) -: - IndirectListAddressing(addr), - UIndirectList<T> - ( - completeList, - IndirectListAddressing::addressing() - ) -{} - - -template<class T> -inline Foam::IndirectList2<T>::IndirectList2 -( - const IndirectList2<T>& lst -) -: - IndirectListAddressing(lst.addressing()), - UIndirectList<T> - ( - lst.completeList(), - IndirectListAddressing::addressing() - ) -{} - - -template<class T> -inline Foam::IndirectList2<T>::IndirectList2 -( - const UIndirectList<T>& lst -) -: - IndirectListAddressing(lst.addressing()), - UIndirectList<T> - ( - lst.completeList(), - IndirectListAddressing::addressing() - ) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -inline const Foam::List<Foam::label>& -Foam::IndirectListAddressing::addressing() const -{ - return addressing_; -} - - -inline void Foam::IndirectListAddressing::resetAddressing -( - const UList<label>& addr -) -{ - addressing_ = addr; -} - - -inline void Foam::IndirectListAddressing::resetAddressing -( - const Xfer<List<label> >& addr -) -{ - addressing_.transfer(addr()); -} - - -// ************************************************************************* // diff --git a/applications/test/IndirectList2/IndirectListTest2.C b/applications/test/IndirectList2/IndirectListTest2.C deleted file mode 100644 index 14d7d4dbae63c2c17901d2e0fe8e0a56cf208149..0000000000000000000000000000000000000000 --- a/applications/test/IndirectList2/IndirectListTest2.C +++ /dev/null @@ -1,101 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -Description - -\*---------------------------------------------------------------------------*/ - -#include "IndirectList2.H" -#include "IOstreams.H" - -using namespace Foam; - -template<class ListType> -void printInfo(const ListType& lst) -{ - Info<< "addr: " << lst.addressing() << nl - << "list: " << lst << nl - << endl; -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Main program: - -int main(int argc, char *argv[]) -{ - List<double> completeList(10); - - forAll(completeList, i) - { - completeList[i] = 0.1*i; - } - - Info<< "raw : " << completeList << nl << endl; - - - List<label> addresses(5); - addresses[0] = 1; - addresses[1] = 0; - addresses[2] = 7; - addresses[3] = 8; - addresses[4] = 5; - - IndirectList2<double> idl1(completeList, addresses); - - printInfo(idl1); - - addresses[4] = 1; - addresses[3] = 0; - addresses[2] = 7; - addresses[1] = 8; - addresses[0] = 5; - - idl1.resetAddressing(addresses.xfer()); - - printInfo(idl1); - - // test copying - UIndirectList<double> uidl1(idl1); - IndirectList2<double> idl2(uidl1); - IndirectList2<double> idl3(idl2); - - printInfo(uidl1); - - idl1.resetAddressing(List<label>()); -// idl2.resetAddressing(List<label>()); - - Info<<"after resetAddressing:" << nl << endl; - - printInfo(uidl1); - printInfo(idl1); - printInfo(idl2); - printInfo(idl3); - - Info<< "End\n" << endl; - - return 0; -} - - -// ************************************************************************* // diff --git a/applications/test/IndirectList2/Make/files b/applications/test/IndirectList2/Make/files deleted file mode 100644 index c6dab96e20b74e41bfec7e2be0e13e6b4d57d129..0000000000000000000000000000000000000000 --- a/applications/test/IndirectList2/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -IndirectListTest2.C - -EXE = $(FOAM_USER_APPBIN)/IndirectListTest2 diff --git a/applications/test/IndirectList2/Make/options b/applications/test/IndirectList2/Make/options deleted file mode 100644 index 6a9e9810b3d5ce6684bdaf03143933480ff45e42..0000000000000000000000000000000000000000 --- a/applications/test/IndirectList2/Make/options +++ /dev/null @@ -1,2 +0,0 @@ -/* EXE_INC = -I$(LIB_SRC)/cfdTools/include */ -/* EXE_LIBS = -lfiniteVolume */ diff --git a/src/OpenFOAM/containers/Lists/IndirectList/IndirectList.H b/src/OpenFOAM/containers/Lists/IndirectList/IndirectList.H index 0d41f70c151c0b5e3722e070794e938a32af6f66..ec65a14a1bfb4f4994026069c549676f809fb105 100644 --- a/src/OpenFOAM/containers/Lists/IndirectList/IndirectList.H +++ b/src/OpenFOAM/containers/Lists/IndirectList/IndirectList.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,7 +25,11 @@ Class Foam::IndirectList Description - A List with indirect addressing + A List with indirect addressing. + +SeeAlso + Foam::UIndirectList for a version without any allocation for the + addressing. SourceFiles IndirectListI.H @@ -35,7 +39,7 @@ SourceFiles #ifndef IndirectList_H #define IndirectList_H -#include "List.H" +#include "UIndirectList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -43,81 +47,109 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class IndirectList Declaration + Class IndirectListAddressing Declaration \*---------------------------------------------------------------------------*/ -template<class T> -class IndirectList +//- A helper class for storing addresses. +class IndirectListAddressing { // Private data - UList<T>& completeList_; + //- Storage for the list addressing List<label> addressing_; -public: + // Private Member Functions + + //- Disallow default bitwise copy construct + IndirectListAddressing(const IndirectListAddressing&); + + //- Disallow default bitwise assignment + void operator=(const IndirectListAddressing&); + + +protected: // Constructors - //- Construct given the complete list and the addressing array - inline IndirectList(const UList<T>&, const UList<label>&); + //- Construct by copying the addressing array + explicit inline IndirectListAddressing(const UList<label>& addr); - //- Construct given the complete list and by transferring addressing - inline IndirectList(const UList<T>&, const Xfer<List<label> >&); + //- Construct by transferring addressing array + explicit inline IndirectListAddressing(const Xfer<List<label> >& addr); // Member Functions // Access - //- Return the number of elements in the list - inline label size() const; + //- Return the list addressing + inline const List<label>& addressing() const; - //- Return true if the list is empty (ie, size() is zero). - inline bool empty() const; + // Edit - //- Return the first element of the list. - inline T& first(); + //- Reset addressing + inline void resetAddressing(const UList<label>&); + inline void resetAddressing(const Xfer<List<label> >&); - //- Return first element of the list. - inline const T& first() const; +}; - //- Return the last element of the list. - inline T& last(); - //- Return the last element of the list. - inline const T& last() const; +/*---------------------------------------------------------------------------*\ + Class IndirectList Declaration +\*---------------------------------------------------------------------------*/ - //- Return the complete list - inline const UList<T>& completeList() const; +template<class T> +class IndirectList +: + private IndirectListAddressing, + public UIndirectList<T> +{ + // Private Member Functions - //- Return the list addressing - inline const List<label>& addressing() const; + //- Disable default assignment operator + void operator=(const IndirectList<T>&); + //- Disable assignment from UIndirectList + void operator=(const UIndirectList<T>&); - // Edit - //- Reset addressing - inline void resetAddressing(const UList<label>&); - inline void resetAddressing(const Xfer<List<label> >&); +public: + + // Constructors + //- Construct given the complete list and the addressing array + inline IndirectList(const UList<T>&, const UList<label>&); - // Member Operators + //- Construct given the complete list and by transferring addressing + inline IndirectList(const UList<T>&, const Xfer<List<label> >&); - //- Return the addressed elements as a List - inline List<T> operator()() const; + //- Copy constructor + inline IndirectList(const IndirectList<T>&); - //- Return non-const access to an element - inline T& operator[](const label); + //- Construct from UIndirectList + explicit inline IndirectList(const UIndirectList<T>&); - //- Return const access to an element - inline const T& operator[](const label) const; - //- Assignment from UList of addressed elements - inline void operator=(const UList<T>&); + // Member Functions + + + // Access + + //- Return the list addressing + using UIndirectList<T>::addressing; + + + // Edit + + //- Reset addressing + using IndirectListAddressing::resetAddressing; + + + // Member Operators - //- Assignment of all entries to the given value - inline void operator=(const T&); + //- Assignment operator + using UIndirectList<T>::operator=; }; diff --git a/src/OpenFOAM/containers/Lists/IndirectList/IndirectListI.H b/src/OpenFOAM/containers/Lists/IndirectList/IndirectListI.H index dfcc20d537165ac6c5a29e7a5f54fe3c9e519131..0303ba2d5eb9164eef9e428fdc8ddb39e33d05c8 100644 --- a/src/OpenFOAM/containers/Lists/IndirectList/IndirectListI.H +++ b/src/OpenFOAM/containers/Lists/IndirectList/IndirectListI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,90 +25,97 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template<class T> -inline Foam::IndirectList<T>::IndirectList + +inline Foam::IndirectListAddressing::IndirectListAddressing ( - const UList<T>& completeList, const UList<label>& addr ) : - completeList_(const_cast<UList<T>&>(completeList)), addressing_(addr) {} -template<class T> -inline Foam::IndirectList<T>::IndirectList +inline Foam::IndirectListAddressing::IndirectListAddressing ( - const UList<T>& completeList, const Xfer<List<label> >& addr ) : - completeList_(const_cast<UList<T>&>(completeList)), addressing_(addr) {} -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template<class T> -inline Foam::label Foam::IndirectList<T>::size() const -{ - return addressing_.size(); -} - - template<class T> -inline bool Foam::IndirectList<T>::empty() const -{ - return addressing_.empty(); -} - - -template<class T> -inline T& Foam::IndirectList<T>::first() -{ - return completeList_[addressing_.first()]; -} +inline Foam::IndirectList<T>::IndirectList +( + const UList<T>& completeList, + const UList<label>& addr +) +: + IndirectListAddressing(addr), + UIndirectList<T> + ( + completeList, + IndirectListAddressing::addressing() + ) +{} template<class T> -inline const T& Foam::IndirectList<T>::first() const -{ - return completeList_[addressing_.first()]; -} +inline Foam::IndirectList<T>::IndirectList +( + const UList<T>& completeList, + const Xfer<List<label> >& addr +) +: + IndirectListAddressing(addr), + UIndirectList<T> + ( + completeList, + IndirectListAddressing::addressing() + ) +{} template<class T> -inline T& Foam::IndirectList<T>::last() -{ - return completeList_[addressing_.last()]; -} +inline Foam::IndirectList<T>::IndirectList +( + const IndirectList<T>& lst +) +: + IndirectListAddressing(lst.addressing()), + UIndirectList<T> + ( + lst.completeList(), + IndirectListAddressing::addressing() + ) +{} template<class T> -inline const T& Foam::IndirectList<T>::last() const -{ - return completeList_[addressing_.last()]; -} - +inline Foam::IndirectList<T>::IndirectList +( + const UIndirectList<T>& lst +) +: + IndirectListAddressing(lst.addressing()), + UIndirectList<T> + ( + lst.completeList(), + IndirectListAddressing::addressing() + ) +{} -template<class T> -inline const Foam::UList<T>& Foam::IndirectList<T>::completeList() const -{ - return completeList_; -} +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template<class T> -inline const Foam::List<Foam::label>& Foam::IndirectList<T>::addressing() const +inline const Foam::List<Foam::label>& +Foam::IndirectListAddressing::addressing() const { return addressing_; } -template<class T> -inline void Foam::IndirectList<T>::resetAddressing +inline void Foam::IndirectListAddressing::resetAddressing ( const UList<label>& addr ) @@ -117,8 +124,7 @@ inline void Foam::IndirectList<T>::resetAddressing } -template<class T> -inline void Foam::IndirectList<T>::resetAddressing +inline void Foam::IndirectListAddressing::resetAddressing ( const Xfer<List<label> >& addr ) @@ -127,63 +133,4 @@ inline void Foam::IndirectList<T>::resetAddressing } -// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - -template<class T> -inline Foam::List<T> Foam::IndirectList<T>::operator()() const -{ - List<T> result(size()); - - forAll(*this, i) - { - result[i] = operator[](i); - } - - return result; -} - - -template<class T> -inline T& Foam::IndirectList<T>::operator[](const label i) -{ - return completeList_[addressing_[i]]; -} - - -template<class T> -inline const T& Foam::IndirectList<T>::operator[](const label i) const -{ - return completeList_[addressing_[i]]; -} - - -template<class T> -inline void Foam::IndirectList<T>::operator=(const UList<T>& ae) -{ - if (addressing_.size() != ae.size()) - { - FatalErrorIn("IndirectList<T>::operator=(const UList<T>&)") - << "Addressing and list of addressed elements " - "have different sizes: " - << addressing_.size() << " " << ae.size() - << abort(FatalError); - } - - forAll(addressing_, i) - { - completeList_[addressing_[i]] = ae[i]; - } -} - - -template<class T> -inline void Foam::IndirectList<T>::operator=(const T& t) -{ - forAll(addressing_, i) - { - completeList_[addressing_[i]] = t; - } -} - - // ************************************************************************* // diff --git a/src/OpenFOAM/containers/Lists/List/List.C b/src/OpenFOAM/containers/Lists/List/List.C index 934fc085f4d5236ea102a79eff2cd6f0d797b9a1..ae4a36a805856686cd3d42816d674bbb98154621 100644 --- a/src/OpenFOAM/containers/Lists/List/List.C +++ b/src/OpenFOAM/containers/Lists/List/List.C @@ -266,24 +266,6 @@ Foam::List<T>::List(const SLList<T>& lst) } -// Construct as copy of IndirectList<T> -template<class T> -Foam::List<T>::List(const IndirectList<T>& lst) -: - UList<T>(NULL, lst.size()) -{ - if (this->size_) - { - this->v_ = new T[this->size_]; - - forAll(*this, i) - { - this->operator[](i) = lst[i]; - } - } -} - - // Construct as copy of UIndirectList<T> template<class T> Foam::List<T>::List(const UIndirectList<T>& lst) @@ -517,25 +499,6 @@ void Foam::List<T>::operator=(const SLList<T>& lst) } -// Assignment operator. Takes linear time. -template<class T> -void Foam::List<T>::operator=(const IndirectList<T>& lst) -{ - if (lst.size() != this->size_) - { - if (this->v_) delete[] this->v_; - this->v_ = 0; - this->size_ = lst.size(); - if (this->size_) this->v_ = new T[this->size_]; - } - - forAll(*this, i) - { - this->operator[](i) = lst[i]; - } -} - - // Assignment operator. Takes linear time. template<class T> void Foam::List<T>::operator=(const UIndirectList<T>& lst) diff --git a/src/OpenFOAM/containers/Lists/List/List.H b/src/OpenFOAM/containers/Lists/List/List.H index 2999e0886ed5826b974c121b9ce2f8c53ad6f6b6..d51a1f9eefcfeb47d113e2ab8966745dcd579edf 100644 --- a/src/OpenFOAM/containers/Lists/List/List.H +++ b/src/OpenFOAM/containers/Lists/List/List.H @@ -131,9 +131,6 @@ public: //- Construct as copy of SLList<T> explicit List(const SLList<T>&); - //- Construct as copy of IndirectList<T> - explicit List(const IndirectList<T>&); - //- Construct as copy of UIndirectList<T> explicit List(const UIndirectList<T>&); @@ -219,9 +216,6 @@ public: //- Assignment from SLList operator. Takes linear time. void operator=(const SLList<T>&); - //- Assignment from IndirectList operator. Takes linear time. - void operator=(const IndirectList<T>&); - //- Assignment from UIndirectList operator. Takes linear time. void operator=(const UIndirectList<T>&);