1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2008-2011 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 Read the dictionary provided as an argument, expand the macros etc. and
29 write the resulting dictionary to standard output.
32 - expandDictionary inputDict [OPTION]
35 Report the #include/#includeIfPresent to stdout only.
38 The \c -list option can be useful when determining which files
39 are actually included by a directory. It can also be used to
40 determine which files may need to be copied when transferring
41 simulation to another environment. The following code snippet
42 could be a useful basis for such cases:
45 for i in . 0 constant system
47 find $i -maxdepth 1 -type f -exec expandDictionary -list '{}' \;
48 done | sed -ne '/^"\//!{ s/^"//; s/"$//; p }' | sort | uniq
51 \*---------------------------------------------------------------------------*/
56 #include "dictionary.H"
57 #include "includeEntry.H"
61 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
64 int main(int argc, char *argv[])
68 "Read the specified dictionary file, expand the macros etc. and write\n"
69 "the resulting dictionary to standard output."
72 argList::addBoolOption
75 "Report the #include/#includeIfPresent to stdout only"
79 argList::noParallel();
80 argList::validArgs.append("inputDict");
81 argList args(argc, argv);
83 const string dictName = args[1];
85 const bool listOpt = args.optionFound("list");
89 Foam::functionEntries::includeEntry::report = true;
92 dictionary dict(IFstream(dictName)(), true);
96 IOobject::writeBanner(Info)
97 <<"//\n// " << dictName << "\n//\n";
98 dict.write(Info, false);
99 IOobject::writeDivider(Info);
106 // ************************************************************************* //