IndirectListI.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 \*---------------------------------------------------------------------------*/
25 
26 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
27 
28 
29 inline Foam::IndirectListAddressing::IndirectListAddressing
30 (
31  const labelUList& addr
32 )
33 :
34  addressing_(addr)
35 {}
36 
37 
38 inline Foam::IndirectListAddressing::IndirectListAddressing
39 (
40  const Xfer<List<label>>& addr
41 )
42 :
43  addressing_(addr)
44 {}
45 
46 
47 template<class T>
49 (
50  const UList<T>& completeList,
51  const labelUList& addr
52 )
53 :
56  (
57  completeList,
58  IndirectListAddressing::addressing()
59  )
60 {}
61 
62 
63 template<class T>
65 (
66  const UList<T>& completeList,
67  const Xfer<List<label>>& addr
68 )
69 :
72  (
73  completeList,
74  IndirectListAddressing::addressing()
75  )
76 {}
77 
78 
79 template<class T>
81 (
82  const IndirectList<T>& lst
83 )
84 :
87  (
88  lst.completeList(),
89  IndirectListAddressing::addressing()
90  )
91 {}
92 
93 
94 template<class T>
96 (
97  const UIndirectList<T>& lst
98 )
99 :
102  (
103  lst.completeList(),
104  IndirectListAddressing::addressing()
105  )
106 {}
107 
108 
109 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
110 
111 inline const Foam::List<Foam::label>&
113 {
114  return addressing_;
115 }
116 
117 
119 (
120  const labelUList& addr
121 )
122 {
123  addressing_ = addr;
124 }
125 
126 
128 (
129  const Xfer<List<label>>& addr
130 )
131 {
132  addressing_.transfer(addr());
133 }
134 
135 
136 // ************************************************************************* //
A simple container for copying or transferring objects of type <T>.
Definition: Xfer.H:85
IndirectList(const UList< T > &, const labelUList &)
Construct given the complete list and the addressing array.
Definition: IndirectListI.H:49
const List< label > & addressing() const
Return the list addressing.
const List< label > & addressing() const
Return the list addressing.
const UList< T > & completeList() const
Return the complete list.
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
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
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
Definition: List.C:365