mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 21:10:33 +05:00
nglib-python restructuring
This commit is contained in:
parent
c2517bdef5
commit
e6157eecd8
@ -13,15 +13,15 @@ if(USE_GUI)
|
||||
endif(USE_GUI)
|
||||
|
||||
if(USE_PYTHON)
|
||||
add_library(pynglib SHARED netgenpy.cpp)
|
||||
target_link_libraries( pynglib nglib )
|
||||
add_library(ngpy SHARED netgenpy.cpp)
|
||||
target_link_libraries( ngpy nglib )
|
||||
if(APPLE)
|
||||
set_target_properties( pynglib PROPERTIES SUFFIX ".so")
|
||||
set_target_properties( ngpy PROPERTIES SUFFIX ".so")
|
||||
elseif(WIN32)
|
||||
set_target_properties( pynglib PROPERTIES SUFFIX ".pyd")
|
||||
set_target_properties( ngpy PROPERTIES SUFFIX ".pyd")
|
||||
endif()
|
||||
set_target_properties( pynglib PROPERTIES OUTPUT_NAME "nglib")
|
||||
install(TARGETS pynglib ${ng_install_dir})
|
||||
# set_target_properties( ngpy PROPERTIES OUTPUT_NAME "nglib")
|
||||
install(TARGETS ngpy ${ng_install_dir})
|
||||
endif(USE_PYTHON)
|
||||
|
||||
install(FILES
|
||||
|
@ -1,18 +1,22 @@
|
||||
#ifdef WIN32
|
||||
|
||||
// a wrapper to load netgen-dll into python
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <boost/python.hpp>
|
||||
|
||||
void __declspec(dllimport) ExportNetgenMeshing();
|
||||
void __declspec(dllimport) ExportMeshVis();
|
||||
void __declspec(dllimport) ExportCSG();
|
||||
void __declspec(dllimport) ExportCSGVis();
|
||||
void __declspec(dllimport) ExportGeom2d();
|
||||
#ifdef WIN32
|
||||
#define DLL_HEADER __declspec(dllimport)
|
||||
#else
|
||||
#define DLL_HEADER
|
||||
#endif
|
||||
|
||||
BOOST_PYTHON_MODULE(nglib)
|
||||
|
||||
void DLL_HEADER ExportNetgenMeshing();
|
||||
void DLL_HEADER ExportMeshVis();
|
||||
void DLL_HEADER ExportCSG();
|
||||
void DLL_HEADER ExportCSGVis();
|
||||
void DLL_HEADER ExportGeom2d();
|
||||
|
||||
BOOST_PYTHON_MODULE(libngpy)
|
||||
{
|
||||
ExportCSG();
|
||||
ExportCSGVis();
|
||||
@ -21,5 +25,3 @@ BOOST_PYTHON_MODULE(nglib)
|
||||
ExportGeom2d();
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -1959,6 +1959,7 @@ namespace netgen
|
||||
|
||||
int w = Togl_Width (togl);
|
||||
int h = Togl_Height (togl);
|
||||
cout << "togl h x w = " << h << " x " << w << endl;
|
||||
|
||||
glViewport(0, 0, w, h);
|
||||
|
||||
|
@ -20,6 +20,9 @@ if(WIN32)
|
||||
endif(WIN32)
|
||||
|
||||
add_library(nglib SHARED nglib.cpp ${nglib_objects})
|
||||
if(NOT WIN32)
|
||||
target_link_libraries( nglib mesh stlvis stl geom2dvis interface geom2d csg stl visual csgvis )
|
||||
endif(NOT WIN32)
|
||||
|
||||
target_link_libraries( nglib ${LIBPTHREAD} ${OCC_LIBRARIES} ${LIBTOGL} ${MPI_CXX_LIBRARIES} ${OPENGL_LIBRARIES} ${TK_LIBRARY} ${TCL_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${X11_Xmu_LIB} ${JPEG_LIBRARIES} ${MKL_LIBRARIES} ${ZLIB_LIBRARIES} )
|
||||
|
||||
|
@ -35,13 +35,10 @@ win_geom = Window( name=b"ngs", drawfunc=mydraw, mousefunc=mymouse)
|
||||
|
||||
###########################################
|
||||
# press ctrl+c to break loop
|
||||
try:
|
||||
while(True):
|
||||
while(True):
|
||||
for i in range(10000):
|
||||
glutMainLoopEvent()
|
||||
print('press ctrl+c to create second window!')
|
||||
except:
|
||||
pass
|
||||
|
||||
###########################################
|
||||
# create second window (transformation matrices are shared)
|
||||
|
@ -15,7 +15,7 @@ class Window():
|
||||
self.drawfunc()
|
||||
|
||||
def __init__( self, name=b"Window", width=500, height=500, drawfunc=None, mousefunc=None ):
|
||||
glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE,GLUT_ACTION_GLUTMAINLOOP_RETURNS)
|
||||
# glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE,GLUT_ACTION_GLUTMAINLOOP_RETURNS)
|
||||
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH)
|
||||
glutInitWindowSize(width, height) # set window size
|
||||
glutInitWindowPosition(0, 0) # set window position
|
||||
|
@ -6,6 +6,9 @@ if __platform.startswith('linux') or __platform.startswith('darwin'):
|
||||
if __platform.startswith('win'):
|
||||
path.append(environ['NETGENDIR'])
|
||||
|
||||
|
||||
from libngpy import *
|
||||
|
||||
from . import csg
|
||||
from . import meshing
|
||||
|
||||
|
@ -1,16 +1,7 @@
|
||||
from netgen import __platform
|
||||
if __platform.startswith('linux') or __platform.startswith('darwin'):
|
||||
# Linux or Mac OS X
|
||||
from libcsg.csg import *
|
||||
import libcsgvis.csgvis as csgvis
|
||||
from libcsgvis.csgvis import MouseMove
|
||||
from libmesh.meshing import *
|
||||
if __platform.startswith('win'):
|
||||
# Windows
|
||||
from nglib.csg import *
|
||||
import nglib.csgvis as csgvis
|
||||
from nglib.csgvis import MouseMove
|
||||
from nglib.meshing import *
|
||||
from libngpy.csg import *
|
||||
import libngpy.csgvis as csgvis
|
||||
from libngpy.csgvis import MouseMove
|
||||
from libngpy.meshing import *
|
||||
|
||||
|
||||
CSGeometry.VS = csgvis.VS
|
||||
|
@ -1,16 +1,5 @@
|
||||
from netgen import __platform
|
||||
if __platform.startswith('linux') or __platform.startswith('darwin'):
|
||||
# Linux or Mac OS X
|
||||
from libgeom2d.geom2d import *
|
||||
# import libcsgvis.csgvis as csgvis
|
||||
# from libcsgvis.csgvis import MouseMove
|
||||
from libmesh.meshing import *
|
||||
if __platform.startswith('win'):
|
||||
# Windows
|
||||
from nglib.geom2d import *
|
||||
# import nglib.csgvis as csgvis
|
||||
# from nglib.csgvis import MouseMove
|
||||
from nglib.meshing import *
|
||||
from libngpy.geom2d import *
|
||||
from libngpy.meshing import *
|
||||
|
||||
|
||||
|
||||
|
@ -1,7 +1 @@
|
||||
from netgen import __platform
|
||||
if __platform.startswith('linux') or __platform.startswith('darwin'):
|
||||
# Linux or Mac OS X
|
||||
from libmesh.meshing import *
|
||||
if __platform.startswith('win'):
|
||||
# Windows
|
||||
from nglib.meshing import *
|
||||
from libngpy.meshing import *
|
||||
|
Loading…
Reference in New Issue
Block a user