Home
Downloads
Documentation
Installation
User Guide
man-pages
API Documentation
README
Release Notes
Changes
License
Support
SourceForge Project
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
OpenFOAM
containers
Lists
List
ListI.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 | Copyright (C) 1991-2010 OpenCFD Ltd.
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>
29
inline
Foam::List<T>::List
()
30
{}
31
32
33
template
<
class
T>
34
inline
Foam::autoPtr<Foam::List<T>
>
Foam::List<T>::clone
()
const
35
{
36
return
autoPtr<List<T>
>(
new
List<T>
(*this));
37
}
38
39
40
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
41
42
template
<
class
T>
43
inline
const
Foam::List<T>
&
Foam::List<T>::null
()
44
{
45
return
*
reinterpret_cast<
List<T>
*
>
(0);
46
}
47
48
49
template
<
class
T>
50
inline
void
Foam::List<T>::resize
(
const
label newSize)
51
{
52
this->
setSize
(newSize);
53
}
54
55
56
template
<
class
T>
57
inline
void
Foam::List<T>::resize
(
const
label newSize,
const
T
& a)
58
{
59
this->
setSize
(newSize, a);
60
}
61
62
63
template
<
class
T>
64
inline
T
&
Foam::List<T>::newElmt
(
const
label i)
65
{
66
if
(i >= this->size())
67
{
68
setSize
(2*this->size());
69
}
70
71
return
UList<T>::operator[]
(i);
72
}
73
74
75
template
<
class
T>
76
inline
void
Foam::List<T>::size
(
const
label n)
77
{
78
UList<T>::size_
= n;
79
}
80
81
82
template
<
class
T>
83
inline
Foam::label
Foam::List<T>::size
()
const
84
{
85
return
UList<T>::size_
;
86
}
87
88
89
template
<
class
T>
90
inline
Foam::Xfer< Foam::List<T>
>
Foam::List<T>::xfer
()
91
{
92
return
xferMove
(*
this
);
93
}
94
95
96
template
<
class
T>
97
inline
void
Foam::List<T>::append
(
const
UList<T>
& lst)
98
{
99
if
(
this
== &lst)
100
{
101
FatalErrorIn
102
(
103
"List<T>::append(const UList<T>&)"
104
) <<
"attempted appending to self"
<<
abort
(
FatalError
);
105
}
106
107
label nextFree = this->size();
108
setSize
(nextFree + lst.
size
());
109
110
forAll
(lst, elemI)
111
{
112
this->operator[](nextFree++) = lst[elemI];
113
}
114
}
115
116
117
template
<
class
T>
118
inline
void
Foam::List<T>::append
(
const
UIndirectList<T>
& lst)
119
{
120
label nextFree = this->size();
121
setSize
(nextFree + lst.
size
());
122
123
forAll
(lst, elemI)
124
{
125
this->operator[](nextFree++) = lst[elemI];
126
}
127
}
128
129
130
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
131
132
template
<
class
T>
133
inline
void
Foam::List<T>::operator=
(
const
T
& t)
134
{
135
UList<T>::operator=
(t);
136
}
137
138
139
// ************************ vim: set sw=4 sts=4 et: ************************ //