StrideList.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) 2025 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::StrideList
28 
29 Description
30  A List with indirect stride addressing.
31 
32 \*---------------------------------------------------------------------------*/
33 
34 #ifndef Foam_StrideList_H
35 #define Foam_StrideList_H
36 
37 #include "IndirectListBase.H"
38 #include "StrideRange.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 /*---------------------------------------------------------------------------*\
46  Class StrideList Declaration
47 \*---------------------------------------------------------------------------*/
48 
49 template<class T>
50 class StrideList
51 :
52  private IndirectListAddressing<StrideRange<label>>,
53  public IndirectListBase<T, StrideRange<label>>
54 {
55  typedef IndirectListAddressing<StrideRange<label>> storage_type;
56  typedef IndirectListBase<T, StrideRange<label>> parent_type;
57 
58 public:
59 
60  // Constructors
61 
62  //- Copy construct from values list and striding
64  (
65  const UList<T>& values,
66  const StrideRange<label>& addr
67  ) noexcept
68  :
69  storage_type(addr),
71  {}
72 
73 
74  // Safety
75 
76  //- The values list (reference) cannot be an rvalue!
77  template<class... Args>
78  StrideList(UList<T>&&, Args&&...) = delete;
79 
80 
81  // Member Functions
82 
83  //- The list addressing
85 
86 
87  // Member Operators
88 
89  //- Use standard assignment operations
90  using parent_type::operator=;
91 };
92 
93 
94 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
95 
96 } // End namespace Foam
97 
98 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
99 
100 #endif
101 
102 // ************************************************************************* //
const UList< T > & values() const noexcept
The list of values (without addressing)
StrideList(const UList< T > &values, const StrideRange< label > &addr) noexcept
Copy construct from values list and striding.
Definition: StrideList.H:59
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:105
const direction noexcept
Definition: scalarImpl.H:265
const StrideRange< label > & addressing() const noexcept
Const access to the addressing.
Namespace for OpenFOAM.