mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
dictionary functionEntries cleanup
* added '#remove' function * changed insert() method name to more general execute() * using #inputMode or #remove within a primitiveEntry now provokes an error * adjusted the dictionaryTest accordingly
This commit is contained in:
@ -42,24 +42,17 @@ namespace functionEntries
|
||||
(
|
||||
functionEntry,
|
||||
calcEntry,
|
||||
insert,
|
||||
execute,
|
||||
primitiveEntryIstream
|
||||
);
|
||||
|
||||
addToMemberFunctionSelectionTable
|
||||
(
|
||||
functionEntry,
|
||||
calcEntry,
|
||||
insert,
|
||||
dictionaryIstream
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionEntries::calcEntry::insert
|
||||
bool Foam::functionEntries::calcEntry::execute
|
||||
(
|
||||
const dictionary& parentDict,
|
||||
primitiveEntry& entry,
|
||||
@ -75,14 +68,4 @@ bool Foam::functionEntries::calcEntry::insert
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionEntries::calcEntry::insert
|
||||
(
|
||||
dictionary& parentDict,
|
||||
Istream& is
|
||||
)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -69,18 +69,13 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
static bool insert
|
||||
static bool execute
|
||||
(
|
||||
const dictionary& parentDict,
|
||||
primitiveEntry& entry,
|
||||
Istream& is
|
||||
);
|
||||
|
||||
static bool insert
|
||||
(
|
||||
dictionary& parentDict,
|
||||
Istream& is
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -1,17 +1,19 @@
|
||||
/*-------------------------------*- C++ -*---------------------------------*\
|
||||
| ========= |
|
||||
| \\ / OpenFOAM |
|
||||
| \\ / |
|
||||
| \\ / The Open Source CFD Toolbox |
|
||||
| \\/ http://www.OpenFOAM.org |
|
||||
\*-------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
|
||||
root "";
|
||||
case "";
|
||||
instance "";
|
||||
local "";
|
||||
|
||||
class dictionary;
|
||||
object testDict;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
#inputMode merge
|
||||
|
||||
dimensions [ 0 2 -2 0 0 0 0 ];
|
||||
internalField uniform 1;
|
||||
@ -29,7 +31,6 @@ inactive
|
||||
type zeroGradient;
|
||||
}
|
||||
|
||||
|
||||
boundaryField
|
||||
{
|
||||
Default_Boundary_Region
|
||||
@ -40,6 +41,12 @@ boundaryField
|
||||
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_6 { $inactive }
|
||||
inlet_7 { $inactive }
|
||||
inlet_8 { $inactive }
|
||||
|
||||
#include "testDictInc"
|
||||
|
||||
@ -48,8 +55,44 @@ boundaryField
|
||||
type inletOutlet;
|
||||
inletValue $internalField;
|
||||
value #include "value";
|
||||
// error #remove self;
|
||||
x 5;
|
||||
y 6;
|
||||
another #calc{x $x; y $y;};
|
||||
}
|
||||
|
||||
// this should have no effect
|
||||
#remove inactive
|
||||
|
||||
inlet_7 { $active }
|
||||
#inputMode overwrite
|
||||
inlet_8 { $active }
|
||||
}
|
||||
|
||||
// NB: the inputMode has a global scope
|
||||
#inputMode merge
|
||||
#include "testDict2"
|
||||
|
||||
foo
|
||||
{
|
||||
$active
|
||||
}
|
||||
|
||||
bar
|
||||
{
|
||||
$active
|
||||
}
|
||||
|
||||
baz
|
||||
{
|
||||
$active
|
||||
}
|
||||
|
||||
|
||||
// this should work
|
||||
#remove active
|
||||
|
||||
// this should work too
|
||||
#remove ( bar baz )
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
30
applications/test/dictionary/testDict2
Normal file
30
applications/test/dictionary/testDict2
Normal file
@ -0,0 +1,30 @@
|
||||
/*-------------------------------*- C++ -*---------------------------------*\
|
||||
| ========= |
|
||||
| \\ / OpenFOAM |
|
||||
| \\ / |
|
||||
| \\ / The Open Source CFD Toolbox |
|
||||
| \\/ http://www.OpenFOAM.org |
|
||||
\*-------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object testDict;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
boundaryField
|
||||
{
|
||||
Default_Boundary_Region
|
||||
{
|
||||
value $internalField;
|
||||
note "actually a noslip wall";
|
||||
}
|
||||
|
||||
inlet_3 "a primitiveEntry squashes directory entry";
|
||||
}
|
||||
|
||||
#inputMode overwrite
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -1 +1,2 @@
|
||||
uniform 2
|
||||
// the trailing ';' shouldn't actually be there, but shouldn't cause problems
|
||||
uniform 2;
|
||||
|
||||
Reference in New Issue
Block a user