testDict 3.85 KB
Newer Older
shunbo's avatar
shunbo committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2112                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      dictionary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#sinclude   "someUnknownFile"
#sinclude   "$FOAM_CASE/someUnknownFile"
#includeIfPresent "$FOAM_CASE/someUnknownFile-$FOAM_CASENAME"

zeroVelocity    uniform (0 0 0);

internalField   uniform 1;

// supply defaults
#default internalField  uniform 10;
#default dimensions     [ 1 2 -2 0 0 0 0 ];
#overwrite dimensions   [ 0 2 -2 0 0 0 0 ];
// #warn       dimensions      [ 0 2 -2 0 0 0 0 ];
// #error      dimensions      [ 0 2 -2 0 0 0 0 ];

active
{
    type            turbulentIntensityKineticEnergyInlet;
    intensity       0.1;
    value           $internalField;
}

inactive
{
    type            zeroGradient;
}


// Indirection
varType active;

// Indirection of values
x 5;
varName x;


// Indirection for keys
key inlet_9;


boundaryField
{
    Default_Boundary_Region
    {
        type            zeroGradient;
    }

    inlet_1  { $active }
    inlet_2  { $inactive }
    inlet_3  { $inactive }
    inlet_4  { $inactive }
    inlet_5  "a primitiveEntry is squashed by a directory entry";
    inlet_5  { $inactive }
    inlet_6a { $...inactive }   // Relative scoping - fairly horrible to use
    inlet_6b { $^inactive }     // Absolute scoping
    inlet_6c { key ${/key}; }   // Absolute scoping

    inlet_7  { ${inactive}}     // Test variable expansion
    inlet_8  { $inactive }

    // Variable expansion for a keyword
    ${key}   { $inactive }

    #include "testDictInc"

    outletBase
    {
        type            inletOutlet;
        inletValue      $internalField;
        value           #include "value";
        // error           #remove self;
        x               ${${varName}};  // Test indirection/recursive expansion
        y               6;
    }

    outlet
    {
        $outletBase
    }

    Default_Boundary_Region
    {
        valueOut        $zeroVelocity;
    }

    // this should have no effect (not in scope)
    #remove inactive

    // But this should work to remove things in different scopes
    #remove "/zeroVelocity"

    inlet_7  { ${inactive} }    // Test variable expansion
    inlet_8  { $inactive }

    inlet_7a { ${${varType}} }  // Test indirection/recursive expansion
    inlet_7b { ${${varType}} }  // Test indirection/recursive expansion

    #overwrite inlet_8  { type none; }
}


// No patterns with scoped removal
// #remove "/boundaryField/outletB.*"
#remove "/boundaryField/outletBase"

#include "testDict2"

verbatim #{

    This is a somewhat larger chunk of verbatim text that we would much
    prefer to move as a token rather than copying its entire content each
    time we do parsing or need to resize the token list.

#};

foo
{
    $active
}

bar
{
    $active
}

baz
{
    $active
}

"anynumber.*"
{
    $active
}

// This should work
#remove x

// This should work too
#remove ( bar baz )

// Remove a sub-dictionary entry
#remove "/anynumber.*/value"

// Removal does not auto-vivify
#remove "/nonExistentDict/value"

// Add into existing dictionary
"/anynumber.*/someValue"  100;

// Auto-vivify
// - but currently cannot auto-vivify entries with dictionary patterns
"/abd/someValue"    100;
"/def/'someValue.*" 100;


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //