![]() |
|
00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2005 OpenCFD Ltd. 00006 \\/ M anipulation | 00007 ------------------------------------------------------------------------------- 00008 License 00009 This file is part of OpenFOAM. 00010 00011 OpenFOAM is free software; you can redistribute it and/or modify it 00012 under the terms of the GNU General Public License as published by the 00013 Free Software Foundation; either version 2 of the License, or (at your 00014 option) any later version. 00015 00016 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00018 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00019 for more details. 00020 00021 You should have received a copy of the GNU General Public License 00022 along with OpenFOAM; if not, write to the Free Software Foundation, 00023 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00024 00025 Class 00026 IndirectList 00027 00028 Description 00029 00030 SourceFiles 00031 IndirectListI.H 00032 00033 \*---------------------------------------------------------------------------*/ 00034 00035 #ifndef IndirectList_H 00036 #define IndirectList_H 00037 00038 #include "List.H" 00039 00040 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00041 00042 namespace Foam 00043 { 00044 00045 // * * * * * * Forward declaration of template friend fuctions * * * * * * * // 00046 00047 template<class T> class IndirectList; 00048 00049 template<class T> Ostream& operator<<(Ostream&, const IndirectList<T>&); 00050 00051 00052 /*---------------------------------------------------------------------------*\ 00053 Class IndirectList Declaration 00054 \*---------------------------------------------------------------------------*/ 00055 00056 template<class T> 00057 class IndirectList 00058 { 00059 // Private data 00060 00061 const UList<T>& completeList_; 00062 List<label> addressing_; 00063 00064 00065 public: 00066 00067 // Constructors 00068 00069 //- Construct given the complete list and the addressing array 00070 inline IndirectList(const UList<T>&, const List<label>&); 00071 00072 00073 // Member Functions 00074 00075 // Access 00076 00077 inline label size() const; 00078 inline const UList<T>& completeList() const; 00079 inline const List<label>& addressing() const; 00080 00081 // Edit 00082 00083 //- Reset addressing 00084 void resetAddressing(const List<label>& addr); 00085 00086 00087 // Member Operators 00088 00089 //- Return the addressed elements as a List 00090 inline List<T> operator()() const; 00091 00092 //- Return const access to an element 00093 inline const T& operator[](const label) const; 00094 00095 00096 // Ostream operator 00097 00098 // Write IndirectList to Ostream. 00099 friend Ostream& operator<< <T>(Ostream&, const IndirectList<T>&); 00100 }; 00101 00102 00103 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00104 00105 } // End namespace Foam 00106 00107 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00108 00109 #include "IndirectListI.H" 00110 00111 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00112 00113 #endif 00114 00115 // ************************************************************************* //