1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 A List with indirect addressing.
30 Like IndirectList but does not store addressing.
35 \*---------------------------------------------------------------------------*/
37 #ifndef UIndirectList_H
38 #define UIndirectList_H
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 // Forward declaration of friend functions and operators
48 template<class T> class UIndirectList;
49 template<class T> Ostream& operator<<(Ostream&, const UIndirectList<T>&);
51 /*---------------------------------------------------------------------------*\
52 Class UIndirectList Declaration
53 \*---------------------------------------------------------------------------*/
60 UList<T>& completeList_;
61 const UList<label>& addressing_;
68 //- Construct given the complete list and the addressing array
69 inline UIndirectList(const UList<T>&, const UList<label>&);
76 inline label size() const;
77 inline bool empty() const;
79 inline const UList<T>& completeList() const;
80 inline const List<label>& addressing() const;
85 //- Return the addressed elements as a List
86 inline List<T> operator()() const;
88 //- Return non-const access to an element
89 inline T& operator[](const label);
91 //- Return const access to an element
92 inline const T& operator[](const label) const;
94 //- Assignment from UList of addressed elements
95 inline void operator=(const UList<T>&);
97 //- Assignment of all entries to the given value
98 inline void operator=(const T&);
103 //- Write UIndirectList to Ostream
104 // Binary output is currently still a bit of a problem
105 friend Ostream& operator<< <T>
108 const UIndirectList<T>&
113 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
115 } // End namespace Foam
117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119 #include "UIndirectListI.H"
122 # include "UIndirectListIO.C"
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 // ************************************************************************* //