ENH: allow "<case>", "<system>" ... in the string expansions (issue #792)

- the expansions were previously required as slash to follow, but
  now either are possible.

    "<case>", "<case>/" both yield the same as "$FOAM_CASE" and
    will not have a trailing slash in the result. The expansion of
    "$FOAM_CASE/" will however have a trailing slash.

- adjust additional files using these expansions
This commit is contained in:
Mark Olesen
2018-04-11 23:10:49 +02:00
parent fc5895f1df
commit 5f88e4271e
15 changed files with 93 additions and 67 deletions

View File

@ -72,26 +72,28 @@ int main(int argc, char *argv[])
const auto& cstr
:
{
"~OpenFOAM/controlDict",
"<etc>/controlDict",
"~OpenFOAM/controlDict", "<etc>/controlDict",
"$FOAM_CASE/xyz", "<case>/xyz",
"$FOAM_CASE/constant/xyz", "<constant>/xyz",
"$FOAM_CASE/system/xyz", "<system>/xyz",
"$FOAM_CASE/test",
"<case>/test",
// corner cases
"~OpenFOAM", "<etc>",
"~OpenFOAM/", "<etc>/",
"$FOAM_CASE", "<case>",
"$FOAM_CASE/constant", "<constant>",
"$FOAM_CASE/system", "<system>",
"$FOAM_CASE/constant/test",
"<case>/constant/test",
"<constant>/test",
"$FOAM_CASE/system/test",
"<case>/system/test",
"<system>/test",
"$FOAM_CASE/", "<case>/",
"$FOAM_CASE/constant/", "<constant>/",
"$FOAM_CASE/system/", "<system>/",
}
)
{
string input(cstr);
string output(stringOps::expand(input));
Info<<"input: " << input << nl
Info<< "input: " << input << nl
<< "expand: " << output << nl << nl;
}
}

View File

@ -112,10 +112,10 @@ sigmaRadialCoeffs
offsetSurfaceCoeffs
{
// Surface that mesh has been meshed to
baseSurface "$FOAM_CASE/constant/triSurface/DTC-scaled-inflated.obj";
baseSurface "<constant>/triSurface/DTC-scaled-inflated.obj";
// Surface to fill in to
offsetSurface "$FOAM_CASE/constant/triSurface/DTC-scaled.obj";
offsetSurface "<constant>/triSurface/DTC-scaled.obj";
}

View File

@ -150,7 +150,7 @@ void createFieldFiles
field.add
(
"#include",
"${FOAM_CASE}/system" + regionPath + "caseProperties"
"$FOAM_CASE/system" + regionPath + "caseProperties"
);
field.add("dimensions", fieldDimensions[i]);