BUG: codedFunctionObject:get codeData to work

This commit is contained in:
mattijs
2012-03-09 08:50:03 +00:00
parent d9c4c8f2b3
commit 85c2251b16
2 changed files with 23 additions and 3 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -63,6 +63,7 @@ void Foam::codedFunctionObject::prepare
dynCode.setFilterVariable("codeRead", codeRead_); dynCode.setFilterVariable("codeRead", codeRead_);
dynCode.setFilterVariable("codeExecute", codeExecute_); dynCode.setFilterVariable("codeExecute", codeExecute_);
dynCode.setFilterVariable("codeEnd", codeEnd_); dynCode.setFilterVariable("codeEnd", codeEnd_);
dynCode.setFilterVariable("codeData", codeData_);
//dynCode.setFilterVariable("codeWrite", codeWrite_); //dynCode.setFilterVariable("codeWrite", codeWrite_);
// compile filtered C template // compile filtered C template
@ -191,6 +192,24 @@ bool Foam::codedFunctionObject::read(const dictionary& dict)
{ {
dict.lookup("redirectType") >> redirectType_; dict.lookup("redirectType") >> redirectType_;
const entry* dataPtr = dict.lookupEntryPtr
(
"codeData",
false,
false
);
if (dataPtr)
{
codeData_ = stringOps::trim(dataPtr->stream());
stringOps::inplaceExpand(codeData_, dict);
dynamicCodeContext::addLineDirective
(
codeData_,
dataPtr->startLineNumber(),
dict.name()
);
}
const entry* readPtr = dict.lookupEntryPtr const entry* readPtr = dict.lookupEntryPtr
( (
"codeRead", "codeRead",
@ -233,7 +252,7 @@ bool Foam::codedFunctionObject::read(const dictionary& dict)
false, false,
false false
); );
if (execPtr) if (endPtr)
{ {
codeEnd_ = stringOps::trim(endPtr->stream()); codeEnd_ = stringOps::trim(endPtr->stream());
stringOps::inplaceExpand(codeEnd_, dict); stringOps::inplaceExpand(codeEnd_, dict);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -64,6 +64,7 @@ protected:
word redirectType_; word redirectType_;
string codeData_;
string codeRead_; string codeRead_;
string codeExecute_; string codeExecute_;
string codeEnd_; string codeEnd_;