All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
IndirectList.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 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 protected:
63 
64  // Constructors
65 
66  //- Construct by copying the addressing array
67  explicit inline IndirectListAddressing(const labelUList& addr);
68 
69  //- Move constructor which moves the addressing array
70  explicit inline IndirectListAddressing(List<label>&& addr);
71 
72  //- Disallow default bitwise copy construction
74 
75 
76  // Member Functions
77 
78  // Access
79 
80  //- Return the list addressing
81  inline const List<label>& addressing() const;
82 
83 
84  // Edit
85 
86  //- Reset addressing
87  inline void resetAddressing(const labelUList&);
88 
89 
90  // Member Operators
91 
92  //- Disallow default bitwise assignment
93  void operator=(const IndirectListAddressing&) = delete;
94 };
95 
96 
97 /*---------------------------------------------------------------------------*\
98  Class IndirectList Declaration
99 \*---------------------------------------------------------------------------*/
100 
101 template<class T>
102 class IndirectList
103 :
104  private IndirectListAddressing,
105  public UIndirectList<T>
106 {
107  // Private Member Functions
108 
109  //- Disallow default bitwise assignment
110  void operator=(const IndirectList<T>&);
111 
112  //- Disallow assignment from UIndirectList
113  void operator=(const UIndirectList<T>&);
114 
115 
116 public:
117 
118  // Constructors
119 
120  //- Construct given the complete list and the addressing array
121  inline IndirectList(const UList<T>&, const labelUList&);
122 
123  //- Move constructor given the complete list and moves the addressing
124  inline IndirectList(const UList<T>&, List<label>&&);
125 
126  //- Copy constructor
127  inline IndirectList(const IndirectList<T>&);
128 
129  //- Construct from UIndirectList
130  explicit inline IndirectList(const UIndirectList<T>&);
131 
132 
133  // Member Functions
134 
135  // Access
136 
137  //- Return the list addressing
139 
140 
141  // Edit
142 
143  //- Reset addressing
145 
146 
147  // Member Operators
148 
149  //- Assignment operator
151 };
152 
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 } // End namespace Foam
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 #include "IndirectListI.H"
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 #endif
165 
166 // ************************************************************************* //
IndirectListAddressing(const labelUList &addr)
Construct by copying the addressing array.
Definition: IndirectListI.H:30
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:60
void operator=(const IndirectListAddressing &)=delete
Disallow default bitwise assignment.
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:101
Namespace for OpenFOAM.