New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[do not merge/ to discuss] freecad needs some adoptions of netgen #4
Conversation
ping @JSchoeberl @mhochsteger |
libsrc/interface/nginterface.cpp
Outdated
@@ -118,122 +118,122 @@ void Ng_LoadMeshFromStream ( istream & input ) | |||
|
|||
void Ng_LoadMesh (const char * filename) | |||
{ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you comment this code ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it was a problem with gcc4.8. This is more a problem with conda. So for sure this shouldn't be merged. I just wanted to start a little discussion to see which stuff has potential to be accepted...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with the CMake changes concerning USE_GUI, the DLL_HEADER stuff and the changes in occgeom.cpp
Concerning the install path for python modules:
We are providing installers (msi, dmg) for Windows and MacOS, so we need relocatable packages containing also the python files.
In addition, we don't know where the user installed Python.
It should be possible for you to set NG_INSTALL_DIR_PYTHON at configure time to your preferred value.
Concerning pybind headers: They are needed by dependent packages (most notably NGSolve). I could add an option do disable installing them but would rather have them installed by default.
CMakeLists.txt
Outdated
@@ -207,7 +228,7 @@ if(WIN32) | |||
else(WIN32) | |||
# build shared libraries | |||
set(NG_LIB_TYPE SHARED) | |||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think about raising the minimum CMake version to 3.1 and using
CXX_STANDARD instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is 14 actually really necessary? I think that was my problem.
nglib/CMakeLists.txt
Outdated
install(FILES nglib.h DESTINATION ${NG_INSTALL_DIR_INCLUDE}/include COMPONENT netgen_devel) | ||
install(FILES nglib.h DESTINATION ${NG_INSTALL_DIR_INCLUDE}/nglib COMPONENT netgen_devel) | ||
install(FILES nglib.h DESTINATION ${NG_INSTALL_DIR_INCLUDE} COMPONENT netgen_devel) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you install nglib.h four times?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did this after some frustration with the cmake of FreeCAD. The proper solution is to change the FindNetgen used in FreeCAD.
But the place where it got placed originally is also quite strange... /include/netgen/include .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concerning the include dir structure: That's because we maintain the relative paths of the header files in the source code. The headers in
libsrc/include contain statements like
#include "../gprim/gprim.hpp"
Therefore we need an additional "include" in the path.
Concerning the FindNetgen.cmake in FreeCAD: Are there reasons not to use NetgenConfig.cmake and netgen-targets.cmake provided by Netgen itself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will have a look at the default cmake, but I think we need our custom FindNetgen, because we are also using older versions of netgen which was build without cmake...
libsrc/meshing/meshtype.hpp
Outdated
Element2d (Element2d &&) = default; | ||
Element2d & operator= (const Element2d &) = default; | ||
Element2d & operator= (Element2d &&) = default; | ||
DLL_HEADER Element2d () = default; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a whole class is exported, inline member functions are not inlined anymore. Therefore we prefer exporting members explicitly. See here for example.
Why you need this information? Also you can always get this information if python is directly available, and if it is not directly available there will be problems anyway. |
@mhochsteger care to weigh in? |
Regarding this issue: I see now, that the method to use python to find out where to install the library is also not the best way. One problem I had with this, are local installation. Python will always point to the main site-package/dist-package in the root dir, if python is installed in a root directory... |
I think I understand the problem now. We have to distinguish between USE_SUPERBUILD=ON and USE_SUPERBUILD=OFF. Let WITH superbuild the current behavior is to install python modules to WITHOUT superbuild, NG_INSTALL_DIR_PYTHON is not set at all, which leads to errors at configure time. I will fix that and hope this sorts out the problem. |
can we check for python default install dir if no NG_INSTALL_DIR_PYTHON is given? |
Yes, that's whats happening now. If nothing is set by the user, it will install to |
👍 |
Includes parts of pull request by looooo #4
libsrc/meshing/meshtype.hpp
Outdated
Element2d & operator= (const Element2d &) = default; | ||
Element2d & operator= (Element2d &&) = default; | ||
DLL_HEADER Element2d () = default; | ||
DLL_HEADER Element2d (const Element2d &) = default; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DLL_HEADER is not needed for default constructors (Tested with VS2015 on Windows). The others functions are exported with commit 0b411e1.
libsrc/occ/occgenmesh.cpp
Outdated
@@ -1291,7 +1291,7 @@ namespace netgen | |||
if (mparam.perfstepsstart <= MESHCONST_ANALYSE) | |||
{ | |||
// delete mesh; | |||
// mesh = make_shared<Mesh>(); | |||
mesh = make_shared<Mesh>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to preserve the given pointer in order to visualize the mesh during mesh generation. I assume the following works for you:
if(mesh.get() == nullptr)
mesh = make_shared<Mesh>();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I have experimented with exactly this and it works for us. It seems this is the missing part which makes netgen again usable for FreeCAD.
Thanks for all the work!
22756da
to
252a0c1
Compare
I think everything is included. I will make a PR for the new changes. |
As you may know, FreeCAD uses Netgen to generate meshes. While this was working quite good for older releases, there were introduced some changes in the recent Netgen version which had to be patched from our side to get Netgen work with FreeCAD.
While some of these patches can be applied directly, others are maybe more difficult to incorporate.