dictionary: Added support for absolute paths when reading dictionaries referred to within keywords
For example in the combustion/coldEngineFoam/freePiston/0/p field the
internalField entry may be obtained from the include/caseSettings dictionary
using either a relative path:
internalField uniform $include/caseSettings!internalField/p;
or an absolute path:
internalField uniform ${$FOAM_CASE/0/include/caseSettings!internalField/p};
in which recursive substitution using ${...} is applied to expand the $FOAM_CASE
environment variable.
This commit is contained in:
@ -31,7 +31,7 @@ License
|
||||
#include "DynamicList.H"
|
||||
#include "inputSyntaxEntry.H"
|
||||
#include "fileOperation.H"
|
||||
|
||||
#include "stringOps.H"
|
||||
|
||||
/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
|
||||
|
||||
@ -330,7 +330,12 @@ const Foam::entry* Foam::dictionary::lookupScopedSubEntryPtr
|
||||
// Lookup in the dictionary specified by file name
|
||||
// created from the part of the keyword before the '!'
|
||||
|
||||
const fileName fName = keyword.substr(0, emarkPos);
|
||||
fileName fName = keyword.substr(0, emarkPos);
|
||||
|
||||
if (!fName.isAbsolute())
|
||||
{
|
||||
fName = topDict().name().path()/fName;
|
||||
}
|
||||
|
||||
if (fName == topDict().name())
|
||||
{
|
||||
@ -351,7 +356,7 @@ const Foam::entry* Foam::dictionary::lookupScopedSubEntryPtr
|
||||
|
||||
autoPtr<ISstream> ifsPtr
|
||||
(
|
||||
fileHandler().NewIFstream(topDict().name().path()/fName)
|
||||
fileHandler().NewIFstream(fName)
|
||||
);
|
||||
ISstream& ifs = ifsPtr();
|
||||
|
||||
|
||||
@ -14,12 +14,11 @@ FoamFile
|
||||
object T;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "include/caseSettings"
|
||||
#inputSyntax slash;
|
||||
|
||||
dimensions [0 0 0 1 0 0 0];
|
||||
|
||||
internalField uniform $:internalField.T;
|
||||
internalField uniform $include/caseSettings!internalField/T;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
@ -35,7 +34,7 @@ boundaryField
|
||||
|
||||
liner
|
||||
{
|
||||
$:wall.T;
|
||||
$include/caseSettings!wall/T;
|
||||
}
|
||||
|
||||
cylinderHead
|
||||
|
||||
@ -14,12 +14,11 @@ FoamFile
|
||||
object U;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "include/caseSettings"
|
||||
#inputSyntax slash;
|
||||
|
||||
dimensions [0 1 -1 0 0 0 0];
|
||||
|
||||
internalField uniform $:internalField.U;
|
||||
internalField uniform $include/caseSettings!internalField/U;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
@ -35,7 +34,7 @@ boundaryField
|
||||
|
||||
liner
|
||||
{
|
||||
$:wall.U;
|
||||
$include/caseSettings!wall/U;
|
||||
}
|
||||
|
||||
cylinderHead
|
||||
@ -45,7 +44,7 @@ boundaryField
|
||||
|
||||
piston
|
||||
{
|
||||
$:piston.U;
|
||||
$include/caseSettings!piston/U;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -14,8 +14,7 @@ FoamFile
|
||||
object air;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "include/caseSettings"
|
||||
#inputSyntax slash;
|
||||
|
||||
dimensions [0 0 0 0 0 0 0];
|
||||
|
||||
@ -35,7 +34,7 @@ boundaryField
|
||||
|
||||
liner
|
||||
{
|
||||
$:wall.p;
|
||||
$include/caseSettings!wall/p;
|
||||
}
|
||||
|
||||
cylinderHead
|
||||
|
||||
@ -14,8 +14,7 @@ FoamFile
|
||||
object alphat;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "include/caseSettings"
|
||||
#inputSyntax slash;
|
||||
|
||||
dimensions [1 -1 -1 0 0 0 0];
|
||||
|
||||
@ -27,11 +26,26 @@ boundaryField
|
||||
{
|
||||
type wedge;
|
||||
}
|
||||
front { $back; }
|
||||
liner { $:wall.alphat; }
|
||||
cylinderHead { $liner; }
|
||||
piston { $liner; }
|
||||
}
|
||||
|
||||
front
|
||||
{
|
||||
$back;
|
||||
}
|
||||
|
||||
liner
|
||||
{
|
||||
$include/caseSettings!wall/alphat;
|
||||
}
|
||||
|
||||
cylinderHead
|
||||
{
|
||||
$liner;
|
||||
}
|
||||
|
||||
piston
|
||||
{
|
||||
$liner;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -14,12 +14,11 @@ FoamFile
|
||||
object epsilon;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "include/caseSettings"
|
||||
#inputSyntax slash;
|
||||
|
||||
dimensions [0 2 -3 0 0 0 0];
|
||||
|
||||
internalField uniform $:internalField.epsilon;
|
||||
internalField uniform $include/caseSettings!internalField/epsilon;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
@ -35,7 +34,7 @@ boundaryField
|
||||
|
||||
liner
|
||||
{
|
||||
$:wall.epsilon;
|
||||
$include/caseSettings!wall/epsilon;
|
||||
}
|
||||
|
||||
cylinderHead
|
||||
|
||||
@ -13,6 +13,7 @@ FoamFile
|
||||
object boundaryConditions;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
#inputSyntax slash;
|
||||
|
||||
wall
|
||||
{
|
||||
@ -35,13 +36,13 @@ wall
|
||||
k
|
||||
{
|
||||
type kqRWallFunction;
|
||||
value uniform $:internalField.k;
|
||||
value uniform $!internalField/k;
|
||||
}
|
||||
|
||||
epsilon
|
||||
{
|
||||
type epsilonWallFunction;
|
||||
value uniform $:internalField.epsilon;
|
||||
value uniform $!internalField/epsilon;
|
||||
}
|
||||
|
||||
nut
|
||||
|
||||
@ -13,6 +13,7 @@ FoamFile
|
||||
object caseSettings;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
#inputSyntax slash;
|
||||
|
||||
internalField
|
||||
{
|
||||
|
||||
@ -14,12 +14,11 @@ FoamFile
|
||||
object k;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "include/caseSettings"
|
||||
#inputSyntax slash;
|
||||
|
||||
dimensions [0 2 -2 0 0 0 0];
|
||||
|
||||
internalField uniform $:internalField.k;
|
||||
internalField uniform $include/caseSettings!internalField/k;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
@ -35,7 +34,7 @@ boundaryField
|
||||
|
||||
liner
|
||||
{
|
||||
$:wall.k;
|
||||
$include/caseSettings!wall/k;
|
||||
}
|
||||
|
||||
cylinderHead
|
||||
|
||||
@ -14,8 +14,7 @@ FoamFile
|
||||
object nut;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "include/caseSettings"
|
||||
#inputSyntax slash;
|
||||
|
||||
dimensions [0 2 -1 0 0 0 0];
|
||||
|
||||
@ -27,11 +26,26 @@ boundaryField
|
||||
{
|
||||
type wedge;
|
||||
}
|
||||
front { $back; }
|
||||
liner { $:wall.nut; }
|
||||
cylinderHead { $liner; }
|
||||
piston { $liner; }
|
||||
}
|
||||
|
||||
front
|
||||
{
|
||||
$back;
|
||||
}
|
||||
|
||||
liner
|
||||
{
|
||||
$include/caseSettings!wall/nut;
|
||||
}
|
||||
|
||||
cylinderHead
|
||||
{
|
||||
$liner;
|
||||
}
|
||||
|
||||
piston
|
||||
{
|
||||
$liner;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -14,12 +14,11 @@ FoamFile
|
||||
object p;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "include/caseSettings"
|
||||
#inputSyntax slash;
|
||||
|
||||
dimensions [1 -1 -2 0 0 0 0];
|
||||
|
||||
internalField uniform $:internalField.p;
|
||||
internalField uniform $include/caseSettings!internalField/p;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
@ -35,7 +34,7 @@ boundaryField
|
||||
|
||||
liner
|
||||
{
|
||||
$:wall.p;
|
||||
$include/caseSettings!wall/p;
|
||||
}
|
||||
|
||||
cylinderHead
|
||||
|
||||
Reference in New Issue
Block a user