From b32b00113bf6c30d43327735b83aaa81cc44433d Mon Sep 17 00:00:00 2001 From: Ugo Date: Sat, 1 May 2021 12:41:10 +0200 Subject: [PATCH] fixed examples --- examples/main.py | 8 +- examples/test.ipynb | 191 +++----------------------------------------- 2 files changed, 15 insertions(+), 184 deletions(-) diff --git a/examples/main.py b/examples/main.py index 29b1693..7349983 100644 --- a/examples/main.py +++ b/examples/main.py @@ -1,7 +1,4 @@ import pybindmagic -import os -os.environ["PATH"] = "/home/ugo/anaconda3/bin" + os.pathsep + os.environ["PATH"] - #%% %%cpp -f generateMesh #include @@ -85,13 +82,13 @@ defs printMesh(*generateMesh()) #%% -%%cpp -c pathtocmake -f viewMesh +%%cpp -c pathtocmake -f viewMeshh #include #include -void viewMesh(Eigen::Matrix V, Eigen::Matrix F) +void viewMeshh(Eigen::Matrix V, Eigen::Matrix F) { // Plot the mesh igl::opengl::glfw::Viewer viewer; @@ -100,7 +97,6 @@ void viewMesh(Eigen::Matrix V, Eigen::Matrix\n", "\n", - "\n", "std::tuple generateMesh()\n", "{\n", " // Inline mesh of a cube\n", @@ -50,38 +49,11 @@ }, { "cell_type": "code", - "execution_count": 3, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Vertices:\n", - " [[0. 0. 0.]\n", - " [0. 0. 1.]\n", - " [0. 1. 0.]\n", - " [0. 1. 1.]\n", - " [1. 0. 0.]\n", - " [1. 0. 1.]\n", - " [1. 1. 0.]\n", - " [1. 1. 1.]]\n", - "Faces:\n", - " [[0 6 4]\n", - " [0 2 6]\n", - " [0 3 2]\n", - " [0 1 3]\n", - " [2 7 6]\n", - " [2 3 7]\n", - " [4 6 7]\n", - " [4 7 5]\n", - " [0 4 5]\n", - " [0 5 1]\n", - " [1 5 7]\n", - " [1 7 3]]\n" - ] - } - ], + "execution_count": null, + "metadata": { + "scrolled": true + }, + "outputs": [], "source": [ "V,F = generateMesh()\n", "print(\"Vertices:\\n\",V)\n", @@ -90,7 +62,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -139,38 +111,9 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Vertices:\n", - " [[0. 0. 0.]\n", - " [0. 0. 1.]\n", - " [0. 1. 0.]\n", - " [0. 1. 1.]\n", - " [1. 0. 0.]\n", - " [1. 0. 1.]\n", - " [1. 1. 0.]\n", - " [1. 1. 1.]]\n", - "Faces:\n", - " [[0 6 4]\n", - " [0 2 6]\n", - " [0 3 2]\n", - " [0 1 3]\n", - " [2 7 6]\n", - " [2 3 7]\n", - " [4 6 7]\n", - " [4 7 5]\n", - " [0 4 5]\n", - " [0 5 1]\n", - " [1 5 7]\n", - " [1 7 3]]\n" - ] - } - ], + "outputs": [], "source": [ "printMesh(*generateMesh())" ] @@ -198,95 +141,9 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "cmake:\n", - "-- The CXX compiler identification is GNU 9.3.0\n", - "-- Check for working CXX compiler: /usr/bin/c++\n", - "-- Check for working CXX compiler: /usr/bin/c++ -- works\n", - "-- Detecting CXX compiler ABI info\n", - "-- Detecting CXX compiler ABI info - done\n", - "-- Detecting CXX compile features\n", - "-- Detecting CXX compile features - done\n", - "-- Found Python: /home/ugo/anaconda3/bin/python3.7 (found version \"3.7.6\") found components: Interpreter Development \n", - "-- pybind11 v2.6.3 dev1\n", - "-- Performing Test HAS_FLTO\n", - "-- Performing Test HAS_FLTO - Success\n", - "-- Looking for C++ include pthread.h\n", - "-- Looking for C++ include pthread.h - found\n", - "-- Performing Test CMAKE_HAVE_LIBC_PTHREAD\n", - "-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed\n", - "-- Looking for pthread_create in pthreads\n", - "-- Looking for pthread_create in pthreads - not found\n", - "-- Looking for pthread_create in pthread\n", - "-- Looking for pthread_create in pthread - found\n", - "-- Found Threads: TRUE \n", - "-- Creating target: igl::core (igl)\n", - "-- Creating target: igl::opengl (igl_opengl)\n", - "-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so found components: OpenGL \n", - "-- The C compiler identification is GNU 9.3.0\n", - "-- Check for working C compiler: /usr/bin/cc\n", - "-- Check for working C compiler: /usr/bin/cc -- works\n", - "-- Detecting C compiler ABI info\n", - "-- Detecting C compiler ABI info - done\n", - "-- Detecting C compile features\n", - "-- Detecting C compile features - done\n", - "-- Creating target: igl::opengl_glfw (igl_opengl_glfw)\n", - "-- Using X11 for window creation\n", - "-- Found X11: /usr/include \n", - "-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so\n", - "-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found\n", - "-- Looking for gethostbyname\n", - "-- Looking for gethostbyname - found\n", - "-- Looking for connect\n", - "-- Looking for connect - found\n", - "-- Looking for remove\n", - "-- Looking for remove - found\n", - "-- Looking for shmat\n", - "-- Looking for shmat - found\n", - "-- Looking for IceConnectionNumber in ICE\n", - "-- Looking for IceConnectionNumber in ICE - found\n", - "-- Configuring done\n", - "-- Generating done\n", - "-- Build files have been written to: /home/ugo/work/pybindipynb/examples/pathtocmake/build\n", - "\n", - "make:\n", - "Scanning dependencies of target glad\n", - "[ 4%] Building C object glad/CMakeFiles/glad.dir/src/glad.c.o\n", - "[ 9%] Linking C static library libglad.a\n", - "[ 9%] Built target glad\n", - "Scanning dependencies of target glfw\n", - "[ 14%] Building C object glfw/src/CMakeFiles/glfw.dir/context.c.o\n", - "[ 19%] Building C object glfw/src/CMakeFiles/glfw.dir/init.c.o\n", - "[ 23%] Building C object glfw/src/CMakeFiles/glfw.dir/input.c.o\n", - "[ 28%] Building C object glfw/src/CMakeFiles/glfw.dir/monitor.c.o\n", - "[ 33%] Building C object glfw/src/CMakeFiles/glfw.dir/vulkan.c.o\n", - "[ 38%] Building C object glfw/src/CMakeFiles/glfw.dir/window.c.o\n", - "[ 42%] Building C object glfw/src/CMakeFiles/glfw.dir/x11_init.c.o\n", - "[ 47%] Building C object glfw/src/CMakeFiles/glfw.dir/x11_monitor.c.o\n", - "[ 52%] Building C object glfw/src/CMakeFiles/glfw.dir/x11_window.c.o\n", - "[ 57%] Building C object glfw/src/CMakeFiles/glfw.dir/xkb_unicode.c.o\n", - "[ 61%] Building C object glfw/src/CMakeFiles/glfw.dir/posix_time.c.o\n", - "[ 66%] Building C object glfw/src/CMakeFiles/glfw.dir/posix_thread.c.o\n", - "[ 71%] Building C object glfw/src/CMakeFiles/glfw.dir/glx_context.c.o\n", - "[ 76%] Building C object glfw/src/CMakeFiles/glfw.dir/egl_context.c.o\n", - "[ 80%] Building C object glfw/src/CMakeFiles/glfw.dir/osmesa_context.c.o\n", - "[ 85%] Building C object glfw/src/CMakeFiles/glfw.dir/linux_joystick.c.o\n", - "[ 90%] Linking C static library libglfw3.a\n", - "[ 90%] Built target glfw\n", - "Scanning dependencies of target cpp_magic_5329071abe\n", - "[ 95%] Building CXX object CMakeFiles/cpp_magic_5329071abe.dir/cpp_magic_5329071abe.cpp.o\n", - "[100%] Linking CXX shared module cpp_magic_5329071abe.cpython-37m-x86_64-linux-gnu.so\n", - "[100%] Built target cpp_magic_5329071abe\n", - "\n" - ] - } - ], + "outputs": [], "source": [ "%%cpp -c pathtocmake -f viewMesh -rebuild\n", "\n", @@ -306,29 +163,7 @@ }, { "cell_type": "code", - "execution_count": 5, - "metadata": {}, - "outputs": [ - { - "ename": "ImportError", - "evalue": "dynamic module does not define module export function (PyInit_cpp_magic_f96b7fce74)", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mImportError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mimport\u001b[0m \u001b[0mcpp_magic_f96b7fce74\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0;31m#viewMesh(V,F)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mImportError\u001b[0m: dynamic module does not define module export function (PyInit_cpp_magic_f96b7fce74)" - ] - } - ], - "source": [ - "import cpp_magic_f96b7fce74\n", - "#viewMesh(V,F)" - ] - }, - { - "cell_type": "code", - "execution_count": 11, + "execution_count": null, "metadata": {}, "outputs": [], "source": [