ILList.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-2015 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 "ILList.H"
30
31// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32
33template<class LListBase, class T>
35:
36 UILList<LListBase, T>()
37{
38 for (const auto& item : lst)
39 {
40 this->append(item.clone().ptr());
41 }
42}
43
44
45template<class LListBase, class T>
47:
48 UILList<LListBase, T>()
49{
51}
52
53
54template<class LListBase, class T>
55template<class CloneArg>
57(
58 const ILList<LListBase, T>& lst,
59 const CloneArg& cloneArg
60)
61:
62 UILList<LListBase, T>()
63{
64 for (const auto& item : lst)
65 {
66 this->append(item.clone(cloneArg).ptr());
67 }
68}
69
70
71// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
72
73template<class LListBase, class T>
75{
76 this->clear();
77}
78
79
80// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
81
82template<class LListBase, class T>
84{
85 T* p = this->removeHead();
86 delete p;
87 return bool(p);
88}
89
90
91template<class LListBase, class T>
93{
94 T* p = remove(item);
95 delete p;
96 return bool(p);
98
99
100template<class LListBase, class T>
102{
103 label len = this->size();
104
105 while (len--)
106 {
107 eraseHead();
108 }
111}
112
113
114template<class LListBase, class T>
116{
117 clear();
119}
120
122// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
123
124template<class LListBase, class T>
126{
127 this->clear();
128
129 for (const auto& item : lst)
130 {
131 this->append(item.clone().ptr());
132 }
133}
135
136template<class LListBase, class T>
138{
139 clear();
141}
142
143
144// ************************************************************************* //
Template class for intrusive linked lists.
Definition: ILList.H:69
bool eraseHead()
Remove the head element specified from the list and delete it.
Definition: ILList.C:83
ILList()=default
Default construct.
bool erase(T *item)
Remove the specified element from the list and delete it.
Definition: ILList.C:92
void clear()
Clear the contents of the list.
Definition: ILList.C:101
~ILList()
Destructor.
Definition: ILList.C:74
void operator=(const ILList< LListBase, T > &lst)
Copy assignment using the 'clone()' method for each element.
Definition: ILList.C:125
Template class for intrusive linked lists.
Definition: UILList.H:70
volScalarField & p
const volScalarField & T
bool
Definition: EEqn.H:20
patchWriters clear()
rAUs append(new volScalarField(IOobject::groupName("rAU", phase1.name()), 1.0/(U1Eqn.A()+byDt(max(phase1.residualAlpha() - alpha1, scalar(0)) *rho1))))