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:
Mark Olesen
2008-06-13 10:43:31 +02:00
parent 64d00dc22b
commit 1e8d4b2a82
16 changed files with 432 additions and 207 deletions

View File

@ -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;
}
// ************************************************************************* //

View File

@ -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
);
};

View File

@ -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 )
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View 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
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1 +1,2 @@
uniform 2
// the trailing ';' shouldn't actually be there, but shouldn't cause problems
uniform 2;