Skip to content
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

Position based dynamics #2

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
93b718a
Changes to CMakeLists.txt to build Manta on macOS.
cesarr Jun 26, 2020
f11cd64
Able to export the positions of the particles in a BasicParticleSystem.
cesarr Jun 26, 2020
7c686db
In the scene "view_particles_in_notebook.py" there is code for conver…
cesarr Jul 2, 2020
8469b07
Added the method BasicParticleSystem.writeParticlesNumpyText which se…
cesarr Jul 2, 2020
cb06105
Small changes to the notebook.
cesarr Jul 2, 2020
b915cd6
Minor changes to the view_particles_in_notebook.ipynb file.
cesarr Jul 17, 2020
5641e29
Merge branch 'master' of https://github.com/tum-pbs/mantaflow
cesarr Jul 17, 2020
1df3006
Merge branch 'review-particle-system'
cesarr Jul 17, 2020
635639f
Added the openVDB source code but I haven't been able to compile the …
cesarr Jul 24, 2020
0cb6c17
The Bacilli on Agar scene is specified. Started work on implementing…
cesarr Jul 31, 2020
a3f9526
Implementing the FLIP and shape matching coupled method for fluid-sol…
cesarr Aug 1, 2020
05d0c7c
Ignoring the Results folder in the Notebook folder.
cesarr Sep 28, 2020
f01845a
Added a solid flag. Added an algorithm for setting solid flags from …
cesarr Sep 28, 2020
153aeab
The solid flag is used in the sampleFlagsWithParticles and addGravity…
cesarr Oct 15, 2020
28ab352
Particles that are part of a solid can be tracked over time. Need to…
cesarr Oct 16, 2020
e055f31
Particles in a ParticleSystem can store if a particle is in a solid o…
cesarr Oct 19, 2020
e97f451
Renamed pbd.cpp to solids.cpp. Added code to the setWallBcs function…
cesarr Oct 21, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,16 @@ waveletNoiseTileDouble.bin
build
doc
tensorflow/mantaGen/datasets
notebooks/results

# macos
.DS_Store

# vscode
\.vscode

# Python
venv
__pycache__
.ipynb_checkpoints
# *.ipynb
75 changes: 39 additions & 36 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ endif()

if(APPLE)
if(NOT CMAKE_PREFIX_PATH)
set(CMAKE_PREFIX_PATH "/usr/local/opt/qt5/") # mac/homebrew (version independent)
#set(CMAKE_PREFIX_PATH "/home/myname/qt/5.5/clang_64") # other...
set(CMAKE_PREFIX_PATH "/usr/local/opt/qt5/") # mac/homebrew (version independent)
# set(CMAKE_PREFIX_PATH "/User/Cesar/anaconda3/") # Anaconda QT
# set(CMAKE_PREFIX_PATH "/home/myname/qt/5.5/clang_64") # other...
# set(CMAKE_PREFIX_PATH "/Users/Cesar/Qt/5.15.0/clang_64/")
endif()
endif()

Expand Down Expand Up @@ -212,6 +214,7 @@ set(PP_SOURCES
source/plugin/vortexplugins.cpp
source/plugin/waveletturbulence.cpp
source/plugin/waves.cpp
source/plugin/solids.cpp
source/python/defines.py
source/test.cpp
)
Expand Down Expand Up @@ -445,41 +448,41 @@ endif(DOXYGEN_FOUND)

# Python
# note - if configuration fails, comment out the auto block below, and manually set the following two paths:
#set(PYTHON_INCLUDE_DIRS "PYTHON_PATH/include")
#set(PYTHON_LIBRARIES "PYTHON_PATH/libs/pythonX.Y.lib/so")
set(PYTHON_INCLUDE_DIRS "/Users/Cesar/anaconda3/include/python3.7m/")
set(PYTHON_LIBRARIES "/Users/Cesar/anaconda3/lib/libpython3.7m.dylib")
# auto block
if(WIN32)
# convenience override for windows, typically the auto find doesnt work, so fall back to WIN_PYTHON_PATH
find_package(PythonLibs ${PYTHON_VER_ID} QUIET)
if(NOT PYTHONLIBS_FOUND)
set(PYTHON_INCLUDE_DIRS "${WIN_PYTHON_PATH}/include")
set(PYTHON_LIBRARIES "${WIN_PYTHON_PATH}/libs/python${PYTHON_VER_ID}.lib")
endif()
else()
# try to configure from python itself first
execute_process(COMMAND python${PYTHON_VER_ID} -c "import sys,sysconfig; sys.stdout.write(sysconfig.get_config_var('INCLUDEPY'))" OUTPUT_VARIABLE PYTHON_INCLUDE_DIRS)
execute_process(COMMAND python${PYTHON_VER_ID} -c "import sys,sysconfig; sys.stdout.write(sysconfig.get_config_var('LIBDIR'))" OUTPUT_VARIABLE PYTHON_LIB1)
if(APPLE)
# LDLIBRARY doesnt seem to work for Macs...
set(PYTHON_LIB2 "../Python")
else()
execute_process(COMMAND python${PYTHON_VER_ID} -c "import sys,sysconfig; sys.stdout.write(sysconfig.get_config_var('LDLIBRARY'))" OUTPUT_VARIABLE PYTHON_LIB2)
endif()
set(PYTHON_LIBRARIES "${PYTHON_LIB1}/${PYTHON_LIB2}")
if(EXISTS "${PYTHON_INCLUDE_DIRS}" AND EXISTS "${PYTHON_LIBRARIES}")
message("Found python configuration")
else()
# otherwise, fall back to cmake find
if(NOT PYTHON_VERSION)
find_package(PythonLibs REQUIRED) # use any
else()
find_package(PythonLibs ${PYTHON_VER_ID} EXACT QUIET) # fixed version
endif()
if(NOT PYTHONLIBS_FOUND)
message(FATAL_ERROR "No python found, please manually set PYTHON_VERSION for cmake, or PYTHON_ paths in CMakeLists.txt")
endif()
endif()
endif()
# if(WIN32)
# # convenience override for windows, typically the auto find doesnt work, so fall back to WIN_PYTHON_PATH
# find_package(PythonLibs ${PYTHON_VER_ID} QUIET)
# if(NOT PYTHONLIBS_FOUND)
# set(PYTHON_INCLUDE_DIRS "${WIN_PYTHON_PATH}/include")
# set(PYTHON_LIBRARIES "${WIN_PYTHON_PATH}/libs/python${PYTHON_VER_ID}.lib")
# endif()
# else()
# # try to configure from python itself first
# execute_process(COMMAND python${PYTHON_VER_ID} -c "import sys,sysconfig; sys.stdout.write(sysconfig.get_config_var('INCLUDEPY'))" OUTPUT_VARIABLE PYTHON_INCLUDE_DIRS)
# execute_process(COMMAND python${PYTHON_VER_ID} -c "import sys,sysconfig; sys.stdout.write(sysconfig.get_config_var('LIBDIR'))" OUTPUT_VARIABLE PYTHON_LIB1)
# if(APPLE)
# # LDLIBRARY doesnt seem to work for Macs...
# set(PYTHON_LIB2 "../Python")
# else()
# execute_process(COMMAND python${PYTHON_VER_ID} -c "import sys,sysconfig; sys.stdout.write(sysconfig.get_config_var('LDLIBRARY'))" OUTPUT_VARIABLE PYTHON_LIB2)
# endif()
# set(PYTHON_LIBRARIES "${PYTHON_LIB1}/${PYTHON_LIB2}")
# if(EXISTS "${PYTHON_INCLUDE_DIRS}" AND EXISTS "${PYTHON_LIBRARIES}")
# message("Found python configuration")
# else()
# # otherwise, fall back to cmake find
# if(NOT PYTHON_VERSION)
# find_package(PythonLibs REQUIRED) # use any
# else()
# find_package(PythonLibs ${PYTHON_VER_ID} EXACT QUIET) # fixed version
# endif()
# if(NOT PYTHONLIBS_FOUND)
# message(FATAL_ERROR "No python found, please manually set PYTHON_VERSION for cmake, or PYTHON_ paths in CMakeLists.txt")
# endif()
# endif()
# endif()
# end auto block, python config done
list(APPEND INCLUDE_PATHS ${PYTHON_INCLUDE_DIRS})
list(APPEND F_LIBS ${PYTHON_LIBRARIES})
Expand Down
69 changes: 69 additions & 0 deletions notebooks/flags.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"metadata": {
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6-final"
},
"orig_nbformat": 2,
"kernelspec": {
"name": "python_defaultSpec_1600384803676",
"display_name": "Python 3.7.6 64-bit ('anaconda3': conda)"
}
},
"nbformat": 4,
"nbformat_minor": 2,
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"file = np.load('./results/flags.npz')"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"tags": []
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": "arr_0\niteration\n"
}
],
"source": [
"for data in file:\n",
" print(data)\n",
" print(\"iteration\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
]
}
108 changes: 108 additions & 0 deletions notebooks/view_particles_in_notebook.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import k3d\n",
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": "Output()",
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "b32e24084a764b3f960f19125f2df785"
}
},
"metadata": {}
}
],
"source": [
"positions = np.loadtxt('frames/particles-frame-0.nptxt').astype(np.float32)\n",
"plot = k3d.plot()\n",
"points = k3d.points(positions, point_size=0.4, shader='3dSpecular')\n",
"plot += points\n",
"plot.display()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": "Output()",
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "6df76752d32a4d45bcf5b02a7c842838"
}
},
"metadata": {}
}
],
"source": [
"# View 50 frames at a time\n",
"\n",
"start = 49\n",
"stop = 99\n",
"\n",
"if start > 0:\n",
" offset = start\n",
" start = 0\n",
" stop = stop - offset\n",
"else:\n",
" offset = 0\n",
"\n",
"positions = {\n",
" str(t):np.loadtxt('frames/particles-frame-%d.nptxt' % (t+offset)).astype(np.float32) for t in range(start, stop, 1)\n",
"}\n",
"plot = k3d.plot(name='points', time=float(start))\n",
"plt_points = k3d.points(positions=positions, point_size=0.4, shader='3dSpecular', color=0xD0D3D4, opacity=0.5)\n",
"plot += plt_points\n",
"plot.display()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.7.6 64-bit ('anaconda3': conda)",
"language": "python",
"name": "python37664bitanaconda3condab615bb15fcd4464bb2000e7d9e446dfd"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6-final"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Loading