1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
28 \*---------------------------------------------------------------------------*/
30 #include "OSspecific.H"
32 #include "IOstreams.H"
33 #include "IStringStream.H"
34 #include "labelList.H"
35 #include "DynamicList.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 int main(int argc, char *argv[])
48 List<label> lstC(IStringStream("(1 2 3 4)")());
55 Info<< "lstA: " << lstA << endl;
56 Info<< "lstC: " << lstC << endl;
58 Xfer<List<label> > xA = xferMove(lstA);
59 Xfer<List<label> > xB;
61 List<label> lstB( xA );
63 Info<< "xA: " << xA() << endl;
64 Info<< "xB: " << xB() << endl;
65 Info<< "lstA: " << lstA << endl;
66 Info<< "lstB: " << lstB << endl;
67 Info<< "lstC: " << lstC << endl;
71 Info<< "xA: " << xA() << endl;
72 Info<< "xB: " << xB() << endl;
73 Info<< "lstA: " << lstA << endl;
74 Info<< "lstB: " << lstB << endl;
75 Info<< "lstC: " << lstC << endl;
79 List<label> lstD(xferCopy(lstC));
80 List<label> lstE(xferMove(lstC));
83 List<label> lstF = xferCopy(lstC);
85 Info<< "xA: " << xA() << endl;
86 Info<< "xB: " << xB() << endl;
87 Info<< "lstA: " << lstA << endl;
88 Info<< "lstB: " << lstB << endl;
89 Info<< "lstC: " << lstC << endl;
90 Info<< "lstD: " << lstD << endl;
91 Info<< "lstE: " << lstE << endl;
92 Info<< "lstF: " << lstF << endl;
94 Info<< "xB[" << xB->size() << "]\n";
96 // clear the underlying List
99 Info<< "xB[" << xB->size() << "]\n";
101 DynamicList<label> dl(10);
102 for (label i = 0; i < 5; i++)
108 face f2(xferCopy<labelList>(dl));
110 Info<< "dl[" << dl.size() << "/" << dl.capacity() << "] " << dl << endl;
111 Info<< "f1: " << f1 << endl;
112 Info<< "f2: " << f2 << endl;
114 // note: xfer() method returns a plain labelList
115 face f3( dl.xfer() );
116 Info<< "dl[" << dl.size() << "/" << dl.capacity() << "] " << dl << endl;
117 Info<< "f3: " << f3 << endl;
123 // ************************************************************************* //