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

Is anyone using Visual Studio Code for OF-programming?

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

Like Tree17Likes
  • 1 Post By chriss85
  • 2 Post By floquation
  • 2 Post By fedvasu
  • 3 Post By arvindpj
  • 2 Post By PositronCascade
  • 4 Post By wyldckat
  • 3 Post By nsf

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 15, 2016, 06:27
Default Is anyone using Visual Studio Code for OF-programming?
  #1
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 18
chriss85 will become famous soon enough
I was wondering if anyone is using Visual Studio Code for developing OpenFOAM applications. What are your experiences? Did you get the debugger working? How about indexing the code?

I found that the indexer fails to finish and vscode has full CPU usage, presumably because of the large code base. It also doesn't give me autocompletion. This might be linked to the unfinished indexing.

If you're using a different editor/IDE, it would be nice to hear about your experience, especially with regards to autocompletion. I'm not sure if it's even reasonable to expect it on such a huge code base using many templates and macros.
Ramzy1990 likes this.
chriss85 is offline   Reply With Quote

Old   December 15, 2016, 07:02
Default
  #2
Senior Member
 
floquation's Avatar
 
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 252
Rep Power: 20
floquation will become famous soon enough
Quote:
Originally Posted by chriss85 View Post
If you're using a different editor/IDE, it would be nice to hear about your experience, especially with regards to autocompletion. I'm not sure if it's even reasonable to expect it on such a huge code base using many templates and macros.
Having started as a Java programmer, Eclipse is my IDE of choice. Originally, this was a purely Java IDE, but over the course of time its large user base created plug-ins for virtually every programming language - including C++.

Does everything work flawlessly? Certainly not... OpenFoam likes to "#include" files in a copy-paste manner, e.g. to declare common variables in solvers. This is perfectly allowed in C++, but the indexer does not understand it. Consequently, virtually all symbols are unknown, and therefore you have nothing: no autocompletion, no "open declaration", etc. Well, that's depressing.

However, with some additional effort, I found a way to "fool Eclipse's indexer". This takes me from this to this. Well, that looks pretty neat!
Disadvantages:
  1. Requires some additional effort on the user's side to get it working
  2. By fooling the indexer, it partially loses the concept of "variable scope", meaning it might not show an error when something is erroneous.
  3. It doesn't work in most #included-files, like "UEqn.H". It only works in "real" C files. (I get around this while developing by simply copying the content of UEqn.H into the solver's main file. Then I have autocompletion etc. When I'm done, I copy it back and #include it.)
Advantages:
  • You have all the neat features like "autocompletion" and "open declaration"!
  • I don't think templating is an issue for the indexer (although it becomes more difficult for you to trace things)
Note that I do not have to "load" OpenFoam into Eclipse. I just specify the relevant include directories, where the indexer can search during indexing.
wyldckat and Ramzy1990 like this.

Last edited by floquation; December 15, 2016 at 08:46.
floquation is offline   Reply With Quote

Old   December 19, 2016, 16:09
Default Similar for Clion
  #3
Member
 
Join Date: Oct 2013
Posts: 92
Rep Power: 12
fedvasu is on a distinguished road
CLion (basically Intellij for C++).

I am doing something similar with Clion as floquation has done with Eclipse.

However you won't get full IDE capabilities unless you make wmake system of OpenFOAM work with the IDE.

I came across an old tutorial which turned Netbeans into a full fledged OF IDE with wmake as the build system integrated with it.

But it was for OF-1.6, I don't think that project is maintained anymore
wyldckat and Ramzy1990 like this.
fedvasu is offline   Reply With Quote

Old   December 19, 2016, 17:28
Default Qt Creator is good too!
  #4
Member
 
Arvind Jay
Join Date: Sep 2012
Posts: 96
Rep Power: 14
arvindpj is on a distinguished road
I find Qt Creator more flexible.
  • It does have auto-complete by default and does not require convoluted set-up as Eclipse.
  • Debugging is a breeze. It is quite similar to VS. All we I had do is specify the working directory.
  • Can be coupled with gdbOF in a simple window.

Cheers
Attached Images
File Type: jpg qt_IDE.jpg (69.9 KB, 279 views)
File Type: jpg debug.jpg (74.6 KB, 221 views)
File Type: jpg gdbof.jpg (127.5 KB, 211 views)
elvis, wyldckat and Ramzy1990 like this.
arvindpj is offline   Reply With Quote

Old   December 26, 2016, 20:36
Default
  #5
Member
 
Hasan Celik
Join Date: Sep 2016
Posts: 64
Rep Power: 9
PositronCascade is on a distinguished road
I use Sublime Text. It is also very good editor
wyldckat and frantov like this.
PositronCascade is offline   Reply With Quote

Old   December 27, 2016, 15:12
Default
  #6
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quote:
Originally Posted by chriss85 View Post
I was wondering if anyone is using Visual Studio Code for developing OpenFOAM applications. What are your experiences? Did you get the debugger working? How about indexing the code?
Quick answer: Last time I checked (3-5 years ago?), MSVC is unable to handle OpenFOAM without a lot of code readjusting. I'm mostly referring to compiling, but if it's not able to compile, then it will have a considerable hard-time parsing the source code.

The only people I know that are possibly still working on this is Hrvoje Jasak at Wikki.co.uk, who had an old version of foam-extend built with MSVC and about a year ago he asked who was interested in this: FOAM on Windows, Linux and Mac - post #4


Nonetheless, I use MSVC occasionally only as a code editor for our work at blueCAPE in developing solvers and utilities, mostly still based on OpenFOAM 2.2.x and the project in MSVC 2008 Express and MSVC 2010 Pro; in both the source code project is configured as a "utility" and not as an actual C++ project, and the included folders from OpenFOAM are only the minimum necessary ("OpenFOAM/lnInclude" and "finiteVolume/lnInclude"). MSVC's auto-complete has a lot of difficulty in figuring out several details about how the OpenFOAM code works, so it has a lot of missing auto-complete features.
__________________
wyldckat is offline   Reply With Quote

Old   December 28, 2016, 04:43
Default
  #7
nsf
Senior Member
 
Nicolas Edh
Join Date: Mar 2010
Location: Uppsala, Sweden
Posts: 123
Rep Power: 18
nsf is on a distinguished road
Hi,

I also use qtcreator. Very little hassle, debugging and building works fine and most autocompletion works. And you can ctrl-click on a declaration and it will take you to the source. There is a somewhat outdated guide here

https://openfoamwiki.net/index.php/H...with_QtCreator

I wrote a script that sets everything up for you. It is posted on the link above but I think it might not work with recent versions of qtcreator.

Best regards
Nicolas
wyldckat, arvindpj and Ramzy1990 like this.
nsf is offline   Reply With Quote

Old   January 2, 2017, 08:30
Default
  #8
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 18
chriss85 will become famous soon enough
Thanks for your replies, I will definitely check out QT Creator.
chriss85 is offline   Reply With Quote

Old   September 7, 2017, 04:12
Default
  #9
New Member
 
Tong Li
Join Date: Mar 2017
Posts: 2
Rep Power: 0
lt123sss is on a distinguished road
Hi Arvind, I am programming with qt creator too. However, I do not know how to debug in qt creator with GDBOF. Can you give me some tips on how to implement GDB of in qt creator? Thank you very much.
lt123sss is offline   Reply With Quote

Old   September 10, 2017, 18:54
Default
  #10
New Member
 
Huipeng Xiao
Join Date: Sep 2017
Posts: 7
Rep Power: 8
Huipeng Xiao is on a distinguished road
Most of people perfer to use IDE, but I use vim as text edite, gdb as debug.

Sent from my Le X620 using CFD Online Forum mobile app
Huipeng Xiao is offline   Reply With Quote

Reply

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
Compiling udf in visual studio: unresolved external symbol ghost82 Fluent UDF and Scheme Programming 4 July 23, 2021 14:59
The udf.h headers are unable to open- in VISUAL STUDIO 13 sanjeetlimbu Fluent UDF and Scheme Programming 4 May 2, 2016 06:38
UDF help for Rapid compression machine ECM. sanjeetlimbu Fluent UDF and Scheme Programming 0 March 17, 2015 23:45
Compiling Fluent UDF with Visual Studio kamnaz Fluent UDF and Scheme Programming 0 August 28, 2014 13:58
Error with visual studio installation akshaymanikjade FLUENT 1 January 31, 2013 00:30


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