UIndirectList.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) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2017-2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::UIndirectList
29 
30 Description
31  A List with indirect addressing.
32 
33  Like IndirectList but does not store addressing.
34 
35  Note the const_cast of the list values. This is so we can use it both
36  on const and non-const lists. Alternative would be to have a const_
37  variant etc.
38 
39 SourceFiles
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef UIndirectList_H
44 #define UIndirectList_H
45 
46 #include "List.H"
47 #include "IndirectListBase.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 // Forward Declarations
55 template<class T> class UIndirectList;
56 
57 // Common list types
60 
61 /*---------------------------------------------------------------------------*\
62  Class UIndirectList Declaration
63 \*---------------------------------------------------------------------------*/
64 
65 template<class T>
66 class UIndirectList
67 :
68  public IndirectListBase<T, labelUList>
69 {
70 public:
71 
72  // Constructors
73 
74  //- Shallow copy values and addressing
75  UIndirectList(const UList<T>& values, const labelUList& addr)
76  :
78  {}
79 
80  //- Copy construct (shallow copy values and addressing)
81  UIndirectList(const UIndirectList<T>& list)
82  :
83  UIndirectList<T>(list.values(), list.addressing())
84  {}
85 
86 
87  // Member Operators
88 
89  //- Use standard assignment operations
91 
92  //- Deep copy values, Fatal if list sizes are not identical
93  void operator=(const UIndirectList<T>& rhs)
94  {
95  this->copyList(rhs);
96  }
97 };
98 
99 
100 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
101 
102 } // End namespace Foam
103 
104 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
105 
106 #endif
107 
108 // ************************************************************************* //
List.H
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::UIndirectList::UIndirectList
UIndirectList(const UIndirectList< T > &list)
Copy construct (shallow copy values and addressing)
Definition: UIndirectList.H:80
Foam::boolUIndList
UIndirectList< bool > boolUIndList
UIndirectList of bools.
Definition: UIndirectList.H:54
IndirectListBase.H
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
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::UIndirectList
A List with indirect addressing.
Definition: faMatrix.H:60
Foam::UIndirectList::UIndirectList
UIndirectList(const UList< T > &values, const labelUList &addr)
Shallow copy values and addressing.
Definition: UIndirectList.H:74
Foam::IndirectListBase
Base for lists with indirect addressing, templated on the list contents type and the addressing type....
Definition: IndirectListBase.H:56
Foam::UIndirectList::operator=
void operator=(const UIndirectList< T > &rhs)
Deep copy values, Fatal if list sizes are not identical.
Definition: UIndirectList.H:92
Foam::labelUIndList
UIndirectList< label > labelUIndList
UIndirectList of labels.
Definition: UIndirectList.H:58