foamDictionary: Added -output option
to specify the path name of the output dictionary to which the expanded and/or
changed dictionary is written.
Usage: foamDictionary [OPTIONS] <dictionary file>
options:
-add <value> Add a new entry
-case <dir> specify alternate case directory, default is the cwd
-dict Set, add or merge entry from a dictionary.
-diff <dict> Write differences with respect to the specified dictionary
-entry <name> report/select the named entry
-expand Read the specified dictionary file and expand the macros
etc.
-fileHandler <handler>
override the fileHandler
-hostRoots <((host1 dir1) .. (hostN dirN))>
slave root directories (per host) for distributed running
-includes List the #include/#includeIfPresent files to standard output
-keywords list keywords
-libs '("lib1.so" ... "libN.so")'
pre-load libraries
-merge <value> Merge entry
-noFunctionObjects
do not execute functionObjects
-output <path name>
Path name of the output dictionary
-parallel run in parallel
-remove Remove the entry.
-roots <(dir1 .. dirN)>
slave root directories for distributed running
-set <value> Set entry value, add new entry or apply list of
substitutions
-value Print entry value
-writePrecision <label>
Write with the specified precision
-srcDoc display source code in browser
-doc display application documentation in browser
-help print the usage
manipulates dictionaries
This commit is contained in:
@ -79,12 +79,16 @@ Usage
|
||||
(or sub entry if -entry specified)
|
||||
|
||||
- \par -expand
|
||||
Read the specified dictionary file, expand the macros etc. and write
|
||||
the resulting dictionary to standard output.
|
||||
Read the specified dictionary file, expand the macros etc.
|
||||
Writes the expanded dictionary to the output dictionary if specified
|
||||
otherwise to standard output
|
||||
|
||||
- \par -includes
|
||||
List the \c #include and \c #includeIfPresent files to standard output
|
||||
|
||||
- \par -output
|
||||
Path name of the output dictionary, defaults to the input dictionary
|
||||
|
||||
Example usage:
|
||||
- Change simulation to run for one timestep only:
|
||||
\verbatim
|
||||
@ -327,8 +331,7 @@ int main(int argc, char *argv[])
|
||||
argList::addBoolOption
|
||||
(
|
||||
"expand",
|
||||
"Read the specified dictionary file, expand the macros etc. and write "
|
||||
"the resulting dictionary to standard output"
|
||||
"Read the specified dictionary file and expand the macros etc."
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
@ -336,6 +339,12 @@ int main(int argc, char *argv[])
|
||||
"label",
|
||||
"Write with the specified precision"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"output",
|
||||
"path name",
|
||||
"Path name of the output dictionary"
|
||||
);
|
||||
|
||||
argList args(argc, argv);
|
||||
|
||||
@ -432,24 +441,31 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else if (args.optionFound("expand") && !args.optionFound("entry"))
|
||||
{
|
||||
IOobject::writeBanner(Info)
|
||||
<<"//\n// " << dictPath << "\n//\n";
|
||||
|
||||
// Change the format to ASCII
|
||||
if (dict.found(IOobject::foamFile))
|
||||
if (!args.optionFound("output"))
|
||||
{
|
||||
dict.subDict(IOobject::foamFile).add
|
||||
(
|
||||
"format",
|
||||
IOstream::ASCII,
|
||||
true
|
||||
);
|
||||
IOobject::writeBanner(Info)
|
||||
<<"//\n// " << dictPath << "\n//\n";
|
||||
|
||||
// Change the format to ASCII
|
||||
if (dict.found(IOobject::foamFile))
|
||||
{
|
||||
dict.subDict(IOobject::foamFile).add
|
||||
(
|
||||
"format",
|
||||
IOstream::ASCII,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
dict.dictionary::write(Info, false);
|
||||
IOobject::writeEndDivider(Info);
|
||||
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
changed = true;
|
||||
}
|
||||
|
||||
dict.dictionary::write(Info, false);
|
||||
IOobject::writeEndDivider(Info);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -635,7 +651,7 @@ int main(int argc, char *argv[])
|
||||
remove(dict, diffDict);
|
||||
dict.dictionary::write(Info, false);
|
||||
}
|
||||
else
|
||||
else if (!args.optionFound("output"))
|
||||
{
|
||||
dict.dictionary::write(Info, false);
|
||||
}
|
||||
@ -648,7 +664,13 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else if (dictPtr)
|
||||
{
|
||||
OFstream os(args.path()/dictPath, dictFormat);
|
||||
// Set output dict name, defaults to the name of the input dict
|
||||
const fileName outputDictPath
|
||||
(
|
||||
args.optionLookupOrDefault<fileName>("output", dictPath)
|
||||
);
|
||||
|
||||
OFstream os(args.path()/outputDictPath, dictFormat);
|
||||
IOobject::writeBanner(os);
|
||||
if (dictPtr->found(IOobject::foamFile))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user