stringOps: Rationalisation of expansions
Specific names have been given for expand functions. Unused functions have been removed, and functions only used locally have been removed from the namespace. Documentation has been corrected. Default and alternative value handling has been removed from code template expansion.
This commit is contained in:
@ -51,7 +51,7 @@ int main(int argc, char *argv[])
|
|||||||
dict.add("aaOpenFOAMcc", 1);
|
dict.add("aaOpenFOAMcc", 1);
|
||||||
|
|
||||||
string s("DDD${aa${WM_PROJECT}cc}EEE");
|
string s("DDD${aa${WM_PROJECT}cc}EEE");
|
||||||
stringOps::inplaceExpand(s, dict, true, false);
|
stringOps::inplaceExpandEntry(s, dict, true, false);
|
||||||
Info<< "variable expansion:" << s << endl;
|
Info<< "variable expansion:" << s << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -93,7 +93,7 @@ ${typeName}FixedValueFvPatch${FieldType}
|
|||||||
:
|
:
|
||||||
fixedValueFvPatchField<${TemplateType}>(p, iF, dict)
|
fixedValueFvPatchField<${TemplateType}>(p, iF, dict)
|
||||||
{
|
{
|
||||||
if (${verbose:-false})
|
if (${verbose})
|
||||||
{
|
{
|
||||||
Info<<"construct ${typeName} sha1: ${SHA1sum}"
|
Info<<"construct ${typeName} sha1: ${SHA1sum}"
|
||||||
" from patch/dictionary\n";
|
" from patch/dictionary\n";
|
||||||
@ -112,7 +112,7 @@ ${typeName}FixedValueFvPatch${FieldType}
|
|||||||
:
|
:
|
||||||
fixedValueFvPatchField<${TemplateType}>(ptf, p, iF, mapper)
|
fixedValueFvPatchField<${TemplateType}>(ptf, p, iF, mapper)
|
||||||
{
|
{
|
||||||
if (${verbose:-false})
|
if (${verbose})
|
||||||
{
|
{
|
||||||
Info<<"construct ${typeName} sha1: ${SHA1sum}"
|
Info<<"construct ${typeName} sha1: ${SHA1sum}"
|
||||||
" from patch/DimensionedField/mapper\n";
|
" from patch/DimensionedField/mapper\n";
|
||||||
@ -129,7 +129,7 @@ ${typeName}FixedValueFvPatch${FieldType}
|
|||||||
:
|
:
|
||||||
fixedValueFvPatchField<${TemplateType}>(ptf, iF)
|
fixedValueFvPatchField<${TemplateType}>(ptf, iF)
|
||||||
{
|
{
|
||||||
if (${verbose:-false})
|
if (${verbose})
|
||||||
{
|
{
|
||||||
Info<<"construct ${typeName} sha1: ${SHA1sum} "
|
Info<<"construct ${typeName} sha1: ${SHA1sum} "
|
||||||
"as copy/DimensionedField\n";
|
"as copy/DimensionedField\n";
|
||||||
@ -142,7 +142,7 @@ ${typeName}FixedValueFvPatch${FieldType}
|
|||||||
${typeName}FixedValueFvPatch${FieldType}::
|
${typeName}FixedValueFvPatch${FieldType}::
|
||||||
~${typeName}FixedValueFvPatch${FieldType}()
|
~${typeName}FixedValueFvPatch${FieldType}()
|
||||||
{
|
{
|
||||||
if (${verbose:-false})
|
if (${verbose})
|
||||||
{
|
{
|
||||||
Info<<"destroy ${typeName} sha1: ${SHA1sum}\n";
|
Info<<"destroy ${typeName} sha1: ${SHA1sum}\n";
|
||||||
}
|
}
|
||||||
@ -158,7 +158,7 @@ void ${typeName}FixedValueFvPatch${FieldType}::updateCoeffs()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (${verbose:-false})
|
if (${verbose})
|
||||||
{
|
{
|
||||||
Info<<"updateCoeffs ${typeName} sha1: ${SHA1sum}\n";
|
Info<<"updateCoeffs ${typeName} sha1: ${SHA1sum}\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -92,7 +92,7 @@ ${typeName}FixedValuePointPatch${FieldType}
|
|||||||
:
|
:
|
||||||
fixedValuePointPatchField<${TemplateType}>(p, iF, dict)
|
fixedValuePointPatchField<${TemplateType}>(p, iF, dict)
|
||||||
{
|
{
|
||||||
if (${verbose:-false})
|
if (${verbose})
|
||||||
{
|
{
|
||||||
Info<<"construct ${typeName} sha1: ${SHA1sum}"
|
Info<<"construct ${typeName} sha1: ${SHA1sum}"
|
||||||
" from patch/dictionary\n";
|
" from patch/dictionary\n";
|
||||||
@ -111,7 +111,7 @@ ${typeName}FixedValuePointPatch${FieldType}
|
|||||||
:
|
:
|
||||||
fixedValuePointPatchField<${TemplateType}>(ptf, p, iF, mapper)
|
fixedValuePointPatchField<${TemplateType}>(ptf, p, iF, mapper)
|
||||||
{
|
{
|
||||||
if (${verbose:-false})
|
if (${verbose})
|
||||||
{
|
{
|
||||||
Info<<"construct ${typeName} sha1: ${SHA1sum}"
|
Info<<"construct ${typeName} sha1: ${SHA1sum}"
|
||||||
" from patch/DimensionedField/mapper\n";
|
" from patch/DimensionedField/mapper\n";
|
||||||
@ -128,7 +128,7 @@ ${typeName}FixedValuePointPatch${FieldType}
|
|||||||
:
|
:
|
||||||
fixedValuePointPatchField<${TemplateType}>(ptf, iF)
|
fixedValuePointPatchField<${TemplateType}>(ptf, iF)
|
||||||
{
|
{
|
||||||
if (${verbose:-false})
|
if (${verbose})
|
||||||
{
|
{
|
||||||
Info<<"construct ${typeName} sha1: ${SHA1sum} "
|
Info<<"construct ${typeName} sha1: ${SHA1sum} "
|
||||||
"as copy/DimensionedField\n";
|
"as copy/DimensionedField\n";
|
||||||
@ -141,7 +141,7 @@ ${typeName}FixedValuePointPatch${FieldType}
|
|||||||
${typeName}FixedValuePointPatch${FieldType}::
|
${typeName}FixedValuePointPatch${FieldType}::
|
||||||
~${typeName}FixedValuePointPatch${FieldType}()
|
~${typeName}FixedValuePointPatch${FieldType}()
|
||||||
{
|
{
|
||||||
if (${verbose:-false})
|
if (${verbose})
|
||||||
{
|
{
|
||||||
Info<<"destroy ${typeName} sha1: ${SHA1sum}\n";
|
Info<<"destroy ${typeName} sha1: ${SHA1sum}\n";
|
||||||
}
|
}
|
||||||
@ -157,7 +157,7 @@ void ${typeName}FixedValuePointPatch${FieldType}::updateCoeffs()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (${verbose:-false})
|
if (${verbose})
|
||||||
{
|
{
|
||||||
Info<<"updateCoeffs ${typeName} sha1: ${SHA1sum}\n";
|
Info<<"updateCoeffs ${typeName} sha1: ${SHA1sum}\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -76,7 +76,7 @@ ${typeName}Function1${TemplateType}
|
|||||||
entryName
|
entryName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (${verbose:-false})
|
if (${verbose})
|
||||||
{
|
{
|
||||||
Info<< "Construct ${typeName} sha1: ${SHA1sum} from dictionary\n";
|
Info<< "Construct ${typeName} sha1: ${SHA1sum} from dictionary\n";
|
||||||
}
|
}
|
||||||
@ -94,7 +94,7 @@ ${typeName}Function1${TemplateType}
|
|||||||
f1
|
f1
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (${verbose:-false})
|
if (${verbose})
|
||||||
{
|
{
|
||||||
Info<< "Construct ${typeName} sha1: ${SHA1sum} as copy\n";
|
Info<< "Construct ${typeName} sha1: ${SHA1sum} as copy\n";
|
||||||
}
|
}
|
||||||
@ -106,7 +106,7 @@ ${typeName}Function1${TemplateType}
|
|||||||
Foam::Function1s::${typeName}Function1${TemplateType}::
|
Foam::Function1s::${typeName}Function1${TemplateType}::
|
||||||
~${typeName}Function1${TemplateType}()
|
~${typeName}Function1${TemplateType}()
|
||||||
{
|
{
|
||||||
if (${verbose:-false})
|
if (${verbose})
|
||||||
{
|
{
|
||||||
Info<< "Destroy ${typeName} sha1: ${SHA1sum}\n";
|
Info<< "Destroy ${typeName} sha1: ${SHA1sum}\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -76,7 +76,7 @@ ${typeName}Function2${TemplateType}
|
|||||||
entryName
|
entryName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (${verbose:-false})
|
if (${verbose})
|
||||||
{
|
{
|
||||||
Info<< "Construct ${typeName} sha1: ${SHA1sum} from dictionary\n";
|
Info<< "Construct ${typeName} sha1: ${SHA1sum} from dictionary\n";
|
||||||
}
|
}
|
||||||
@ -94,7 +94,7 @@ ${typeName}Function2${TemplateType}
|
|||||||
f1
|
f1
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (${verbose:-false})
|
if (${verbose})
|
||||||
{
|
{
|
||||||
Info<< "Construct ${typeName} sha1: ${SHA1sum} as copy\n";
|
Info<< "Construct ${typeName} sha1: ${SHA1sum} as copy\n";
|
||||||
}
|
}
|
||||||
@ -106,7 +106,7 @@ ${typeName}Function2${TemplateType}
|
|||||||
Foam::Function2s::${typeName}Function2${TemplateType}::
|
Foam::Function2s::${typeName}Function2${TemplateType}::
|
||||||
~${typeName}Function2${TemplateType}()
|
~${typeName}Function2${TemplateType}()
|
||||||
{
|
{
|
||||||
if (${verbose:-false})
|
if (${verbose})
|
||||||
{
|
{
|
||||||
Info<< "Destroy ${typeName} sha1: ${SHA1sum}\n";
|
Info<< "Destroy ${typeName} sha1: ${SHA1sum}\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -108,7 +108,7 @@ ${typeName}FunctionObject::~${typeName}FunctionObject()
|
|||||||
|
|
||||||
bool ${typeName}FunctionObject::read(const dictionary& dict)
|
bool ${typeName}FunctionObject::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
if (${verbose:-false})
|
if (${verbose})
|
||||||
{
|
{
|
||||||
Info<<"read ${typeName} sha1: ${SHA1sum}\n";
|
Info<<"read ${typeName} sha1: ${SHA1sum}\n";
|
||||||
}
|
}
|
||||||
@ -123,7 +123,7 @@ bool ${typeName}FunctionObject::read(const dictionary& dict)
|
|||||||
|
|
||||||
Foam::wordList ${typeName}FunctionObject::fields() const
|
Foam::wordList ${typeName}FunctionObject::fields() const
|
||||||
{
|
{
|
||||||
if (${verbose:-false})
|
if (${verbose})
|
||||||
{
|
{
|
||||||
Info<<"fields ${typeName} sha1: ${SHA1sum}\n";
|
Info<<"fields ${typeName} sha1: ${SHA1sum}\n";
|
||||||
}
|
}
|
||||||
@ -139,7 +139,7 @@ Foam::wordList ${typeName}FunctionObject::fields() const
|
|||||||
|
|
||||||
bool ${typeName}FunctionObject::execute()
|
bool ${typeName}FunctionObject::execute()
|
||||||
{
|
{
|
||||||
if (${verbose:-false})
|
if (${verbose})
|
||||||
{
|
{
|
||||||
Info<<"execute ${typeName} sha1: ${SHA1sum}\n";
|
Info<<"execute ${typeName} sha1: ${SHA1sum}\n";
|
||||||
}
|
}
|
||||||
@ -154,7 +154,7 @@ bool ${typeName}FunctionObject::execute()
|
|||||||
|
|
||||||
bool ${typeName}FunctionObject::write()
|
bool ${typeName}FunctionObject::write()
|
||||||
{
|
{
|
||||||
if (${verbose:-false})
|
if (${verbose})
|
||||||
{
|
{
|
||||||
Info<<"write ${typeName} sha1: ${SHA1sum}\n";
|
Info<<"write ${typeName} sha1: ${SHA1sum}\n";
|
||||||
}
|
}
|
||||||
@ -169,7 +169,7 @@ bool ${typeName}FunctionObject::write()
|
|||||||
|
|
||||||
bool ${typeName}FunctionObject::end()
|
bool ${typeName}FunctionObject::end()
|
||||||
{
|
{
|
||||||
if (${verbose:-false})
|
if (${verbose})
|
||||||
{
|
{
|
||||||
Info<<"end ${typeName} sha1: ${SHA1sum}\n";
|
Info<<"end ${typeName} sha1: ${SHA1sum}\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -103,7 +103,7 @@ ${typeName}FvModel${SourceType}
|
|||||||
fvModel(name, modelType, mesh, dict),
|
fvModel(name, modelType, mesh, dict),
|
||||||
set_(mesh, coeffs())
|
set_(mesh, coeffs())
|
||||||
{
|
{
|
||||||
if (${verbose:-false})
|
if (${verbose})
|
||||||
{
|
{
|
||||||
Info<<"construct ${typeName} sha1: ${SHA1sum}"
|
Info<<"construct ${typeName} sha1: ${SHA1sum}"
|
||||||
" from components\n";
|
" from components\n";
|
||||||
@ -116,7 +116,7 @@ ${typeName}FvModel${SourceType}
|
|||||||
${typeName}FvModel${SourceType}::
|
${typeName}FvModel${SourceType}::
|
||||||
~${typeName}FvModel${SourceType}()
|
~${typeName}FvModel${SourceType}()
|
||||||
{
|
{
|
||||||
if (${verbose:-false})
|
if (${verbose})
|
||||||
{
|
{
|
||||||
Info<<"destroy ${typeName} sha1: ${SHA1sum}\n";
|
Info<<"destroy ${typeName} sha1: ${SHA1sum}\n";
|
||||||
}
|
}
|
||||||
@ -131,7 +131,7 @@ void ${typeName}FvModel${SourceType}::addSup
|
|||||||
const word& fieldName
|
const word& fieldName
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (${verbose:-false})
|
if (${verbose})
|
||||||
{
|
{
|
||||||
Info<<"${typeName}FvModel${SourceType}::addSup()\n";
|
Info<<"${typeName}FvModel${SourceType}::addSup()\n";
|
||||||
}
|
}
|
||||||
@ -149,7 +149,7 @@ void ${typeName}FvModel${SourceType}::addSup
|
|||||||
const word& fieldName
|
const word& fieldName
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (${verbose:-false})
|
if (${verbose})
|
||||||
{
|
{
|
||||||
Info<<"${typeName}FvModel${SourceType}::addSup()\n";
|
Info<<"${typeName}FvModel${SourceType}::addSup()\n";
|
||||||
}
|
}
|
||||||
@ -168,7 +168,7 @@ void ${typeName}FvModel${SourceType}::addSup
|
|||||||
const word& fieldName
|
const word& fieldName
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (${verbose:-false})
|
if (${verbose})
|
||||||
{
|
{
|
||||||
Info<<"${typeName}FvModel${SourceType}::addSup()\n";
|
Info<<"${typeName}FvModel${SourceType}::addSup()\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -93,7 +93,7 @@ ${typeName}MixedValueFvPatch${FieldType}
|
|||||||
:
|
:
|
||||||
mixedFvPatchField<${TemplateType}>(p, iF, dict)
|
mixedFvPatchField<${TemplateType}>(p, iF, dict)
|
||||||
{
|
{
|
||||||
if (${verbose:-false})
|
if (${verbose})
|
||||||
{
|
{
|
||||||
Info<<"construct ${typeName} sha1: ${SHA1sum}"
|
Info<<"construct ${typeName} sha1: ${SHA1sum}"
|
||||||
" from patch/dictionary\n";
|
" from patch/dictionary\n";
|
||||||
@ -112,7 +112,7 @@ ${typeName}MixedValueFvPatch${FieldType}
|
|||||||
:
|
:
|
||||||
mixedFvPatchField<${TemplateType}>(ptf, p, iF, mapper)
|
mixedFvPatchField<${TemplateType}>(ptf, p, iF, mapper)
|
||||||
{
|
{
|
||||||
if (${verbose:-false})
|
if (${verbose})
|
||||||
{
|
{
|
||||||
Info<<"construct ${typeName} sha1: ${SHA1sum}"
|
Info<<"construct ${typeName} sha1: ${SHA1sum}"
|
||||||
" from patch/DimensionedField/mapper\n";
|
" from patch/DimensionedField/mapper\n";
|
||||||
@ -129,7 +129,7 @@ ${typeName}MixedValueFvPatch${FieldType}
|
|||||||
:
|
:
|
||||||
mixedFvPatchField<${TemplateType}>(ptf, iF)
|
mixedFvPatchField<${TemplateType}>(ptf, iF)
|
||||||
{
|
{
|
||||||
if (${verbose:-false})
|
if (${verbose})
|
||||||
{
|
{
|
||||||
Info<<"construct ${typeName} sha1: ${SHA1sum} "
|
Info<<"construct ${typeName} sha1: ${SHA1sum} "
|
||||||
"as copy/DimensionedField\n";
|
"as copy/DimensionedField\n";
|
||||||
@ -142,7 +142,7 @@ ${typeName}MixedValueFvPatch${FieldType}
|
|||||||
${typeName}MixedValueFvPatch${FieldType}::
|
${typeName}MixedValueFvPatch${FieldType}::
|
||||||
~${typeName}MixedValueFvPatch${FieldType}()
|
~${typeName}MixedValueFvPatch${FieldType}()
|
||||||
{
|
{
|
||||||
if (${verbose:-false})
|
if (${verbose})
|
||||||
{
|
{
|
||||||
Info<<"destroy ${typeName} sha1: ${SHA1sum}\n";
|
Info<<"destroy ${typeName} sha1: ${SHA1sum}\n";
|
||||||
}
|
}
|
||||||
@ -158,7 +158,7 @@ void ${typeName}MixedValueFvPatch${FieldType}::updateCoeffs()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (${verbose:-false})
|
if (${verbose})
|
||||||
{
|
{
|
||||||
Info<<"updateCoeffs ${typeName} sha1: ${SHA1sum}\n";
|
Info<<"updateCoeffs ${typeName} sha1: ${SHA1sum}\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -359,7 +359,7 @@ Foam::fileName Foam::findConfigFile
|
|||||||
{
|
{
|
||||||
const fileName dictFile
|
const fileName dictFile
|
||||||
(
|
(
|
||||||
stringOps::expand("$FOAM_CASE")/"system"/region/configName
|
stringOps::expandEnvVar("$FOAM_CASE")/"system"/region/configName
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isFile(dictFile))
|
if (isFile(dictFile))
|
||||||
@ -374,7 +374,7 @@ Foam::fileName Foam::findConfigFile
|
|||||||
{
|
{
|
||||||
const fileName dictFile
|
const fileName dictFile
|
||||||
(
|
(
|
||||||
stringOps::expand("$FOAM_CASE")/"system"/configName
|
stringOps::expandEnvVar("$FOAM_CASE")/"system"/configName
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isFile(dictFile))
|
if (isFile(dictFile))
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -192,7 +192,7 @@ bool Foam::entry::New(dictionary& parentDict, Istream& is)
|
|||||||
|
|
||||||
// Substitute dictionary and environment variables. Do not allow
|
// Substitute dictionary and environment variables. Do not allow
|
||||||
// empty substitutions.
|
// empty substitutions.
|
||||||
stringOps::inplaceExpand(s, parentDict, true, false);
|
stringOps::inplaceExpandEntry(s, parentDict, true, false);
|
||||||
keyword.std::string::replace(1, keyword.size() - 1, s);
|
keyword.std::string::replace(1, keyword.size() - 1, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2018-2023 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -102,7 +102,7 @@ Foam::token Foam::functionEntries::ifeqEntry::expand
|
|||||||
{
|
{
|
||||||
// String expansion. Allow unset variables
|
// String expansion. Allow unset variables
|
||||||
string expanded(var);
|
string expanded(var);
|
||||||
stringOps::inplaceExpand(expanded, dict, true, true);
|
stringOps::inplaceExpandEntry(expanded, dict, true, true);
|
||||||
|
|
||||||
// Re-form as a string token so we can compare to string
|
// Re-form as a string token so we can compare to string
|
||||||
return token(expanded, t.lineNumber());
|
return token(expanded, t.lineNumber());
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -78,7 +78,7 @@ Foam::fileName Foam::functionEntries::includeEntry::includeFileName
|
|||||||
fileName fName(is);
|
fileName fName(is);
|
||||||
// Substitute dictionary and environment variables. Allow empty
|
// Substitute dictionary and environment variables. Allow empty
|
||||||
// substitutions.
|
// substitutions.
|
||||||
stringOps::inplaceExpand(fName, dict, true, true);
|
stringOps::inplaceExpandEntry(fName, dict, true, true);
|
||||||
|
|
||||||
if (fName.empty() || fName.isAbsolute())
|
if (fName.empty() || fName.isAbsolute())
|
||||||
{
|
{
|
||||||
@ -102,7 +102,7 @@ Foam::fileName Foam::functionEntries::includeEntry::includeFileName
|
|||||||
fileName fName(f);
|
fileName fName(f);
|
||||||
// Substitute dictionary and environment variables. Allow empty
|
// Substitute dictionary and environment variables. Allow empty
|
||||||
// substitutions.
|
// substitutions.
|
||||||
stringOps::inplaceExpand(fName, dict, true, true);
|
stringOps::inplaceExpandEntry(fName, dict, true, true);
|
||||||
|
|
||||||
if (fName.empty() || fName.isAbsolute())
|
if (fName.empty() || fName.isAbsolute())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015-2023 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -78,7 +78,7 @@ Foam::fileName Foam::functionEntries::includeEtcEntry::includeEtcFileName
|
|||||||
|
|
||||||
// Substitute dictionary and environment variables.
|
// Substitute dictionary and environment variables.
|
||||||
// Allow empty substitutions.
|
// Allow empty substitutions.
|
||||||
stringOps::inplaceExpand(fName, dict, true, true);
|
stringOps::inplaceExpandEntry(fName, dict, true, true);
|
||||||
|
|
||||||
if (fName.empty() || fName.isAbsolute())
|
if (fName.empty() || fName.isAbsolute())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -52,7 +52,7 @@ bool Foam::primitiveEntry::expandVariable
|
|||||||
|
|
||||||
// Substitute dictionary and environment variables. Do not allow
|
// Substitute dictionary and environment variables. Do not allow
|
||||||
// empty substitutions.
|
// empty substitutions.
|
||||||
stringOps::inplaceExpand(s, dict, true, false);
|
stringOps::inplaceExpandEntry(s, dict, true, false);
|
||||||
variable newW(w);
|
variable newW(w);
|
||||||
newW.std::string::replace(1, newW.size() - 1, s);
|
newW.std::string::replace(1, newW.size() - 1, s);
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2021 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2021-2023 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -128,12 +128,12 @@ void Foam::compileTemplate::prepare
|
|||||||
// Define Make/options
|
// Define Make/options
|
||||||
dynCode.setMakeOptions(context.options() + "\n\n" + context.libs());
|
dynCode.setMakeOptions(context.options() + "\n\n" + context.libs());
|
||||||
|
|
||||||
// Debugging: make verbose
|
// Make verbose if debugging
|
||||||
|
dynCode.setFilterVariable("verbose", Foam::name(bool(debug)));
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
dynCode.setFilterVariable("verbose", "true");
|
Info<<"compile " << codeName() << " sha1: " << context.sha1() << endl;
|
||||||
Info<<"compile " << codeName() << " sha1: "
|
|
||||||
<< context.sha1() << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -132,7 +132,7 @@ void Foam::dynamicCode::copyAndFilter
|
|||||||
// Expand according to mapping.
|
// Expand according to mapping.
|
||||||
// Expanding according to env variables might cause too many
|
// Expanding according to env variables might cause too many
|
||||||
// surprises
|
// surprises
|
||||||
stringOps::inplaceExpand(line, mapping);
|
stringOps::inplaceExpandCodeTemplate(line, mapping);
|
||||||
os.writeQuoted(line, false) << nl;
|
os.writeQuoted(line, false) << nl;
|
||||||
}
|
}
|
||||||
while (is.good());
|
while (is.good());
|
||||||
@ -322,8 +322,8 @@ bool Foam::dynamicCode::writeDigest(const std::string& sha1) const
|
|||||||
|
|
||||||
Foam::dynamicCode::dynamicCode(const word& codeName, const word& codeDirName)
|
Foam::dynamicCode::dynamicCode(const word& codeName, const word& codeDirName)
|
||||||
:
|
:
|
||||||
codeRoot_(stringOps::expand("$FOAM_CASE")/topDirName),
|
codeRoot_(stringOps::expandEnvVar("$FOAM_CASE")/topDirName),
|
||||||
libSubDir_(stringOps::expand("platforms/$WM_OPTIONS/lib")),
|
libSubDir_(stringOps::expandEnvVar("platforms/$WM_OPTIONS/lib")),
|
||||||
codeName_(codeName),
|
codeName_(codeName),
|
||||||
codeDirName_(codeDirName)
|
codeDirName_(codeDirName)
|
||||||
{
|
{
|
||||||
@ -491,7 +491,7 @@ bool Foam::dynamicCode::copyOrCreateFiles(const bool verbose) const
|
|||||||
{
|
{
|
||||||
const fileName dstFile
|
const fileName dstFile
|
||||||
(
|
(
|
||||||
outputDir/stringOps::expand(createFiles_[fileI].first())
|
outputDir/stringOps::expandEnvVar(createFiles_[fileI].first())
|
||||||
);
|
);
|
||||||
|
|
||||||
mkDir(dstFile.path());
|
mkDir(dstFile.path());
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -63,15 +63,9 @@ Foam::dynamicCodeContext::dynamicCodeContext
|
|||||||
codePtrs[i] = dict.lookupEntryPtr(key, false, false);
|
codePtrs[i] = dict.lookupEntryPtr(key, false, false);
|
||||||
if (codePtrs[i])
|
if (codePtrs[i])
|
||||||
{
|
{
|
||||||
code_.insert
|
string s(stringOps::trim(verbatimString(codePtrs[i]->stream())));
|
||||||
(
|
stringOps::inplaceExpandCodeString(s, dict);
|
||||||
key,
|
code_.insert(key, s);
|
||||||
stringOps::expand
|
|
||||||
(
|
|
||||||
stringOps::trim(verbatimString(codePtrs[i]->stream())),
|
|
||||||
dict
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -83,24 +77,16 @@ Foam::dynamicCodeContext::dynamicCodeContext
|
|||||||
const entry* optionsPtr = dict.lookupEntryPtr("codeOptions", false, false);
|
const entry* optionsPtr = dict.lookupEntryPtr("codeOptions", false, false);
|
||||||
if (optionsPtr)
|
if (optionsPtr)
|
||||||
{
|
{
|
||||||
options_ =
|
options_ = stringOps::trim(verbatimString(optionsPtr->stream()));
|
||||||
stringOps::expand
|
stringOps::inplaceExpandCodeString(options_, dict);
|
||||||
(
|
|
||||||
stringOps::trim(verbatimString(optionsPtr->stream())),
|
|
||||||
dict
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Libs
|
// Libs
|
||||||
const entry* libsPtr = dict.lookupEntryPtr("codeLibs", false, false);
|
const entry* libsPtr = dict.lookupEntryPtr("codeLibs", false, false);
|
||||||
if (libsPtr)
|
if (libsPtr)
|
||||||
{
|
{
|
||||||
libs_ =
|
libs_ = stringOps::trim(verbatimString(libsPtr->stream()));
|
||||||
stringOps::expand
|
stringOps::inplaceExpandCodeString(libs_, dict);
|
||||||
(
|
|
||||||
stringOps::trim(verbatimString(libsPtr->stream())),
|
|
||||||
dict
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate SHA1 digest from all entries
|
// Calculate SHA1 digest from all entries
|
||||||
|
|||||||
@ -71,13 +71,12 @@ void Foam::codedFixedValuePointPatchField<Type>::prepare
|
|||||||
// Copy filtered H template
|
// Copy filtered H template
|
||||||
dynCode.addCopyFile(codeTemplateH("codedFixedValuePointPatchField"));
|
dynCode.addCopyFile(codeTemplateH("codedFixedValuePointPatchField"));
|
||||||
|
|
||||||
// Debugging: make BC verbose
|
// Make verbose if debugging
|
||||||
|
dynCode.setFilterVariable("verbose", Foam::name(bool(debug)));
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
// Debugging: make BC verbose
|
Info<<"compile " << codeName() << " sha1: " << context.sha1() << endl;
|
||||||
dynCode.setFilterVariable("verbose", "true");
|
|
||||||
Info<<"compile " << codeName() << " sha1: "
|
|
||||||
<< context.sha1() << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define Make/options
|
// Define Make/options
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2020-2023 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -58,12 +58,12 @@ void Foam::Function1s::Coded<Type>::prepare
|
|||||||
// Copy filtered H template
|
// Copy filtered H template
|
||||||
dynCode.addCopyFile(codeTemplateH("codedFunction1"));
|
dynCode.addCopyFile(codeTemplateH("codedFunction1"));
|
||||||
|
|
||||||
// Debugging: make verbose
|
// Make verbose if debugging
|
||||||
|
dynCode.setFilterVariable("verbose", Foam::name(bool(debug)));
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
dynCode.setFilterVariable("verbose", "true");
|
Info<<"compile " << codeName() << " sha1: " << context.sha1() << endl;
|
||||||
Info<<"compile " << codeName() << " sha1: "
|
|
||||||
<< context.sha1() << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define Make/options
|
// Define Make/options
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2020-2023 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -58,12 +58,12 @@ void Foam::Function2s::Coded<Type>::prepare
|
|||||||
// Copy filtered H template
|
// Copy filtered H template
|
||||||
dynCode.addCopyFile(codeTemplateH("codedFunction2"));
|
dynCode.addCopyFile(codeTemplateH("codedFunction2"));
|
||||||
|
|
||||||
// Debugging: make verbose
|
// Make verbose if debugging
|
||||||
|
dynCode.setFilterVariable("verbose", Foam::name(bool(debug)));
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
dynCode.setFilterVariable("verbose", "true");
|
Info<<"compile " << codeName() << " sha1: " << context.sha1() << endl;
|
||||||
Info<<"compile " << codeName() << " sha1: "
|
|
||||||
<< context.sha1() << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define Make/options
|
// Define Make/options
|
||||||
|
|||||||
@ -124,7 +124,7 @@ Foam::string Foam::string::replaceAll
|
|||||||
|
|
||||||
Foam::string& Foam::string::expand(const bool allowEmpty)
|
Foam::string& Foam::string::expand(const bool allowEmpty)
|
||||||
{
|
{
|
||||||
stringOps::inplaceExpand(*this, allowEmpty);
|
stringOps::inplaceExpandEnvVar(*this, allowEmpty);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -32,6 +32,7 @@ SourceFiles
|
|||||||
stringOps.C
|
stringOps.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef stringOps_H
|
#ifndef stringOps_H
|
||||||
#define stringOps_H
|
#define stringOps_H
|
||||||
|
|
||||||
@ -50,10 +51,16 @@ namespace Foam
|
|||||||
|
|
||||||
namespace stringOps
|
namespace stringOps
|
||||||
{
|
{
|
||||||
//- Expand occurrences of variables according to the mapping
|
//- Expand all occurrences of environment variables and paths
|
||||||
// Expansion includes:
|
// Expansion includes:
|
||||||
// -# variables
|
// -# environment variables
|
||||||
// - "$VAR", "${VAR}"
|
// - "$VAR", "${VAR}"
|
||||||
|
// -# current directory
|
||||||
|
// - leading "./" : the current directory
|
||||||
|
// -# tilde expansion
|
||||||
|
// - leading "~/" : home directory
|
||||||
|
// - leading "~user" : home directory for specified user
|
||||||
|
// - leading "~OpenFOAM" : site/user OpenFOAM configuration directory
|
||||||
//
|
//
|
||||||
// Supports default values as per the Bourne/Korn shell.
|
// Supports default values as per the Bourne/Korn shell.
|
||||||
// \code
|
// \code
|
||||||
@ -69,105 +76,78 @@ namespace stringOps
|
|||||||
// If parameter is unset or null, nothing is substituted.
|
// If parameter is unset or null, nothing is substituted.
|
||||||
// Otherwise the \c altValue is substituted.
|
// Otherwise the \c altValue is substituted.
|
||||||
//
|
//
|
||||||
// Any unknown entries are removed silently.
|
// Any unknown entries are removed silently, if allowEmpty is true.
|
||||||
//
|
//
|
||||||
// Malformed entries (eg, brace mismatch, sigil followed by bad character)
|
// Malformed entries (eg, brace mismatch, sigil followed by bad character)
|
||||||
// are left as is.
|
// are left as is.
|
||||||
//
|
//
|
||||||
// \note the leading sigil can be changed to avoid conflicts with other
|
// \sa
|
||||||
// string expansions
|
// Foam::findEtcFile
|
||||||
string expand
|
string expandEnvVar
|
||||||
(
|
(
|
||||||
const string&,
|
const string&,
|
||||||
const HashTable<string, word, string::hash>& mapping,
|
const bool allowEmpty = false
|
||||||
const char sigil = '$'
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Expand all occurrences of environment variables and paths
|
||||||
|
// See expandEnvVar
|
||||||
|
string& inplaceExpandEnvVar
|
||||||
|
(
|
||||||
|
string&,
|
||||||
|
const bool allowEmpty = false
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Inplace expand occurrences of variables according to the dictionary
|
||||||
|
// Expansion includes:
|
||||||
|
// -# variables
|
||||||
|
// - "$VAR", "${VAR}"
|
||||||
|
//
|
||||||
|
// Any unknown entries are left as-is
|
||||||
|
//
|
||||||
|
// \note the leading sigil can be changed to avoid conflicts with other
|
||||||
|
// string expansions
|
||||||
|
string& inplaceExpandCodeString
|
||||||
|
(
|
||||||
|
string&,
|
||||||
|
const dictionary& dict,
|
||||||
|
const char sigil = '$'
|
||||||
|
);
|
||||||
|
|
||||||
//- Inplace expand occurrences of variables according to the mapping
|
//- Inplace expand occurrences of variables according to the mapping
|
||||||
// Expansion includes:
|
// Expansion includes:
|
||||||
// -# variables
|
// -# variables
|
||||||
// - "$VAR", "${VAR}"
|
// - "$VAR", "${VAR}"
|
||||||
//
|
//
|
||||||
// Supports default values as per the Bourne/Korn shell.
|
|
||||||
// \code
|
|
||||||
// "${parameter:-defValue}"
|
|
||||||
// \endcode
|
|
||||||
// If parameter is unset or null, the \c defValue is substituted.
|
|
||||||
// Otherwise, the value of parameter is substituted.
|
|
||||||
//
|
|
||||||
// Supports alternative values as per the Bourne/Korn shell.
|
|
||||||
// \code
|
|
||||||
// "${parameter:+altValue}"
|
|
||||||
// \endcode
|
|
||||||
// If parameter is unset or null, nothing is substituted.
|
|
||||||
// Otherwise the \c altValue is substituted.
|
|
||||||
//
|
|
||||||
// Any unknown entries are removed silently.
|
// Any unknown entries are removed silently.
|
||||||
//
|
//
|
||||||
// Malformed entries (eg, brace mismatch, sigil followed by bad character)
|
|
||||||
// are left as is.
|
|
||||||
//
|
|
||||||
// \note the leading sigil can be changed to avoid conflicts with other
|
// \note the leading sigil can be changed to avoid conflicts with other
|
||||||
// string expansions
|
// string expansions
|
||||||
string& inplaceExpand
|
string& inplaceExpandCodeTemplate
|
||||||
(
|
(
|
||||||
string&,
|
string&,
|
||||||
const HashTable<string, word, string::hash>& mapping,
|
const HashTable<string, word, string::hash>& mapping,
|
||||||
const char sigil = '$'
|
const char sigil = '$'
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Expand occurrences of variables according to the dictionary
|
|
||||||
// Expansion includes:
|
|
||||||
// -# variables
|
|
||||||
// - "$VAR", "${VAR}"
|
|
||||||
//
|
|
||||||
// Any unknown entries are left as-is
|
|
||||||
//
|
|
||||||
// \note the leading sigil can be changed to avoid conflicts with other
|
|
||||||
// string expansions
|
|
||||||
string expand
|
|
||||||
(
|
|
||||||
const string&,
|
|
||||||
const dictionary& dict,
|
|
||||||
const char sigil = '$'
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
//- Get dictionary or (optionally) environment variable
|
|
||||||
string getVariable
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const dictionary& dict,
|
|
||||||
const bool allowEnvVars,
|
|
||||||
const bool allowEmpty
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
//- Recursively expands (dictionary or environment) variable
|
|
||||||
// starting at index in string. Updates index.
|
|
||||||
string expand
|
|
||||||
(
|
|
||||||
const string& s,
|
|
||||||
string::size_type& index,
|
|
||||||
const dictionary& dict,
|
|
||||||
const bool allowEnvVars,
|
|
||||||
const bool allowEmpty
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
//- Inplace expand occurrences of variables according to the dictionary
|
//- Inplace expand occurrences of variables according to the dictionary
|
||||||
// and optionally environment variables
|
// and optionally environment variables
|
||||||
// Expansion includes:
|
// Expansion includes:
|
||||||
// -# variables
|
// -# variables
|
||||||
// - "$VAR", "${VAR}"
|
// - "$VAR", "${VAR}"
|
||||||
|
// -# current directory
|
||||||
|
// - leading "./" : the current directory
|
||||||
|
// -# tilde expansion
|
||||||
|
// - leading "~/" : home directory
|
||||||
|
// - leading "~user" : home directory for specified user
|
||||||
|
// - leading "~OpenFOAM" : site/user OpenFOAM configuration directory
|
||||||
//
|
//
|
||||||
// with the "${}" syntax doing a recursive substitution.
|
// with the "${}" syntax doing a recursive substitution.
|
||||||
|
//
|
||||||
// Any unknown entries are left as-is
|
// Any unknown entries are left as-is
|
||||||
//
|
//
|
||||||
// \note the leading sigil can be changed to avoid conflicts with other
|
// \note the leading sigil can be changed to avoid conflicts with other
|
||||||
// string expansions
|
// string expansions
|
||||||
string& inplaceExpand
|
string& inplaceExpandEntry
|
||||||
(
|
(
|
||||||
string& s,
|
string& s,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
@ -177,102 +157,6 @@ namespace stringOps
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Inplace expand occurrences of variables according to the dictionary
|
|
||||||
// Expansion includes:
|
|
||||||
// -# variables
|
|
||||||
// - "$VAR", "${VAR}"
|
|
||||||
//
|
|
||||||
// Any unknown entries are left as-is
|
|
||||||
//
|
|
||||||
// \note the leading sigil can be changed to avoid conflicts with other
|
|
||||||
// string expansions
|
|
||||||
string& inplaceExpand
|
|
||||||
(
|
|
||||||
string&,
|
|
||||||
const dictionary& dict,
|
|
||||||
const char sigil = '$'
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
//- Expand initial tildes and all occurrences of environment variables
|
|
||||||
// Expansion includes:
|
|
||||||
// -# environment variables
|
|
||||||
// - "$VAR", "${VAR}"
|
|
||||||
// -# current directory
|
|
||||||
// - leading "./" : the current directory
|
|
||||||
// -# tilde expansion
|
|
||||||
// - leading "~/" : home directory
|
|
||||||
// - leading "~user" : home directory for specified user
|
|
||||||
// - leading "~OpenFOAM" : site/user OpenFOAM configuration directory
|
|
||||||
//
|
|
||||||
// Supports default values as per the Bourne/Korn shell.
|
|
||||||
// \code
|
|
||||||
// "${parameter:-defValue}"
|
|
||||||
// \endcode
|
|
||||||
// If parameter is unset or null, the \c defValue is substituted.
|
|
||||||
// Otherwise, the value of parameter is substituted.
|
|
||||||
//
|
|
||||||
// Supports alternative values as per the Bourne/Korn shell.
|
|
||||||
// \code
|
|
||||||
// "${parameter:+altValue}"
|
|
||||||
// \endcode
|
|
||||||
// If parameter is unset or null, nothing is substituted.
|
|
||||||
// Otherwise the \c altValue is substituted.
|
|
||||||
//
|
|
||||||
// Any unknown entries are removed silently, if allowEmpty is true.
|
|
||||||
//
|
|
||||||
// Malformed entries (eg, brace mismatch, sigil followed by bad character)
|
|
||||||
// are left as is.
|
|
||||||
//
|
|
||||||
// \sa
|
|
||||||
// Foam::findEtcFile
|
|
||||||
string expand
|
|
||||||
(
|
|
||||||
const string&,
|
|
||||||
const bool allowEmpty = false
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
//- Expand initial tildes and all occurrences of environment variables
|
|
||||||
// Expansion includes:
|
|
||||||
// -# environment variables
|
|
||||||
// - "$VAR", "${VAR}"
|
|
||||||
// -# current directory
|
|
||||||
// - leading "./" : the current directory
|
|
||||||
// -# tilde expansion
|
|
||||||
// - leading "~/" : home directory
|
|
||||||
// - leading "~user" : home directory for specified user
|
|
||||||
// - leading "~OpenFOAM" : site/user OpenFOAM configuration directory
|
|
||||||
//
|
|
||||||
// Supports default values as per the Bourne/Korn shell.
|
|
||||||
// \code
|
|
||||||
// "${parameter:-defValue}"
|
|
||||||
// \endcode
|
|
||||||
// If parameter is unset or null, the \c defValue is substituted.
|
|
||||||
// Otherwise, the value of parameter is substituted.
|
|
||||||
//
|
|
||||||
// Supports alternative values as per the Bourne/Korn shell.
|
|
||||||
// \code
|
|
||||||
// "${parameter:+altValue}"
|
|
||||||
// \endcode
|
|
||||||
// If parameter is unset or null, nothing is substituted.
|
|
||||||
// Otherwise the \c altValue is substituted.
|
|
||||||
//
|
|
||||||
// Any unknown entries are removed silently, if allowEmpty is true.
|
|
||||||
//
|
|
||||||
// Malformed entries (eg, brace mismatch, sigil followed by bad character)
|
|
||||||
// are left as is.
|
|
||||||
//
|
|
||||||
// Any unknown entries are removed silently if allowEmpty is true.
|
|
||||||
// \sa
|
|
||||||
// Foam::findEtcFile
|
|
||||||
string& inplaceExpand
|
|
||||||
(
|
|
||||||
string&,
|
|
||||||
const bool allowEmpty = false
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
//- Return string trimmed of leading whitespace
|
//- Return string trimmed of leading whitespace
|
||||||
string trimLeft(const string&);
|
string trimLeft(const string&);
|
||||||
|
|
||||||
|
|||||||
@ -70,12 +70,12 @@ void Foam::codedFixedValueFvPatchField<Type>::prepare
|
|||||||
// Copy filtered H template
|
// Copy filtered H template
|
||||||
dynCode.addCopyFile(codeTemplateH("codedFixedValueFvPatchField"));
|
dynCode.addCopyFile(codeTemplateH("codedFixedValueFvPatchField"));
|
||||||
|
|
||||||
// Debugging: make BC verbose
|
// Make verbose if debugging
|
||||||
|
dynCode.setFilterVariable("verbose", Foam::name(bool(debug)));
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
dynCode.setFilterVariable("verbose", "true");
|
Info<<"compile " << codeName() << " sha1: " << context.sha1() << endl;
|
||||||
Info<<"compile " << codeName() << " sha1: "
|
|
||||||
<< context.sha1() << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define Make/options
|
// Define Make/options
|
||||||
|
|||||||
@ -70,12 +70,12 @@ void Foam::codedMixedFvPatchField<Type>::prepare
|
|||||||
// Copy filtered H template
|
// Copy filtered H template
|
||||||
dynCode.addCopyFile(codeTemplateH("codedMixedFvPatchField"));
|
dynCode.addCopyFile(codeTemplateH("codedMixedFvPatchField"));
|
||||||
|
|
||||||
// Debugging: make BC verbose
|
// Make verbose if debugging
|
||||||
|
dynCode.setFilterVariable("verbose", Foam::name(bool(debug)));
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
dynCode.setFilterVariable("verbose", "true");
|
Info<<"compile " << codeName() << " sha1: " << context.sha1() << endl;
|
||||||
Info<<"compile " << codeName() << " sha1: "
|
|
||||||
<< context.sha1() << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define Make/options
|
// Define Make/options
|
||||||
|
|||||||
@ -80,12 +80,12 @@ void Foam::codedFunctionObject::prepare
|
|||||||
// Copy filtered H template
|
// Copy filtered H template
|
||||||
dynCode.addCopyFile(codeTemplateH("codedFunctionObject"));
|
dynCode.addCopyFile(codeTemplateH("codedFunctionObject"));
|
||||||
|
|
||||||
// Debugging: make verbose
|
// Make verbose if debugging
|
||||||
|
dynCode.setFilterVariable("verbose", Foam::name(bool(debug)));
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
dynCode.setFilterVariable("verbose", "true");
|
Info<<"compile " << codeName() << " sha1: " << context.sha1() << endl;
|
||||||
Info<<"compile " << codeName() << " sha1: "
|
|
||||||
<< context.sha1() << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define Make/options
|
// Define Make/options
|
||||||
|
|||||||
Reference in New Issue
Block a user