Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
f9d4a778
Commit
f9d4a778
authored
Sep 06, 2013
by
mattijs
Browse files
ENH: #calc: allow in primitiveEntry
parent
d6ae8d56
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/db/dictionary/functionEntries/calcEntry/calcEntry.C
View file @
f9d4a778
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011
-2013
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -37,6 +37,14 @@ namespace functionEntries
{
defineTypeNameAndDebug
(
calcEntry
,
0
);
addToMemberFunctionSelectionTable
(
functionEntry
,
calcEntry
,
execute
,
dictionaryIstream
);
addToMemberFunctionSelectionTable
(
functionEntry
,
...
...
@@ -96,4 +104,48 @@ bool Foam::functionEntries::calcEntry::execute
}
bool
Foam
::
functionEntries
::
calcEntry
::
execute
(
dictionary
&
parentDict
,
Istream
&
is
)
{
Info
<<
"Using #calcEntry at line "
<<
is
.
lineNumber
()
<<
" in file "
<<
parentDict
.
name
()
<<
endl
;
dynamicCode
::
checkSecurity
(
"functionEntries::calcEntry::execute(..)"
,
parentDict
);
// Read string
string
s
(
is
);
// Make sure we stop this entry
//is.putBack(token(token::END_STATEMENT, is.lineNumber()));
// Construct codeDict for codeStream
// must reference parent for stringOps::expand to work nicely.
dictionary
codeSubDict
;
codeSubDict
.
add
(
"code"
,
"os << ("
+
s
+
");"
);
dictionary
codeDict
(
parentDict
,
codeSubDict
);
codeStream
::
streamingFunctionType
function
=
codeStream
::
getFunction
(
parentDict
,
codeDict
);
// use function to write stream
OStringStream
os
(
is
.
format
());
(
*
function
)(
os
,
parentDict
);
// get the entry from this stream
IStringStream
resultStream
(
os
.
str
());
parentDict
.
read
(
resultStream
);
return
true
;
}
// ************************************************************************* //
src/OpenFOAM/db/dictionary/functionEntries/calcEntry/calcEntry.H
View file @
f9d4a778
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011
-2013
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -89,6 +89,9 @@ public:
// Member Functions
//- Execute the functionEntry in a sub-dict context
static
bool
execute
(
dictionary
&
parentDict
,
Istream
&
);
//- Execute the functionEntry in a primitiveEntry context
static
bool
execute
(
const
dictionary
&
parentDict
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment