dictionary: Set the default scoping syntax to 'slash'

The new optional 'slash' scoping syntax is now the default and provides a more
intuitive and flexible syntax than the previous 'dot' syntax, corresponding to
the common directory/file access syntax used in UNIX, providing support for
reading entries from other dictionary files.

In the 'slash' syntax
    '/' is the scope operator
    '../' is the parent dictionary scope operator
    '!' is the top-level dictionary scope operator

Examples:

    internalField 3.4;

    active
    {
        type            fixedValue;
        value.air       $internalField;
    }

    inactive
    {
        type            anotherFixedValue;

        value           $../active/value.air;
        anotherValue    $!active/value.air;

        sub
        {
            value           $../../active/value.air;
            anotherValue    $!active/value.air;
        }
    }

    "U.*"
    {
        solver GAMG;
    }

    e.air
    {
        $U.air;
    }

    external
    {
        value $testSlashDict2!active/value.air;
    }

    active2
    {
        $testSlashDict2!active;
    }

If there is a part of the keyword before the '!' then this is taken to be the
file name of the dictionary from which the entry will be looked-up using the
part of the keyword after the '!'.  For example given a file testSlashDict containing

    internalField 5.6;

    active
    {
        type            fixedValue;
        value.air       $internalField;
    }

entries from it can be read directly from another file, e.g.

    external
    {
        value $testSlashDict2!active/value.air;
    }

    active2
    {
        $testSlashDict2!active;
    }

    which expands to

    external
    {
        value           5.6;
    }

    active2
    {
        type            fixedValue;
        value.air       5.6;
    }

These examples are provided in applications/test/dictionary.

The the default syntax can be changed from 'slash' to 'dot' in etc/controlDict
to revert to the previous behaviour:

OptimisationSwitches
{
.
.
.
    // Default dictionary scoping syntax
    inputSyntax slash;  // Change to dot for previous behaviour
}

or within a specific dictionary by adding the entry

See applications/test/dictionary/testDotDict.
This commit is contained in:
Henry Weller
2020-07-23 20:36:51 +01:00
parent 0257ab1459
commit 6c8732df5b
37 changed files with 44 additions and 72 deletions

View File

@ -81,7 +81,7 @@ OptimisationSwitches
stopAtWriteNowSignal -1;
// Default dictionary scoping syntax
inputSyntax dot;
inputSyntax slash;
}

View File

@ -13,7 +13,6 @@ FoamFile
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputSyntax slash;
backgroundMesh
{

View File

@ -13,7 +13,6 @@ FoamFile
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputSyntax slash;
backgroundMesh
{

View File

@ -13,7 +13,6 @@ FoamFile
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputSyntax slash;
// Example configuration:
// - Cylindrical mesh along z-axis (0 < z < 10)

View File

@ -13,7 +13,6 @@ FoamFile
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputSyntax slash;
backgroundMesh
{

View File

@ -13,7 +13,6 @@ FoamFile
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputSyntax slash;
backgroundMesh
{

View File

@ -13,7 +13,6 @@ FoamFile
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputSyntax slash;
// Example configuration:
// - Cylindrical mesh along z-axis (0 < z < 10)

View File

@ -13,7 +13,6 @@ FoamFile
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputSyntax slash;
backgroundMesh
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2019-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -49,7 +49,7 @@ Foam::functionEntries::inputSyntaxEntry::inputSyntax
"inputSyntax"
)
)
: DOT
: SLASH
);
// Initialise the current dictionary syntax to the default

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2019-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -35,12 +35,13 @@ Description
The possible input syntax:
- \par slash use '/' as the scope operator
'../' to go to the parent dictionary
and '!' to go to the top-level dictionary
'!' to go to the top-level dictionary
- \par dot use '.' as the scope operator
'..' to go to the parent dictionary
and ':' to go to the top-level dictionary
':' to go to the top-level dictionary
The default dictionary syntax is \c dot but can be changed to \c slash in
The default dictionary syntax is \c slash but can be changed to \c dot in
etc/controlDict
\verbatim
OptimisationSwitches
@ -48,7 +49,7 @@ Description
.
.
.
inputSyntax slash;
inputSyntax dot;
}
\endverbatim

View File

@ -14,7 +14,6 @@ FoamFile
object T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputSyntax slash;
dimensions [0 0 0 1 0 0 0];

View File

@ -14,7 +14,6 @@ FoamFile
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputSyntax slash;
dimensions [0 1 -1 0 0 0 0];

View File

@ -14,7 +14,6 @@ FoamFile
object air;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputSyntax slash;
dimensions [0 0 0 0 0 0 0];

View File

@ -14,7 +14,6 @@ FoamFile
object alphat;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputSyntax slash;
dimensions [1 -1 -1 0 0 0 0];

View File

@ -14,7 +14,6 @@ FoamFile
object epsilon;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputSyntax slash;
dimensions [0 2 -3 0 0 0 0];

View File

@ -13,7 +13,6 @@ FoamFile
object boundaryConditions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputSyntax slash;
wall
{

View File

@ -13,7 +13,6 @@ FoamFile
object caseSettings;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputSyntax slash;
internalField
{

View File

@ -14,7 +14,6 @@ FoamFile
object k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputSyntax slash;
dimensions [0 2 -2 0 0 0 0];

View File

@ -14,7 +14,6 @@ FoamFile
object nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputSyntax slash;
dimensions [0 2 -1 0 0 0 0];

View File

@ -14,7 +14,6 @@ FoamFile
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputSyntax slash;
dimensions [1 -1 -2 0 0 0 0];

View File

@ -14,7 +14,6 @@ FoamFile
object include;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputSyntax slash;
sleeve
{

View File

@ -13,7 +13,6 @@ FoamFile
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputSyntax slash
domain
{

View File

@ -14,7 +14,6 @@ FoamFile
object caseProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputSyntax slash;
calculated
{

View File

@ -14,7 +14,6 @@ FoamFile
object caseSummary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputSyntax slash;
innerInlet
{

View File

@ -14,7 +14,6 @@ FoamFile
object dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputSyntax slash;
#include "${FOAM_CASE}/constant/caseSettings"

View File

@ -13,7 +13,6 @@ FoamFile
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputSyntax slash
domain
{

View File

@ -14,7 +14,6 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputSyntax slash;
#include "$FOAM_CASE/system/blockMeshDict"

View File

@ -13,7 +13,6 @@ FoamFile
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputSyntax slash;
backgroundMesh
{

View File

@ -13,7 +13,6 @@ FoamFile
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputSyntax slash;
backgroundMesh
{

View File

@ -13,7 +13,6 @@ FoamFile
object snappyHexMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputSyntax slash;
// Which of the steps to run
castellatedMesh true;

View File

@ -13,7 +13,6 @@ FoamFile
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputSyntax slash;
backgroundMesh
{

View File

@ -13,7 +13,6 @@ FoamFile
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputSyntax slash;
backgroundMesh
{

View File

@ -28,20 +28,20 @@ convertToMeters 1;
vertices
(
( 0 0 -1)
($:backgroundMesh.length 0 -1)
( 0 $:backgroundMesh.rA -1)
($:backgroundMesh.length $:backgroundMesh.rA -1)
($!backgroundMesh/length 0 -1)
( 0 $!backgroundMesh/rA -1)
($!backgroundMesh/length $!backgroundMesh/rA -1)
( 0 0 0)
($:backgroundMesh.length 0 0)
( 0 $:backgroundMesh.rA 0)
($:backgroundMesh.length $:backgroundMesh.rA 0)
($!backgroundMesh/length 0 0)
( 0 $!backgroundMesh/rA 0)
($!backgroundMesh/length $!backgroundMesh/rA 0)
);
blocks
(
hex (0 1 3 2 4 5 7 6)
($:backgroundMesh.lengthCells $:backgroundMesh.rAcells 1)
($!backgroundMesh/lengthCells $!backgroundMesh/rAcells 1)
simpleGrading (1 0.5 1)
);

View File

@ -27,20 +27,20 @@ convertToMeters 1;
vertices
(
( 0 0 -1)
($:backgroundMesh.length 0 -1)
( 0 $:backgroundMesh.rA -1)
($:backgroundMesh.length $:backgroundMesh.rA -1)
($!backgroundMesh/length 0 -1)
( 0 $!backgroundMesh/rA -1)
($!backgroundMesh/length $!backgroundMesh/rA -1)
( 0 0 0)
($:backgroundMesh.length 0 0)
( 0 $:backgroundMesh.rA 0)
($:backgroundMesh.length $:backgroundMesh.rA 0)
($!backgroundMesh/length 0 0)
( 0 $!backgroundMesh/rA 0)
($!backgroundMesh/length $!backgroundMesh/rA 0)
);
blocks
(
hex (0 1 3 2 4 5 7 6)
($:backgroundMesh.lengthCells $:backgroundMesh.rAcells 1)
($!backgroundMesh/lengthCells $!backgroundMesh/rAcells 1)
simpleGrading (1 0.5 1)
);

View File

@ -27,20 +27,20 @@ convertToMeters 1;
vertices
(
( 0 0 -1)
($:backgroundMesh.length 0 -1)
( 0 $:backgroundMesh.rA -1)
($:backgroundMesh.length $:backgroundMesh.rA -1)
($!backgroundMesh/length 0 -1)
( 0 $!backgroundMesh/rA -1)
($!backgroundMesh/length $!backgroundMesh/rA -1)
( 0 0 0)
($:backgroundMesh.length 0 0)
( 0 $:backgroundMesh.rA 0)
($:backgroundMesh.length $:backgroundMesh.rA 0)
($!backgroundMesh/length 0 0)
( 0 $!backgroundMesh/rA 0)
($!backgroundMesh/length $!backgroundMesh/rA 0)
);
blocks
(
hex (0 1 3 2 4 5 7 6)
($:backgroundMesh.lengthCells $:backgroundMesh.rAcells 1)
($!backgroundMesh/lengthCells $!backgroundMesh/rAcells 1)
simpleGrading (1 0.5 1)
);

View File

@ -27,20 +27,20 @@ convertToMeters 1;
vertices
(
( 0 0 -1)
($:backgroundMesh.length 0 -1)
( 0 $:backgroundMesh.rA -1)
($:backgroundMesh.length $:backgroundMesh.rA -1)
($!backgroundMesh/length 0 -1)
( 0 $!backgroundMesh/rA -1)
($!backgroundMesh/length $!backgroundMesh/rA -1)
( 0 0 0)
($:backgroundMesh.length 0 0)
( 0 $:backgroundMesh.rA 0)
($:backgroundMesh.length $:backgroundMesh.rA 0)
($!backgroundMesh/length 0 0)
( 0 $!backgroundMesh/rA 0)
($!backgroundMesh/length $!backgroundMesh/rA 0)
);
blocks
(
hex (0 1 3 2 4 5 7 6)
($:backgroundMesh.lengthCells $:backgroundMesh.rAcells 1)
($!backgroundMesh/lengthCells $!backgroundMesh/rAcells 1)
simpleGrading (1 0.5 1)
);

View File

@ -27,20 +27,20 @@ convertToMeters 1;
vertices
(
( 0 0 -1)
($:backgroundMesh.length 0 -1)
( 0 $:backgroundMesh.rA -1)
($:backgroundMesh.length $:backgroundMesh.rA -1)
($!backgroundMesh/length 0 -1)
( 0 $!backgroundMesh/rA -1)
($!backgroundMesh/length $!backgroundMesh/rA -1)
( 0 0 0)
($:backgroundMesh.length 0 0)
( 0 $:backgroundMesh.rA 0)
($:backgroundMesh.length $:backgroundMesh.rA 0)
($!backgroundMesh/length 0 0)
( 0 $!backgroundMesh/rA 0)
($!backgroundMesh/length $!backgroundMesh/rA 0)
);
blocks
(
hex (0 1 3 2 4 5 7 6)
($:backgroundMesh.lengthCells $:backgroundMesh.rAcells 1)
($!backgroundMesh/lengthCells $!backgroundMesh/rAcells 1)
simpleGrading (1 0.5 1)
);