ENH: utilities: small merge of dev functionality

This commit is contained in:
mattijs 2016-01-28 15:36:42 +00:00
parent e00acab949
commit 21bc7a0c39
2 changed files with 38 additions and 5 deletions

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -37,6 +37,11 @@ Foam::label Foam::starMesh::readVtxLabel(IFstream& is)
for (int i=0; i<15; i++)
{
if (!is.good())
{
return -1;
}
is.get(lcs[i]);
}
@ -85,12 +90,10 @@ void Foam::starMesh::readPoints(const scalar scaleFactor)
if (pointsFile.good())
{
label pointLabel;
maxLabel = -1;
while (pointsFile)
{
pointLabel = readVtxLabel(pointsFile);
label pointLabel = readVtxLabel(pointsFile);
if (!pointsFile) break;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -38,6 +38,16 @@ Description
we detect the keywords in zones and redo the dictionary entries
to be labelLists.
Usage
- foamFormatConvert [OPTION]
\param -noConstant \n
Exclude the constant/ directory from the times list
\param -enableFunctionEntries \n
By default all dictionary preprocessing of fields is disabled
\*---------------------------------------------------------------------------*/
#include "argList.H"
@ -148,6 +158,11 @@ int main(int argc, char *argv[])
"noConstant",
"exclude the 'constant/' dir in the times list"
);
argList::addBoolOption
(
"enableFunctionEntries",
"enable expansion of dictionary directives - #include, #codeStream etc"
);
#include "addRegionOption.H"
#include "setRootCase.H"
@ -166,6 +181,19 @@ int main(int argc, char *argv[])
#include "createTime.H"
const bool enableEntries = args.optionFound("enableFunctionEntries");
if (enableEntries)
{
Info<< "Allowing dictionary preprocessing ('#include', '#codeStream')."
<< endl;
}
int oldFlag = entry::disableFunctionEntries;
if (!enableEntries)
{
// By default disable dictionary expansion for fields
entry::disableFunctionEntries = 1;
}
// Make sure we do not use the master-only reading since we read
// fields (different per processor) as dictionaries.
@ -267,6 +295,8 @@ int main(int argc, char *argv[])
Info<< endl;
}
entry::disableFunctionEntries = oldFlag;
Info<< "End\n" << endl;
return 0;