1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 \*---------------------------------------------------------------------------*/
31 #include "OSspecific.H"
33 #include "wordReList.H"
35 #include "IOstreams.H"
36 #include "IStringStream.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 int main(int argc, char *argv[])
49 argList::noParallel();
50 argList::validOptions.insert("reList", "reList");
51 argList::validOptions.insert("wordList", "wordList");
52 argList::validOptions.insert("stringList", "stringList");
53 argList::validOptions.insert("float", "xx");
54 argList::validOptions.insert("flag", "");
56 # include "setRootCase.H"
58 List<vector> list1(IStringStream("1 ((0 1 2))")());
59 Info<< "list1: " << list1 << endl;
61 List<vector> list2(IStringStream("((0 1 2) (3 4 5) (6 7 8))")());
62 Info<< "list2: " << list2 << endl;
65 Info<< "list1.append(list2): " << list1 << endl;
67 Info<< findIndex(list2, vector(3, 4, 5)) << endl;
69 list2.setSize(10, vector(1, 2, 3));
70 Info<< "list2: " << list2 << endl;
72 List<vector> list3(list2.xfer());
73 Info<< "Transferred via the xfer() method" << endl;
74 Info<< "list2: " << list2 << nl
75 << "list3: " << list3 << endl;
79 const labelList map(IStringStream("2 (0 2)")());
80 List<vector> subList3(list3, map);
81 Info<< "Elements " << map << " out of " << list3
82 << " => " << subList3 << endl;
91 if (args.optionFound("flag"))
93 Info<<"-flag:" << args.option("flag") << endl;
96 if (args.optionReadIfPresent<scalar>("float", xxx))
98 Info<<"read float " << xxx << endl;
101 if (args.optionFound("reList"))
103 reLst = args.optionReadList<wordRe>("reList");
106 if (args.optionFound("wordList"))
108 wLst = args.optionReadList<word>("wordList");
111 if (args.optionFound("stringList"))
113 sLst = args.optionReadList<string>("stringList");
117 << "-reList: " << reLst << nl
118 << "-wordList: " << wLst << nl
119 << "-stringList: " << sLst << endl;
124 // ************************************************************************* //