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 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "LList.H"
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
32 template<class LListBase, class T>
34 :
35  LListBase()
36 {
37  for (const T& val : lst)
38  {
39  this->append(val);
40  }
41 }
42 
43 
44 template<class LListBase, class T>
46 :
47  LListBase()
48 {
49  LListBase::transfer(lst);
50 }
51 
52 
53 template<class LListBase, class T>
54 Foam::LList<LListBase, T>::LList(std::initializer_list<T> lst)
55 :
56  LListBase()
57 {
58  for (const T& val : lst)
59  {
60  this->append(val);
61  }
62 }
63 
64 
65 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
66 
67 template<class LListBase, class T>
69 {
70  this->clear();
71 }
72 
73 
74 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
75 
76 template<class LListBase, class T>
78 {
79  const label len = this->size();
80  for (label i=0; i<len; ++i)
81  {
82  this->removeHead();
83  }
84 
86 }
87 
88 
89 template<class LListBase, class T>
91 {
92  clear();
93  LListBase::transfer(lst);
94 }
95 
96 
97 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
98 
99 template<class LListBase, class T>
101 {
102  this->clear();
103 
104  for (const T& val : lst)
105  {
106  this->append(val);
107  }
108 }
109 
110 
111 template<class LListBase, class T>
113 {
114  this->clear();
115 
116  LListBase::transfer(lst);
117 }
118 
119 
120 template<class LListBase, class T>
121 void Foam::LList<LListBase, T>::operator=(std::initializer_list<T> lst)
122 {
123  this->clear();
124 
125  for (const T& val : lst)
126  {
127  this->append(val);
128  }
129 }
130 
131 
132 // ************************************************************************* //
append
rAUs append(new volScalarField(IOobject::groupName("rAU", phase1.name()), 1.0/(U1Eqn.A()+byDt(max(phase1.residualAlpha() - alpha1, scalar(0)) *rho1))))
Foam::LList::clear
void clear()
Delete contents of list.
Definition: LList.C:77
Foam::LList
Template class for non-intrusive linked lists.
Definition: LList.H:54
Foam::LList::~LList
~LList()
Destructor.
Definition: LList.C:68
Foam::LList::operator=
void operator=(const LList< LListBase, T > &lst)
Copy assignment.
Definition: LList.C:100
LList.H
T
const volScalarField & T
Definition: createFieldRefs.H:2
clear
patchWriters clear()
Foam::LList::LList
LList()=default
Default construct.
Foam::LList::transfer
void transfer(LList< LListBase, T > &lst)
Transfer the contents of the argument into this List.
Definition: LList.C:90