IndirectSubList.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2020 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::IndirectSubList
28 
29 Description
30  Indirect access to a sub-section of a list.
31 
32  In many cases, using a Foam::SubList provides a simpler and more
33  efficient means of accessing a sub-list.
34  There are, however, some advantages of a IndirectSubList:
35  - allows adjustment of its addressing range after construct
36  - can recover the original, underlying list at any time
37 
38 SeeAlso
39  Foam::SubList
40 
41 SourceFiles
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef IndirectSubList_H
46 #define IndirectSubList_H
47 
48 #include "IndirectListAddressing.H"
49 #include "IndirectListBase.H"
50 #include "labelRange.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 
57 /*---------------------------------------------------------------------------*\
58  Class IndirectSubList Declaration
59 \*---------------------------------------------------------------------------*/
60 
61 template<class T>
62 class IndirectSubList
63 :
64  private IndirectListAddressing<labelRange>,
65  public IndirectListBase<T, labelRange>
66 {
67 public:
68 
69  // Constructors
70 
71  //- Construct from UList, the entire size
72  explicit IndirectSubList(const UList<T>& values)
73  :
76  (
77  values,
79  )
80  {}
81 
82  //- Construct from values list and range
84  (
85  const UList<T>& values,
86  const labelRange& addr
87  )
88  :
91  (
92  values,
94  )
95  {}
96 
97 
98  // Member Functions
99 
100  //- The list addressing
102 
103 
104  // Member Operators
105 
106  //- Use standard assignment operations
108 };
109 
110 
111 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
112 
113 } // End namespace Foam
114 
115 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
116 
117 #endif
118 
119 // ************************************************************************* //
Foam::IndirectListAddressing::addressing
const Addr & addressing() const noexcept
Const access to the addressing.
Definition: IndirectListAddressing.H:76
Foam::IndirectListAddressing
A class for storing list addressing (labels, slices etc), which are normally to used by IndirectList....
Definition: IndirectListAddressing.H:48
Foam::HashTableOps::values
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
Definition: HashOps.H:149
Foam::IndirectSubList::IndirectSubList
IndirectSubList(const UList< T > &values)
Construct from UList, the entire size.
Definition: IndirectSubList.H:71
IndirectListBase.H
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::labelRange
A range or interval of labels defined by a start and a size.
Definition: labelRange.H:55
Foam::IndirectSubList::addressing
const Addr & addressing() const noexcept
The list addressing.
Definition: IndirectListAddressing.H:76
IndirectListAddressing.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
labelRange.H
Foam::UList
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:103
Foam::IndirectListBase
Base for lists with indirect addressing, templated on the list contents type and the addressing type....
Definition: IndirectListBase.H:56