View Issue Details

IDProjectCategoryView StatusLast Update
0003158OpenFOAMBugpublic2019-02-04 09:43
ReporterfedeAssigned Towill 
Status resolvedResolutionfixed 
PlatformLinuxOSDebian OS VersionStretch
Product Versiondev 
Fixed in Versiondev 
Summary0003158: codeOptions entry no longer supported by #codeStream
DescriptionDear Henry,
after the recent updates to the implementation of dynamicCode, the codeOptions entry is no longer read in the codeStream functions. This feature was supported in the previous versions of the code (OpenFOAM-6 for instance). This causes that some coded functions working with previous (but still recent) versions of OpenFOAM.
The reason is that in the newest implementation of codeStream (available only in OpenFOAM-dev) some lines are missing. Everything works in OpenFOAM-6.
Please find attached the files with the patch to revert the missing functionality.

Wish this helps.
Have a nice week end,


Steps To ReproduceTry to include a "codeOption" entry in a codedFunction and a file "fileInSystemFolder.H" in the path specified in the codeOptions. The code will not work (of course "ileInSystemFolder.H" must be located in a folder which is not included in the PATH, for instance $FOAM_CASE/system).


<fileEntry> ( #codeStream

    //! Optional:
          #include "fileInSystemFolder.H"
Additional InformationTesting was done in OpenFOAM-dev, commit 5afec3aae0a06adc5e1af0a23f7afad94e5d4b60.
TagsNo tags attached.



2019-02-01 18:26


codeStream.C (12,277 bytes)
dynamicCodeContext.C (3,390 bytes)


2019-02-01 18:28

reporter   ~0010277

Apologies with my English.
"This causes that some coded functions working with previous (but still recent) versions of OpenFOAM."


"This causes that some coded functions working with previous (but still recent) versions of OpenFOAM do not work with the latest commits of OpenFOAM-dev."


2019-02-04 09:43

manager   ~0010278

Thanks you for the report.

I haven't applied your changes. They do not resolve the problem in the way that the design intends. "codeOptions" was not intended to be part of the list of code keys, as it is not actually C++ code and therefore has to be handled a little differently. Similarly, "codeLibs" was also missing, but should not be one of the code keys for the same reason.

What I forgot to add in my changes last week was just the reading and setting of the options and libs data in the dynamicCodeContext constructor. I have now done this as part of commit 528dccc0 in dev. It should now work as it did before.

You did not provide a test case, so I cannot be 100% sure that this fixes your problem. I actually did my testing with codedFunctionObject. If your problem persists, please open another report and attach an example which reproduces the failure.

Issue History

Date Modified Username Field Change
2019-02-01 18:26 fede New Issue
2019-02-01 18:26 fede File Added: codeStream.C
2019-02-01 18:26 fede File Added: dynamicCodeContext.C
2019-02-01 18:28 fede Note Added: 0010277
2019-02-04 09:31 will View Status private => public
2019-02-04 09:32 will Note View State: 0010277: public
2019-02-04 09:43 will Assigned To => will
2019-02-04 09:43 will Status new => resolved
2019-02-04 09:43 will Resolution open => fixed
2019-02-04 09:43 will Fixed in Version => dev
2019-02-04 09:43 will Note Added: 0010278