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 "wordReList.H"
34 #include "IOstreams.H"
35 #include "IStringStream.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 int main(int argc, char *argv[])
48 argList::noParallel();
49 argList::validOptions.insert("reList", "reList");
50 argList::validOptions.insert("wordList", "wordList");
51 argList::validOptions.insert("stringList", "stringList");
52 argList::validOptions.insert("float", "xx");
53 argList::validOptions.insert("flag", "");
55 # include "setRootCase.H"
57 List<vector> list1(IStringStream("1 ((0 1 2))")());
58 Info<< "list1: " << list1 << endl;
60 List<vector> list2(IStringStream("((0 1 2) (3 4 5) (6 7 8))")());
61 Info<< "list2: " << list2 << endl;
64 Info<< "list1.append(list2): " << list1 << endl;
66 Info<< findIndex(list2, vector(3, 4, 5)) << endl;
68 list2.setSize(10, vector(1, 2, 3));
69 Info<< "list2: " << list2 << endl;
71 List<vector> list3(list2.xfer());
72 Info<< "Transferred via the xfer() method" << endl;
73 Info<< "list2: " << list2 << nl
74 << "list3: " << list3 << endl;
78 const labelList map(IStringStream("2 (0 2)")());
79 List<vector> subList3(list3, map);
80 Info<< "Elements " << map << " out of " << list3
81 << " => " << subList3 << endl;
90 if (args.optionFound("flag"))
92 Info<<"-flag:" << args.option("flag") << endl;
95 if (args.optionReadIfPresent<scalar>("float", xxx))
97 Info<<"read float " << xxx << endl;
100 if (args.optionFound("reList"))
102 reLst = args.optionReadList<wordRe>("reList");
105 if (args.optionFound("wordList"))
107 wLst = args.optionReadList<word>("wordList");
110 if (args.optionFound("stringList"))
112 sLst = args.optionReadList<string>("stringList");
116 << "-reList: " << reLst << nl
117 << "-wordList: " << wLst << nl
118 << "-stringList: " << sLst << endl;
123 // ************************************************************************* //