CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

can I access to the "dict" object from codeWrite in a coded function object?

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By olesen

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 22, 2021, 09:12
Default can I access to the "dict" object from codeWrite in a coded function object?
  #1
New Member
 
ONESP-RO
Join Date: Feb 2021
Posts: 23
Rep Power: 2
NotOverUnderated is on a distinguished road
Hello,

In a coded function object, I can access the "dict" object from within the codeRead section. However, this object is not available in the codeWrite section. Is it possible to access this object without manually creating the dictionary manually.


Code:
mfunc
{
      type coded
      libs ("libutilityFunctionObjects.so");
      name example;

      codeRead
      #{
             // the object 'dict' is available here.
      #};

      codeWrite
      #{
           // but I can't access it here. How can I access that object?
           // I have tried: this->dict but it doesn't work.
      #};
}
I appreciate your help.

Thank you
NotOverUnderated is offline   Reply With Quote

Old   October 28, 2021, 15:53
Default
  #2
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,332
Rep Power: 33
olesen will become famous soon enougholesen will become famous soon enough
Quote:
Originally Posted by NotOverUnderated View Post
Hello,

In a coded function object, I can access the "dict" object from within the codeRead section. However, this object is not available in the codeWrite section. Is it possible to access this object without manually creating the dictionary manually.


Code:
mfunc
{
      type coded
      libs ("libutilityFunctionObjects.so");
      name example;

      codeRead
      #{
             // the object 'dict' is available here.
      #};

      codeWrite
      #{
           // but I can't access it here. How can I access that object?
           // I have tried: this->dict but it doesn't work.
      #};
}
I appreciate your help.

Thank you

That got added into the OpenFOAM-v2106 release - see the merge-request information for the related commits.



https://develop.openfoam.com/Develop...ts/466/commits


Note that it uses 'this->codeContext()' to access the dictionary in question (or at least part of it). If you run into bugs, open an issue on develop.openfoam.com to discuss there.
NotOverUnderated likes this.
olesen is offline   Reply With Quote

Old   October 28, 2021, 19:46
Default
  #3
New Member
 
ONESP-RO
Join Date: Feb 2021
Posts: 23
Rep Power: 2
NotOverUnderated is on a distinguished road
Thank you for the answer. I have to upgrade to that latest version. Very exciting.
NotOverUnderated is offline   Reply With Quote

Reply

Tags
coded function object, functionobjects, openfoam

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ParaView for OF-1.6-ext Chrisi1984 OpenFOAM Installation 0 December 31, 2010 07:42
Version 15 on Mac OS X gschaider OpenFOAM Installation 113 December 2, 2009 11:23
Compilation error OF1.5-dev on Suse10.3 darenyang OpenFOAM Installation 0 April 29, 2009 05:55
Compilation errors in ThirdPartymallochoard feng_w OpenFOAM Installation 1 January 25, 2009 07:59
[blockMesh] BlockMeshmergePatchPairs hjasak OpenFOAM Meshing & Mesh Conversion 11 August 15, 2008 08:36


All times are GMT -4. The time now is 10:24.