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

OpenFOAM and YouCompleteMe

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By gaza
  • 1 Post By gaza
  • 1 Post By gaza

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 26, 2018, 04:22
Default OpenFOAM and YouCompleteMe
  #1
Senior Member
 
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 15
gaza is on a distinguished road
Hi Foamers,
Does anyone use YouCompleteMe vim plugin?


https://github.com/Valloric/YouCompleteMe


Can anyone provide an exemplary .ycm_extra_conf.py file
or tell how to set YCM for OpenFOAM?
sourav90 likes this.
__________________
best regards
pblasiak
gaza is offline   Reply With Quote

Old   August 16, 2021, 09:09
Default
  #2
Senior Member
 
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 15
gaza is on a distinguished road
Hi
Here you have a plugin that creates .ycm_extra_conf.py
https://github.com/rdnetto/YCM-Generator
sourav90 likes this.
__________________
best regards
pblasiak
gaza is offline   Reply With Quote

Old   August 21, 2021, 12:59
Default Making YCM-Generator work
  #3
Member
 
Sourav Mandal
Join Date: Jul 2019
Posts: 55
Rep Power: 6
sourav90 is on a distinguished road
Dear Przemek,

Thanks for posting it. However, I'm not able to make it work.

I went into my OpenFOAM install directory, then ran

PHP Code:
vim 
Inside vim, I ran the following command as suggested here: https://github.com/rdnetto/YCM-Generator#usage
PHP Code:
:YcmGenerateConfig 
Then it returns the following error:
PHP Code:
ERRORUnknown build system

shell returned 2

Press ENTER 
or type command to continue 
Can you please help regarding what might be the problem?
sourav90 is offline   Reply With Quote

Old   August 22, 2021, 08:40
Default
  #4
Senior Member
 
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 15
gaza is on a distinguished road
Hi
Please read this
https://github.com/rdnetto/YCM-Generator/issues/122
__________________
best regards
pblasiak
gaza is offline   Reply With Quote

Old   August 23, 2021, 06:36
Default Debugging
  #5
Member
 
Sourav Mandal
Join Date: Jul 2019
Posts: 55
Rep Power: 6
sourav90 is on a distinguished road
Hello,

I tried to follow this, but when I run this:

PHP Code:
$ ./config_gen.py --verbose -/opt/OpenFOAM/OpenFOAM-8/applications/solvers/multiphase/interFoam 
I am presented with the following error
PHP Code:
Found OpenFOAM Make/options

Running wmake
...
wmake
Build completed in 0.25 sec

Collected 0 relevant entries 
for C compilation (0 discarded).
Collected 0 relevant entries for C++ compilation (0 discarded).

ERRORNo commands were logged to the build logs (C: /tmp/tmpM5woKMC++: /tmp/tmpBXTsU7).
Your build system may not be compatible
It's weird that it still doesn't work for me , which worked for you & can't find out what might be the error.

I checked my shell environment, according to Wlydckat's blog post that you had mentioned in the GitHub issue :

PHP Code:
$ echo $WM_PROJECT_DIR
/opt/OpenFOAM/OpenFOAM-8
$ echo $FOAM_APPBIN
/opt/OpenFOAM/OpenFOAM-8/platforms/linux64GccDPInt32Opt/bin 
sourav90 is offline   Reply With Quote

Old   August 23, 2021, 06:43
Default
  #6
Senior Member
 
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 15
gaza is on a distinguished road
Please do these steps:
1. load OpenFOAM environment variables
2.

Code:
cd /opt/OpenFOAM/OpenFOAM-8/applications/solvers/multiphase/interFoam
3.

Code:
vim interFoam.C
4. in vim
Code:
:YcmGenerateConfig -e
REMARK: For me it works only in
Code:
$WM_PROJECT_USER_DIR/dirToSolver
In
Code:
$WM_PROJECT_DIR/dirToSolver
I get the same errors as you.


So please try copy interFoam to user directory and than apply the steps 1-4.
sourav90 likes this.
__________________
best regards
pblasiak
gaza is offline   Reply With Quote

Old   August 23, 2021, 10:10
Default Maybe due to permission issue
  #7
Member
 
Sourav Mandal
Join Date: Jul 2019
Posts: 55
Rep Power: 6
sourav90 is on a distinguished road
Thanks so much! So, this works perfectly now. I wanted this for learning purpose – OOP C++ for OpenFOAM. Imagine how much beneficial it would be to type namespaces like `Foam::` & having these nice autosuggestion (see the attached image). Someone needs vim with these two plugins: youcompleteme & ycm-generator.

I'll be looking forward to get the same with nvim in future.

Only question remains: If all the OpenFoam namespaces are available in this way or only the ones related to interFoam, if someone does copy just one solver (interFoam here) to user directory & generates the required file using ycm-generator.

Screenshot 2021-08-23 at 15.50.59.jpg
sourav90 is offline   Reply With Quote

Reply


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



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