Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
173 commits
Select commit Hold shift + click to select a range
f7a76ff
initial cleanup
meepzh Feb 29, 2016
f675968
make buildable on linux, rename project
meepzh Feb 29, 2016
286fd1c
ignore build folder
meepzh Feb 29, 2016
96271f3
changed cmake a bit according to tutorials
meepzh Feb 29, 2016
7291fcf
prepped file structure, got it working with qt creator
meepzh Feb 29, 2016
2e3b849
creates glfw window now
meepzh Feb 29, 2016
e1cbbea
basic fluid sim + particles (untested), changed stdio.h to cstdio
meepzh Feb 29, 2016
a22595d
changed particle properties to state struct
meepzh Feb 29, 2016
27594b1
basic camera properties
meepzh Feb 29, 2016
5438b73
arcball implementation
meepzh Feb 29, 2016
b7d9912
added shader program linking+compilation, removed hasError from viewe…
meepzh Feb 29, 2016
52b3a80
added wire shader, removed '?' from readme
meepzh Feb 29, 2016
39f8fb4
finished shader program and drawable implementation. changed color fr…
meepzh Feb 29, 2016
afa562d
added transform class, implemented cube wireframe, reworded credits
meepzh Feb 29, 2016
e3797d6
Added "how it works" to readme. Implemented scene
meepzh Feb 29, 2016
4112ebc
copy json/glsl files to build folder, bugfix glew and viewer.scene
meepzh Feb 29, 2016
526edf8
replaced for iterator loops with for-in loops, connected scene camera…
meepzh Feb 29, 2016
48e42d3
cleaned up debug output, moved color to vertex shader, trying to fix …
meepzh Feb 29, 2016
a8c45d6
fixed shader compile error, still can't see anything
meepzh Feb 29, 2016
f691fa7
glfw interface to arcball. still can't see anything
meepzh Feb 29, 2016
79540c8
getchar is useful, readded. moved shader and scene stuff after vao init
meepzh Feb 29, 2016
0591ec2
fixed seeing nothing due to zoom=0
meepzh Feb 29, 2016
1ae1e3e
fixed arcball
meepzh Feb 29, 2016
85a6225
fixed box draw
meepzh Feb 29, 2016
71c6b2c
basic particle shader program
meepzh Feb 29, 2016
312b7cb
finished particleshaderprogram implementation (untested)
meepzh Feb 29, 2016
b4c71a2
started work on spawning within volume, particle shader
meepzh Feb 29, 2016
783dbca
added dds texture to particle shader program, reworded credits
meepzh Mar 2, 2016
c3a3a57
particle texture and shader
meepzh Mar 2, 2016
aaf1c4d
moved fluidsolver to scene. identified problem with particle pointers…
meepzh Mar 2, 2016
6c14a87
added better debug options for gcc, protected particles container (ch…
meepzh Mar 2, 2016
295f817
got particles to sort of appear
meepzh Mar 2, 2016
ae6c387
default particle size. something is up with fragment shader
meepzh Mar 2, 2016
97252f9
cube of particles appears, but no box drawing or particle texture
meepzh Mar 2, 2016
a4daa1a
moved fluid source and container to solver
meepzh Mar 2, 2016
0e3bc56
particles change color upon crossing border. made camera further away…
meepzh Mar 2, 2016
0881917
added play/pause
meepzh Mar 2, 2016
228b959
fix particles not having texture. still not sure why lines disappear …
meepzh Mar 2, 2016
a1430cb
opengl/rendering tweaks
meepzh Mar 2, 2016
ee15d49
added readme note about wireframe
meepzh Mar 2, 2016
d4e077b
added build instructions
meepzh Mar 2, 2016
4821ebf
Added debug info (opengl version, texture loading). Fixed improper te…
meepzh Mar 22, 2016
5c24e91
changed shader versions to 330 core, wire shader out_Color now a vec4
meepzh Mar 22, 2016
c169b61
added opengl debug callback
meepzh Mar 22, 2016
7eef4ed
better debug log. still don't know why wireframe doesn't show
meepzh Mar 22, 2016
dee210d
fixed gl_invalid_value at beginning
meepzh Mar 22, 2016
7ae9ae8
fix whitespace
meepzh Mar 22, 2016
c4555a0
temporarily use gl_points for particles so wireframe finally shows
meepzh Mar 22, 2016
cd94c60
added framework for sph stuff
meepzh Mar 22, 2016
97e8a95
added linux openvdb libraries
meepzh Mar 22, 2016
7b9f15a
basic kernel functions implementation
meepzh Mar 22, 2016
dbf89e0
added structure for neighbor search and sph solver
meepzh Mar 22, 2016
b7c7722
framework for neighborsearch, sphsolver, kernelfunctions
meepzh Mar 22, 2016
3cd2b18
basic unit testing framework with cmake
meepzh Mar 22, 2016
936b4b4
boost testing framework complete
meepzh Mar 22, 2016
0fad72e
moved unittest directory to root
meepzh Mar 22, 2016
675e5c9
implemented naive neighbor search with unit tests
meepzh Mar 22, 2016
6f89883
config for sph
meepzh Mar 22, 2016
6bbafe0
moved file strings to config json
meepzh Mar 22, 2016
385988b
successfully tested kernel functions. added fequal utils header. edit…
meepzh Mar 23, 2016
8772d60
add todolist to readme
meepzh Mar 23, 2016
76e69fa
added sphparticles. this disables default functionality of particles
meepzh Mar 23, 2016
cf9fb3f
switch neighborsearch to sphparticle
meepzh Mar 23, 2016
b2d8f7d
updated neighbor search to use access sph particles' neighbor lists i…
meepzh Mar 23, 2016
98c7141
moved particles vector from fluidsolver to sphsolver
meepzh Mar 23, 2016
07a4369
implements sph core algorithm except compute forces
meepzh Mar 23, 2016
2b4d39f
untested grid neighbor search
meepzh Mar 23, 2016
7d124b1
uniform grid neighbor search with working unit tests
meepzh Mar 23, 2016
637505d
switch to standard grid, grid bugfix when getting coordinates
meepzh Mar 23, 2016
7876cd8
started neighbor search visual demo code, fixed grid neighbor search …
meepzh Mar 23, 2016
34fc50d
switched particle neighbors fxn from reference to pointer
meepzh Mar 23, 2016
7f505e2
added random selection of which particle's neighbors to view. removed…
meepzh Mar 23, 2016
788d557
sph solver config read
meepzh Mar 23, 2016
d581443
working openvdb
meepzh Mar 23, 2016
52baf7f
exports vdb (only on uniform grid mode)
meepzh Mar 23, 2016
939fe63
performance tests for neighbor searches
meepzh Mar 23, 2016
c140830
added performance graph
meepzh Mar 23, 2016
ffbc29c
readme typo
meepzh Mar 23, 2016
685af54
cleaned up readme
meepzh Mar 23, 2016
f5878bc
removed excessive crediting
meepzh Mar 23, 2016
9fb86d2
prep for sprint 2
meepzh Mar 27, 2016
b7735c2
implemented viscosity, pressure, and density solve. todo: boundary check
meepzh Mar 27, 2016
87c9898
added check bounds. added instant particle reseeding
meepzh Mar 27, 2016
0c7ebbe
step function. sane parameters. spiky gradient
meepzh Mar 27, 2016
9fa5aa0
fixed pressure solve! adjusted some parameters
meepzh Mar 27, 2016
f21052d
added boundary following. fix crashing due to spiky kernel, not havin…
meepzh Mar 28, 2016
945f1ef
working simulation after talk with irem, needs cleanup. todo: standar…
meepzh Mar 28, 2016
c466d35
cleanup. added logging levels and detailed config options
meepzh Mar 29, 2016
e25896f
added exceptions for exiting the application
meepzh Mar 29, 2016
595eb88
switched from printf to std::cout
meepzh Mar 29, 2016
6483793
fixed errors when compiling all code. added pause/unpause notification
meepzh Mar 29, 2016
282488b
moved uniform grid to its own class. renamed standard grid to uniform…
meepzh Mar 29, 2016
aabf75a
can now control timestep, camera, visualization type from config/scene.
meepzh Mar 29, 2016
5b4f9c5
added performance testing. added ability to update particle in unifor…
meepzh Mar 29, 2016
833d5a3
started work on z index sorted uniform grid
meepzh Mar 29, 2016
8a15e65
changed from solver vector of particle pointers to vector of particles
meepzh Mar 29, 2016
9ba8b03
switched uniform grid data to nonpointer
meepzh Mar 29, 2016
1db812e
basic zcurve implementation
meepzh Mar 29, 2016
e642b11
connected zcurve to zisuniform grid
meepzh Mar 29, 2016
41c4e6a
implemented index sorted uniform grid. reorganized sphgrid and gridne…
meepzh Mar 30, 2016
35201c4
added indexSortedUniform to config. fixed compile errors from impleme…
meepzh Mar 30, 2016
a557f61
added more tests and tracing. got neighbor visualization working. add…
meepzh Mar 30, 2016
d4b6f85
fixed index sorted uniform grid error
meepzh Mar 30, 2016
3eb9cad
added zcurve unit tests. fixed zcurve. added interface for using z in…
meepzh Mar 30, 2016
27dfc78
got zIndexSortedUniformGrid working. added unit tests for it
meepzh Mar 30, 2016
aa3a5b6
added insertion sort option. refactored neighbor search prep. added d…
meepzh Mar 30, 2016
cf98605
implemented and used insertion sort
meepzh Mar 30, 2016
e83dc80
attempted zcurve caching. ended up disabling via config
meepzh Mar 30, 2016
25dfdd7
added performance recording for neighbor search
meepzh Mar 30, 2016
7bd49c8
readme for compute times
meepzh Mar 30, 2016
60d2935
typo in readme
meepzh Mar 30, 2016
afe9f5d
graph image was different from preview, fixed readme to match
meepzh Mar 30, 2016
465b3dd
added tbb and removed record performance since it was affected by tbb
meepzh Apr 4, 2016
154d6f3
attempted to fix timer problem with std::clock. will switch to tbb clock
meepzh Apr 4, 2016
c7898b3
pause when end simulation. working overall simulation performance timing
meepzh Apr 4, 2016
422b8d2
moved particle update outside of sphparticle class in prep for iisph
meepzh Apr 10, 2016
9bbb2f3
fixed performance stats for unlimited simulations
meepzh Apr 10, 2016
03bed07
added normal index sorted uniform grid but with insertion sort
meepzh Apr 10, 2016
c172ec9
added pressure and scalar velocity visualization. added more info whe…
meepzh Apr 10, 2016
841c652
updated readme with new repo name and performance stats system info
meepzh Apr 10, 2016
de24548
readme formatting
meepzh Apr 10, 2016
4336cb8
major refactor: added src to include directories (no more relative in…
meepzh Apr 10, 2016
81d9320
separated force density into pressure and nonpressure in prep for iisph
meepzh Apr 10, 2016
7090752
implemented sph solver with forces instead of force densities
meepzh Apr 10, 2016
1b8c981
rough implementation of iisph. still need work on estimated average d…
meepzh Apr 10, 2016
c4d3b9c
converted deltaT to float. changed pressure calculation for sesph to …
meepzh Apr 10, 2016
44e246a
bicubic spline kernels
meepzh Apr 10, 2016
b0fbc15
progress on iisph. added some missing parts of algorithm. currently w…
meepzh Apr 10, 2016
8daad41
progress on iisph. disabled tbb, added assert macro for inf and nan, …
meepzh Apr 10, 2016
6f037c9
renamed variables for clarity. fixed dJI and aSelf in advection predi…
meepzh Apr 10, 2016
b9363f8
iisph working more or less, but slow. todo: add tbb parallel_reduce
meepzh Apr 10, 2016
02c9e84
added parallel_reduce. seems to freeze after a couple frames
meepzh Apr 11, 2016
86f6b66
cleanup for recording sph solver
meepzh Apr 11, 2016
eb6d470
parallelized manual screenshot taking
meepzh Apr 11, 2016
c827c2d
autorender and render every # frames, create render folder with boost…
meepzh Apr 11, 2016
20c92fd
changed config for rendering. fixed checking if render directory worked
meepzh Apr 11, 2016
c9ef909
fluid source positioning, no longer drawing fluid source
meepzh Apr 11, 2016
ce67719
index visualizatino
meepzh Apr 18, 2016
809ce6d
switched to non-blocked version of parallel_for when possible
meepzh Apr 18, 2016
01dd455
limit pressure solve iterations, only count positive pressure error
meepzh Apr 18, 2016
bd46b24
added credit to nuparu
meepzh Apr 18, 2016
5603a48
commented code
meepzh Apr 18, 2016
e44691b
set cube indices to be constant (no more for loop). set aSelf to 1 if…
meepzh Apr 18, 2016
a6d9b74
fixed major pressure solve equation error. pressure is still crazy
meepzh Apr 18, 2016
b5fecdf
renamed iisph variables to be more descriptive
meepzh Apr 18, 2016
555db1e
fixed error in sum pressure displacement by neighbors (forgot deltaT2…
meepzh Apr 18, 2016
3d903f7
added density and particle visualization. moved sceneLoaded stuff to …
meepzh Apr 18, 2016
abe371f
defer updating pressure until all pressures calculated
meepzh Apr 18, 2016
b06b8a7
renamed spikyGradientToNeighbor to be clearer as spikyGradientFromNei…
meepzh Apr 18, 2016
2a0bdb4
added back tbb, tweaked parameters for iisph
meepzh Apr 18, 2016
809a357
working iisph! removed asserts, updated goals
meepzh Apr 18, 2016
f331bdd
switched from .at() to [], added optional asserts as necessary instead
meepzh Apr 18, 2016
afe4c37
adjusted readme, set timestep to that recommended by Ihmsen
meepzh Apr 18, 2016
aed30ab
updated readme, added jittered seeding, added printout of amount of t…
meepzh Apr 18, 2016
d44856b
added partio libraries for arch linux
meepzh Apr 19, 2016
ba16d57
switched scene load defaults to use config. +misc changes to readme
meepzh Apr 19, 2016
d677170
added in partio framework. reorganied cmakelists and input.cpp
meepzh Apr 19, 2016
9b5a0ea
implemented partio export
meepzh Apr 19, 2016
0a46675
performance analysis of iisph
meepzh Apr 20, 2016
a420985
fixed errors in readme, removed old comments in isuGrid
meepzh Apr 20, 2016
492fa4f
slight clarification on performance analysis
meepzh Apr 20, 2016
c00e959
added optional particle statistics for detecting and debugging flyawa…
meepzh Apr 20, 2016
f354f62
checking for former flyaways affecting other particles, mutex for bet…
meepzh Apr 20, 2016
f1286db
add print particle stats to file
meepzh Apr 20, 2016
535c1cd
***seemed to fixed crashing. increased pressure solve iteration limit…
meepzh Apr 20, 2016
9554b5f
added neighbor stats, though they don't seem to predict flyaways
meepzh Apr 20, 2016
006190c
linted code
meepzh Apr 20, 2016
e4aa9d9
put switch cases into blocks
meepzh Apr 20, 2016
0b3965d
rough max pressure solve iterations config
meepzh Apr 20, 2016
e4a4e21
added preview for iisph stuff
meepzh Apr 20, 2016
d602fa1
start visualizing on frame 0, make jittered particles less jittered
meepzh Apr 27, 2016
c2639b0
updated readme with new video
meepzh Apr 27, 2016
7b9ae8b
linux openvdb libraries
meepzh Jun 2, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
Thanda.xcodeproj
Thanda.build
MFluidSolver.xcodeproj
MFluidSolver.build
DerivedData
CMakeScripts
CMakeFiles
CMakeCache.txt
cmake_install.cmake
CMakeLists.txt.user
build
138 changes: 114 additions & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,43 @@
##################
# Thanda #
##################
########################
# MFluidSolver #
########################

# credit - base CMake config : Yining Karl Li , edited CMake config: Akshay Shah & Debanshu Singh
# Credit - base CMake config: Yining Karl Li, edited CMake config: Akshay Shah & Debanshu Singh

#name your project
project(Thanda)
# Name your project
project(MFluidSolver)
cmake_minimum_required(VERSION 2.8)

# set creates a variable
set (NUPARU "nuparu")
# add include and src directories to path
# Versioning - https://cmake.org/cmake-tutorial/
set(MFluidSolver_VERSION_MAJOR 1)
set(MFluidSolver_VERSION_MINOR 0)
configure_file(
"${PROJECT_SOURCE_DIR}/src/MFluidSolverConfig.hpp.in"
"${PROJECT_BINARY_DIR}/MFluidSolverConfig.hpp"
)
include_directories("${PROJECT_BINARY_DIR}")

# Copy GLSL, JSON, and Texture files
file(GLOB CONFIG_FILE "${PROJECT_SOURCE_DIR}/config/*")
file(COPY ${CONFIG_FILE} DESTINATION "${PROJECT_BINARY_DIR}/")
file(GLOB GLSL_SRC "${PROJECT_SOURCE_DIR}/glsl/*.glsl")
file(COPY ${GLSL_SRC} DESTINATION "${PROJECT_BINARY_DIR}/glsl/")
file(GLOB JSON_SRC "${PROJECT_SOURCE_DIR}/scene/*.json")
file(COPY ${JSON_SRC} DESTINATION "${PROJECT_BINARY_DIR}/scene/")
file(GLOB TEXTURE_SRC "${PROJECT_SOURCE_DIR}/texture/*")
file(COPY ${TEXTURE_SRC} DESTINATION "${PROJECT_BINARY_DIR}/texture/")

# Set creates a variable
set(NUPARU "nuparu")
# Add include and src directories to path
include_directories(
${PROJECT_SOURCE_DIR}/src
${NUPARU}/include
${NUPARU}/src
)

# Add path for pre-compiled libraries here (we will later link them with our compiled source)
# Add Nuparu library to path for OSX, linux and windows
# Add Nuparu library to path for OSX, Linux and Windows
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${NUPARU}/lib/osx)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
Expand All @@ -26,27 +46,38 @@ elseif(WIN32)
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${NUPARU}/lib/win)
endif()

#set include variables
set(GLFW_INCLUDE_DIR ${NUPARU}/include )
set(GLEW_INCLUDE_DIR ${NUPARU}/include )
# Set include variables
set(GLFW_LIBRARY_DIR ${CMAKE_LIBRARY_PATH})
set(GLEW_LIBRARY_DIR ${CMAKE_LIBRARY_PATH})
set(GLFW_INCLUDE_DIR ${NUPARU}/include)
set(GLEW_INCLUDE_DIR ${NUPARU}/include)

# Use find_package & find_library to link with
find_package(OPENGL REQUIRED)
find_package(Boost COMPONENTS filesystem system REQUIRED)
find_package(OpenGL REQUIRED)
find_package(GLEW)
find_library(GLFW_LIBRARY "glfw3" HINTS ${GLFW_LIBRARY_DIR})
find_library(JSONCPP "jsoncpp")
find_library(LIBZ "z")
find_library(OPENVDB "openvdb")
find_library(OPENEXR_HALF NAMES Half PATHS ${CMAKE_LIBRARY_PATH})
find_library(PARTIO "partio")
find_library(TBB "tbb")

include_directories(${Boost_INCLUDE_DIRS})

add_definitions(
-DTW_STATIC
-DTW_NO_LIB_PRAGMA
-DTW_NO_DIRECT3D
-DGLEW_STATIC
-D_CRT_SECURE_NO_WARNINGS
-DBOOST_TEST_DYN_LINK
)

set(CORE_LIBS ${GLFW_LIBRARY} ${GLUT_LIBRARY} ${GLEW_LIBRARY} ${JSONCPP} ${OPENGL_LIBRARY} )
set(CORE_LIBS ${GLFW_LIBRARY} ${GLUT_LIBRARY} ${GLEW_LIBRARY} ${OPENGL_LIBRARY}
${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY}
${JSONCPP} ${LIBZ} ${OPENVDB} ${OPENEXR_HALF} ${PARTIO} ${TBB})

# OSX-specific hacks/fixes
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
Expand All @@ -62,33 +93,92 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lX11 -lXxf86vm -lXrandr -lpthread -lXi")
endif()

# set compiler flags for c++11
# Set compiler flags for c++11
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O3 -m64 -msse2 -w")
elseif(WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()

# Add -O0 to remove optimizations when using gcc
IF(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0")
ENDIF(CMAKE_COMPILER_IS_GNUCC)

if(MSVC)
set(COMPILER_FLAGS
set(COMPILER_FLAGS
CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE
CMAKE_C_FLAGS
CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
)
endif()

# Add source files you want to compile (.cpp)
set(CORE_SRC
src/main.cpp
src/camera/camera.cpp
src/viewer/viewer.cpp
nuparu/src/stb_image/stb_image_write.c
src/fluidSolver/sphSolver/iiSphSolver.cpp
src/fluidSolver/sphSolver/kernelFunctions.cpp
src/fluidSolver/sphSolver/neighborSearch.cpp
src/fluidSolver/sphSolver/sphGrid.cpp
src/fluidSolver/sphSolver/sphIndexSortedUniformGrid.cpp
src/fluidSolver/sphSolver/sphParticle.cpp
src/fluidSolver/sphSolver/sphSolver.cpp
src/fluidSolver/sphSolver/sphUniformGrid.cpp
src/fluidSolver/sphSolver/sphZIndexSortedUniformGrid.cpp
src/fluidSolver/fluidSolver.cpp
src/scene/scene.cpp
src/fluidSolver/particle.cpp
src/fluidSolver/zCurve.cpp
src/geom/cube.cpp
src/geom/drawable.cpp
src/geom/geom.cpp
src/geom/transform.cpp
src/scene/camera.cpp
src/scene/scene.cpp
src/viewer/input.cpp
src/viewer/particleShaderProgram.cpp
src/viewer/shaderProgram.cpp
src/viewer/viewer.cpp
src/main.cpp
src/utils.cpp
)

add_executable(MFluidSolver ${CORE_SRC})
target_link_libraries(MFluidSolver ${CORE_LIBS})

##### Testing #####
add_subdirectory(unittest)

# KernelFunctions Library
set(MKERNELFUNCTIONS_LIB
src/fluidSolver/sphSolver/kernelFunctions.cpp
)
add_library(MKernelFunctions ${MKERNELFUNCTIONS_LIB})

# NeighborSearch Library
set(MNEIGHBORSEARCH_LIB
src/fluidSolver/sphSolver/neighborSearch.cpp
src/fluidSolver/sphSolver/sphGrid.cpp
src/fluidSolver/sphSolver/sphIndexSortedUniformGrid.cpp
src/fluidSolver/sphSolver/sphParticle.cpp
src/fluidSolver/sphSolver/sphUniformGrid.cpp
src/fluidSolver/sphSolver/sphZIndexSortedUniformGrid.cpp
src/fluidSolver/particle.cpp
src/fluidSolver/zCurve.cpp
src/utils.cpp
)
add_library(MNeighborSearch ${MNEIGHBORSEARCH_LIB})
target_link_libraries(MNeighborSearch ${CORE_LIBS})

# ZCurve Library
set(MZCURVE_LIB
src/fluidSolver/zCurve.cpp
)
add_library(MZCurve ${MZCURVE_LIB})

add_executable(Thanda ${CORE_SRC})
target_link_libraries(Thanda ${CORE_LIBS})
# Tests
enable_testing()
add_test(NAME MTest COMMAND MTest)
151 changes: 143 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,151 @@
# CIS563-FluidSolver
(Credit : CIS565 README)
# MFluidSolver #

Fluid Solver Submission guidelines:
IISPH Demo: [Vimeo](https://vimeo.com/groups/cis563/videos/164437486)

![IISPH Cube in Cube Snapshot](images/cube-iisph-sprint1_0.png?raw=true "IISPH Cube in Cube snapshot.")

- If you have modified any of the CMakeLists.txt files at all (aside from the list of CORE_SRC), you must test that your project can build. Beware of any build issues.
### How Does It Work ###
This fluid solver uses GLFW, GLM, and GLEW. It reads a JSON configuration file
and a JSON scene file, creating a fluid container and a scene container. The
fluid generates particles once, then all the particles are subject to fluid
forces (currently none). The scene is initially paused. The camera is controlled
by a standard arcball interface described below. The solver currently set to
display the neighbor particles of the first particle, which can be changed
randomly. The solver can also export the backend grid for the fluid particles to
the VDB format. The solver runs both SESPH and IISPH.

- Open a GitHub pull request so that we can see that you have finished. The title should be "Submission: YOUR NAME".
### Dependencies ###

- In the body of the pull request, include a link to your repository.
- Boost (Filesytem, System, Unit Test Framework)
- OpenVDB 2.3.0

- Submit on canvas with a direct link to your pull request on GitHub
### Build Instructions (*nix) ###
By default, the program is set to default debugging mode as set in
`src/MFluidSolverConfig.hpp.in`. There are many other options there including
logging settings and defaults, but note that defaults will be overwritten by
the configuration file `config/config.json`.

mkdir build
cd build
cmake ..
make
./MFluidSolver

And you're done!
### Unit Test Instructions (*nix) ###
This will run all tests in the unittest folder. Test results will be printed
to stdout, and details are found in `build/Testing/Temporary/LastTest.log`.
This does include a brief performance test on neighbor search.

make test

### How To Use ###
Press P to toggle pausing. Press Press N to randomly pick a particle to show
its neighbors. Press E to export a VDB file of the graph to `export.vdb` (if
OpenVDB is enabled in `MFluidSolverConfig`). Press R to reseed the scene
using the fluid source. Press right to step frame by frame (0.001 seconds).
Press S to write out a screenshot to `screenshot_%05d.tga`.

All SPH parameters, as well as several general program parameters, can be found
in `config/config.json`. The scene file, which contains dimensions, particle
parameters, camera settings, and particle spawn information, can be edited from
`scene/scene.json`. Parameter names are case sensitive, but options are not. If
you change parameters outside of the build folder, you will need to rerun
`cmake ..`. You can avoid this issue by editing the files in the build folder.
Note the following case-insensitive string options available for several
parameters:

neighborSearchType
- naive
- uniform
- indexSortedUniform
- indexSortedUniformInsertionSort
- zIndexSortedUniform
- zIndexSortedUniformInsertionSort

spawnMethod
- jittered
- poissonDisk
- uniform

visualization
- type
- density (set maxDensityDifference)
- index
- neighbors
- none
- particle (set particleId)
- pressure (set maxPressure)
- velocity (set maxVelocity)
- velocityDir
- maxDensityDifference
- maxPressure
- maxVelocity
- particleId
- velocityColor (8-bit rgb array)

The `numUpdates` parameter can be used to set the number of frames to simulate
in order to get accurate and comparable performance ratings.

#### Arcball ####
The camera uses the arcball interface and can be controlled with the left and
right mouse buttons and the scroll wheel.

The left mouse button is handled by an arcball interface. Clicking and dragging
across the center of the GL widget rotates the camera around its focus point in
the X and Y directions. Clicking and dragging in a circular motion around the
outer edges of the GL widget rotates the camera around its focus point in the Z
direction. The movements of the camera should follow the movements of the mouse
intuitively.

The scroll wheel zooms the camera. Scrolling up zooms out and scrolling down
zooms in.

The right mouse button pans the camera. This changes both the camera's and its
focus point's position. Right-click and drag to move the camera in the opposite
direction of the mouse. It will look like you're dragging the scene with you.

### IISPH Simulation Performance ###
CPU: Intel i7-4800MQ limited to 2.7GHz<br />
GPU: NVIDIA GeForce GTX 765M<br />
Compiler: GCC 5.3.0<br />
Measured in seconds per frame. Note that this includes time spent updating the
viewer and logging input events.

![Graph of the simulation performance for different neighbor search types](images/nsPerfGraph2.png?raw=true "Index sorting improves performance without forced insertion sort.")

- The performance gain from index sorting is a signficant improvement over a
standard uniform grid, especially when insertion sort is not forced.
- The fact that the uniform grid uses the Y axis last (i.e.: change in the
Y-coordinate causes the greatest index change) may play a role in making uniform
grids comparable to Z-indexed grids, as fluids tend to stay within the XZ-plane.
It would be interesting to explore this further.
- Z-indexing may be more beneficial in cases where the XZ-plane is large (i.e.:
when there are larger index changes in the uniform grid), as it is in the Cube
in Cube scene.
- Index sorted grids sort every frame with std::sort, which is a hybrid of
introsort and insertion sort in [GCC](https://gcc.gnu.org/onlinedocs/libstdc++/libstdc++-html-USERS-4.4/a01027.html).
This likely explains the deficiencies of using insertion sort only.
- Insertion sort may also be less effective in IISPH where timesteps can be
larger than in traditional SESPH, so particles travel much farther and therefore
change indices much more frequently.

### Missing Required Features ###

- Test Partio point export
- OpenVDB level set export
- Optional: Update derivatives
- Optional: Ihmsen boundary conditions
- Optional: Cache neighbor distances
- Optional: Better seeding (poisson distribution)
- Optional: Test bicubic spline kernel
- Optional: Solid body coupling
- Optional: Headless mode
- Optional: Refactor IISPH because update() is way too hard to read
- Optional: Flyaway prevention

### Extra Features ###
None

### Credits ###
- [Nuparu Dependency and Foundation Libraries](https://github.com/betajippity/Nuparu)
- DDS File Loader adapted from [opengl-tutorial.org](http://www.opengl-tutorial.org/beginners-tutorials/tutorial-5-a-textured-cube/) [(WTF Public License)](http://www.wtfpl.net/).
Loading