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/>.
26 \*---------------------------------------------------------------------------*/
28 #include "UIndirectList.H"
29 #include "DynamicList.H"
30 #include "IOstreams.H"
36 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 int main(int argc, char *argv[])
41 List<double> completeList(10);
43 forAll(completeList, i)
45 completeList[i] = 0.1*i;
48 List<label> addresses(5);
55 UIndirectList<double> idl(completeList, addresses);
61 Info<< "idl[1] changed: " << idl << endl;
65 Info<< "idl changed: " << idl << endl;
67 UIndirectList<double> idl2(idl);
69 Info<< "idl2: " << idl2 << endl;
73 List<double> ident(idl.size());
77 ident[i] = ident.size() - i;
82 Info<< "idl assigned from UList: " << idl << endl;
84 // test List operations
86 List<double> flatList = UIndirectList<double>(completeList, addresses);
87 Info<< "List assigned from UIndirectList: " << flatList << endl;
89 List<double> flatList2(UIndirectList<double>(completeList, addresses));
90 Info<< "List constructed from UIndirectList: " << flatList2 << endl;
92 flatList.append(UIndirectList<double>(completeList, addresses));
93 Info<< "List::append(UIndirectList): " << flatList << endl;
96 DynamicList<double> dynList(UIndirectList<double>(completeList, addresses));
97 Info<< "DynamicList constructed from UIndirectList: " << dynList << endl;
99 dynList.append(UIndirectList<double>(completeList, addresses));
100 Info<< "DynamicList::append(UIndirectList): " << dynList << endl;
102 Info << "\nEnd\n" << endl;
108 // ************************************************************************* //