SubListI.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-2024 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 #include "SubList.H"
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 template<class T>
32 (
33  const UList<T>& list,
34  const label subSize
35 )
36 :
37  UList<T>(list.v_, subSize)
38 {
39  #ifdef FULLDEBUG
40  list.checkSize(subSize);
41  #endif
42 }
43 
44 
45 template<class T>
47 (
48  const UList<T>& list,
49  const label subSize,
50  const label startIndex
51 )
52 :
53  UList<T>(&(list.v_[startIndex]), subSize)
54 {
55  #ifdef FULLDEBUG
56 
57  // Artificially allow the start of a zero-sized subList to be
58  // one past the end of the original list.
59  if (subSize)
60  {
61  list.checkStart(startIndex);
62  list.checkSize(startIndex + subSize);
63  }
64  else
65  {
66  // Start index needs to fall between 0 and size. One position
67  // behind the last element is allowed
68  list.checkSize(startIndex);
69  }
70  #endif
71 }
72 
73 
74 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
75 
76 template<class T>
78 {
79  return NullObjectRef<SubList<T>>();
80 }
81 
82 
83 template<class T>
85 {
87 }
88 
89 
90 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
91 
92 template<class T>
94 {
95  return *reinterpret_cast<const List<T>* >(this);
96 }
97 
98 
99 template<class T>
101 {
103 }
104 
105 
106 template<class T>
108 {
110 }
111 
112 
113 template<class T>
114 inline void Foam::SubList<T>::operator=(const T& t)
115 {
117 }
118 
119 
120 template<class T>
122 {
124 }
125 
126 
127 // ************************************************************************* //
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:91
A List obtained as a section of another List.
Definition: SubList.H:56
void transfer(UList< T > &)
Transfer the contents of the argument List into this list.
Definition: SubListI.H:84
SubList(const UList< T > &list, const label subSize)
Construct from UList and sub-list size.
Definition: SubListI.H:32
void operator=(const SubList< T > &)
Assignment of all entries to the given sub-list.
Definition: SubListI.H:100
static const SubList< T > & null()
Return a null SubList.
Definition: SubListI.H:77
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: UList.H:74
void deepCopy(const UList< T > &)
Copy elements of the given UList.
Definition: UList.C:35
void checkSize(const label size) const
Check size is within valid range (0 ... size)
Definition: UListI.H:84
void checkStart(const label start) const
Check start is within valid range (0 ... size-1)
Definition: UListI.H:72
A class representing the concept of 0 used to avoid unnecessary manipulations for objects that are kn...
Definition: zero.H:50
static const zero Zero
Definition: zero.H:97
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
void T(LagrangianPatchField< Type > &f, const LagrangianPatchField< Type > &f1)