LList.C
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-2022 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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\*---------------------------------------------------------------------------*/
28
29#include "LList.H"
30
31// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32
33template<class LListBase, class T>
35:
36 LListBase()
37{
38 for (const T& val : lst)
39 {
40 this->append(val);
41 }
42}
43
44
45template<class LListBase, class T>
47:
48 LListBase()
49{
51}
52
53
54template<class LListBase, class T>
55Foam::LList<LListBase, T>::LList(std::initializer_list<T> lst)
56:
57 LListBase()
58{
59 for (const T& val : lst)
60 {
61 this->append(val);
62 }
63}
64
65
66// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
67
68template<class LListBase, class T>
70{
71 this->clear();
72}
73
74
75// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
76
77template<class LListBase, class T>
79{
80 label len = this->size();
81
82 while (len--)
83 {
84 this->eraseHead();
85 }
86
88}
89
90
91template<class LListBase, class T>
93{
94 clear();
96}
97
98
99// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
100
101template<class LListBase, class T>
103{
104 this->clear();
105
106 for (const T& val : lst)
107 {
108 this->append(val);
109 }
110}
111
112
113template<class LListBase, class T>
115{
116 this->clear();
117
119}
120
121
122template<class LListBase, class T>
123void Foam::LList<LListBase, T>::operator=(std::initializer_list<T> lst)
124{
125 this->clear();
126
127 for (const T& val : lst)
128 {
129 this->append(val);
130 }
131}
132
133
134// ************************************************************************* //
Template class for non-intrusive linked lists.
Definition: LList.H:79
LList()=default
Default construct.
void clear()
Delete contents of list.
Definition: LList.C:78
void append(const T &elem)
Add copy at back of list.
Definition: LList.H:245
~LList()
Destructor.
Definition: LList.C:69
void operator=(const LList< LListBase, T > &lst)
Copy assignment.
Definition: LList.C:102
const volScalarField & T
patchWriters clear()
rAUs append(new volScalarField(IOobject::groupName("rAU", phase1.name()), 1.0/(U1Eqn.A()+byDt(max(phase1.residualAlpha() - alpha1, scalar(0)) *rho1))))