How is smesh (salome mesh) module maintained in FreeCAD

Having trouble installing or compiling FreeCAD? Get help here.
qingfeng.xia
Posts: 172
Joined: Tue Sep 22, 2015 1:47 pm
Location: Oxford Uk
Contact:

How is smesh (salome mesh) module maintained in FreeCAD

Postby qingfeng.xia » Mon Nov 04, 2019 12:48 pm

Dear FCers,

I am curious how smesh module, currently in freecad soource tree, is maintained, as opencascade and salome evolve?

There needs some effort to split smesh out from salome, here is the salome 8.3 's extraction.
https://github.com/LaughlinResearch/ who wrote python binding for smesh and occt 7.2

I did not found the smesh version in the current FreeCAD, can anyone shed me some light?
I hope to record this process into the book "Module developer's guide to FreeCAD source code"

Thank you

Qingfeng
Ubuntu LTS 64bit in virtualbox, always work with latest FreeCAD git version
Mainly work on OpenFOAM + Fenics for CFD, FSI
vocx
Posts: 1851
Joined: Thu Oct 18, 2018 9:18 pm

Re: How is smesh (salome mesh) module maintained in FreeCAD

Postby vocx » Mon Nov 04, 2019 4:11 pm

qingfeng.xia wrote:
Mon Nov 04, 2019 12:48 pm
I am curious how smesh module, currently in freecad soource tree, is maintained, as opencascade and salome evolve?
It seems to me that at some point in time, FreeCAD developers just copied the source code of various libraries, like SMESH, zipios++, KDL, etc., so that they would be together with FreeCAD. Maybe those libraries were not easy to get in the past, so to avoid tracking the dependencies, they just copied them into the source tree (as long as they are BSD, MIT, LGPL 2 licensed). Obviously, this means that the source in the tree needs to be updated manually, or it will become obsolete.
...
I did not found the smesh version in the current FreeCAD, can anyone shed me some light?...
https://github.com/FreeCAD/FreeCAD/tree ... esmesh/inc

The source has a bunch of references to "Upgrade to SMESH 7.7.1" (last change three years ago), so I presume this is the version that is included in FreeCAD.

There are CMake switches in FreeCAD to use external libraries.

Code: Select all

FREECAD_USE_EXTERNAL_KDL
FREECAD_USE_EXTERNAL_SMESH
FREECAD_USE_EXTERNAL_ZIPIOS
Maybe you can use the appropriate switch, and then use the sources of SMESH 8.3 externally.
qingfeng.xia
Posts: 172
Joined: Tue Sep 22, 2015 1:47 pm
Location: Oxford Uk
Contact:

Re: How is smesh (salome mesh) module maintained in FreeCAD

Postby qingfeng.xia » Tue Nov 05, 2019 4:35 pm

great! thank you!, Salome 7.7 seems not quite ancient. it can stay in FreeCAD as it is

I will think about a tool to track the change and review the diff.

In my other parallel preprocessor project, I split out some function of Salome geom module, I will share a link once it is available.
Ubuntu LTS 64bit in virtualbox, always work with latest FreeCAD git version
Mainly work on OpenFOAM + Fenics for CFD, FSI
User avatar
Kunda1
Posts: 5915
Joined: Thu Jan 05, 2017 9:03 pm

Re: How is smesh (salome mesh) module maintained in FreeCAD

Postby Kunda1 » Tue Nov 05, 2019 5:04 pm

I think from time to time the devs add little tweaks. Recently I believe Werner did some form of tweak for netgen import for smesh. I would need to find the commit. So it's good to keep an eye on these things
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
vocx
Posts: 1851
Joined: Thu Oct 18, 2018 9:18 pm

Re: How is smesh (salome mesh) module maintained in FreeCAD

Postby vocx » Tue Nov 05, 2019 10:21 pm

Kunda1 wrote:
Tue Nov 05, 2019 5:04 pm
... Recently I believe Werner did some form of tweak for netgen import for smesh. ...
Correct. But this doesn't sound like the best solution. The best solution should be to use the most up-to-date SMESH. If FreeCAD does some improvements, these should be upstreamed. Because FreeCAD keeping its own copy of SMESH is going to be difficult to maintain.
User avatar
kkremitzki
Posts: 1793
Joined: Thu Mar 03, 2016 9:52 pm
Location: Texas

Re: How is smesh (salome mesh) module maintained in FreeCAD

Postby kkremitzki » Tue Nov 05, 2019 10:38 pm

In the long run not keeping a copy of smesh involves getting it packaged for Debian/Ubuntu, but that involves packaging all of salome, which is pretty big. It was previously in Debian (https://tracker.debian.org/pkg/salome) and removed so it wouldn't be a from-scratch effort, but it hasn't been maintained since 2010 so it won't be easy.
Like my FreeCAD work? I'd appreciate any level of support via Patreon, Liberapay, or PayPal! Read more about what I do at my blog.
looo
Posts: 2950
Joined: Mon Nov 11, 2013 5:29 pm

Re: How is smesh (salome mesh) module maintained in FreeCAD

Postby looo » Wed Nov 06, 2019 3:43 am

kkremitzki wrote:
Tue Nov 05, 2019 10:38 pm
In the long run not keeping a copy of smesh involves getting it packaged for Debian/Ubuntu, but that involves packaging all of salome, which is pretty big. It was previously in Debian (https://tracker.debian.org/pkg/salome) and removed so it wouldn't be a from-scratch effort, but it hasn't been maintained since 2010 so it won't be easy.
You can simply create a package from https://github.com/LaughlinResearch/SMESH which we do for conda packages and works for all plattforms. Using the latest salome release is a bit more work I guess. But if anyone has the motivation, it shouldn't be too much trouble.
please help with my conda-packaging efforts: https://liberapay.com/looooo/
qingfeng.xia
Posts: 172
Joined: Tue Sep 22, 2015 1:47 pm
Location: Oxford Uk
Contact:

Re: How is smesh (salome mesh) module maintained in FreeCAD

Postby qingfeng.xia » Fri Nov 08, 2019 4:01 pm

I split out salome geometry module, it is now on github https://github.com/ukaea/SGeom

I managed to compiled smesh 8.3 with latest FreeCAD without netgen. Freecad test workbench does not complain any error. I will send a PR , can someone have a test on other platforms, windows. This smesh may not work with OCE.

PR link: https://github.com/FreeCAD/FreeCAD/pull/2706
netgen has been turn off in smesh, even CI trun it on. I am fixing it.
the new smesh does not compile/cmake failed on windows according to CI

Code: Select all

CMake Error at src/3rdParty/salomesmesh/CMakeLists.txt:150 (message):
  pthread include directory is required.
Fem module wiki said netgen has been disabled since moved to occt 7.x. netget must be patched, in ordered to work with smesh.
but wmayer seems just fixed the existing 7.7 this week. I made my change on smesh 8.3 to make it working.

vocx wrote:
Tue Nov 05, 2019 10:21 pm
Kunda1 wrote:
Tue Nov 05, 2019 5:04 pm
... Recently I believe Werner did some form of tweak for netgen import for smesh. ...
Correct. But this doesn't sound like the best solution. The best solution should be to use the most up-to-date SMESH. If FreeCAD does some improvements, these should be upstreamed. Because FreeCAD keeping its own copy of SMESH is going to be difficult to maintain.
Last edited by qingfeng.xia on Sat Nov 09, 2019 12:41 pm, edited 4 times in total.
Ubuntu LTS 64bit in virtualbox, always work with latest FreeCAD git version
Mainly work on OpenFOAM + Fenics for CFD, FSI
looo
Posts: 2950
Joined: Mon Nov 11, 2013 5:29 pm

Re: How is smesh (salome mesh) module maintained in FreeCAD

Postby looo » Fri Nov 08, 2019 4:25 pm

qingfeng.xia wrote:
Fri Nov 08, 2019 4:01 pm
Fem module wiki said netgen has been disabled since moved to occt 7.x. so it is safe. netget must be patched, in ordered to work with smesh, I just wonder why netgen does not merge this patch, due to occt 7.0 upgrade. I will have another investigation on netgen error, to see if I can bring it back.
No netgen works with occt7.3 and this version of smesh:
https://github.com/LaughlinResearch/SMESH

Smesh and netgen are build for linux, osx and win via these recipes as conda-packages:
https://github.com/conda-forge/smesh-feedstock
https://github.com/conda-forge/netgen-feedstock

But I don't think repo you linked will work with netgen, as the structure has changed a lot.

btw.: why did you split out salome geometry module. I thought we are talkina about salome mesh module.
Last edited by looo on Fri Nov 08, 2019 4:40 pm, edited 1 time in total.
please help with my conda-packaging efforts: https://liberapay.com/looooo/
vocx
Posts: 1851
Joined: Thu Oct 18, 2018 9:18 pm

Re: How is smesh (salome mesh) module maintained in FreeCAD

Postby vocx » Fri Nov 08, 2019 4:27 pm

qingfeng.xia wrote:
Fri Nov 08, 2019 4:01 pm
...
Fem module wiki said netgen has been disabled since moved to occt 7.x. so it is safe. netget must be patched, in ordered to work with smesh, I just wonder why netgen does not merge this patch, due to occt 7.0 upgrade. I will have another investigation on netgen error, to see if I can bring it back.
...
The wiki information was true at the time it was written, but in this development version, 0.19, some users in fact enabled Netgen with FreeCAD and it seemed to work. compile with netgen for FEM meshing. Only recently there seems to be some problems with Netgen again.

Therefore, being completely honest, I don't know what the status of Netgen is. Does it work, does it not work? Does it require a specific version of SMESH? Is the problem pybind11? Travis failures pybind11?

See this
user1234 wrote:
Sat Nov 02, 2019 9:38 pm
I tried to compile the master of netgen [https://github.com/NGSolve/netgen] today (Debian 10) for FreeCAD, but no success because of pybind11 (error in cmake for pybind11 in netgen). But they have updated the master for OCCT7.4.0.

Greetings
user