IndirectList.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::IndirectList
26 
27 Description
28  A List with indirect addressing.
29 
30 See also
31  Foam::UIndirectList for a version without any allocation for the
32  addressing.
33 
34 SourceFiles
35  IndirectListI.H
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef IndirectList_H
40 #define IndirectList_H
41 
42 #include "UIndirectList.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class IndirectListAddressing Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 //- A helper class for storing addresses.
55 {
56  // Private data
57 
58  //- Storage for the list addressing
59  List<label> addressing_;
60 
61 
62  // Private Member Functions
63 
64  //- Disallow default bitwise copy construct
66 
67  //- Disallow default bitwise assignment
68  void operator=(const IndirectListAddressing&);
69 
70 
71 protected:
72 
73  // Constructors
74 
75  //- Construct by copying the addressing array
76  explicit inline IndirectListAddressing(const labelUList& addr);
77 
78  //- Construct by transferring addressing array
79  explicit inline IndirectListAddressing(const Xfer<List<label>>& addr);
80 
81 
82  // Member Functions
83 
84  // Access
85 
86  //- Return the list addressing
87  inline const List<label>& addressing() const;
88 
89  // Edit
90 
91  //- Reset addressing
92  inline void resetAddressing(const labelUList&);
93  inline void resetAddressing(const Xfer<List<label>>&);
94 
95 };
96 
97 
98 /*---------------------------------------------------------------------------*\
99  Class IndirectList Declaration
100 \*---------------------------------------------------------------------------*/
101 
102 template<class T>
103 class IndirectList
104 :
105  private IndirectListAddressing,
106  public UIndirectList<T>
107 {
108  // Private Member Functions
109 
110  //- Disallow default assignment operator
111  void operator=(const IndirectList<T>&);
112 
113  //- Disallow assignment from UIndirectList
114  void operator=(const UIndirectList<T>&);
115 
116 
117 public:
118 
119  // Constructors
120 
121  //- Construct given the complete list and the addressing array
122  inline IndirectList(const UList<T>&, const labelUList&);
123 
124  //- Construct given the complete list and by transferring addressing
125  inline IndirectList(const UList<T>&, const Xfer<List<label>>&);
126 
127  //- Copy constructor
128  inline IndirectList(const IndirectList<T>&);
129 
130  //- Construct from UIndirectList
131  explicit inline IndirectList(const UIndirectList<T>&);
132 
133 
134  // Member Functions
135 
136 
137  // Access
138 
139  //- Return the list addressing
141 
142 
143  // Edit
144 
145  //- Reset addressing
147 
148 
149  // Member Operators
150 
151  //- Assignment operator
153 };
154 
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 } // End namespace Foam
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 #include "IndirectListI.H"
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 #endif
167 
168 // ************************************************************************* //
A simple container for copying or transferring objects of type <T>.
Definition: Xfer.H:85
void resetAddressing(const labelUList &)
Reset addressing.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:61
const List< label > & addressing() const
Return the list addressing.
A helper class for storing addresses.
Definition: IndirectList.H:53
A List with indirect addressing.
Definition: fvMatrix.H:106
A List with indirect addressing.
Definition: IndirectList.H:102
Namespace for OpenFOAM.