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

Find List of Options for given dictionary key programmatically

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 29, 2018, 17:30
Default Find List of Options for given dictionary key programmatically
  #1
Member
 
James Wright
Join Date: Oct 2015
Posts: 40
Rep Power: 10
u2berggeist is on a distinguished road
So I'm working on a vim plugin for OpenFOAM that will hopefully provide some completion help.

To do that, I need a list of possible options for a given dictionary key. How can I access the available options easily and programmatically?

I've found a brute force way of doing it; misname a option and the error message will show the available options:

Code:
--> FOAM FATAL IO ERROR: 
Unknown ddt scheme Eulers

Valid ddt schemes are :

8
(
CoEuler
CrankNicolson
Euler
SLTS
backward
bounded
localEuler
steadyState
)
While this works, I was wondering if there was a way to get it a bit more directly.

The way I see it, it could be done by two ways: either go through OpenFOAM to find it (ie. mangle around with C++ or use a builtin function that I don't know about) OR find out how it creates the list in the first place.

I've tried looking at the source code (look at "OpenFOAM/OpenFOAM-v1712/src/finiteVolume/lnInclude/ddtScheme.C" at line 76 for the code that created the output of the above example), but I have no experience in C++ (or any statically typed language for that matter) and have had a very difficult time figuring it out.

Any help would be greatly appreciated!
u2berggeist is offline   Reply With Quote

Old   July 3, 2018, 12:32
Default
  #2
Member
 
James Wright
Join Date: Oct 2015
Posts: 40
Rep Power: 10
u2berggeist is on a distinguished road
Update on the "How do they know whether an option is available?" problem; The list that is output through the error message comes from a runTimeSelectionTable.

Now my question turns to how can I access said runTimeSelectionTable?

Last edited by u2berggeist; July 3, 2018 at 12:33. Reason: grammar
u2berggeist is offline   Reply With Quote

Reply

Tags
dictionary, openfoam, options


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
GPU Linear Solvers for OpenFOAM gocarts OpenFOAM Announcements from Other Sources 37 August 17, 2022 14:22
OpenFOAM 1.6-ext git installation on Ubuntu 11.10 x64 Attesz OpenFOAM Installation 45 January 13, 2012 12:38
Problem Building OF on Centos cluster (no admin rights) CKH OpenFOAM Installation 5 November 13, 2011 06:32
OpenFOAM on MinGW crosscompiler hosted on Linux allenzhao OpenFOAM Installation 127 January 30, 2009 19:08
Errors running allwmake in OpenFOAM141dev with WM_COMPILE_OPTION%3ddebug unoder OpenFOAM Installation 11 January 30, 2008 20:30


All times are GMT -4. The time now is 04:15.