compile with netgen for FEM meshing

Having trouble installing or compiling FreeCAD? Get help here.
reox
Posts: 666
Joined: Sat Aug 13, 2016 10:06 am
Contact:

Re: compile with netgen for FEM meshing

Postby reox » Fri Jun 28, 2019 5:49 am

No one has an idea what is going wrong here?
Is it possible that the re-declaration is causing those issues? Wrong header files?
looo
Posts: 2951
Joined: Mon Nov 11, 2013 5:29 pm

Re: compile with netgen for FEM meshing

Postby looo » Fri Jun 28, 2019 8:30 am

We have seen similar results with gmsh and the smesh unv conversation. Fixes should be applied to internal and external smesh. So this shouldn't be a problem any more. Also I don't think it's related the reported problems.
Maybe you want to try the external smesh [1]. Not sure if it works out of the box, but with some modifications it works for me on ubuntu 18.04:

- Install all occt libraries (I think occt-misc containing the cmake config files necessary for smesh)
- I had to link some libtbb libraries from lib*.so.2 to libt*.so (not sure why this was necessary)
- install all netgen libraries (netgen, libnglib-dev, ...) not sure which library is really needed by smesh.

This was all I had to do on my ubuntu 18.04 system. For sure this depends a lot on your system and the installed packages.

Once installed you need to set FREECAD_USE_EXTERNAL_SMESH to ON in the freecad-cmake configuration:

Code: Select all

cmake .. -DFREECAD_USE_EXTERNAL_SMESH:Bool=OFF
or doing this with cmake-gui or similar tools.

[1] https://github.com/LaughlinResearch/SMESH
please help with my conda-packaging efforts: https://liberapay.com/looooo/
reox
Posts: 666
Joined: Sat Aug 13, 2016 10:06 am
Contact:

Re: compile with netgen for FEM meshing

Postby reox » Mon Jul 01, 2019 12:59 pm

Mhh maybe I can use the version from here: https://salsa.debian.org/kkremitzki-guest/salome-smesh
I'll give it a try!


edit: ah salome-smesh is also affected by the missing ld.conf of netgen:

Code: Select all

   dh_shlibdeps -O--buildsystem=cmake
dpkg-shlibdeps: warning: cannot find library libnglib.so needed by debian/libsalome-smesh/usr/lib/x86_64-linux-gnu/libNETGENPlugin.so.8.3.0.2 (ELF format: 'elf64-x86-64' abi: '0201003e00000000'; RPATH: '')
dpkg-shlibdeps: warning: cannot find library libinterface.so needed by debian/libsalome-smesh/usr/lib/x86_64-linux-gnu/libNETGENPlugin.so.8.3.0.2 (ELF format: 'elf64-x86-64' abi: '0201003e00000000'; RPATH: '')
dpkg-shlibdeps: warning: cannot find library libstlvis.so needed by debian/libsalome-smesh/usr/lib/x86_64-linux-gnu/libNETGENPlugin.so.8.3.0.2 (ELF format: 'elf64-x86-64' abi: '0201003e00000000'; RPATH: '')
dpkg-shlibdeps: warning: cannot find library libstl.so needed by debian/libsalome-smesh/usr/lib/x86_64-linux-gnu/libNETGENPlugin.so.8.3.0.2 (ELF format: 'elf64-x86-64' abi: '0201003e00000000'; RPATH: '')
dpkg-shlibdeps: warning: cannot find library libgeom2dvis.so needed by debian/libsalome-smesh/usr/lib/x86_64-linux-gnu/libNETGENPlugin.so.8.3.0.2 (ELF format: 'elf64-x86-64' abi: '0201003e00000000'; RPATH: '')
dpkg-shlibdeps: warning: cannot find library libgeom2d.so needed by debian/libsalome-smesh/usr/lib/x86_64-linux-gnu/libNETGENPlugin.so.8.3.0.2 (ELF format: 'elf64-x86-64' abi: '0201003e00000000'; RPATH: '')
dpkg-shlibdeps: warning: cannot find library libcsgvis.so needed by debian/libsalome-smesh/usr/lib/x86_64-linux-gnu/libNETGENPlugin.so.8.3.0.2 (ELF format: 'elf64-x86-64' abi: '0201003e00000000'; RPATH: '')
dpkg-shlibdeps: warning: cannot find library libcsg.so needed by debian/libsalome-smesh/usr/lib/x86_64-linux-gnu/libNETGENPlugin.so.8.3.0.2 (ELF format: 'elf64-x86-64' abi: '0201003e00000000'; RPATH: '')
dpkg-shlibdeps: warning: cannot find library libmesh.so needed by debian/libsalome-smesh/usr/lib/x86_64-linux-gnu/libNETGENPlugin.so.8.3.0.2 (ELF format: 'elf64-x86-64' abi: '0201003e00000000'; RPATH: '')
dpkg-shlibdeps: warning: cannot find library libvisual.so needed by debian/libsalome-smesh/usr/lib/x86_64-linux-gnu/libNETGENPlugin.so.8.3.0.2 (ELF format: 'elf64-x86-64' abi: '0201003e00000000'; RPATH: '')
dpkg-shlibdeps: warning: cannot find library libocc.so needed by debian/libsalome-smesh/usr/lib/x86_64-linux-gnu/libNETGENPlugin.so.8.3.0.2 (ELF format: 'elf64-x86-64' abi: '0201003e00000000'; RPATH: '')
reox
Posts: 666
Joined: Sat Aug 13, 2016 10:06 am
Contact:

Re: compile with netgen for FEM meshing

Postby reox » Mon Jul 01, 2019 6:00 pm

kkremitzki wrote: ping
maybe you can help here? I tried your salome-smesh from salsa.debian.org but ran into some issues:

* there is no SMESH_VERSION but only the _MAJOR, _MINOR, _PATCH and _TWEAK variables (not sure of SMESH_VERSION shall be reported, but FreeCAD's CMakeLists.txt assumes this)
* the cmake config file is probably at the wrong path, IMHO it should be /usr/lib/cmake/smesh/SMESHConfig.cmake instead of /usr/lib/cmake/salome-smesh - or you need to name SMESHConfig.cmake different.
* the SMESH_INCLUDE_PATH and SMESH_LIB_PATH are wrong: /usr/lib/cmake/smesh/../include/smesh. It should be /usr/lib/cmake/smesh/../../../include/smesh (both two .. are missing - or maybe just use an absolute path)
* in debian/rules you specify -DOpenCASCADE_DIR=/usr/lib/cmake/occt which is /usr/lib/cmake/opencascade right now

I also noticed, that FreeCAD's CMakeLists.txt will not abort if the external SMESH is not found.


But anyways, I build now a version depending on the external SMESH, but netgen does still not work.
ldd freecad does not print anything related to SMESH but Fem.so does. So I assume it links correctly:

Code: Select all

$ ldd Fem.so | grep SMESH
	libSMESH.so.8.3 => /usr/lib/x86_64-linux-gnu/libSMESH.so.8.3 (0x00007fced9945000)
	libSMESHBasics.so.8.3 => /usr/lib/x86_64-linux-gnu/libSMESHBasics.so.8.3 (0x00007fced993f000)
	libSMESHControls.so.8.3 => /usr/lib/x86_64-linux-gnu/libSMESHControls.so.8.3 (0x00007fced98cf000)
	libSMESHDS.so.8.3 => /usr/lib/x86_64-linux-gnu/libSMESHDS.so.8.3 (0x00007fced9891000)
	libSMESHMisc.so.8.3 => /usr/lib/x86_64-linux-gnu/libSMESHMisc.so.8.3 (0x00007fced9861000)
	libSMESHTrace.so.8.3 => /usr/lib/x86_64-linux-gnu/libSMESHTrace.so.8.3 (0x00007fced9857000)
	libSMESHUtils.so.8.3 => /usr/lib/x86_64-linux-gnu/libSMESHUtils.so.8.3 (0x00007fced97d9000)
I'm not sure if 8.3.0.2 is the newest version, as there are 12 newer commits on github, I can try to build master as well, but I dont think it will change anything.

Code: Select all

-- Python:              [/usr/bin/python3] [.cpython-37m-x86_64-linux-gnu]
-- PCL:                 1.9.1
-- pybind11:            2.2.4
-- Boost:               106700
-- XercesC:             [/usr/lib/x86_64-linux-gnu/libxerces-c.so] [/usr/include]
-- ZLIB:                1.2.11
-- PyCXX:               [/build/freecad-daily-0.19+git201907011842~daily/src]
-- OCC:                 7.3.0 [TKFillet;TKMesh;TKernel;TKG2d;TKG3d;TKMath;TKIGES;TKSTL;TKShHealing;TKXSBase;TKBin;TKBool;TKBO;TKCDF;TKBRep;TKTopAlgo;TKGeomAlgo;TKGeomBase;TKOffset;TKPrim;TKSTEP;TKSTEPBase;TKSTEPAttr;TKHLR;TKFeat]
-- SMESH:               8.3.0.2 [/usr/lib/cmake/smesh/../../../include/smesh]
-- NETGEN:              6.2-dev [-DNO_PARALLEL_THREADS;-DOCCGEOMETRY;-DNETGEN_VERSION=393728] [] [/usr/include/netgen/include;/usr/include/netgen] [nglib] [/usr/include/netgen/include;/usr/include/netgen]
-- SWIG:                3.0.12
-- Eigen3               3.3.7
-- Qt5Core:             5.11.3
-- Qt5Network:          5.11.3
-- Qt5Xml:              5.11.3
-- Qt5XmlPatterns:      5.11.3
-- Qt5Widgets:          5.11.3
-- Qt5PrintSupport:     5.11.3
-- Qt5OpenGL:           5.11.3
-- Qt5Svg:              5.11.3
-- Qt5UiTools:          5.11.3
-- Qt5Concurrent:       5.11.3
-- Qt5WebKitWidgets:    5.212.0
-- Shiboken2:           5.11.2 [/usr/lib/x86_64-linux-gnu/cmake/Shiboken2-5.11.2] [/usr/include/shiboken2]
-- PySide2:             5.11.2 [/usr/include/PySide2]
-- PySide2Tools:        [/usr/bin/pyside2-uic] [/usr/bin/pyside2-rcc]
-- Freetype:            2.9.1
-- OpenGLU:             /usr/lib/x86_64-linux-gnu/libGLU.so [/usr/lib/x86_64-linux-gnu/libGLU.so][/usr/include]
-- Coin3D:              [/usr/lib/x86_64-linux-gnu/libCoin.so] [/usr/include]
-- SPNAV:               [/usr/lib/libspnav.so] [/usr/include]
-- Matplotlib:          3.0.2
-- Rift:                not enabled (BUILD_VR)
-- Doxygen:             not found

User avatar
kkremitzki
Posts: 1795
Joined: Thu Mar 03, 2016 9:52 pm
Location: Texas

Re: compile with netgen for FEM meshing

Postby kkremitzki » Mon Jul 01, 2019 6:06 pm

That package is incomplete/WIP, I wouldn't recommend using it at all yet.
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.
reox
Posts: 666
Joined: Sat Aug 13, 2016 10:06 am
Contact:

Re: compile with netgen for FEM meshing

Postby reox » Mon Jul 01, 2019 6:17 pm

kkremitzki wrote:
Mon Jul 01, 2019 6:06 pm
That package is incomplete/WIP, I wouldn't recommend using it at all yet.
thanks for the reply! Okay I see, but building the package worked fine :)

Btw, if this is worth merging here are the (small) changes to FC's CMakeLists.txt: https://github.com/FreeCAD/FreeCAD/comp ... eox:master
as well as my crude hacks to smesh: https://github.com/reox/salome-smesh/co ... 55c5785de2
reox
Posts: 666
Joined: Sat Aug 13, 2016 10:06 am
Contact:

Re: compile with netgen for FEM meshing

Postby reox » Thu Jul 04, 2019 7:24 pm

Yet another idea:
Can someone who as build FC with netgen and FEM meshing works upload a build log? I would like to check if there are any differences.
Where can I find one? I saw some conda (?) logs somewhere but cant remember where...
reox
Posts: 666
Joined: Sat Aug 13, 2016 10:06 am
Contact:

Re: compile with netgen for FEM meshing

Postby reox » Sun Jul 07, 2019 9:35 am

So I found this log here: https://dev.azure.com/conda-forge/feeds ... ldId=44340

The interesseting part is, that there are no deprecation warnings. Is it because of C++17 standard is used?
I just try out of curiosity to build everything with C++17...


edit: no, that makes it worse. SMESH has features which are deprecated in C++11 and forbidden in C++17:

Code: Select all

/usr/lib/cmake/smesh/../../../include/smesh/SMESH_Gen.hxx:70:5: error: ISO C++17 does not allow dynamic exception specifications
     throw(SALOME_Exception);
     ^~~~~
editedit: ah, these issues are already fixed in the internal smesh.


editeditedit: When I build with smesh internal and C++17, it builds but I get this error during packaging:

Code: Select all

dwz: debian/freecad-daily/usr/lib/freecad-daily/lib/libFreeCADGui.so: Couldn't find DIE referenced by DW_OP_GNU_parameter_ref

editediteditedit: removed dwz from build, FC packages now but still, the netgen meshing does not work :(
looo
Posts: 2951
Joined: Mon Nov 11, 2013 5:29 pm

Re: compile with netgen for FEM meshing

Postby looo » Sun Jul 07, 2019 6:47 pm

reox wrote:
Sun Jul 07, 2019 9:35 am
edit: no, that makes it worse. SMESH has features which are deprecated in C++11 and forbidden in C++17:
C++17 should work with external smesh. this commit includes the fixes:
https://github.com/LaughlinResearch/SME ... 62021ad599
please help with my conda-packaging efforts: https://liberapay.com/looooo/
reox
Posts: 666
Joined: Sat Aug 13, 2016 10:06 am
Contact:

Re: compile with netgen for FEM meshing

Postby reox » Wed Jul 10, 2019 5:32 pm

Ah yes I see. Looks like the version I compiled is quite older than that.