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-2018 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 template<class T>
30 (
31  const UList<T>& list,
32  const label subSize
33 )
34 :
35  UList<T>(list.v_, subSize)
36 {
37  #ifdef FULLDEBUG
38  list.checkSize(subSize);
39  #endif
40 }
41 
42 
43 template<class T>
45 (
46  const UList<T>& list,
47  const label subSize,
48  const label startIndex
49 )
50 :
51  UList<T>(&(list.v_[startIndex]), subSize)
52 {
53  #ifdef FULLDEBUG
54 
55  // Artificially allow the start of a zero-sized subList to be
56  // one past the end of the original list.
57  if (subSize)
58  {
59  list.checkStart(startIndex);
60  list.checkSize(startIndex + subSize);
61  }
62  else
63  {
64  // Start index needs to fall between 0 and size. One position
65  // behind the last element is allowed
66  list.checkSize(startIndex);
67  }
68  #endif
69 }
70 
71 
72 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
73 
74 template<class T>
76 {
77  return NullObjectRef<SubList<T>>();
78 }
79 
80 
81 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
82 
83 template<class T>
85 {
86  return *reinterpret_cast<const List<T>* >(this);
87 }
88 
89 
90 template<class T>
92 {
94 }
95 
96 
97 template<class T>
99 {
101 }
102 
103 
104 template<class T>
105 inline void Foam::SubList<T>::operator=(const T& t)
106 {
108 }
109 
110 
111 // ************************************************************************* //
void operator=(const SubList< T > &)
Assignment of all entries to the given sub-list.
Definition: SubListI.H:91
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
A List obtained as a section of another List.
Definition: SubList.H:53
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
const volScalarField & T
static const SubList< T > & null()
Return a null SubList.
Definition: SubListI.H:75
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
SubList(const UList< T > &list, const label subSize)
Construct from UList and sub-list size.
Definition: SubListI.H:30