Giter VIP home page Giter VIP logo

cubbyflow / cubbyflow Goto Github PK

View Code? Open in Web Editor NEW
255.0 14.0 33.0 311.22 MB

Voxel-based fluid simulation engine for computer games

Home Page: https://cubbyflow.github.io/CubbyFlow/

License: MIT License

CMake 0.74% C++ 93.41% CSS 0.26% JavaScript 1.48% HTML 0.07% Python 1.32% Dockerfile 0.01% Cuda 2.70%
physics-engine fluid-simulation-engine computer-graphics computational-physics computational-fluid-dynamics cpp cpp17 cplusplus

cubbyflow's Introduction

CubbyFlow

License Windows Ubuntu macOS Ubuntu - Codecov Build Status

codecov Codacy Badge CodeFactor Discord

Quality Gate Status Lines of Code Maintainability Rating Reliability Rating Security Rating

CubbyFlow is voxel-based fluid simulation engine for computer games based on Jet framework that was created by Doyub Kim. The code is built on C++17 and can be compiled with commonly available compilers such as g++, clang++, or Microsoft Visual Studio. CubbyFlow currently supports macOS (10.12.6 or later), Ubuntu (17.04 or later), Windows (Visual Studio 2017 or later), and Windows Subsystem for Linux (WSL). Other untested platforms that support C++17 also should be able to build CubbyFlow.

Key Features

  • Basic math and geometry operations and data structures
  • Spatial query accelerators
  • SPH and PCISPH fluid simulators
  • Stable fluids-based smoke simulator
  • Level set-based liquid simulator
  • PIC, FLIP, and APIC fluid simulators
  • Upwind, ENO, and FMM level set solvers
  • Jacobi, Gauss-Seidel, SOR, MG, CG, ICCG, and MGPCG linear system solvers
  • Spherical, SPH, Zhu & Bridson, and Anisotropic kernel for points-to-surface converter
  • Converters between signed distance function and triangular mesh
  • C++ and Python API
  • Intel TBB, OpenMP, HPX and C++11 multi-threading backends

Every simulator has both 2-D and 3-D implementations.

Quick Start

You will need CMake to build the code. If you're using Windows, you need Visual Studio 2017 in addition to CMake.

First, clone the code:

git clone https://github.com/CubbyFlow/CubbyFlow.git --recursive
cd CubbyFlow

C++ API

For macOS or Linux or Windows Subsystem for Linux (WSL):

mkdir build
cd build
cmake ..
make

For Windows:

mkdir build
cd build
cmake .. -G"Visual Studio 15 2017 Win64"
MSBuild CubbyFlow.sln /p:Configuration=Release

Now run some examples, such as:

bin/HybridLiquidSim

Python API

Build and install the package by running

pip install -U .

Docker

docker pull cubbyflow/cubbyflow:latest

Now run hybrid simulation example:

docker run -it cubbyflow/cubbyflow
[inside docker container]
/app/build/bin/HybridLiquidSim

More Instructions of Building the Code

To learn how to build, test, and install the SDK, please check out INSTALL.md.

Documentation

All the documentations for the framework can be found from the project website incluing the API reference.

Examples

Here are some of the example simulations generated using CubbyFlow framework. Corresponding example codes can be found under Examples. All images are rendered using Mitsuba renderer and the Mitsuba scene files can be found from the demo directory. Find out more demos from the project website.

PCISPH Simulation Example

PCISPH_dam_breaking

Level Set Simulation Example

Level-set_dam_breaking

FLIP Simulation Example

FLIP_dam_breaking

PIC Simulation Example

PIC_dam_breaking

APIC Simulation Example

APIC_dam_breaking

Level Set Example with Different Viscosity (high / low)

level_set_bunny_drop_high_viscosity level_set_bunny_drop_low_viscosity

Smoke Simulation with Different Advection Methods (Linear / Cubic-Spline)

rising_smoke_linear rising_smoke_cubic

Presentations

Articles

How To Contribute

Contributions are always welcome, either reporting issues/bugs or forking the repository and then issuing pull requests when you have completed some additional coding that you feel will be beneficial to the main project. If you are interested in contributing in a more dedicated capacity, then please contact me.

Contact

You can contact me via e-mail (utilForever at gmail.com). I am always happy to answer questions or help with any issues you might have, and please be sure to share any additional work or your creations with me, I love seeing what other people are making.

License

The class is licensed under the MIT License:

Copyright (c) 2018-2020 CubbyFlow Team

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

cubbyflow's People

Contributors

cheolwanpark avatar dependabot[bot] avatar dvelopery0115 avatar federandink avatar luncliff avatar moreal avatar red-portal avatar sj avatar snowapril avatar utilforever avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cubbyflow's Issues

PEP 8 -- Style Guide for Python Code

Currently, the variables and function names in Python API are mixedCase.
I want to change these names to obey PEP8 -- Style Guide for Python Code.

Support for GPU-based simulation

This revision supports GPU-based parallel system such as CUDA, OpenCL and OpenACC. I want to support only CUDA first. If I get a chance later, I'll work on supporting the other two libraries.

Copy all files from CubbyFlow

  • Add libraries to gitmodules
    • googletest
    • googlebenchmark
    • pybind11
    • Clara
  • Add libraries
    • cnpy
    • flatbuffers
    • obj
    • pystring
  • Add header and source files
    • Core
    • Python API
  • Add tests
    • UnitTests
    • ManualTests
    • MemPerfTests
    • TimePerfTests
    • PythonTests
  • Add documents and medias

Troubleshooting recent build failures for the branch 'fix-code'

Situation
As seen here, the builds have been failing at some point after the commit: feat(fix-code): Add comments for Jet framework.

Probable cause
Current error message
error: Server does not allow request for unadvertised object 8553a4a0a72ac7c81ae7a59dc0380902208f73cb Fetched in submodule path 'Libraries/tinyobj', but it did not contain 8553a4a0a72ac7c81ae7a59dc0380902208f73cb. Direct fetching of that commit failed. ##[error]Git submodule update failed with exit code: 1
indicates that there are problems when fetching 'tinyobj'. After inspecting a similar case, I suspect that the submodule 'depth' (as of right now, 2) might be too small for fetching the specific commit for 'tinyobj'.

git -c http.https://github.com.extraheader="AUTHORIZATION: basic ***" submodule update --init --force --depth=**2**

Extra
Here' another related issue: AppImage/AppImageKit#511

Python API import error on Windows and Python 3.8+ with Intel TBB

I encountered Python API import error while updating CubbyFlow.

import pyCubbyFlow
ImportError: DLL load failed while importing pyCubbyFlow:
The specified module could not be found. 

At first, I thought it was my problem, but after a few days of investigation, I found that there is a new Windows safety feature that changes how DLLs are loaded in Python 3.8.
To resolve this issue, I needed to tell Python how to find the library again like this:

import os
os.add_dll_directory(r'C:/Intel/tbb/bin/intel64/vc14') << (The path that Intel TBB is located)
import pyCubbyFlow

I'll add this situation and solution to README.md or INSTALL.md.

Migrate to pytest for unit testing Python API

The pytest framework makes it easy to write small tests, yet scales to support complex functional testing for applications and libraries. I'll migrate to it for unit testing Python API.

Rearrange folder structures

This revision rearranges folder structures to make C# API.

  • Change Includes/Core, Sources/Core to Cores
  • Change Includes/API, Sources/API to APIs

Support C# API

  • Add C++/CLI and C++/CX codes for C# API
  • Add tests for C# API
  • Make examples for C# API

Apply lcov settings to generate code coverage report

This revision sets lcov to generate code coverage report.

CAUTION
lcov --directory . --capture --output-file coverage.info doesn't work. I added the compiler flag and link flag, and when I built it, the .gcno file was created, but the .gcda file was not created. It seems to be a problem caused by the updated version of gcov. (WARNING: no .gcda files found in .)

Add code quality tool (SonarCloud)

SonarCloud is a cloud service offered by SonarSource and based on SonarQube. SonarQube is a widely adopted open source platform to inspect continuously the quality of source code and detect bugs, vulnerabilities and code smells in more than 20 different languages.

Implement a GUI program that makes it easy to run examples

This revision creates a GUI program that makes it easy to run examples using imgui. Existing examples are run from the console, which is inconvenient because you have to enter the parameters multiple times. I am trying to improve this part.

  • HybridLiquidSim
  • LevelSetLiquidSim
  • SmokeSim
  • SPHSim

Annotations for the files from Jet Framework

One of the purposes of restructuring CubbyFlow and branching out to CubbyFlow-v0 is to distinguish CubbyFlow’s own code vs copied code from Jet Framework. Since this v0 repo (or “branch”) is still going to keep the copied code, please add a comment in those files stating the origin (Jet Framework, corresponding file and authors) unless this v0 repo is going to be a private repo.

Fix link error problem in MemPerfTest

If you have the latest version of googletest, you will get link errors when building the MemPerfTests project. This problem is caused by the ColoredPrintf function becoming a static function. This revision fixes it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.