1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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
26 Interrogates a case and prints information to screen
28 \*---------------------------------------------------------------------------*/
31 #include "objectRegistry.H"
33 #include "dictionary.H"
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 int main(int argc, char *argv[])
43 argList::noParallel();
44 argList::validOptions.insert("times", "");
45 argList::validOptions.insert("dictionary", "dictionary name");
46 argList::validOptions.insert("keywords", "");
47 argList::validOptions.insert("entry", "entry name");
49 # include "setRootCase.H"
53 if (args.optionFound("times"))
57 Foam::Time::findTimes(args.rootPath()/args.caseName())
62 Info<< times[i].name() << endl;
66 if (args.optionFound("dictionary"))
70 args.rootPath()/args.caseName()/args.option("dictionary")
73 IFstream dictFile(dictFileName);
77 dictionary dict(dictFile);
79 if (args.optionFound("keywords") && !args.optionFound("entry"))
83 IDLList<entry>::iterator iter = dict.begin();
88 Info<< iter().keyword() << endl;
91 else if (args.optionFound("entry"))
95 fileName(args.option("entry")).components(':')
98 if (dict.found(entryNames[0]))
100 const entry* entPtr = &dict.lookupEntry
107 for (int i=1; i<entryNames.size(); i++)
109 if (entPtr->dict().found(entryNames[i]))
111 entPtr = &entPtr->dict().lookupEntry
120 FatalErrorIn(args.executable())
121 << "Cannot find sub-entry " << entryNames[i]
122 << " in entry " << args.option("entry")
123 << " in dictionary " << dictFileName;
128 if (args.optionFound("keywords"))
131 if (ent[1] != token::BEGIN_BLOCK)
133 FatalErrorIn(args.executable())
134 << "Cannot find entry "
135 << args.option("entry")
136 << " in dictionary " << dictFileName
137 << " is not a sub-dictionary";
142 const dictionary& dict(entPtr->dict());
145 IDLList<entry>::const_iterator iter = dict.begin();
150 Info<< iter().keyword() << endl;
155 Info<< *entPtr << endl;
160 FatalErrorIn(args.executable())
161 << "Cannot find entry "
163 << " in dictionary " << dictFileName;
174 FatalErrorIn(args.executable())
175 << "Cannot open file " << dictFileName;
184 // ************************************************************************* //