initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / OpenFOAM / containers / Lists / UIndirectList / UIndirectList.H
blob0219e02af72861fb2c92b001b498f6ff1fb68b18
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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
25 Class
26     Foam::UIndirectList
28 Description
29     A List with indirect addressing.
30     Like IndirectList but does not store addressing.
32 SourceFiles
33     UIndirectListI.H
35 \*---------------------------------------------------------------------------*/
37 #ifndef UIndirectList_H
38 #define UIndirectList_H
40 #include "List.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 namespace Foam
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 \*---------------------------------------------------------------------------*/
55 template<class T>
56 class UIndirectList
58     // Private data
60         UList<T>& completeList_;
61         const UList<label>& addressing_;
64 public:
66     // Constructors
68         //- Construct given the complete list and the addressing array
69         inline UIndirectList(const UList<T>&, const UList<label>&);
72     // Member Functions
74         // Access
76             inline label size() const;
77             inline bool  empty() const;
79             inline const UList<T>& completeList() const;
80             inline const List<label>& addressing() const;
83         // Member Operators
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&);
101     // Ostream operator
103         //- Write UIndirectList to Ostream
104         //  Binary output is currently still a bit of a problem
105         friend Ostream& operator<< <T>
106         (
107             Ostream&,
108             const UIndirectList<T>&
109         );
113 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
115 } // End namespace Foam
117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119 #include "UIndirectListI.H"
121 #ifdef NoRepository
122 #   include "UIndirectListIO.C"
123 #endif
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 #endif
129 // ************************************************************************* //