### Install Python Bindings via Setup Script Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/doc/build_from_source.md Build and install the Python wheel package from the project root. ```bash git clone https://github.com/InteractiveComputerGraphics/SPlisHSPlasH.git cd SPlisHSPlasH python setup.py bdist_wheel pip install build/dist/*.whl ``` -------------------------------- ### Minimal Working Example with GUI Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/doc/py_getting_started.md Initializes the SPlisHSPlasH simulator with a graphical user interface. Requires the `pysplishsplash` library to be installed. ```python import pysplishsplash as sph def main(): base = sph.Exec.SimulatorBase() base.init() gui = sph.GUI.Simulator_GUI_imgui(base) base.setGui(gui) base.run() if __name__ == "__main__": main() ``` -------------------------------- ### Minimal Working Example without GUI Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/doc/py_getting_started.md Initializes and runs the SPlisHSPlasH simulator without a graphical interface, stopping at a specified time. Requires the `pysplishsplash` library to be installed. ```python import pysplishsplash as sph def main(): base = sph.Exec.SimulatorBase() base.init(useGui=False) base.setValueFloat(base.STOP_AT, 10.0) # Important to have the dot to denote a float base.run() if __name__ == "__main__": main() ``` -------------------------------- ### Handle Wheel Installation Files Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/extern/pybind/CMakeLists.txt Creates and installs __init__.py files when building a wheel. ```cmake # When building a wheel, include __init__.py's for modules # (see https://github.com/pybind/pybind11/pull/5552) if(DEFINED SKBUILD_PROJECT_NAME AND SKBUILD_PROJECT_NAME STREQUAL "pybind11") file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/empty") file(TOUCH "${CMAKE_CURRENT_BINARY_DIR}/empty/__init__.py") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/empty/__init__.py" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/empty/__init__.py" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig/") endif() ``` -------------------------------- ### Configure Installation Directories Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/extern/eigen/CMakeLists.txt Sets up installation paths for Eigen headers, CMake config files, and pkg-config files, ensuring paths are relative to the install prefix. ```cmake if(EIGEN_INCLUDE_INSTALL_DIR) message(WARNING "EIGEN_INCLUDE_INSTALL_DIR is deprecated. Use INCLUDE_INSTALL_DIR instead.") endif() if(EIGEN_INCLUDE_INSTALL_DIR AND NOT INCLUDE_INSTALL_DIR) set(INCLUDE_INSTALL_DIR ${EIGEN_INCLUDE_INSTALL_DIR} CACHE PATH "The directory relative to CMAKE_INSTALL_PREFIX where Eigen header files are installed") else() set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}/eigen3" CACHE PATH "The directory relative to CMAKE_INSTALL_PREFIX where Eigen header files are installed" ) endif() set(CMAKEPACKAGE_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/eigen3/cmake" CACHE PATH "The directory relative to CMAKE_INSTALL_PREFIX where Eigen3Config.cmake is installed" ) set(PKGCONFIG_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/pkgconfig" CACHE PATH "The directory relative to CMAKE_INSTALL_PREFIX where eigen3.pc is installed" ) foreach(var INCLUDE_INSTALL_DIR CMAKEPACKAGE_INSTALL_DIR PKGCONFIG_INSTALL_DIR) # If an absolute path is specified, make it relative to "{CMAKE_INSTALL_PREFIX}". if(IS_ABSOLUTE "${${var}}") file(RELATIVE_PATH "${var}" "${CMAKE_INSTALL_PREFIX}" "${${var}}") endif() endforeach() ``` -------------------------------- ### Install Eigen Files Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/extern/eigen/CMakeLists.txt Handles the installation of library files, pkg-config files, and header directories. ```cmake install(FILES signature_of_eigen3_matrix_library DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel ) if(EIGEN_BUILD_PKGCONFIG) configure_file(eigen3.pc.in eigen3.pc @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/eigen3.pc DESTINATION ${PKGCONFIG_INSTALL_DIR} ) endif() install(DIRECTORY Eigen DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel) ``` -------------------------------- ### Custom Exporter Example in Python Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/doc/implement_exporter.md An example demonstrating how to implement a custom exporter using the Python interface is available in the SPlisHSPlasH examples directory. ```python pySPlisHSPlasH\examples\custom_exporter.py ``` -------------------------------- ### Full Scene Setup and Run Script Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/doc/py_creating_scenes.md A complete script to set up a simulator with a GUI, add boundary and fluid objects, and run the simulation. Includes initialization, GUI setup, scene modification, and execution. ```python import pysplishsplash as sph import pysplishsplash.Utilities.SceneLoaderStructs as Scenes def main(): # Set up the simulator base = sph.Exec.SimulatorBase() base.init(useGui=True, sceneFile=sph.Extras.Scenes.Empty) # Create a simulator gui = sph.GUI.Simulator_GUI_imgui(base) base.setGui(gui) # Get the scene and add objects scene = base.getScene() scene.boundaryModels.append(Scenes.BoundaryData(meshFile="../models/UnitBox.obj", translation=[0., 3.0, 0.], scale=[4., 6., 4.], color=[0.1, 0.4, 0.5, 1.0], isWall=True, mapInvert=True, mapResolution=[25, 25, 25])) scene.fluidBlocks.append(Scenes.FluidBlock(id='Fluid', box=Scenes.Box([-1.5, 0.0, -1.5], [-0.5, 2.0, -0.5]), mode=0, initialVelocity=[0.0, 0.0, 0.0])) scene.fluidBlocks.append(Scenes.FluidBlock(id='Fluid', box=Scenes.Box([0.5, 0.0, 0.5], [1.5, 2.0, 1.5]), mode=0, initialVelocity=[0.0, 0.0, 0.0])) # Run the GUI base.run() if __name__ == "__main__": main() ``` -------------------------------- ### Build and Install Python Bindings Manually Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/doc/build_from_source.md Use these commands in the project root to build a wheel and install the generated package. Ensure a virtual environment is active before execution. ```bash git clone https://github.com/InteractiveComputerGraphics/SPlisHSPlasH.git cd SPlisHSPlasH python setup.py bdist_wheel pip install build/dist/pySPlisHSPlasH-2.8.3-cp37-cp37m-win_amd64.whl ``` -------------------------------- ### Install Python Bindings via Git Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/doc/build_from_source.md Install the Python bindings directly from the repository URL. ```bash pip install git+https://github.com/InteractiveComputerGraphics/SPlisHSPlasH.git ``` -------------------------------- ### Installing GLFW Files Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/extern/glfw/CMakeLists.txt Installs GLFW headers, CMake configuration files, export targets, and pkg-config files when GLFW_INSTALL is enabled. ```cmake if (GLFW_INSTALL) install(DIRECTORY include/GLFW DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} FILES_MATCHING PATTERN glfw3.h PATTERN glfw3native.h) install(FILES "${GLFW_BINARY_DIR}/src/glfw3Config.cmake" "${GLFW_BINARY_DIR}/src/glfw3ConfigVersion.cmake" DESTINATION "${GLFW_CONFIG_PATH}") install(EXPORT glfwTargets FILE glfw3Targets.cmake EXPORT_LINK_INTERFACE_LIBRARIES DESTINATION "${GLFW_CONFIG_PATH}") install(FILES "${GLFW_BINARY_DIR}/src/glfw3.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") # Only generate this target if no higher-level project already has if (NOT TARGET uninstall) configure_file(cmake_uninstall.cmake.in cmake_uninstall.cmake IMMEDIATE @ONLY) add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${GLFW_BINARY_DIR}/cmake_uninstall.cmake") set_target_properties(uninstall PROPERTIES FOLDER "GLFW3") endif() endif() ``` -------------------------------- ### Install Linux Dependencies Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/doc/build_from_source.md Install required system packages for building SPlisHSPlasH on Ubuntu. ```bash sudo apt install git cmake xorg-dev freeglut3-dev build-essential ``` -------------------------------- ### Install SPlisHSPlasH Python Bindings Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/doc/getting_started.md Clone the repository and install the Python bindings using pip. It is recommended to use a virtual environment. ```shell git clone https://github.com/InteractiveComputerGraphics/SPlisHSPlasH.git pip install SPlisHSPlasH/ ``` -------------------------------- ### Install pybind11 Package and Config Files Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/extern/pybind/CMakeLists.txt Configures and installs package files, headers, and CMake configuration files for pybind11. ```cmake if(PYBIND11_INSTALL) if(DEFINED SKBUILD_PROJECT_NAME AND SKBUILD_PROJECT_NAME STREQUAL "pybind11_global") install(DIRECTORY ${pybind11_INCLUDE_DIR}/pybind11 DESTINATION "${SKBUILD_HEADERS_DIR}") endif() install(DIRECTORY ${pybind11_INCLUDE_DIR}/pybind11 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) set(PYBIND11_CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME}" CACHE STRING "install path for pybind11Config.cmake") if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}") set(pybind11_INCLUDEDIR "${CMAKE_INSTALL_FULL_INCLUDEDIR}") else() set(pybind11_INCLUDEDIR "\${PACKAGE_PREFIX_DIR}/${CMAKE_INSTALL_INCLUDEDIR}") endif() configure_package_config_file( tools/${PROJECT_NAME}Config.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" INSTALL_DESTINATION ${PYBIND11_CMAKECONFIG_INSTALL_DIR}) # CMake natively supports header-only libraries write_basic_package_version_file( ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake VERSION ${PROJECT_VERSION} COMPATIBILITY AnyNewerVersion ARCH_INDEPENDENT) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake tools/FindPythonLibsNew.cmake tools/pybind11Common.cmake tools/pybind11Tools.cmake tools/pybind11NewTools.cmake tools/pybind11GuessPythonExtSuffix.cmake DESTINATION ${PYBIND11_CMAKECONFIG_INSTALL_DIR}) if(NOT PYBIND11_EXPORT_NAME) set(PYBIND11_EXPORT_NAME "${PROJECT_NAME}Targets") endif() install(TARGETS pybind11_headers EXPORT "${PYBIND11_EXPORT_NAME}") install( EXPORT "${PYBIND11_EXPORT_NAME}" NAMESPACE "pybind11::" DESTINATION ${PYBIND11_CMAKECONFIG_INSTALL_DIR}) ``` -------------------------------- ### Example SplishSplash Python Script Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/doc/py_embedded_python.md A comprehensive example script demonstrating initialization, step-by-step simulation logic, reset functionality, and custom GUI commands. It utilizes the `splishsplash` and `numpy` modules. ```python import splishsplash as sph import numpy as np counter = 0 function_list = ['command', 'command2'] def init(base): global counter print("init test") counter = 1 def step(): global counter sim = sph.Simulation.getCurrent() fluid = sim.getFluidModel(0) tm = sph.TimeManager.getCurrent() print(fluid.getPosition(0)) print(tm.getTime()) print(counter) counter += 1 print("---") def reset(): print("reset test") def command(): print("tst cmd") def command2(): print("tst cmd2") ``` -------------------------------- ### Install Python Bindings Dependencies Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/doc/build_from_source.md Install Python development tools required for building bindings. ```bash sudo apt install python3-dev python3-pip python3-venv python3 -m pip install pipx python3 -m pipx ensurepath ``` -------------------------------- ### Build and Install SPlisHSPlasH Wheel Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/doc/py_getting_started.md Builds a Python wheel file for SPlisHSPlasH and installs it. This is useful for development purposes. ```shell cd SPlisHSPlasH python setup.py bdist_wheel pip install -I build/dist/*.whl ``` -------------------------------- ### Install Eigen Header Files Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/extern/eigen/Eigen/CMakeLists.txt Installs the filtered Eigen header files to the specified include directory. Ensures the Devel component is used for installation. ```cmake install(FILES ${Eigen_directory_files_to_install} DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen COMPONENT Devel ) ``` -------------------------------- ### Check pySPlisHSPlasH Installation Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/doc/py_getting_started.md Verifies the pySPlisHSPlasH installation by importing the library. ```shell python -c "import pysplishsplash" ``` -------------------------------- ### Install pybind11 dependency Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/Scripts/Paraview/README.md Install the required pybind11 module using pip. ```bash pip install pybind11 ``` -------------------------------- ### SPlisHSPlasH Configuration Example Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/doc/file_format.md This JSON snippet demonstrates the structure for configuring a SPlisHSPlasH simulation, including general settings and parameters for different pressure solvers like WCSPH, PBF, and DFSPH. ```json "Configuration": { "pause": true, "sim2D": false, "timeStepSize": 0.001, "numberOfStepsPerRenderUpdate": 2, "particleRadius": 0.025, "simulationMethod": 4, "gravitation": [0.0,-9.81,0], "cflMethod": 1, "cflFactor": 1, "cflMaxTimeStepSize": 0.005, "WCSPH": { "stiffness": 50000, "exponent": 7 } "PBF": { "minIterations": 2, "maxIterations": 100, "maxError": 0.01, "velocityUpdateMethod": 0 }, "DFSPH": { "minIterations": 2, "maxIterations": 100, "maxError": 0.01, "maxIterationsV": 100, "maxErrorV": 0.1, "enableDivergenceSolver": true } } ``` -------------------------------- ### Install Targets for GLFW Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/extern/glfw/src/CMakeLists.txt Installs the GLFW target, including runtime, archive, and library destinations, based on the GLFW_INSTALL flag. ```cmake install(TARGETS glfw EXPORT glfwTargets RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") ``` -------------------------------- ### Install Numpy Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/doc/py_getting_started.md Installs the numpy library, which may be a required dependency for pySPlisHSPlasH. ```shell pip install numpy ``` -------------------------------- ### Construct and Write PLYData Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/extern/happly/README.md Examples of initializing a PLYData object from a file and writing data to a new file. ```cpp PLYData::PLYData("my_input.ply") ``` ```cpp PLYData::write("my_output.ply", DataFormat::ASCII) ``` -------------------------------- ### Install SPlisHSPlasH using Pip Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/doc/py_getting_started.md Installs the SPlisHSPlasH library using pip. Ensure you are one directory above the cloned source directory. ```shell pip install SPlisHSPlasH/ ``` -------------------------------- ### Outline of a simulation step Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/doc/creating_pressure.md Example implementation of the step() method showing the sequence of operations in a standard SPH simulation. ```cpp void TimeStepWCSPH::step() { Simulation *sim = Simulation::getCurrent(); const unsigned int nModels = sim->numberOfFluidModels(); TimeManager *tm = TimeManager::getCurrent (); const Real h = tm->getTimeStepSize(); // 1. Perform a neighborhood search performNeighborhoodSearch(); // 2. Compute non-pressure forces and SPH densities for (unsigned int fluidModelIndex = 0; fluidModelIndex < nModels; fluidModelIndex++) { clearAccelerations(fluidModelIndex); computeDensities(fluidModelIndex); } sim->computeNonPressureForces(); // 3. Compute pressure forces computePressureForces(); // 4. Update time step tize with CFL condition sim->updateTimeStepSize(); // 5. Advect particles advectParticles(); // 6. Emit and/or animate particles if necessary sim->emitParticles(); sim->animateParticles(); // 7. Advect time tm->setTime(tm->getTime() + h); } ``` -------------------------------- ### Install SPlisHSPlasH via pip Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/README.md Use this command to install the prebuilt Python wheel for supported versions (3.6-3.10). ```bash pip install pysplishsplash ``` -------------------------------- ### Generate pkg-config Support Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/extern/pybind/CMakeLists.txt Configures and installs a .pc file for pkg-config support. ```cmake # pkg-config support if(NOT prefix_for_pc_file) if(IS_ABSOLUTE "${CMAKE_INSTALL_DATAROOTDIR}") set(prefix_for_pc_file "${CMAKE_INSTALL_PREFIX}") else() set(pc_datarootdir "${CMAKE_INSTALL_DATAROOTDIR}") if(CMAKE_VERSION VERSION_LESS 3.20) set(prefix_for_pc_file "\${pcfiledir}/..") while(pc_datarootdir) get_filename_component(pc_datarootdir "${pc_datarootdir}" DIRECTORY) string(APPEND prefix_for_pc_file "/..") endwhile() else() cmake_path(RELATIVE_PATH CMAKE_INSTALL_PREFIX BASE_DIRECTORY CMAKE_INSTALL_DATAROOTDIR OUTPUT_VARIABLE prefix_for_pc_file) endif() endif() endif() join_paths(includedir_for_pc_file "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}") configure_file("${CMAKE_CURRENT_SOURCE_DIR}/tools/pybind11.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/pybind11.pc" @ONLY) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/pybind11.pc" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig/") ``` -------------------------------- ### Verify Python Bindings Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/doc/build_from_source.md Test that the Python bindings are correctly installed and importable. ```cpp cd lib python3 -c "import pysplishsplash" ``` -------------------------------- ### Enable Hardware Instruction Sets Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/extern/eigen/CMakeLists.txt Provides user-selectable options to enable specific CPU instruction sets for tests and examples. ```cmake set(CMAKE_REQUIRED_FLAGS "") option(EIGEN_TEST_SSE2 "Enable/Disable SSE2 in tests/examples" OFF) if(EIGEN_TEST_SSE2) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2") message(STATUS "Enabling SSE2 in tests/examples") endif() option(EIGEN_TEST_SSE3 "Enable/Disable SSE3 in tests/examples" OFF) if(EIGEN_TEST_SSE3) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse3") message(STATUS "Enabling SSE3 in tests/examples") endif() option(EIGEN_TEST_SSSE3 "Enable/Disable SSSE3 in tests/examples" OFF) if(EIGEN_TEST_SSSE3) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mssse3") message(STATUS "Enabling SSSE3 in tests/examples") endif() option(EIGEN_TEST_SSE4_1 "Enable/Disable SSE4.1 in tests/examples" OFF) if(EIGEN_TEST_SSE4_1) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1") message(STATUS "Enabling SSE4.1 in tests/examples") endif() option(EIGEN_TEST_SSE4_2 "Enable/Disable SSE4.2 in tests/examples" OFF) if(EIGEN_TEST_SSE4_2) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.2") message(STATUS "Enabling SSE4.2 in tests/examples") endif() option(EIGEN_TEST_AVX "Enable/Disable AVX in tests/examples" OFF) if(EIGEN_TEST_AVX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx") message(STATUS "Enabling AVX in tests/examples") endif() option(EIGEN_TEST_FMA "Enable/Disable FMA in tests/examples" OFF) if(EIGEN_TEST_FMA AND NOT EIGEN_TEST_NEON) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfma") message(STATUS "Enabling FMA in tests/examples") endif() option(EIGEN_TEST_AVX2 "Enable/Disable AVX2 in tests/examples" OFF) if(EIGEN_TEST_AVX2) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2 -mfma") message(STATUS "Enabling AVX2 in tests/examples") endif() option(EIGEN_TEST_AVX512 "Enable/Disable AVX512 in tests/examples" OFF) if(EIGEN_TEST_AVX512) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx512f -mfma") if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fabi-version=6") endif() message(STATUS "Enabling AVX512 in tests/examples") endif() option(EIGEN_TEST_AVX512DQ "Enable/Disable AVX512DQ in tests/examples" OFF) if(EIGEN_TEST_AVX512DQ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx512dq") if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fabi-version=6") endif() message(STATUS "Enabling AVX512DQ in tests/examples") endif() option(EIGEN_TEST_F16C "Enable/Disable F16C in tests/examples" OFF) if(EIGEN_TEST_F16C) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mf16c") message(STATUS "Enabling F16C in tests/examples") endif() option(EIGEN_TEST_ALTIVEC "Enable/Disable AltiVec in tests/examples" OFF) if(EIGEN_TEST_ALTIVEC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maltivec -mabi=altivec") message(STATUS "Enabling AltiVec in tests/examples") endif() option(EIGEN_TEST_VSX "Enable/Disable VSX in tests/examples" OFF) if(EIGEN_TEST_VSX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -mvsx") message(STATUS "Enabling VSX in tests/examples") endif() option(EIGEN_TEST_MSA "Enable/Disable MSA in tests/examples" OFF) if(EIGEN_TEST_MSA) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmsa") message(STATUS "Enabling MSA in tests/examples") endif() option(EIGEN_TEST_NEON "Enable/Disable Neon in tests/examples" OFF) if(EIGEN_TEST_NEON) if(EIGEN_TEST_FMA) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon-vfpv4") else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon") endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfloat-abi=hard") ``` -------------------------------- ### Configure Relative Directory Paths Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/extern/pybind/CMakeLists.txt Sets the installation directory for headers based on Python include paths. ```cmake if(USE_PYTHON_INCLUDE_DIR AND DEFINED Python_INCLUDE_DIRS) file(RELATIVE_PATH CMAKE_INSTALL_INCLUDEDIR ${CMAKE_INSTALL_PREFIX} ${Python_INCLUDE_DIRS}) elseif(USE_PYTHON_INCLUDE_DIR AND DEFINED PYTHON_INCLUDE_DIR) file(RELATIVE_PATH CMAKE_INSTALL_INCLUDEDIR ${CMAKE_INSTALL_PREFIX} ${PYTHON_INCLUDE_DIRS}) endif() ``` -------------------------------- ### Display Build Configuration Status Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/extern/eigen/CMakeLists.txt Prints status messages to the console regarding available build targets and installation paths. ```cmake message(STATUS "") message(STATUS "Configured Eigen ${EIGEN_VERSION_NUMBER}") message(STATUS "") string(TOLOWER "${CMAKE_GENERATOR}" cmake_generator_tolower) if(cmake_generator_tolower MATCHES "makefile") message(STATUS "Available targets (use: make TARGET):") else() message(STATUS "Available targets (use: cmake --build . --target TARGET):") endif() message(STATUS "---------+--------------------------------------------------------------") message(STATUS "Target | Description") message(STATUS "---------+--------------------------------------------------------------") message(STATUS "install | Install Eigen. Headers will be installed to:") message(STATUS " | /") message(STATUS " | Using the following values:") message(STATUS " | CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") message(STATUS " | INCLUDE_INSTALL_DIR: ${INCLUDE_INSTALL_DIR}") message(STATUS " | Change the install location of Eigen headers using:") message(STATUS " | cmake . -DCMAKE_INSTALL_PREFIX=yourprefix") message(STATUS " | Or:") message(STATUS " | cmake . -DINCLUDE_INSTALL_DIR=yourdir") message(STATUS "doc | Generate the API documentation, requires Doxygen & LaTeX") if(BUILD_TESTING) message(STATUS "check | Build and run the unit-tests. Read this page:") message(STATUS " | http://eigen.tuxfamily.org/index.php?title=Tests") endif() message(STATUS "blas | Build BLAS library (not the same thing as Eigen)") message(STATUS "uninstall| Remove files installed by the install target") message(STATUS "---------+--------------------------------------------------------------") message(STATUS "") ``` -------------------------------- ### Install Eigen Source Directory Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/extern/eigen/Eigen/CMakeLists.txt Installs the 'src' directory from Eigen, specifically matching and installing only files ending with '.h'. This ensures only header files from the source directory are installed. ```cmake install(DIRECTORY src DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen COMPONENT Devel FILES_MATCHING PATTERN "*.h") ``` -------------------------------- ### Configure Wayland Backend Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/extern/glfw/CMakeLists.txt Finds and configures Wayland, WaylandScanner, WaylandProtocols, and XKBCommon packages for Wayland window creation. Includes checks for memfd_create and EpollShim if not on Linux. ```cmake if (_GLFW_WAYLAND) find_package(ECM REQUIRED NO_MODULE) list(APPEND CMAKE_MODULE_PATH "${ECM_MODULE_PATH}") find_package(Wayland REQUIRED Client Cursor Egl) find_package(WaylandScanner REQUIRED) find_package(WaylandProtocols 1.15 REQUIRED) list(APPEND glfw_PKG_DEPS "wayland-client") list(APPEND glfw_INCLUDE_DIRS "${Wayland_INCLUDE_DIRS}") list(APPEND glfw_LIBRARIES "${Wayland_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT}") find_package(XKBCommon REQUIRED) list(APPEND glfw_INCLUDE_DIRS "${XKBCOMMON_INCLUDE_DIRS}") include(CheckIncludeFiles) include(CheckFunctionExists) check_function_exists(memfd_create HAVE_MEMFD_CREATE) if (NOT CMAKE_SYSTEM_NAME STREQUAL "Linux") find_package(EpollShim) if (EPOLLSHIM_FOUND) list(APPEND glfw_INCLUDE_DIRS "${EPOLLSHIM_INCLUDE_DIRS}") list(APPEND glfw_LIBRARIES "${EPOLLSHIM_LIBRARIES}") endif() endif() endif() ``` -------------------------------- ### Execute MeshSkinning via command line Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/doc/MeshSkinning.md Run the tool using a scene file with splitting and overwrite options enabled. ```bash MeshSkinning --splitting --overwrite --scene ..\data\Scenes\Beam.json ``` -------------------------------- ### Configuring Header and PC Files Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/extern/glfw/CMakeLists.txt Configures the glfw_config.h header file and the glfw3.pc pkg-config file. ```cmake configure_file(src/glfw_config.h.in src/glfw_config.h @ONLY) configure_file(src/glfw3.pc.in src/glfw3.pc @ONLY) ``` -------------------------------- ### Configure X11 Backend Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/extern/glfw/CMakeLists.txt Finds and configures the X11 package, setting up include paths and libraries for X11, XRandR, Xinerama, Xkb, Xcursor, and XInput. Includes checks for essential X11 extensions. ```cmake if (_GLFW_X11) find_package(X11 REQUIRED) list(APPEND glfw_PKG_DEPS "x11") # Set up library and include paths list(APPEND glfw_INCLUDE_DIRS "${X11_X11_INCLUDE_PATH}") list(APPEND glfw_LIBRARIES "${X11_X11_LIB}" "${CMAKE_THREAD_LIBS_INIT}") # Check for XRandR (modern resolution switching and gamma control) if (NOT X11_Xrandr_INCLUDE_PATH) message(FATAL_ERROR "RandR headers not found; install libxrandr development package") endif() # Check for Xinerama (legacy multi-monitor support) if (NOT X11_Xinerama_INCLUDE_PATH) message(FATAL_ERROR "Xinerama headers not found; install libxinerama development package") endif() # Check for Xkb (X keyboard extension) if (NOT X11_Xkb_INCLUDE_PATH) message(FATAL_ERROR "XKB headers not found; install X11 development package") endif() # Check for Xcursor (cursor creation from RGBA images) if (NOT X11_Xcursor_INCLUDE_PATH) message(FATAL_ERROR "Xcursor headers not found; install libxcursor development package") endif() # Check for XInput (modern HID input) if (NOT X11_Xi_INCLUDE_PATH) message(FATAL_ERROR "XInput headers not found; install libxi development package") endif() list(APPEND glfw_INCLUDE_DIRS "${X11_Xrandr_INCLUDE_PATH}" "${X11_Xinerama_INCLUDE_PATH}" "${X11_Xkb_INCLUDE_PATH}" "${X11_Xcursor_INCLUDE_PATH}" "${X11_Xi_INCLUDE_PATH}") endif() ``` -------------------------------- ### Load Scene from Absolute Path Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/doc/py_creating_scenes.md Initializes the simulator using a scene file specified by an absolute path. Ensure the path is correctly formatted. ```python import os custom_scene = os.path.abspath("scene.json") base.init(sceneFile=custom_scene) ``` -------------------------------- ### Build SPlisHSPlasH from Source Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/doc/build_from_source.md Clone the repository and build the project using CMake. ```bash git clone https://github.com/InteractiveComputerGraphics/SPlisHSPlasH.git cd SPlisHSPlasH mkdir build && cd build cmake -DCMAKE_BUILD_TYPE=Release -DUSE_PYTHON_BINDINGS= .. make -j 4 ``` -------------------------------- ### Build the partio extension Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/Scripts/Paraview/README.md Compile the partio module within the partio_extension directory. ```bash python setup.py build_ext ``` -------------------------------- ### Execute VolumeSampling via command line Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/doc/VolumeSampling.md Run the VolumeSampling executable to convert an OBJ model into a VTK particle file using the Kugelstadt et al. 2021 sampling mode. ```bash VolumeSampling.exe --mode 4 -i ..\data\models\bunny.obj -o bunny.vtk ``` -------------------------------- ### Custom Target for Python Module Installation Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/pySPlisHSPlasH/CMakeLists.txt Defines a custom CMake target 'pysplishsplash_install' to build a Python wheel and install it using pip. This is useful for packaging the Python bindings. ```cmake add_custom_target(pysplishsplash_install ${PYTHON_EXECUTABLE} setup.py bdist_wheel COMMAND ${PYTHON_EXECUTABLE} -m pip install -I build/dist/py*.whl WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) ``` -------------------------------- ### Run SPlisHSPlasH command line simulator Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/README.md Execute the simulator or view help documentation using these commands. ```bash splash splash --help ``` -------------------------------- ### Run SPlisHSPlasH Simulation from Command Line Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/doc/py_getting_started.md Launches the SPlisHSPlasH simulator with a preconfigured scene file, prompting the user for selection. ```shell splash ``` -------------------------------- ### Filter and Install Eigen Header Files Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/extern/eigen/Eigen/CMakeLists.txt Iterates through found Eigen directory files, filtering out specific patterns (like .txt files or hidden files) before installing the remaining header files. ```cmake foreach(f ${Eigen_directory_files}) if(NOT f MATCHES "\.txt" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/[.].+" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/src") list(APPEND Eigen_directory_files_to_install ${f}) endif() endforeach(f ${Eigen_directory_files}) ``` -------------------------------- ### Visualize Output Directory Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/doc/PartioViewer.md This tool is also able to read a complete output directory. The tool searches for partio files of multiple phases in the subdirectory 'partio' and for rigid body data in 'rigid_bodies'. ```cpp PartioViewer output/DamBreakModel ``` -------------------------------- ### Display SPlisHSPlasH Help Information Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/doc/py_getting_started.md Shows the available command-line options and functionality for the SPlisHSPlasH simulator. ```shell splash --help ``` -------------------------------- ### Integrate Custom Solver in Simulation.cpp (Method) Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/doc/creating_pressure.md Include the header file for your custom pressure solver in `Simulation.cpp` and add a new `else if` block to the `Simulation::setSimulationMethod` function to instantiate and initialize your solver. ```cpp #include "SPlisHSPlasH/MyPressureSolver/TimeStepMyPressureSolver.h" else if (method == SimulationMethods::MyPressureSolver) { m_timeStep = new TimeStepMyPressureSolver(); m_timeStep->init(); setValue(Simulation::KERNEL_METHOD, ); setValue(Simulation::GRAD_KERNEL_METHOD, ); } ``` -------------------------------- ### Implement RigidBodyExporter_MyFormat Class Methods Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/doc/implement_exporter.md This C++ source file provides the implementation for the RigidBodyExporter_MyFormat class. It defines how the export path is initialized, how rigid body data is processed per frame (with special handling for static bodies), and how the output directory is created upon activation. ```cpp #include "RigidBodyExporter_MyFormat.h" #include #include #include "SPlisHSPlasH/Simulation.h" using namespace SPH; using namespace Utilities; RigidBodyExporter_MyFormat::RigidBodyExporter_MyFormat(SimulatorBase* base) : ExporterBase(base) { m_isFirstFrame = true; } RigidBodyExporter_MyFormat::~RigidBodyExporter_MyFormat(void) { } void RigidBodyExporter_MyFormat::init(const std::string& outputPath) { // define output path for the data m_exportPath = FileSystem::normalizePath(outputPath + "/my_format"); } void RigidBodyExporter_MyFormat::step(const unsigned int frame) { // check if the exporter is active if (!m_active) return; // check if we have a static model bool isStatic = true; for (unsigned int i = 0; i < sim->numberOfBoundaryModels(); i++) { BoundaryModel* bm = sim->getBoundaryModel(i); if (bm->getRigidBodyObject()->isDynamic()) { isStatic = false; break; } } // If we have a static model, write the data only for the first frame. // Otherwise each frame is exported. if (m_isFirstFrame || !isStatic) { [...] } m_isFirstFrame = false; } void RigidBodyExporter_MyFormat::reset() { m_isFirstFrame = true; } void RigidBodyExporter_MyFormat::setActive(const bool active) { ExporterBase::setActive(active); // create output folder if (m_active) FileSystem::makeDirs(m_exportPath); } ``` -------------------------------- ### Define Eigen Interface Target Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/extern/eigen/CMakeLists.txt Sets up the Eigen interface library target and configures include directories for build and install interfaces. ```cmake set ( EIGEN_VERSION_STRING ${EIGEN_VERSION_NUMBER} ) set ( EIGEN_VERSION_MAJOR ${EIGEN_WORLD_VERSION} ) set ( EIGEN_VERSION_MINOR ${EIGEN_MAJOR_VERSION} ) set ( EIGEN_VERSION_PATCH ${EIGEN_MINOR_VERSION} ) set ( EIGEN_DEFINITIONS "") set ( EIGEN_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR}" ) set ( EIGEN_ROOT_DIR ${CMAKE_INSTALL_PREFIX} ) include (CMakePackageConfigHelpers) # Imported target support add_library (eigen INTERFACE) add_library (Eigen3::Eigen ALIAS eigen) target_compile_definitions (eigen INTERFACE ${EIGEN_DEFINITIONS}) target_include_directories (eigen INTERFACE $ $ ) # Export as title case Eigen set_target_properties (eigen PROPERTIES EXPORT_NAME Eigen) install (TARGETS eigen EXPORT Eigen3Targets) ``` -------------------------------- ### Configure PartioViewer Build System Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/Tools/PartioViewer/CMakeLists.txt Defines dependencies, source groups, and executable properties for the PartioViewer project. ```cmake include(${PROJECT_SOURCE_DIR}/GUI/OpenGL/CMakeLists.txt) include(${PROJECT_SOURCE_DIR}/GUI/imgui/CMakeLists.txt) set(VIEWER_LINK_LIBRARIES imgui SPlisHSPlasH) set(VIEWER_DEPENDENCIES imgui SPlisHSPlasH CopySPlisHSPlasHShaders CopyImguiFonts) set(GUI_SOURCE_FILES GUI/imgui/PartioViewer_GUI_imgui.cpp ) set(GUI_HEADER_FILES GUI/imgui/PartioViewer_GUI_imgui.h ) source_group("Header Files\\GUI\\imgui" FILES ${GUI_HEADER_FILES}) source_group("Source Files\\GUI\\imgui" FILES ${GUI_SOURCE_FILES}) if(WIN32) set(VIEWER_LINK_LIBRARIES opengl32.lib glu32.lib ${VIEWER_LINK_LIBRARIES}) set(VIEWER_DEPENDENCIES ${VIEWER_DEPENDENCIES}) else() set(OpenGL_GL_PREFERENCE GLVND) find_package(OpenGL REQUIRED) include_directories( ${OPENGL_INCLUDE_DIRS}) set(VIEWER_LINK_LIBRARIES ${VIEWER_LINK_LIBRARIES} ${OPENGL_LIBRARIES} ) endif() add_executable(PartioViewer main.cpp PartioViewer.cpp PartioViewer.h GUI/OpenGL/PartioViewer_OpenGL.cpp GUI/OpenGL/PartioViewer_OpenGL.h GUI/PartioViewer_GUI_Base.h ${GUI_SOURCE_FILES} ${GUI_HEADER_FILES} ${PROJECT_SOURCE_DIR}/extern/toojpeg/toojpeg.cpp ${PROJECT_SOURCE_DIR}/extern/toojpeg/toojpeg.h ${VIS_FILES} ${GUI_FILES} ) add_dependencies(PartioViewer ${VIEWER_DEPENDENCIES}) target_link_libraries(PartioViewer ${VIEWER_LINK_LIBRARIES}) VIS_SOURCE_GROUPS() GUI_SOURCE_GROUPS() set_target_properties(PartioViewer PROPERTIES FOLDER "Tools") set_target_properties(PartioViewer PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) set_target_properties(PartioViewer PROPERTIES RELWITHDEBINFO_POSTFIX ${CMAKE_RELWITHDEBINFO_POSTFIX}) set_target_properties(PartioViewer PROPERTIES MINSIZEREL_POSTFIX ${CMAKE_MINSIZEREL_POSTFIX}) source_group("Header Files\\GUI" FILES GUI/PartioViewer_GUI_Base.h) source_group("Header Files\\GUI\\OpenGL" FILES GUI/OpenGL/PartioViewer_OpenGL.h) source_group("Source Files\\GUI\\OpenGL" FILES GUI/OpenGL/PartioViewer_OpenGL.cpp) ``` -------------------------------- ### Replace Fluid Block in SPlisHSPlasH Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/doc/py_getting_started.md This Python script replaces the second fluid block in a SPlisHSPlasH simulation with a larger cube. Ensure pysplishsplash is installed and configured. ```python import pysplishsplash import pysplishsplash.Utilities.SceneLoaderStructs as Scene def main(): base = pysplishsplash.Exec.SimulatorBase() args = base.init() gui = pysplishsplash.GUI.Simulator_GUI_imgui(base) base.setGui(gui) scene = base.getScene() add_block = Scene.FluidBlock('Fluid', Scene.Box([0.0, 0.0, 0.0], [1.0, 1.0, 1.0]), 0, [0.0, 0.0, 0.0]) scene.fluidBlocks[1] = add_block # In Place construction not supported yet base.run() if __name__ == "__main__": main() ``` -------------------------------- ### Define Library Sources Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/extern/nfd/CMakeLists.txt Initializes the library target and adds platform-specific source files. ```cmake set(NFD_LIB "" CACHE INTERNAL "") set(TARGET_NAME nfd) set(PUBLIC_HEADER_FILES include/nfd.h include/nfd.hpp) set(SOURCE_FILES ${PUBLIC_HEADER_FILES}) if(nfd_PLATFORM STREQUAL PLATFORM_WIN32) list(APPEND SOURCE_FILES nfd_win.cpp) endif() ``` -------------------------------- ### Get Git Revision Description Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/Utilities/CMakeLists.txt Includes CMake functions to retrieve Git revision information. Used to determine the project's current version and detect local changes. ```cmake include(GetGitRevisionDescription) get_git_head_revision(GIT_REFSPEC GIT_SHA1) git_local_changes(GIT_LOCAL_CHANGES) if (DL_OUTPUT) git_local_diff(GIT_LOCAL_DIFF) # Write the output to a file in the binary directory file(WRITE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/git_diff.txt "${GIT_LOCAL_DIFF}") endif() if (${GIT_LOCAL_CHANGES} STREQUAL "DIRTY") set(COMPILER_MESSAGE "#pragma WARNING(Local changes not committed.)") endif() file (STRINGS "../version.txt" SPLISHSPLASH_VERSION) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Version.h.in ${CMAKE_CURRENT_SOURCE_DIR}/Version.h @ONLY) ``` -------------------------------- ### Load Empty Scene Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/doc/py_creating_scenes.md Initializes the simulator with a predefined empty scene. This sets default simulation parameters. ```python import pysplishsplash as sph import pysplishsplash.Utilities.SceneLoaderStructs as Scenes base = sph.Exec.SimulatorBase() base.init(sceneFile=Scenes.Empty) ``` -------------------------------- ### Iterate Over Boundary Neighbors for Density Maps (C++) Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/doc/macros.md Use this macro to loop through all boundary neighbors and access their density and gradient information. Requires specific simulation and boundary model setup. ```cpp #define forall_density_maps(code) \ for (unsigned int pid = 0; pid < nBoundaries; pid++) \ { \ BoundaryModel_Koschier2017 *bm_neighbor = static_cast(sim->getBoundaryModel(pid)); \ const Real rho = bm_neighbor->getBoundaryDensity(fluidModelIndex, i); \ if (rho != 0.0) \ { \ const Vector3r &gradRho = bm_neighbor->getBoundaryDensityGradient(fluidModelIndex, i).cast(); \ const Vector3r &xj = bm_neighbor->getBoundaryXj(fluidModelIndex, i); \ code \ } \ } ``` -------------------------------- ### Implement deferred initialization Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/doc/implement_nonpressure_force.md Override deferredInit to initialize values dependent on scene parameters after loading. ```cpp void MyViscosity::deferredInit() { initMyViscosity(); } ``` -------------------------------- ### Define Fluid Blocks Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/doc/file_format.md Use this snippet to define axis-aligned blocks of fluid particles. Specify the start and end coordinates, translation, and scale. Dense mode controls particle sampling density. ```json "FluidBlocks": [ { "denseMode": 0, "start": [-2.0, 0.0, -1], "end": [-0.5, 1.5, 1], "translation": [1.0, 0.0, 0.0], "scale": [1, 1, 1] } ] ``` -------------------------------- ### Iterate Over Boundary Neighbors for Volume Maps (C++) Source: https://github.com/interactivecomputergraphics/splishsplash/blob/master/doc/macros.md This macro iterates over boundary neighbors to retrieve boundary volume information. It is suitable for calculations involving boundary volumes and positions. Requires specific simulation and boundary model setup. ```cpp #define forall_volume_maps(code) \ for (unsigned int pid = 0; pid < nBoundaries; pid++) \ { \ BoundaryModel_Bender2019 *bm_neighbor = static_cast(sim->getBoundaryModel(pid)); \ const Real Vj = bm_neighbor->getBoundaryVolume(fluidModelIndex, i); \ if (Vj > 0.0) \ { \ const Vector3r &xj = bm_neighbor->getBoundaryXj(fluidModelIndex, i); \ code \ } \ } ```