├── .github └── ISSUE_TEMPLATE │ ├── bug-report.md │ ├── feature-request.md │ └── questions-comments.md ├── .gitignore ├── LICENSE_GPLv3.md ├── LICENSE_MIT.md ├── LICENSE_Standard_Royalty_Free.md ├── README.md ├── __init__.py ├── build.py ├── cmake └── CMakeLists.txt └── src ├── addon ├── __init__.py.in ├── bake.py ├── blender_manifest.toml.in ├── exit_handler.py ├── export.py ├── filesystem │ ├── __init__.py │ └── filesystem_protection_layer.py ├── icons │ ├── flip_fluids_logo_27.png │ └── flip_fluids_logo_28.png ├── materials │ ├── LICENSE.md │ ├── __init__.py │ └── material_library.py ├── objects │ ├── __init__.py │ ├── flip_fluid_aabb.py │ ├── flip_fluid_cache.py │ ├── flip_fluid_geometry_database.py │ ├── flip_fluid_geometry_export_object.py │ ├── flip_fluid_geometry_exporter.py │ ├── flip_fluid_map.py │ ├── flip_fluid_material_library.py │ ├── flip_fluid_mesh_exporter.py │ └── flip_fluid_preset_stack.py ├── operators │ ├── __init__.py │ ├── bake_operators.py │ ├── cache_operators.py │ ├── command_line_operators.py │ ├── draw_force_field_operators.py │ ├── draw_grid_operators.py │ ├── draw_operators.py │ ├── draw_particles_operators.py │ ├── error_operators.py │ ├── export_operators.py │ ├── helper_operators.py │ ├── material_operators.py │ ├── object_operators.py │ ├── preferences_operators.py │ ├── preset_operators.py │ ├── render_operators.py │ ├── render_passes.py │ ├── stats_operators.py │ ├── support_operators.py │ └── world_operators.py ├── presets │ ├── __init__.py │ ├── preset_library.py │ ├── preset_library │ │ ├── resources │ │ │ └── empty.blend │ │ ├── sys │ │ │ ├── FF_Compositing.blend │ │ │ ├── LICENSE.md │ │ │ └── default.preset │ │ └── usr │ │ │ └── basic_fluids │ │ │ ├── LICENSE.md │ │ │ ├── apple_juice_90344ad8 │ │ │ ├── data.preset │ │ │ └── icon.png │ │ │ ├── apple_spritzer_5d811745 │ │ │ ├── data.preset │ │ │ └── icon.png │ │ │ ├── beer_3ccd2f97 │ │ │ ├── data.preset │ │ │ └── icon.png │ │ │ ├── blood_7424cd41 │ │ │ ├── data.preset │ │ │ └── icon.png │ │ │ ├── caramel_0540c2bc │ │ │ ├── data.preset │ │ │ └── icon.png │ │ │ ├── chocolate_73bd6e22 │ │ │ ├── data.preset │ │ │ └── icon.png │ │ │ ├── coffee_5c9a13cf │ │ │ ├── data.preset │ │ │ └── icon.png │ │ │ ├── copper_2e5520a5 │ │ │ ├── data.preset │ │ │ └── icon.png │ │ │ ├── milk_3b0ded24 │ │ │ ├── data.preset │ │ │ └── icon.png │ │ │ ├── ocean_c430eb6b │ │ │ ├── data.preset │ │ │ └── icon.png │ │ │ ├── orange_juice_1a45e5dd │ │ │ ├── data.preset │ │ │ └── icon.png │ │ │ ├── package.info │ │ │ ├── red_wine_d4e52e6d │ │ │ ├── data.preset │ │ │ └── icon.png │ │ │ ├── sparkling_water_6db52085 │ │ │ ├── data.preset │ │ │ └── icon.png │ │ │ └── wax_0c995138 │ │ │ ├── data.preset │ │ │ └── icon.png │ └── render_passes.py ├── properties │ ├── __init__.py │ ├── custom_properties.py │ ├── domain_advanced_properties.py │ ├── domain_bake_properties.py │ ├── domain_cache_properties.py │ ├── domain_debug_properties.py │ ├── domain_materials_properties.py │ ├── domain_particles_properties.py │ ├── domain_presets_properties.py │ ├── domain_properties.py │ ├── domain_render_properties.py │ ├── domain_simulation_properties.py │ ├── domain_stats_properties.py │ ├── domain_surface_properties.py │ ├── domain_whitewater_properties.py │ ├── domain_world_properties.py │ ├── flip_fluid_properties.py │ ├── fluid_properties.py │ ├── force_field_properties.py │ ├── helper_properties.py │ ├── inflow_properties.py │ ├── material_properties.py │ ├── object_properties.py │ ├── obstacle_properties.py │ ├── outflow_properties.py │ ├── preferences_properties.py │ └── preset_properties.py ├── render.py ├── resources │ ├── command_line_scripts │ │ ├── alembic_export.py │ │ ├── cmd_bake_template.bat │ │ ├── render_animation_multi_instance.py │ │ ├── render_animation_render_passes.py │ │ ├── render_animation_render_passes_multi_instance.py │ │ ├── render_single_frame.py │ │ ├── render_single_frame_turbo_tools.py │ │ ├── run_simulation.py │ │ ├── run_simulation_and_batch_render.py │ │ ├── run_simulation_and_render.py │ │ ├── run_simulation_and_render_interleaved.py │ │ ├── run_simulation_and_render_sequence.py │ │ └── run_simulation_and_render_sequence_batch.py │ ├── example_scene_data │ │ ├── LICENSE.md │ │ ├── cascading_water_feature │ │ │ └── flipdata.sim │ │ ├── fluid_in_an_invisible_box │ │ │ └── flipdata.sim │ │ ├── lighthouse │ │ │ └── flipdata.sim │ │ └── viscous_net │ │ │ └── flipdata.sim │ ├── geometry_nodes │ │ └── geometry_nodes_library.blend │ ├── installation_data │ │ └── empty_file │ ├── sounds │ │ └── alarm │ │ │ ├── alarm.ogg │ │ │ ├── license.txt │ │ │ └── sound_data.json │ └── version_data │ │ └── versions.json ├── third_party │ ├── cpuinfo.py │ └── mixbox │ │ └── empty_file ├── types.py ├── ui │ ├── __init__.py │ ├── cache_object_ui.py │ ├── domain_advanced_ui.py │ ├── domain_cache_ui.py │ ├── domain_debug_ui.py │ ├── domain_display_ui.py │ ├── domain_materials_ui.py │ ├── domain_particles_ui.py │ ├── domain_presets_ui.py │ ├── domain_simulation_ui.py │ ├── domain_stats_ui.py │ ├── domain_surface_ui.py │ ├── domain_tabbed_ui.py │ ├── domain_ui.py │ ├── domain_whitewater_ui.py │ ├── domain_world_ui.py │ ├── flip_fluids_addon_disabled_ui.py │ ├── fluid_ui.py │ ├── force_field_ui.py │ ├── helper_ui.py │ ├── inflow_ui.py │ ├── none_ui.py │ ├── obstacle_ui.py │ └── outflow_ui.py └── utils │ ├── __init__.py │ ├── api_workaround_utils.py │ ├── audio_utils.py │ ├── cache_utils.py │ ├── color_utils.py │ ├── export_utils.py │ ├── installation_utils.py │ ├── installation_utils.py.in │ ├── preset_utils.py │ ├── ui_utils.py │ └── version_compatibility_utils.py └── engine ├── Eigen ├── Cholesky ├── CholmodSupport ├── Core ├── Dense ├── Eigen ├── Eigenvalues ├── Geometry ├── Householder ├── IterativeLinearSolvers ├── Jacobi ├── KLUSupport ├── LU ├── MetisSupport ├── OrderingMethods ├── PaStiXSupport ├── PardisoSupport ├── QR ├── QtAlignedMalloc ├── SPQRSupport ├── SVD ├── Sparse ├── SparseCholesky ├── SparseCore ├── SparseLU ├── SparseQR ├── StdDeque ├── StdList ├── StdVector ├── SuperLUSupport ├── UmfPackSupport └── src │ ├── Cholesky │ ├── LDLT.h │ ├── LLT.h │ └── LLT_LAPACKE.h │ ├── CholmodSupport │ └── CholmodSupport.h │ ├── Core │ ├── ArithmeticSequence.h │ ├── Array.h │ ├── ArrayBase.h │ ├── ArrayWrapper.h │ ├── Assign.h │ ├── AssignEvaluator.h │ ├── Assign_MKL.h │ ├── BandMatrix.h │ ├── Block.h │ ├── BooleanRedux.h │ ├── CommaInitializer.h │ ├── ConditionEstimator.h │ ├── CoreEvaluators.h │ ├── CoreIterators.h │ ├── CwiseBinaryOp.h │ ├── CwiseNullaryOp.h │ ├── CwiseTernaryOp.h │ ├── CwiseUnaryOp.h │ ├── CwiseUnaryView.h │ ├── DenseBase.h │ ├── DenseCoeffsBase.h │ ├── DenseStorage.h │ ├── Diagonal.h │ ├── DiagonalMatrix.h │ ├── DiagonalProduct.h │ ├── Dot.h │ ├── EigenBase.h │ ├── ForceAlignedAccess.h │ ├── Fuzzy.h │ ├── GeneralProduct.h │ ├── GenericPacketMath.h │ ├── GlobalFunctions.h │ ├── IO.h │ ├── IndexedView.h │ ├── Inverse.h │ ├── Map.h │ ├── MapBase.h │ ├── MathFunctions.h │ ├── MathFunctionsImpl.h │ ├── Matrix.h │ ├── MatrixBase.h │ ├── NestByValue.h │ ├── NoAlias.h │ ├── NumTraits.h │ ├── PartialReduxEvaluator.h │ ├── PermutationMatrix.h │ ├── PlainObjectBase.h │ ├── Product.h │ ├── ProductEvaluators.h │ ├── Random.h │ ├── Redux.h │ ├── Ref.h │ ├── Replicate.h │ ├── Reshaped.h │ ├── ReturnByValue.h │ ├── Reverse.h │ ├── Select.h │ ├── SelfAdjointView.h │ ├── SelfCwiseBinaryOp.h │ ├── Solve.h │ ├── SolveTriangular.h │ ├── SolverBase.h │ ├── StableNorm.h │ ├── StlIterators.h │ ├── Stride.h │ ├── Swap.h │ ├── Transpose.h │ ├── Transpositions.h │ ├── TriangularMatrix.h │ ├── VectorBlock.h │ ├── VectorwiseOp.h │ ├── Visitor.h │ ├── arch │ │ ├── AVX │ │ │ ├── Complex.h │ │ │ ├── MathFunctions.h │ │ │ ├── PacketMath.h │ │ │ └── TypeCasting.h │ │ ├── AVX512 │ │ │ ├── Complex.h │ │ │ ├── MathFunctions.h │ │ │ ├── PacketMath.h │ │ │ └── TypeCasting.h │ │ ├── AltiVec │ │ │ ├── Complex.h │ │ │ ├── MathFunctions.h │ │ │ ├── MatrixProduct.h │ │ │ ├── MatrixProductCommon.h │ │ │ ├── MatrixProductMMA.h │ │ │ └── PacketMath.h │ │ ├── CUDA │ │ │ └── Complex.h │ │ ├── Default │ │ │ ├── BFloat16.h │ │ │ ├── ConjHelper.h │ │ │ ├── GenericPacketMathFunctions.h │ │ │ ├── GenericPacketMathFunctionsFwd.h │ │ │ ├── Half.h │ │ │ ├── Settings.h │ │ │ └── TypeCasting.h │ │ ├── GPU │ │ │ ├── MathFunctions.h │ │ │ ├── PacketMath.h │ │ │ └── TypeCasting.h │ │ ├── HIP │ │ │ └── hcc │ │ │ │ └── math_constants.h │ │ ├── MSA │ │ │ ├── Complex.h │ │ │ ├── MathFunctions.h │ │ │ └── PacketMath.h │ │ ├── NEON │ │ │ ├── Complex.h │ │ │ ├── GeneralBlockPanelKernel.h │ │ │ ├── MathFunctions.h │ │ │ ├── PacketMath.h │ │ │ └── TypeCasting.h │ │ ├── SSE │ │ │ ├── Complex.h │ │ │ ├── MathFunctions.h │ │ │ ├── PacketMath.h │ │ │ └── TypeCasting.h │ │ ├── SVE │ │ │ ├── MathFunctions.h │ │ │ ├── PacketMath.h │ │ │ └── TypeCasting.h │ │ ├── SYCL │ │ │ ├── InteropHeaders.h │ │ │ ├── MathFunctions.h │ │ │ ├── PacketMath.h │ │ │ ├── SyclMemoryModel.h │ │ │ └── TypeCasting.h │ │ └── ZVector │ │ │ ├── Complex.h │ │ │ ├── MathFunctions.h │ │ │ └── PacketMath.h │ ├── functors │ │ ├── AssignmentFunctors.h │ │ ├── BinaryFunctors.h │ │ ├── NullaryFunctors.h │ │ ├── StlFunctors.h │ │ ├── TernaryFunctors.h │ │ └── UnaryFunctors.h │ ├── products │ │ ├── GeneralBlockPanelKernel.h │ │ ├── GeneralMatrixMatrix.h │ │ ├── GeneralMatrixMatrixTriangular.h │ │ ├── GeneralMatrixMatrixTriangular_BLAS.h │ │ ├── GeneralMatrixMatrix_BLAS.h │ │ ├── GeneralMatrixVector.h │ │ ├── GeneralMatrixVector_BLAS.h │ │ ├── Parallelizer.h │ │ ├── SelfadjointMatrixMatrix.h │ │ ├── SelfadjointMatrixMatrix_BLAS.h │ │ ├── SelfadjointMatrixVector.h │ │ ├── SelfadjointMatrixVector_BLAS.h │ │ ├── SelfadjointProduct.h │ │ ├── SelfadjointRank2Update.h │ │ ├── TriangularMatrixMatrix.h │ │ ├── TriangularMatrixMatrix_BLAS.h │ │ ├── TriangularMatrixVector.h │ │ ├── TriangularMatrixVector_BLAS.h │ │ ├── TriangularSolverMatrix.h │ │ ├── TriangularSolverMatrix_BLAS.h │ │ └── TriangularSolverVector.h │ └── util │ │ ├── BlasUtil.h │ │ ├── ConfigureVectorization.h │ │ ├── Constants.h │ │ ├── DisableStupidWarnings.h │ │ ├── ForwardDeclarations.h │ │ ├── IndexedViewHelper.h │ │ ├── IntegralConstant.h │ │ ├── MKL_support.h │ │ ├── Macros.h │ │ ├── Memory.h │ │ ├── Meta.h │ │ ├── NonMPL2.h │ │ ├── ReenableStupidWarnings.h │ │ ├── ReshapedHelper.h │ │ ├── StaticAssert.h │ │ ├── SymbolicIndex.h │ │ └── XprHelper.h │ ├── Eigenvalues │ ├── ComplexEigenSolver.h │ ├── ComplexSchur.h │ ├── ComplexSchur_LAPACKE.h │ ├── EigenSolver.h │ ├── GeneralizedEigenSolver.h │ ├── GeneralizedSelfAdjointEigenSolver.h │ ├── HessenbergDecomposition.h │ ├── MatrixBaseEigenvalues.h │ ├── RealQZ.h │ ├── RealSchur.h │ ├── RealSchur_LAPACKE.h │ ├── SelfAdjointEigenSolver.h │ ├── SelfAdjointEigenSolver_LAPACKE.h │ └── Tridiagonalization.h │ ├── Geometry │ ├── AlignedBox.h │ ├── AngleAxis.h │ ├── EulerAngles.h │ ├── Homogeneous.h │ ├── Hyperplane.h │ ├── OrthoMethods.h │ ├── ParametrizedLine.h │ ├── Quaternion.h │ ├── Rotation2D.h │ ├── RotationBase.h │ ├── Scaling.h │ ├── Transform.h │ ├── Translation.h │ ├── Umeyama.h │ └── arch │ │ └── Geometry_SIMD.h │ ├── Householder │ ├── BlockHouseholder.h │ ├── Householder.h │ └── HouseholderSequence.h │ ├── IterativeLinearSolvers │ ├── BasicPreconditioners.h │ ├── BiCGSTAB.h │ ├── ConjugateGradient.h │ ├── IncompleteCholesky.h │ ├── IncompleteLUT.h │ ├── IterativeSolverBase.h │ ├── LeastSquareConjugateGradient.h │ └── SolveWithGuess.h │ ├── Jacobi │ └── Jacobi.h │ ├── KLUSupport │ └── KLUSupport.h │ ├── LU │ ├── Determinant.h │ ├── FullPivLU.h │ ├── InverseImpl.h │ ├── PartialPivLU.h │ ├── PartialPivLU_LAPACKE.h │ └── arch │ │ └── InverseSize4.h │ ├── MetisSupport │ └── MetisSupport.h │ ├── OrderingMethods │ ├── Amd.h │ ├── Eigen_Colamd.h │ └── Ordering.h │ ├── PaStiXSupport │ └── PaStiXSupport.h │ ├── PardisoSupport │ └── PardisoSupport.h │ ├── QR │ ├── ColPivHouseholderQR.h │ ├── ColPivHouseholderQR_LAPACKE.h │ ├── CompleteOrthogonalDecomposition.h │ ├── FullPivHouseholderQR.h │ ├── HouseholderQR.h │ └── HouseholderQR_LAPACKE.h │ ├── SPQRSupport │ └── SuiteSparseQRSupport.h │ ├── SVD │ ├── BDCSVD.h │ ├── JacobiSVD.h │ ├── JacobiSVD_LAPACKE.h │ ├── SVDBase.h │ └── UpperBidiagonalization.h │ ├── SparseCholesky │ ├── SimplicialCholesky.h │ └── SimplicialCholesky_impl.h │ ├── SparseCore │ ├── AmbiVector.h │ ├── CompressedStorage.h │ ├── ConservativeSparseSparseProduct.h │ ├── MappedSparseMatrix.h │ ├── SparseAssign.h │ ├── SparseBlock.h │ ├── SparseColEtree.h │ ├── SparseCompressedBase.h │ ├── SparseCwiseBinaryOp.h │ ├── SparseCwiseUnaryOp.h │ ├── SparseDenseProduct.h │ ├── SparseDiagonalProduct.h │ ├── SparseDot.h │ ├── SparseFuzzy.h │ ├── SparseMap.h │ ├── SparseMatrix.h │ ├── SparseMatrixBase.h │ ├── SparsePermutation.h │ ├── SparseProduct.h │ ├── SparseRedux.h │ ├── SparseRef.h │ ├── SparseSelfAdjointView.h │ ├── SparseSolverBase.h │ ├── SparseSparseProductWithPruning.h │ ├── SparseTranspose.h │ ├── SparseTriangularView.h │ ├── SparseUtil.h │ ├── SparseVector.h │ ├── SparseView.h │ └── TriangularSolver.h │ ├── SparseLU │ ├── SparseLU.h │ ├── SparseLUImpl.h │ ├── SparseLU_Memory.h │ ├── SparseLU_Structs.h │ ├── SparseLU_SupernodalMatrix.h │ ├── SparseLU_Utils.h │ ├── SparseLU_column_bmod.h │ ├── SparseLU_column_dfs.h │ ├── SparseLU_copy_to_ucol.h │ ├── SparseLU_gemm_kernel.h │ ├── SparseLU_heap_relax_snode.h │ ├── SparseLU_kernel_bmod.h │ ├── SparseLU_panel_bmod.h │ ├── SparseLU_panel_dfs.h │ ├── SparseLU_pivotL.h │ ├── SparseLU_pruneL.h │ └── SparseLU_relax_snode.h │ ├── SparseQR │ └── SparseQR.h │ ├── StlSupport │ ├── StdDeque.h │ ├── StdList.h │ ├── StdVector.h │ └── details.h │ ├── SuperLUSupport │ └── SuperLUSupport.h │ ├── UmfPackSupport │ └── UmfPackSupport.h │ ├── misc │ ├── Image.h │ ├── Kernel.h │ ├── RealSvd2x2.h │ ├── blas.h │ ├── lapack.h │ ├── lapacke.h │ └── lapacke_mangling.h │ └── plugins │ ├── ArrayCwiseBinaryOps.h │ ├── ArrayCwiseUnaryOps.h │ ├── BlockMethods.h │ ├── CommonCwiseBinaryOps.h │ ├── CommonCwiseUnaryOps.h │ ├── IndexedViewMethods.h │ ├── MatrixCwiseBinaryOps.h │ ├── MatrixCwiseUnaryOps.h │ └── ReshapedMethods.h ├── aabb.cpp ├── aabb.h ├── array3d.h ├── arrayview3d.h ├── attributetogridtransfer.h ├── blockarray3d.h ├── boundedbuffer.h ├── c_bindings ├── aabb_c.h ├── cbindings.cpp ├── cbindings.h ├── diffuseparticle_c.h ├── fluidsimulation_c.cpp ├── forcefield_c.cpp ├── forcefieldcurve_c.cpp ├── forcefieldgrid_c.cpp ├── forcefieldpoint_c.cpp ├── forcefieldsurface_c.cpp ├── forcefieldvolume_c.cpp ├── gridindex_c.h ├── markerparticle_c.h ├── meshfluidsource_c.cpp ├── meshobject_c.cpp ├── mixbox_c.cpp ├── openclutils_c.cpp └── vector3_c.h ├── clscalarfield.cpp ├── clscalarfield.h ├── collision.cpp ├── collision.h ├── diffuseparticle.h ├── diffuseparticlesimulation.cpp ├── diffuseparticlesimulation.h ├── fluidmaterialgrid.cpp ├── fluidmaterialgrid.h ├── fluidsimassert.h ├── fluidsimulation.cpp ├── fluidsimulation.h ├── forcefield.cpp ├── forcefield.h ├── forcefieldcurve.cpp ├── forcefieldcurve.h ├── forcefieldgravityscalegrid.h ├── forcefieldgrid.cpp ├── forcefieldgrid.h ├── forcefieldpoint.cpp ├── forcefieldpoint.h ├── forcefieldsurface.cpp ├── forcefieldsurface.h ├── forcefieldutils.cpp ├── forcefieldutils.h ├── forcefieldvolume.cpp ├── forcefieldvolume.h ├── fragmentedvector.h ├── glibc_version_header ├── LICENSE.md └── force_link_glibc_2.5.h ├── grid3d.h ├── gridindexkeymap.cpp ├── gridindexkeymap.h ├── gridindexvector.cpp ├── gridindexvector.h ├── gridutils.cpp ├── gridutils.h ├── influencegrid.cpp ├── influencegrid.h ├── interpolation.cpp ├── interpolation.h ├── kernels ├── kernels.cpp.in ├── kernels.h ├── scalarfield.cl └── trilinearinterpolate.cl ├── levelsetsolver.cpp ├── levelsetsolver.h ├── levelsetutils.cpp ├── levelsetutils.h ├── logfile.cpp ├── logfile.h ├── macvelocityfield.cpp ├── macvelocityfield.h ├── main.cpp ├── markerparticle.h ├── meshfluidsource.cpp ├── meshfluidsource.h ├── meshlevelset.cpp ├── meshlevelset.h ├── meshobject.cpp ├── meshobject.h ├── meshutils.cpp ├── meshutils.h ├── mingw32_threads ├── LICENSE ├── mingw.condition_variable.h ├── mingw.mutex.h └── mingw.thread.h ├── mixbox ├── mixbox.h └── mixbox_stub.cpp ├── noisegenerationutils.cpp ├── noisegenerationutils.h ├── opencl_bindings ├── clcpp.cpp └── clcpp.h ├── openclutils.cpp ├── openclutils.h ├── particleadvector.cpp ├── particleadvector.h ├── particlelevelset.cpp ├── particlelevelset.h ├── particlemaskgrid.cpp ├── particlemaskgrid.h ├── particlemesher.cpp ├── particlemesher.h ├── particlesheeter.cpp ├── particlesheeter.h ├── particlesystem.cpp ├── particlesystem.h ├── pcgsolver ├── blaswrapper.h ├── pcgsolver.h └── sparsematrix.h ├── polygonizer3d.cpp ├── polygonizer3d.h ├── pressuresolver.cpp ├── pressuresolver.h ├── pyfluid ├── __init__.py ├── aabb.py ├── array3d.py ├── fluidsimulation.py ├── forcefield.py ├── forcefieldcurve.py ├── forcefieldgrid.py ├── forcefieldpoint.py ├── forcefieldsurface.py ├── forcefieldvolume.py ├── gpu_utils.py ├── gridindex.py ├── meshfluidsource.py ├── meshobject.py ├── method_decorators.py ├── mixbox.py ├── pybindings.py ├── pyfluid.py ├── trianglemesh.py └── vector3.py ├── scalarfield.cpp ├── scalarfield.h ├── spatialpointgrid.cpp ├── spatialpointgrid.h ├── stopwatch.cpp ├── stopwatch.h ├── subdividedarray3d.h ├── threadutils.cpp ├── threadutils.h ├── triangle.h ├── trianglemesh.cpp ├── trianglemesh.h ├── turbulencefield.cpp ├── turbulencefield.h ├── velocityadvector.cpp ├── velocityadvector.h ├── versionutils.cpp.in ├── versionutils.h ├── viscositysolver.cpp ├── viscositysolver.h ├── vmath.cpp └── vmath.h /.github/ISSUE_TEMPLATE/bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug Report 3 | about: Create a bug report. Read our bug reporting guidelines on the wiki. 4 | 5 | --- 6 | 7 | 12 | 13 | #### System Information 14 | 15 | **Blender Version (including hash):** 16 | **FLIP Fluids Version:** 17 | **Operating System:** 18 | **CPU:** 19 | **GFX:** 20 | **RAM:** 21 | 22 | #### Describe the bug 23 | 24 | Provide a clear and concise description of what the actual bug/issue is that you are experiencing. 25 | 26 | #### To Reproduce 27 | 28 | Provide descriptive instructions for how to reproduce the issue or how to use your .blend file. 29 | 30 | #### Expected Behaviour 31 | 32 | A description of what you expected to happen. 33 | 34 | #### Actual Behaviour 35 | 36 | A description of what actually happened. 37 | 38 | #### Screenshots 39 | 40 | If applicable, add screenshots to help explain your problem. 41 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature Request 3 | about: Feature requests will not be accepted on the issue tracker. 4 | 5 | --- 6 | 7 | See [Guidelines for Feature Requests](https://github.com/rlguy/Blender-FLIP-Fluids/wiki/Guidelines-for-Feature-Requests) for how to suggest features. 8 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/questions-comments.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Questions/Comments 3 | about: This issue tracker is not the correct place for questions/comments. 4 | 5 | --- 6 | 7 | This issue tracker is not the correct place for questions/comments. See our [Technical Support Guidelines](https://github.com/rlguy/Blender-FLIP-Fluids/wiki/Technical-Support-Guidelines) document for more information. Send us a message on the [marketplace where you have purchased the FLIP Fluids addon](https://github.com/rlguy/Blender-FLIP-Fluids/wiki/Official-Marketplaces-of-the-FLIP-Fluids-Addon) or send us an email at flip.fluids@gmail.com if you would like to propose a discussion topic for this issue tracker. 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | src/engine/kernels/kernels.cpp 2 | src/engine/versionutils.cpp 3 | src/addon/__init__.py 4 | src/addon/blender_manifest.toml 5 | src/addon/utils/installation_utils.py 6 | CMakeLists.txt 7 | build 8 | .DS_Store -------------------------------------------------------------------------------- /LICENSE_MIT.md: -------------------------------------------------------------------------------- 1 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. -------------------------------------------------------------------------------- /LICENSE_Standard_Royalty_Free.md: -------------------------------------------------------------------------------- 1 | Standard Royalty Free License 2 | 3 | The Standard Royalty Free license grants you, the purchaser, the ability to make 4 | use of the purchased product for personal, educational, or commercial purposes 5 | as long as those purposes do not violate any of the following: 6 | 7 | - You may not resell, redistribute, or repackage the purchased product 8 | without explicit permission from the original author. 9 | 10 | - You may not use the purchased product in a logo, watermark, or trademark 11 | of any kind Exception: shader, material, and texture products are exempt 12 | from this rule. These products are much the same as colors, and such are a 13 | secondary meaning and may be used as part of a logo, watermark, or 14 | trademark. -------------------------------------------------------------------------------- /src/addon/blender_manifest.toml.in: -------------------------------------------------------------------------------- 1 | schema_version = "1.0.0" 2 | 3 | id = "flip_fluids_addon" 4 | type = "add-on" 5 | version = "@FLUIDENGINE_VERSION_MAJOR@.@FLUIDENGINE_VERSION_MINOR@.@FLUIDENGINE_VERSION_REVISION@" 6 | name = "FLIP Fluids" 7 | tagline = "A FLIP Fluid Simulation Tool for Blender (v@FLUIDENGINE_VERSION_LABEL@)" 8 | maintainer = "Ryan Guy & Dennis Fassbaender" 9 | website = "https://github.com/rlguy/Blender-FLIP-Fluids/wiki" 10 | tags = ["Animation", "Physics"] 11 | blender_version_min = "4.2.0" 12 | license = ["SPDX:GPL-3.0-or-later"] 13 | platforms = ["windows-x64", "macos-x64", "macos-arm64", "linux-x64"] 14 | 15 | [permissions] 16 | files = "Read and write simulation cache files to the filesystem" 17 | clipboard = "Copy and paste render and bake commands" 18 | -------------------------------------------------------------------------------- /src/addon/exit_handler.py: -------------------------------------------------------------------------------- 1 | # Blender FLIP Fluids Add-on 2 | # Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | 17 | 18 | import bpy, os, shutil 19 | 20 | # These variables are used when running an exit handler where 21 | # access to Blender data may no longer be available 22 | IS_BLEND_FILE_SAVED = False 23 | CACHE_DIRECTORY = "" 24 | 25 | def on_exit(): 26 | # nothing currently to do on exit 27 | pass 28 | 29 | 30 | def save_post(): 31 | global IS_BLEND_FILE_SAVED 32 | IS_BLEND_FILE_SAVED = True 33 | 34 | 35 | def load_post(): 36 | global IS_BLEND_FILE_SAVED 37 | base = os.path.basename(bpy.data.filepath) 38 | save_file = os.path.splitext(base)[0] 39 | is_unsaved = not base or not save_file 40 | IS_BLEND_FILE_SAVED = not is_unsaved 41 | 42 | 43 | def set_cache_directory(dirpath): 44 | global CACHE_DIRECTORY 45 | CACHE_DIRECTORY = dirpath -------------------------------------------------------------------------------- /src/addon/filesystem/__init__.py: -------------------------------------------------------------------------------- 1 | # Blender FLIP Fluids Add-on 2 | # Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | 17 | if "bpy" in locals(): 18 | import importlib 19 | reloadable_modules = [ 20 | 'filesystem_protection_layer', 21 | ] 22 | for module_name in reloadable_modules: 23 | if module_name in locals(): 24 | importlib.reload(locals()[module_name]) 25 | 26 | import bpy 27 | 28 | from . import ( 29 | filesystem_protection_layer, 30 | ) 31 | -------------------------------------------------------------------------------- /src/addon/icons/flip_fluids_logo_27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rlguy/Blender-FLIP-Fluids/47dadab41788992b930bb4fd6da69f04a996cf99/src/addon/icons/flip_fluids_logo_27.png -------------------------------------------------------------------------------- /src/addon/icons/flip_fluids_logo_28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rlguy/Blender-FLIP-Fluids/47dadab41788992b930bb4fd6da69f04a996cf99/src/addon/icons/flip_fluids_logo_28.png -------------------------------------------------------------------------------- /src/addon/materials/LICENSE.md: -------------------------------------------------------------------------------- 1 | The FLIP Fluids Material Library Blend files and containing materials in this directory 2 | and subdirectories are licensed under the MIT License: 3 | 4 | -------------------------------------------------------------------------------- 5 | 6 | MIT License 7 | 8 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in all 18 | copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | SOFTWARE. 27 | 28 | -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- /src/addon/materials/__init__.py: -------------------------------------------------------------------------------- 1 | # Blender FLIP Fluids Add-on 2 | # Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | 17 | if "bpy" in locals(): 18 | import importlib 19 | reloadable_modules = [ 20 | 'material_library' 21 | ] 22 | for module_name in reloadable_modules: 23 | if module_name in locals(): 24 | importlib.reload(locals()[module_name]) 25 | 26 | import bpy 27 | 28 | from . import ( 29 | material_library 30 | ) 31 | 32 | 33 | def load_post(): 34 | material_library.load_post() 35 | 36 | 37 | def scene_update_post(scene): 38 | material_library.scene_update_post(scene) 39 | 40 | 41 | def register(): 42 | material_library.register() 43 | 44 | 45 | def unregister(): 46 | material_library.unregister() -------------------------------------------------------------------------------- /src/addon/objects/__init__.py: -------------------------------------------------------------------------------- 1 | # Blender FLIP Fluids Add-on 2 | # Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | 17 | if "bpy" in locals(): 18 | import importlib 19 | reloadable_modules = [ 20 | 'flip_fluid_aabb', 21 | 'flip_fluid_cache', 22 | 'flip_fluid_material_library' 23 | 'flip_fluid_map', 24 | 'flip_fluid_geometry_export_object', 25 | 'flip_fluid_geometry_database', 26 | 'flip_fluid_geometry_exporter', 27 | 'flip_fluid_preset_stack', 28 | ] 29 | for module_name in reloadable_modules: 30 | if module_name in locals(): 31 | importlib.reload(locals()[module_name]) 32 | 33 | import bpy 34 | 35 | from . import ( 36 | flip_fluid_aabb, 37 | flip_fluid_cache, 38 | flip_fluid_material_library, 39 | flip_fluid_map, 40 | flip_fluid_geometry_export_object, 41 | flip_fluid_geometry_database, 42 | flip_fluid_geometry_exporter, 43 | flip_fluid_preset_stack, 44 | ) 45 | 46 | 47 | def register(): 48 | flip_fluid_cache.register() 49 | flip_fluid_material_library.register() 50 | flip_fluid_preset_stack.register() 51 | 52 | 53 | def unregister(): 54 | flip_fluid_cache.unregister() 55 | flip_fluid_material_library.unregister() 56 | flip_fluid_preset_stack.unregister() -------------------------------------------------------------------------------- /src/addon/objects/flip_fluid_map.py: -------------------------------------------------------------------------------- 1 | # Blender FLIP Fluids Add-on 2 | # Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | 17 | class Map(dict): 18 | def __init__(self, dict_data): 19 | super(Map, self).__init__(dict_data) 20 | for k, v in dict_data.items(): 21 | if isinstance(v, dict): 22 | self[k] = Map(v) 23 | elif isinstance(v, list): 24 | new_list = [] 25 | for list_element in v: 26 | if isinstance(list_element, dict): 27 | new_list.append(Map(list_element)) 28 | else: 29 | new_list.append(list_element) 30 | self[k] = new_list 31 | 32 | else: 33 | self[k] = v 34 | 35 | 36 | def __getattr__(self, attr): 37 | return self.get(attr) 38 | 39 | 40 | def __setattr__(self, key, value): 41 | self.__setitem__(key, value) 42 | 43 | 44 | def __setitem__(self, key, value): 45 | super(Map, self).__setitem__(key, value) 46 | self.__dict__.update({key: value}) 47 | 48 | 49 | def __delattr__(self, item): 50 | self.__delitem__(item) 51 | 52 | 53 | def __delitem__(self, key): 54 | super(Map, self).__delitem__(key) 55 | del self.__dict__[key] 56 | -------------------------------------------------------------------------------- /src/addon/operators/error_operators.py: -------------------------------------------------------------------------------- 1 | # Blender FLIP Fluids Add-on 2 | # Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | 17 | import bpy, textwrap 18 | from bpy.props import ( 19 | StringProperty, 20 | IntProperty 21 | ) 22 | 23 | from ..utils import version_compatibility_utils as vcu 24 | 25 | 26 | class FlipFluidDisplayError(bpy.types.Operator): 27 | bl_idname = "flip_fluid_operators.display_error" 28 | bl_label = "" 29 | bl_description = "" 30 | 31 | error_message = StringProperty() 32 | exec(vcu.convert_attribute_to_28("error_message")) 33 | 34 | error_description = StringProperty() 35 | exec(vcu.convert_attribute_to_28("error_description")) 36 | 37 | popup_width = IntProperty(default=400) 38 | exec(vcu.convert_attribute_to_28("popup_width")) 39 | 40 | 41 | def draw(self, context): 42 | row = self.layout.row() 43 | row.alignment = 'CENTER' 44 | row.label(text=self.error_message, icon='ERROR') 45 | 46 | if self.error_description: 47 | text_list = textwrap.wrap(self.error_description, width=self.popup_width//6) 48 | column = self.layout.column(align=True) 49 | column.separator() 50 | column.separator() 51 | for idx,line in enumerate(text_list): 52 | column.label(text=line) 53 | 54 | self.layout.separator() 55 | self.layout.separator() 56 | 57 | 58 | def execute(self, context): 59 | self.report({'INFO'}, self.error_message) 60 | if self.error_description: 61 | self.report({'INFO'}, self.error_description) 62 | self.error_message = "" 63 | self.error_description = "" 64 | self.popup_width = 400 65 | return {'FINISHED'} 66 | 67 | 68 | def invoke(self, context, event): 69 | return context.window_manager.invoke_props_dialog(self, width=self.popup_width) 70 | 71 | 72 | def register(): 73 | bpy.utils.register_class(FlipFluidDisplayError) 74 | 75 | 76 | def unregister(): 77 | bpy.utils.unregister_class(FlipFluidDisplayError) 78 | -------------------------------------------------------------------------------- /src/addon/operators/object_operators.py: -------------------------------------------------------------------------------- 1 | # Blender FLIP Fluids Add-on 2 | # Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | 17 | import bpy 18 | 19 | from ..utils import version_compatibility_utils as vcu 20 | from ..utils import installation_utils 21 | 22 | 23 | class FlipFluidAdd(bpy.types.Operator): 24 | bl_idname = "flip_fluid_operators.flip_fluid_add" 25 | bl_label = "Add FLIP fluid object" 26 | bl_description = "Add active object as FLIP Fluid" 27 | bl_options = {'REGISTER'} 28 | 29 | 30 | @classmethod 31 | def poll(csl, context): 32 | is_addon_disabled = context.scene.flip_fluid.is_addon_disabled_in_blend_file() 33 | return installation_utils.is_installation_complete() and not is_addon_disabled 34 | 35 | 36 | def execute(self, context): 37 | installation_utils.tag_addon_active() 38 | obj = vcu.get_active_object(context) 39 | obj.flip_fluid.is_active = True 40 | vcu.add_to_flip_fluids_collection(obj, context) 41 | return {'FINISHED'} 42 | 43 | 44 | class FlipFluidRemove(bpy.types.Operator): 45 | bl_idname = "flip_fluid_operators.flip_fluid_remove" 46 | bl_label = "Remove FLIP fluid object" 47 | bl_description = "Remove FLIP Fluid settings from Object" 48 | bl_options = {'REGISTER'} 49 | 50 | 51 | @classmethod 52 | def poll(csl, context): 53 | is_addon_disabled = context.scene.flip_fluid.is_addon_disabled_in_blend_file() 54 | return installation_utils.is_installation_complete() and not is_addon_disabled 55 | 56 | 57 | def execute(self, context): 58 | obj = vcu.get_active_object(context) 59 | obj.flip_fluid.object_type = 'TYPE_NONE' 60 | obj.flip_fluid.is_active = False 61 | vcu.remove_from_flip_fluids_collection(obj, context) 62 | return {'FINISHED'} 63 | 64 | 65 | def register(): 66 | bpy.utils.register_class(FlipFluidAdd) 67 | bpy.utils.register_class(FlipFluidRemove) 68 | 69 | 70 | def unregister(): 71 | bpy.utils.unregister_class(FlipFluidAdd) 72 | bpy.utils.unregister_class(FlipFluidRemove) 73 | -------------------------------------------------------------------------------- /src/addon/operators/stats_operators.py: -------------------------------------------------------------------------------- 1 | # Blender FLIP Fluids Add-on 2 | # Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | 17 | import bpy 18 | 19 | from . import bake_operators 20 | 21 | 22 | class FlipFluidRefreshStats(bpy.types.Operator): 23 | bl_idname = "flip_fluid_operators.refresh_stats" 24 | bl_label = "Refresh Stats" 25 | bl_description = "Refresh and update the cache and frame stats" 26 | bl_options = {'REGISTER'} 27 | 28 | 29 | @classmethod 30 | def poll(csl, context): 31 | return True 32 | 33 | 34 | def execute(self, context): 35 | num_updated_frames = bake_operators.update_stats() 36 | self.report({'INFO'}, "Cache and frame stats have been refreshed. Found (" + str(num_updated_frames) + ") new frames.") 37 | return {'FINISHED'} 38 | 39 | 40 | def register(): 41 | bpy.utils.register_class(FlipFluidRefreshStats) 42 | 43 | 44 | def unregister(): 45 | bpy.utils.unregister_class(FlipFluidRefreshStats) 46 | -------------------------------------------------------------------------------- /src/addon/operators/world_operators.py: -------------------------------------------------------------------------------- 1 | # Blender FLIP Fluids Add-on 2 | # Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | 17 | import bpy 18 | 19 | 20 | class FlipFluidMakeZeroGravity(bpy.types.Operator): 21 | bl_idname = "flip_fluid_operators.make_zero_gravity" 22 | bl_label = "Set to Zero Gravity" 23 | bl_description = "Quickly switch to custom gravity mode set to zero gravity" 24 | 25 | 26 | @classmethod 27 | def poll(cls, context): 28 | return True 29 | 30 | 31 | def execute(self, context): 32 | dprops = context.scene.flip_fluid.get_domain_properties() 33 | if dprops is None: 34 | return {'CANCELLED'} 35 | 36 | dprops.world.gravity_type = 'GRAVITY_TYPE_CUSTOM' 37 | dprops.world.gravity = (0.0, 0.0, 0.0) 38 | return {'FINISHED'} 39 | 40 | 41 | def register(): 42 | bpy.utils.register_class(FlipFluidMakeZeroGravity) 43 | 44 | 45 | def unregister(): 46 | bpy.utils.unregister_class(FlipFluidMakeZeroGravity) 47 | -------------------------------------------------------------------------------- /src/addon/presets/__init__.py: -------------------------------------------------------------------------------- 1 | # Blender FLIP Fluids Add-on 2 | # Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | 17 | if "bpy" in locals(): 18 | import importlib 19 | reloadable_modules = [ 20 | 'preset_library' 21 | ] 22 | for module_name in reloadable_modules: 23 | if module_name in locals(): 24 | importlib.reload(locals()[module_name]) 25 | 26 | import bpy 27 | 28 | from . import ( 29 | preset_library 30 | ) 31 | 32 | 33 | def load_post(): 34 | preset_library.load_post() 35 | 36 | 37 | def register(): 38 | preset_library.register() 39 | 40 | 41 | def unregister(): 42 | preset_library.unregister() -------------------------------------------------------------------------------- /src/addon/presets/preset_library/resources/empty.blend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rlguy/Blender-FLIP-Fluids/47dadab41788992b930bb4fd6da69f04a996cf99/src/addon/presets/preset_library/resources/empty.blend -------------------------------------------------------------------------------- /src/addon/presets/preset_library/sys/FF_Compositing.blend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rlguy/Blender-FLIP-Fluids/47dadab41788992b930bb4fd6da69f04a996cf99/src/addon/presets/preset_library/sys/FF_Compositing.blend -------------------------------------------------------------------------------- /src/addon/presets/preset_library/sys/LICENSE.md: -------------------------------------------------------------------------------- 1 | The preset data files in this directory and subdirectories are licensed under 2 | the MIT License: 3 | 4 | -------------------------------------------------------------------------------- 5 | 6 | MIT License 7 | 8 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in all 18 | copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | SOFTWARE. 27 | 28 | -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- /src/addon/presets/preset_library/usr/basic_fluids/LICENSE.md: -------------------------------------------------------------------------------- 1 | The preset data files in this directory and subdirectories are licensed under 2 | the MIT License: 3 | 4 | -------------------------------------------------------------------------------- 5 | 6 | MIT License 7 | 8 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in all 18 | copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | SOFTWARE. 27 | 28 | -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- /src/addon/presets/preset_library/usr/basic_fluids/apple_juice_90344ad8/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rlguy/Blender-FLIP-Fluids/47dadab41788992b930bb4fd6da69f04a996cf99/src/addon/presets/preset_library/usr/basic_fluids/apple_juice_90344ad8/icon.png -------------------------------------------------------------------------------- /src/addon/presets/preset_library/usr/basic_fluids/apple_spritzer_5d811745/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rlguy/Blender-FLIP-Fluids/47dadab41788992b930bb4fd6da69f04a996cf99/src/addon/presets/preset_library/usr/basic_fluids/apple_spritzer_5d811745/icon.png -------------------------------------------------------------------------------- /src/addon/presets/preset_library/usr/basic_fluids/beer_3ccd2f97/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rlguy/Blender-FLIP-Fluids/47dadab41788992b930bb4fd6da69f04a996cf99/src/addon/presets/preset_library/usr/basic_fluids/beer_3ccd2f97/icon.png -------------------------------------------------------------------------------- /src/addon/presets/preset_library/usr/basic_fluids/blood_7424cd41/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rlguy/Blender-FLIP-Fluids/47dadab41788992b930bb4fd6da69f04a996cf99/src/addon/presets/preset_library/usr/basic_fluids/blood_7424cd41/icon.png -------------------------------------------------------------------------------- /src/addon/presets/preset_library/usr/basic_fluids/caramel_0540c2bc/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rlguy/Blender-FLIP-Fluids/47dadab41788992b930bb4fd6da69f04a996cf99/src/addon/presets/preset_library/usr/basic_fluids/caramel_0540c2bc/icon.png -------------------------------------------------------------------------------- /src/addon/presets/preset_library/usr/basic_fluids/chocolate_73bd6e22/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rlguy/Blender-FLIP-Fluids/47dadab41788992b930bb4fd6da69f04a996cf99/src/addon/presets/preset_library/usr/basic_fluids/chocolate_73bd6e22/icon.png -------------------------------------------------------------------------------- /src/addon/presets/preset_library/usr/basic_fluids/coffee_5c9a13cf/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rlguy/Blender-FLIP-Fluids/47dadab41788992b930bb4fd6da69f04a996cf99/src/addon/presets/preset_library/usr/basic_fluids/coffee_5c9a13cf/icon.png -------------------------------------------------------------------------------- /src/addon/presets/preset_library/usr/basic_fluids/copper_2e5520a5/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rlguy/Blender-FLIP-Fluids/47dadab41788992b930bb4fd6da69f04a996cf99/src/addon/presets/preset_library/usr/basic_fluids/copper_2e5520a5/icon.png -------------------------------------------------------------------------------- /src/addon/presets/preset_library/usr/basic_fluids/milk_3b0ded24/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rlguy/Blender-FLIP-Fluids/47dadab41788992b930bb4fd6da69f04a996cf99/src/addon/presets/preset_library/usr/basic_fluids/milk_3b0ded24/icon.png -------------------------------------------------------------------------------- /src/addon/presets/preset_library/usr/basic_fluids/ocean_c430eb6b/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rlguy/Blender-FLIP-Fluids/47dadab41788992b930bb4fd6da69f04a996cf99/src/addon/presets/preset_library/usr/basic_fluids/ocean_c430eb6b/icon.png -------------------------------------------------------------------------------- /src/addon/presets/preset_library/usr/basic_fluids/orange_juice_1a45e5dd/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rlguy/Blender-FLIP-Fluids/47dadab41788992b930bb4fd6da69f04a996cf99/src/addon/presets/preset_library/usr/basic_fluids/orange_juice_1a45e5dd/icon.png -------------------------------------------------------------------------------- /src/addon/presets/preset_library/usr/basic_fluids/package.info: -------------------------------------------------------------------------------- 1 | { 2 | "author": "Dennis Fassbaender & Ryan Guy", 3 | "description": "Some presets for you to start with", 4 | "identifier": "basic_fluids_a5b505ae", 5 | "is_default_user_package": false, 6 | "is_system_package": false, 7 | "name": "Basic Fluids", 8 | "uid": 1, 9 | "use_custom_icons": true 10 | } -------------------------------------------------------------------------------- /src/addon/presets/preset_library/usr/basic_fluids/red_wine_d4e52e6d/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rlguy/Blender-FLIP-Fluids/47dadab41788992b930bb4fd6da69f04a996cf99/src/addon/presets/preset_library/usr/basic_fluids/red_wine_d4e52e6d/icon.png -------------------------------------------------------------------------------- /src/addon/presets/preset_library/usr/basic_fluids/sparkling_water_6db52085/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rlguy/Blender-FLIP-Fluids/47dadab41788992b930bb4fd6da69f04a996cf99/src/addon/presets/preset_library/usr/basic_fluids/sparkling_water_6db52085/icon.png -------------------------------------------------------------------------------- /src/addon/presets/preset_library/usr/basic_fluids/wax_0c995138/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rlguy/Blender-FLIP-Fluids/47dadab41788992b930bb4fd6da69f04a996cf99/src/addon/presets/preset_library/usr/basic_fluids/wax_0c995138/icon.png -------------------------------------------------------------------------------- /src/addon/resources/command_line_scripts/cmd_bake_template.bat: -------------------------------------------------------------------------------- 1 | set /a launch_attempts = MAX_LAUNCH_ATTEMPTS 2 | set /a launch_counter = %launch_attempts% 3 | :DoWhile 4 | if %launch_counter% == 0 goto EndDoWhile 5 | @echo on 6 | COMMAND_OPERATION 7 | @echo off 8 | if %errorlevel% == 0 goto EndDoWhile else ( 9 | set /a current_restart = %launch_attempts% - %launch_counter% + 1 10 | set /a max_restarts = %launch_attempts% - 1 11 | echo -------------------------------------------------------------------------------- 12 | echo SIMULATION TERMINATED: An unknown error has caused Blender to crash ^(error code %ERRORLEVEL%^) 13 | if %launch_counter% neq 1 ( 14 | echo Attempting to re-launch simulation ^(attempt %current_restart% / %max_restarts%^) 15 | ) 16 | echo -------------------------------------------------------------------------------- 17 | ) 18 | set /a launch_counter = %launch_counter% - 1 19 | if %launch_counter% gtr 0 goto DoWhile 20 | :EndDoWhile -------------------------------------------------------------------------------- /src/addon/resources/command_line_scripts/render_animation_render_passes.py: -------------------------------------------------------------------------------- 1 | import bpy, sys, os, platform, subprocess, pathlib 2 | 3 | _USE_OVERWRITE = False # TODO 4 | 5 | def render_script(): 6 | 7 | hprops = bpy.context.scene.flip_fluid_helper 8 | 9 | blend_file_directory = os.path.dirname(bpy.data.filepath) 10 | base_file_name = pathlib.Path(bpy.path.basename(bpy.data.filepath)).stem 11 | 12 | pass_suffixes = [ 13 | ("catchers_only", hprops.render_passes_catchers_only), 14 | ("objects_only", hprops.render_passes_objects_only), 15 | ("fluidparticles_only", hprops.render_passes_fluidparticles_only), 16 | ("fluid_only", hprops.render_passes_fluid_only), 17 | ("fluid_shadows_only", hprops.render_passes_fluid_shadows_only), 18 | ("reflr_only", hprops.render_passes_reflr_only), 19 | ("bubblesanddust_only", hprops.render_passes_bubblesanddust_only), 20 | ("foamandspray_only", hprops.render_passes_foamandspray_only), 21 | # ("object_shadows_only", hprops.render_passes_object_shadows_only), # Disabled for now 22 | ] 23 | 24 | render_pass_blend_filepaths = [] 25 | enabled_passes = [suffix for suffix, enabled in pass_suffixes if enabled] 26 | 27 | for idx, (render_pass, enabled) in enumerate(pass_suffixes): 28 | if not enabled: 29 | continue 30 | number = enabled_passes.index(render_pass) + 1 31 | render_pass_blend_filename = f"{number}_{base_file_name}_{render_pass}.blend" 32 | blend_filepath = os.path.join(blend_file_directory, render_pass_blend_filename) 33 | if not os.path.isfile(blend_filepath): 34 | print(f"Warning: {render_pass} is enabled, but the blend file was not found: <{blend_filepath}>. This file will be skipped.") 35 | continue 36 | render_pass_blend_filepaths.append(blend_filepath) 37 | 38 | blender_binary_path = bpy.app.binary_path 39 | frame_start = bpy.context.scene.frame_start 40 | frame_end = bpy.context.scene.frame_end 41 | frame_step = bpy.context.scene.frame_step 42 | 43 | render_command_queue = [] 44 | for frameno in range(frame_start, frame_end + 1, frame_step): 45 | for blend_filepath in render_pass_blend_filepaths: 46 | command = [blender_binary_path, "-b", blend_filepath, "-f", str(frameno)] 47 | render_command_queue.append(command) 48 | 49 | for command in render_command_queue: 50 | print(f"Executing render command: {command}") 51 | subprocess.call(command, shell=False) 52 | print(f"Render command completed: {command}") 53 | 54 | render_script() 55 | 56 | -------------------------------------------------------------------------------- /src/addon/resources/command_line_scripts/render_single_frame.py: -------------------------------------------------------------------------------- 1 | import bpy, sys, os, platform, subprocess 2 | 3 | argv = sys.argv 4 | argv = argv[argv.index("--") + 1:] 5 | frameno = int(argv[0]) 6 | open_image_after = False 7 | if argv[1] == "1": 8 | open_image_after = True 9 | 10 | original_output_path = bpy.context.scene.render.filepath 11 | image_path = bpy.context.scene.render.frame_path(frame=frameno) 12 | 13 | bpy.context.scene.frame_set(frameno) 14 | bpy.context.scene.render.filepath = image_path 15 | bpy.ops.render.render(write_still=True) 16 | bpy.context.scene.render.filepath = original_output_path 17 | 18 | if open_image_after: 19 | print("Attempting to open image: <" + image_path + ">") 20 | system = platform.system() 21 | if system == "Windows": 22 | os.startfile(image_path) 23 | elif system == "Darwin": 24 | subprocess.call(["open", image_path]) 25 | elif system == "Linux": 26 | subprocess.call(["xdg-open", image_path]) 27 | pass -------------------------------------------------------------------------------- /src/addon/resources/command_line_scripts/render_single_frame_turbo_tools.py: -------------------------------------------------------------------------------- 1 | import bpy, sys, os, platform, subprocess 2 | 3 | argv = sys.argv 4 | argv = argv[argv.index("--") + 1:] 5 | frameno = int(argv[0]) 6 | open_image_after = False 7 | if argv[1] == "1": 8 | open_image_after = True 9 | 10 | original_output_path = bpy.context.scene.render.filepath 11 | image_path = bpy.context.scene.render.frame_path(frame=frameno) 12 | 13 | bpy.context.scene.frame_set(frameno) 14 | bpy.context.scene.render.filepath = image_path 15 | bpy.ops.threedi.render_still(write_still=True) 16 | bpy.context.scene.render.filepath = original_output_path 17 | 18 | if open_image_after: 19 | print("Attempting to open image: <" + image_path + ">") 20 | system = platform.system() 21 | if system == "Windows": 22 | os.startfile(image_path) 23 | elif system == "Darwin": 24 | subprocess.call(["open", image_path]) 25 | elif system == "Linux": 26 | subprocess.call(["xdg-open", image_path]) 27 | pass -------------------------------------------------------------------------------- /src/addon/resources/command_line_scripts/run_simulation.py: -------------------------------------------------------------------------------- 1 | import bpy, os, json, time 2 | 3 | def play_sound(json_audio_filepath, block=False): 4 | if not (bpy.app.version >= (2, 80, 0)): 5 | # aud not supported in Blender 2.79 or lower 6 | return 7 | 8 | try: 9 | if bpy.app.version >= (4, 2, 0): 10 | for module in bpy.context.preferences.addons: 11 | module_name = module.module 12 | if module_name.endswith("flip_fluids_addon"): 13 | prefs = bpy.context.preferences.addons[module_name].preferences 14 | break 15 | else: 16 | prefs = bpy.context.preferences.addons["flip_fluids_addon"].preferences 17 | except: 18 | return 19 | 20 | if not prefs.enable_bake_alarm: 21 | return 22 | 23 | import aud 24 | 25 | with open(json_audio_filepath, 'r', encoding='utf-8') as f: 26 | json_data = json.loads(f.read()) 27 | 28 | audio_length = float(json_data["length"]) 29 | audio_filename = json_data["filename"] 30 | audio_filepath = os.path.join(os.path.dirname(json_audio_filepath), audio_filename) 31 | 32 | device = aud.Device() 33 | sound = aud.Sound(audio_filepath) 34 | handle = device.play(sound) 35 | 36 | if block: 37 | time.sleep(audio_length) 38 | handle.stop() 39 | 40 | 41 | bpy.ops.flip_fluid_operators.bake_fluid_simulation_cmd() 42 | 43 | resources_directory = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) 44 | audio_json_filepath = os.path.join(resources_directory, "sounds", "alarm", "sound_data.json") 45 | play_sound(audio_json_filepath, block=True) -------------------------------------------------------------------------------- /src/addon/resources/command_line_scripts/run_simulation_and_batch_render.py: -------------------------------------------------------------------------------- 1 | import bpy, os, json, time 2 | 3 | def play_sound(json_audio_filepath, block=False): 4 | if not (bpy.app.version >= (2, 80, 0)): 5 | # aud not supported in Blender 2.79 or lower 6 | return 7 | 8 | try: 9 | prefs = bpy.context.preferences.addons["flip_fluids_addon"].preferences 10 | except: 11 | print("FLIP Fluids: Unable to locate addon preferences") 12 | return 13 | if not prefs.enable_bake_alarm: 14 | return 15 | 16 | import aud 17 | 18 | with open(json_audio_filepath, 'r', encoding='utf-8') as f: 19 | json_data = json.loads(f.read()) 20 | 21 | audio_length = float(json_data["length"]) 22 | audio_filename = json_data["filename"] 23 | audio_filepath = os.path.join(os.path.dirname(json_audio_filepath), audio_filename) 24 | 25 | device = aud.Device() 26 | sound = aud.Sound(audio_filepath) 27 | handle = device.play(sound) 28 | 29 | if block: 30 | time.sleep(audio_length) 31 | handle.stop() 32 | 33 | 34 | 35 | bpy.ops.flip_fluid_operators.bake_fluid_simulation_cmd() 36 | retcode = bpy.ops.flip_fluid_operators.helper_cmd_render_to_scriptfile() 37 | if retcode != {'CANCELLED'}: 38 | bpy.ops.flip_fluid_operators.helper_run_scriptfile() 39 | 40 | resources_directory = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) 41 | audio_json_filepath = os.path.join(resources_directory, "sounds", "alarm", "sound_data.json") 42 | play_sound(audio_json_filepath, block=True) -------------------------------------------------------------------------------- /src/addon/resources/command_line_scripts/run_simulation_and_render.py: -------------------------------------------------------------------------------- 1 | import bpy, os, json, time 2 | 3 | def play_sound(json_audio_filepath, block=False): 4 | if not (bpy.app.version >= (2, 80, 0)): 5 | # aud not supported in Blender 2.79 or lower 6 | return 7 | 8 | try: 9 | if bpy.app.version >= (4, 2, 0): 10 | for module in bpy.context.preferences.addons: 11 | module_name = module.module 12 | if module_name.endswith("flip_fluids_addon"): 13 | prefs = bpy.context.preferences.addons[module_name].preferences 14 | break 15 | else: 16 | prefs = bpy.context.preferences.addons["flip_fluids_addon"].preferences 17 | except: 18 | return 19 | 20 | if not prefs.enable_bake_alarm: 21 | return 22 | 23 | import aud 24 | 25 | with open(json_audio_filepath, 'r', encoding='utf-8') as f: 26 | json_data = json.loads(f.read()) 27 | 28 | audio_length = float(json_data["length"]) 29 | audio_filename = json_data["filename"] 30 | audio_filepath = os.path.join(os.path.dirname(json_audio_filepath), audio_filename) 31 | 32 | device = aud.Device() 33 | sound = aud.Sound(audio_filepath) 34 | handle = device.play(sound) 35 | 36 | if block: 37 | time.sleep(audio_length) 38 | handle.stop() 39 | 40 | 41 | 42 | bpy.ops.flip_fluid_operators.bake_fluid_simulation_cmd() 43 | bpy.ops.wm.revert_mainfile() 44 | bpy.ops.flip_fluid_operators.helper_command_line_render() 45 | 46 | resources_directory = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) 47 | audio_json_filepath = os.path.join(resources_directory, "sounds", "alarm", "sound_data.json") 48 | play_sound(audio_json_filepath, block=True) -------------------------------------------------------------------------------- /src/addon/resources/command_line_scripts/run_simulation_and_render_sequence.py: -------------------------------------------------------------------------------- 1 | import bpy, os, json, time 2 | 3 | def play_sound(json_audio_filepath, block=False): 4 | if not (bpy.app.version >= (2, 80, 0)): 5 | # aud not supported in Blender 2.79 or lower 6 | return 7 | 8 | try: 9 | if bpy.app.version >= (4, 2, 0): 10 | for module in bpy.context.preferences.addons: 11 | module_name = module.module 12 | if module_name.endswith("flip_fluids_addon"): 13 | prefs = bpy.context.preferences.addons[module_name].preferences 14 | print(prefs) 15 | break 16 | else: 17 | prefs = bpy.context.preferences.addons["flip_fluids_addon"].preferences 18 | except: 19 | print("FLIP Fluids: Unable to locate addon preferences") 20 | return 21 | 22 | if not prefs.enable_bake_alarm: 23 | return 24 | 25 | import aud 26 | 27 | with open(json_audio_filepath, 'r', encoding='utf-8') as f: 28 | json_data = json.loads(f.read()) 29 | 30 | audio_length = float(json_data["length"]) 31 | audio_filename = json_data["filename"] 32 | audio_filepath = os.path.join(os.path.dirname(json_audio_filepath), audio_filename) 33 | 34 | device = aud.Device() 35 | sound = aud.Sound(audio_filepath) 36 | handle = device.play(sound) 37 | 38 | if block: 39 | time.sleep(audio_length) 40 | handle.stop() 41 | 42 | 43 | 44 | bpy.ops.flip_fluid_operators.bake_fluid_simulation_cmd() 45 | bpy.ops.wm.revert_mainfile() 46 | bpy.ops.render.render(animation=True) 47 | 48 | resources_directory = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) 49 | audio_json_filepath = os.path.join(resources_directory, "sounds", "alarm", "sound_data.json") 50 | play_sound(audio_json_filepath, block=True) -------------------------------------------------------------------------------- /src/addon/resources/command_line_scripts/run_simulation_and_render_sequence_batch.py: -------------------------------------------------------------------------------- 1 | import bpy, os, json, time 2 | 3 | def play_sound(json_audio_filepath, block=False): 4 | if not (bpy.app.version >= (2, 80, 0)): 5 | # aud not supported in Blender 2.79 or lower 6 | return 7 | 8 | try: 9 | if bpy.app.version >= (4, 2, 0): 10 | for module in bpy.context.preferences.addons: 11 | module_name = module.module 12 | if module_name.endswith("flip_fluids_addon"): 13 | prefs = bpy.context.preferences.addons[module_name].preferences 14 | print(prefs) 15 | break 16 | else: 17 | prefs = bpy.context.preferences.addons["flip_fluids_addon"].preferences 18 | except: 19 | print("FLIP Fluids: Unable to locate addon preferences") 20 | return 21 | 22 | if not prefs.enable_bake_alarm: 23 | return 24 | 25 | import aud 26 | 27 | with open(json_audio_filepath, 'r', encoding='utf-8') as f: 28 | json_data = json.loads(f.read()) 29 | 30 | audio_length = float(json_data["length"]) 31 | audio_filename = json_data["filename"] 32 | audio_filepath = os.path.join(os.path.dirname(json_audio_filepath), audio_filename) 33 | 34 | device = aud.Device() 35 | sound = aud.Sound(audio_filepath) 36 | handle = device.play(sound) 37 | 38 | if block: 39 | time.sleep(audio_length) 40 | handle.stop() 41 | 42 | 43 | 44 | bpy.ops.flip_fluid_operators.bake_fluid_simulation_cmd() 45 | retcode = bpy.ops.flip_fluid_operators.helper_cmd_render_to_scriptfile() 46 | if retcode != {'CANCELLED'}: 47 | bpy.ops.flip_fluid_operators.helper_run_batch_render_scriptfile(regenerate_batch_file=False) 48 | 49 | resources_directory = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) 50 | audio_json_filepath = os.path.join(resources_directory, "sounds", "alarm", "sound_data.json") 51 | play_sound(audio_json_filepath, block=True) -------------------------------------------------------------------------------- /src/addon/resources/example_scene_data/LICENSE.md: -------------------------------------------------------------------------------- 1 | Data for running example scenes in this directory and subdirectories are licensed 2 | under the MIT License: 3 | 4 | -------------------------------------------------------------------------------- 5 | 6 | MIT License 7 | 8 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in all 18 | copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | SOFTWARE. 27 | 28 | -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- /src/addon/resources/example_scene_data/cascading_water_feature/flipdata.sim: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rlguy/Blender-FLIP-Fluids/47dadab41788992b930bb4fd6da69f04a996cf99/src/addon/resources/example_scene_data/cascading_water_feature/flipdata.sim -------------------------------------------------------------------------------- /src/addon/resources/example_scene_data/fluid_in_an_invisible_box/flipdata.sim: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rlguy/Blender-FLIP-Fluids/47dadab41788992b930bb4fd6da69f04a996cf99/src/addon/resources/example_scene_data/fluid_in_an_invisible_box/flipdata.sim -------------------------------------------------------------------------------- /src/addon/resources/example_scene_data/lighthouse/flipdata.sim: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rlguy/Blender-FLIP-Fluids/47dadab41788992b930bb4fd6da69f04a996cf99/src/addon/resources/example_scene_data/lighthouse/flipdata.sim -------------------------------------------------------------------------------- /src/addon/resources/example_scene_data/viscous_net/flipdata.sim: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rlguy/Blender-FLIP-Fluids/47dadab41788992b930bb4fd6da69f04a996cf99/src/addon/resources/example_scene_data/viscous_net/flipdata.sim -------------------------------------------------------------------------------- /src/addon/resources/geometry_nodes/geometry_nodes_library.blend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rlguy/Blender-FLIP-Fluids/47dadab41788992b930bb4fd6da69f04a996cf99/src/addon/resources/geometry_nodes/geometry_nodes_library.blend -------------------------------------------------------------------------------- /src/addon/resources/installation_data/empty_file: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rlguy/Blender-FLIP-Fluids/47dadab41788992b930bb4fd6da69f04a996cf99/src/addon/resources/installation_data/empty_file -------------------------------------------------------------------------------- /src/addon/resources/sounds/alarm/alarm.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rlguy/Blender-FLIP-Fluids/47dadab41788992b930bb4fd6da69f04a996cf99/src/addon/resources/sounds/alarm/alarm.ogg -------------------------------------------------------------------------------- /src/addon/resources/sounds/alarm/license.txt: -------------------------------------------------------------------------------- 1 | alarm.ogg is licensed under CC0 Public Domain 2 | https://creativecommons.org/publicdomain/zero/1.0/ 3 | 4 | Source: OpenGameArt.org 5 | https://opengameart.org/content/win-jingle -------------------------------------------------------------------------------- /src/addon/resources/sounds/alarm/sound_data.json: -------------------------------------------------------------------------------- 1 | { 2 | "filename": "alarm.ogg", 3 | "length": 2.5 4 | } -------------------------------------------------------------------------------- /src/addon/third_party/mixbox/empty_file: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rlguy/Blender-FLIP-Fluids/47dadab41788992b930bb4fd6da69f04a996cf99/src/addon/third_party/mixbox/empty_file -------------------------------------------------------------------------------- /src/addon/ui/flip_fluids_addon_disabled_ui.py: -------------------------------------------------------------------------------- 1 | # Blender FLIP Fluids Add-on 2 | # Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | 17 | import bpy 18 | 19 | from ..utils import version_compatibility_utils as vcu 20 | 21 | 22 | class FLIPFLUID_PT_FLIPFluidsAddonDisabledPanel(bpy.types.Panel): 23 | bl_space_type = "PROPERTIES" 24 | bl_region_type = "WINDOW" 25 | bl_context = "physics" 26 | bl_category = "FLIP Fluid" 27 | bl_label = "FLIP Fluids Addon Disabled" 28 | 29 | @classmethod 30 | def poll(cls, context): 31 | is_addon_disabled = context.scene.flip_fluid.is_addon_disabled_in_blend_file() 32 | return is_addon_disabled 33 | 34 | def draw(self, context): 35 | column = self.layout.column(align=True) 36 | row = column.row(align=True) 37 | row.alert = True 38 | row.label(text="FLIP Fluids Addon has been disabled in this Blend file", icon="INFO") 39 | row = column.row(align=True) 40 | row.alert = True 41 | row.label(text="Click to re-enable and use the addon", icon="INFO") 42 | 43 | operator_name = "flip_fluid_operators.enable_addon_in_blend_file" 44 | icon = context.scene.flip_fluid.get_logo_icon() 45 | if icon is not None: 46 | column.operator(operator_name, icon_value=icon.icon_id) 47 | else: 48 | column.operator(operator_name, icon='X') 49 | 50 | 51 | def register(): 52 | bpy.utils.register_class(FLIPFLUID_PT_FLIPFluidsAddonDisabledPanel) 53 | 54 | 55 | def unregister(): 56 | bpy.utils.unregister_class(FLIPFLUID_PT_FLIPFluidsAddonDisabledPanel) 57 | -------------------------------------------------------------------------------- /src/addon/ui/none_ui.py: -------------------------------------------------------------------------------- 1 | # Blender FLIP Fluids Add-on 2 | # Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | 17 | import bpy 18 | 19 | from ..utils import version_compatibility_utils as vcu 20 | 21 | 22 | class FLIPFLUID_PT_NoneTypePanel(bpy.types.Panel): 23 | bl_space_type = "PROPERTIES" 24 | bl_region_type = "WINDOW" 25 | bl_context = "physics" 26 | bl_category = "FLIP Fluid" 27 | bl_label = "FLIP Fluid" 28 | 29 | 30 | @classmethod 31 | def poll(cls, context): 32 | obj_props = vcu.get_active_object(context).flip_fluid 33 | return obj_props.is_active and obj_props.object_type == 'TYPE_NONE' 34 | 35 | 36 | def draw(self, context): 37 | obj = vcu.get_active_object(context) 38 | obj_props = obj.flip_fluid 39 | 40 | column = self.layout.column() 41 | column.prop(obj_props, "object_type") 42 | 43 | 44 | def register(): 45 | bpy.utils.register_class(FLIPFLUID_PT_NoneTypePanel) 46 | 47 | 48 | def unregister(): 49 | bpy.utils.unregister_class(FLIPFLUID_PT_NoneTypePanel) 50 | -------------------------------------------------------------------------------- /src/addon/utils/__init__.py: -------------------------------------------------------------------------------- 1 | # Blender FLIP Fluids Add-on 2 | # Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | 17 | if "bpy" in locals(): 18 | import importlib 19 | reloadable_modules = [ 20 | 'color_utils', 21 | 'export_utils', 22 | 'ui_utils', 23 | 'preset_utils', 24 | 'installation_utils', 25 | 'version_compatibility_utils', 26 | 'cache_utils', 27 | 'api_workaround_utils', 28 | ] 29 | for module_name in reloadable_modules: 30 | if module_name in locals(): 31 | importlib.reload(locals()[module_name]) 32 | 33 | import bpy 34 | 35 | from . import ( 36 | color_utils, 37 | export_utils, 38 | ui_utils, 39 | preset_utils, 40 | installation_utils, 41 | version_compatibility_utils, 42 | cache_utils, 43 | api_workaround_utils, 44 | ) 45 | -------------------------------------------------------------------------------- /src/addon/utils/audio_utils.py: -------------------------------------------------------------------------------- 1 | # Blender FLIP Fluids Add-on 2 | # Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | 17 | import bpy, os, json, time 18 | 19 | from . import version_compatibility_utils as vcu 20 | 21 | 22 | def get_sounds_directory(): 23 | return os.path.join(vcu.get_addon_directory(), "resources", "sounds") 24 | 25 | 26 | def play_sound(json_audio_filepath, block=False): 27 | if not vcu.is_blender_28(): 28 | # aud not supported in Blender 2.79 or lower 29 | return 30 | 31 | import aud 32 | 33 | with open(json_audio_filepath, 'r', encoding='utf-8') as f: 34 | json_data = json.loads(f.read()) 35 | 36 | audio_length = float(json_data["length"]) 37 | audio_filename = json_data["filename"] 38 | audio_filepath = os.path.join(os.path.dirname(json_audio_filepath), audio_filename) 39 | 40 | device = aud.Device() 41 | sound = aud.Sound(audio_filepath) 42 | handle = device.play(sound) 43 | 44 | if block: 45 | time.sleep(audio_length) 46 | handle.stop() -------------------------------------------------------------------------------- /src/addon/utils/cache_utils.py: -------------------------------------------------------------------------------- 1 | # Blender FLIP Fluids Add-on 2 | # Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | 17 | import hashlib 18 | 19 | 20 | def string_to_cache_slug(string): 21 | max_hash_len = 16 22 | max_string_len = 64 - max_hash_len 23 | whitelist = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-" 24 | 25 | h = hashlib.md5() 26 | h.update(bytes(string, 'utf-8')) 27 | hexstr = h.hexdigest() 28 | hexstr = hexstr[:max_hash_len] 29 | 30 | slug = string[:max_string_len] 31 | slug = ''.join(c if c in whitelist else '-' for c in slug) 32 | slug += hexstr 33 | 34 | return slug 35 | -------------------------------------------------------------------------------- /src/addon/utils/color_utils.py: -------------------------------------------------------------------------------- 1 | # Blender FLIP Fluids Add-on 2 | # Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | 17 | import os 18 | 19 | from ..pyfluid import ( 20 | mixbox, 21 | ) 22 | 23 | 24 | def mixbox_lerp_srgb32f(r1, g1, b1, r2, g2, b2, t): 25 | if not mixbox.is_initialized(): 26 | __initialize_mixbox() 27 | return mixbox.lerp_srgb32f(r1, g1, b1, r2, g2, b2, t) 28 | 29 | 30 | def __initialize_mixbox(): 31 | module_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) 32 | lut_filepath = os.path.join(module_dir, "third_party", "mixbox", "mixbox_lut_data.bin") 33 | with open(lut_filepath, 'rb') as f: 34 | lut_data = f.read() 35 | lut_data_bytes = len(lut_data) 36 | mixbox.initialize(lut_data, lut_data_bytes) 37 | -------------------------------------------------------------------------------- /src/engine/Eigen/Cholesky: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_CHOLESKY_MODULE_H 9 | #define EIGEN_CHOLESKY_MODULE_H 10 | 11 | #include "Core" 12 | #include "Jacobi" 13 | 14 | #include "src/Core/util/DisableStupidWarnings.h" 15 | 16 | /** \defgroup Cholesky_Module Cholesky module 17 | * 18 | * 19 | * 20 | * This module provides two variants of the Cholesky decomposition for selfadjoint (hermitian) matrices. 21 | * Those decompositions are also accessible via the following methods: 22 | * - MatrixBase::llt() 23 | * - MatrixBase::ldlt() 24 | * - SelfAdjointView::llt() 25 | * - SelfAdjointView::ldlt() 26 | * 27 | * \code 28 | * #include 29 | * \endcode 30 | */ 31 | 32 | #include "src/Cholesky/LLT.h" 33 | #include "src/Cholesky/LDLT.h" 34 | #ifdef EIGEN_USE_LAPACKE 35 | #ifdef EIGEN_USE_MKL 36 | #include "mkl_lapacke.h" 37 | #else 38 | #include "src/misc/lapacke.h" 39 | #endif 40 | #include "src/Cholesky/LLT_LAPACKE.h" 41 | #endif 42 | 43 | #include "src/Core/util/ReenableStupidWarnings.h" 44 | 45 | #endif // EIGEN_CHOLESKY_MODULE_H 46 | -------------------------------------------------------------------------------- /src/engine/Eigen/CholmodSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_CHOLMODSUPPORT_MODULE_H 9 | #define EIGEN_CHOLMODSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | extern "C" { 16 | #include 17 | } 18 | 19 | /** \ingroup Support_modules 20 | * \defgroup CholmodSupport_Module CholmodSupport module 21 | * 22 | * This module provides an interface to the Cholmod library which is part of the suitesparse package. 23 | * It provides the two following main factorization classes: 24 | * - class CholmodSupernodalLLT: a supernodal LLT Cholesky factorization. 25 | * - class CholmodDecomposiiton: a general L(D)LT Cholesky factorization with automatic or explicit runtime selection of the underlying factorization method (supernodal or simplicial). 26 | * 27 | * For the sake of completeness, this module also propose the two following classes: 28 | * - class CholmodSimplicialLLT 29 | * - class CholmodSimplicialLDLT 30 | * Note that these classes does not bring any particular advantage compared to the built-in 31 | * SimplicialLLT and SimplicialLDLT factorization classes. 32 | * 33 | * \code 34 | * #include 35 | * \endcode 36 | * 37 | * In order to use this module, the cholmod headers must be accessible from the include paths, and your binary must be linked to the cholmod library and its dependencies. 38 | * The dependencies depend on how cholmod has been compiled. 39 | * For a cmake based project, you can use our FindCholmod.cmake module to help you in this task. 40 | * 41 | */ 42 | 43 | #include "src/CholmodSupport/CholmodSupport.h" 44 | 45 | #include "src/Core/util/ReenableStupidWarnings.h" 46 | 47 | #endif // EIGEN_CHOLMODSUPPORT_MODULE_H 48 | 49 | -------------------------------------------------------------------------------- /src/engine/Eigen/Dense: -------------------------------------------------------------------------------- 1 | #include "Core" 2 | #include "LU" 3 | #include "Cholesky" 4 | #include "QR" 5 | #include "SVD" 6 | #include "Geometry" 7 | #include "Eigenvalues" 8 | -------------------------------------------------------------------------------- /src/engine/Eigen/Eigen: -------------------------------------------------------------------------------- 1 | #include "Dense" 2 | #include "Sparse" 3 | -------------------------------------------------------------------------------- /src/engine/Eigen/Eigenvalues: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_EIGENVALUES_MODULE_H 9 | #define EIGEN_EIGENVALUES_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "Cholesky" 14 | #include "Jacobi" 15 | #include "Householder" 16 | #include "LU" 17 | #include "Geometry" 18 | 19 | #include "src/Core/util/DisableStupidWarnings.h" 20 | 21 | /** \defgroup Eigenvalues_Module Eigenvalues module 22 | * 23 | * 24 | * 25 | * This module mainly provides various eigenvalue solvers. 26 | * This module also provides some MatrixBase methods, including: 27 | * - MatrixBase::eigenvalues(), 28 | * - MatrixBase::operatorNorm() 29 | * 30 | * \code 31 | * #include 32 | * \endcode 33 | */ 34 | 35 | #include "src/misc/RealSvd2x2.h" 36 | #include "src/Eigenvalues/Tridiagonalization.h" 37 | #include "src/Eigenvalues/RealSchur.h" 38 | #include "src/Eigenvalues/EigenSolver.h" 39 | #include "src/Eigenvalues/SelfAdjointEigenSolver.h" 40 | #include "src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h" 41 | #include "src/Eigenvalues/HessenbergDecomposition.h" 42 | #include "src/Eigenvalues/ComplexSchur.h" 43 | #include "src/Eigenvalues/ComplexEigenSolver.h" 44 | #include "src/Eigenvalues/RealQZ.h" 45 | #include "src/Eigenvalues/GeneralizedEigenSolver.h" 46 | #include "src/Eigenvalues/MatrixBaseEigenvalues.h" 47 | #ifdef EIGEN_USE_LAPACKE 48 | #ifdef EIGEN_USE_MKL 49 | #include "mkl_lapacke.h" 50 | #else 51 | #include "src/misc/lapacke.h" 52 | #endif 53 | #include "src/Eigenvalues/RealSchur_LAPACKE.h" 54 | #include "src/Eigenvalues/ComplexSchur_LAPACKE.h" 55 | #include "src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h" 56 | #endif 57 | 58 | #include "src/Core/util/ReenableStupidWarnings.h" 59 | 60 | #endif // EIGEN_EIGENVALUES_MODULE_H 61 | -------------------------------------------------------------------------------- /src/engine/Eigen/Geometry: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_GEOMETRY_MODULE_H 9 | #define EIGEN_GEOMETRY_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "SVD" 14 | #include "LU" 15 | #include 16 | 17 | #include "src/Core/util/DisableStupidWarnings.h" 18 | 19 | /** \defgroup Geometry_Module Geometry module 20 | * 21 | * This module provides support for: 22 | * - fixed-size homogeneous transformations 23 | * - translation, scaling, 2D and 3D rotations 24 | * - \link Quaternion quaternions \endlink 25 | * - cross products (\ref MatrixBase::cross, \ref MatrixBase::cross3) 26 | * - orthognal vector generation (\ref MatrixBase::unitOrthogonal) 27 | * - some linear components: \link ParametrizedLine parametrized-lines \endlink and \link Hyperplane hyperplanes \endlink 28 | * - \link AlignedBox axis aligned bounding boxes \endlink 29 | * - \link umeyama least-square transformation fitting \endlink 30 | * 31 | * \code 32 | * #include 33 | * \endcode 34 | */ 35 | 36 | #include "src/Geometry/OrthoMethods.h" 37 | #include "src/Geometry/EulerAngles.h" 38 | 39 | #include "src/Geometry/Homogeneous.h" 40 | #include "src/Geometry/RotationBase.h" 41 | #include "src/Geometry/Rotation2D.h" 42 | #include "src/Geometry/Quaternion.h" 43 | #include "src/Geometry/AngleAxis.h" 44 | #include "src/Geometry/Transform.h" 45 | #include "src/Geometry/Translation.h" 46 | #include "src/Geometry/Scaling.h" 47 | #include "src/Geometry/Hyperplane.h" 48 | #include "src/Geometry/ParametrizedLine.h" 49 | #include "src/Geometry/AlignedBox.h" 50 | #include "src/Geometry/Umeyama.h" 51 | 52 | // Use the SSE optimized version whenever possible. 53 | #if (defined EIGEN_VECTORIZE_SSE) || (defined EIGEN_VECTORIZE_NEON) 54 | #include "src/Geometry/arch/Geometry_SIMD.h" 55 | #endif 56 | 57 | #include "src/Core/util/ReenableStupidWarnings.h" 58 | 59 | #endif // EIGEN_GEOMETRY_MODULE_H 60 | -------------------------------------------------------------------------------- /src/engine/Eigen/Householder: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_HOUSEHOLDER_MODULE_H 9 | #define EIGEN_HOUSEHOLDER_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** \defgroup Householder_Module Householder module 16 | * This module provides Householder transformations. 17 | * 18 | * \code 19 | * #include 20 | * \endcode 21 | */ 22 | 23 | #include "src/Householder/Householder.h" 24 | #include "src/Householder/HouseholderSequence.h" 25 | #include "src/Householder/BlockHouseholder.h" 26 | 27 | #include "src/Core/util/ReenableStupidWarnings.h" 28 | 29 | #endif // EIGEN_HOUSEHOLDER_MODULE_H 30 | -------------------------------------------------------------------------------- /src/engine/Eigen/IterativeLinearSolvers: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_ITERATIVELINEARSOLVERS_MODULE_H 9 | #define EIGEN_ITERATIVELINEARSOLVERS_MODULE_H 10 | 11 | #include "SparseCore" 12 | #include "OrderingMethods" 13 | 14 | #include "src/Core/util/DisableStupidWarnings.h" 15 | 16 | /** 17 | * \defgroup IterativeLinearSolvers_Module IterativeLinearSolvers module 18 | * 19 | * This module currently provides iterative methods to solve problems of the form \c A \c x = \c b, where \c A is a squared matrix, usually very large and sparse. 20 | * Those solvers are accessible via the following classes: 21 | * - ConjugateGradient for selfadjoint (hermitian) matrices, 22 | * - LeastSquaresConjugateGradient for rectangular least-square problems, 23 | * - BiCGSTAB for general square matrices. 24 | * 25 | * These iterative solvers are associated with some preconditioners: 26 | * - IdentityPreconditioner - not really useful 27 | * - DiagonalPreconditioner - also called Jacobi preconditioner, work very well on diagonal dominant matrices. 28 | * - IncompleteLUT - incomplete LU factorization with dual thresholding 29 | * 30 | * Such problems can also be solved using the direct sparse decomposition modules: SparseCholesky, CholmodSupport, UmfPackSupport, SuperLUSupport. 31 | * 32 | \code 33 | #include 34 | \endcode 35 | */ 36 | 37 | #include "src/IterativeLinearSolvers/SolveWithGuess.h" 38 | #include "src/IterativeLinearSolvers/IterativeSolverBase.h" 39 | #include "src/IterativeLinearSolvers/BasicPreconditioners.h" 40 | #include "src/IterativeLinearSolvers/ConjugateGradient.h" 41 | #include "src/IterativeLinearSolvers/LeastSquareConjugateGradient.h" 42 | #include "src/IterativeLinearSolvers/BiCGSTAB.h" 43 | #include "src/IterativeLinearSolvers/IncompleteLUT.h" 44 | #include "src/IterativeLinearSolvers/IncompleteCholesky.h" 45 | 46 | #include "src/Core/util/ReenableStupidWarnings.h" 47 | 48 | #endif // EIGEN_ITERATIVELINEARSOLVERS_MODULE_H 49 | -------------------------------------------------------------------------------- /src/engine/Eigen/Jacobi: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_JACOBI_MODULE_H 9 | #define EIGEN_JACOBI_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** \defgroup Jacobi_Module Jacobi module 16 | * This module provides Jacobi and Givens rotations. 17 | * 18 | * \code 19 | * #include 20 | * \endcode 21 | * 22 | * In addition to listed classes, it defines the two following MatrixBase methods to apply a Jacobi or Givens rotation: 23 | * - MatrixBase::applyOnTheLeft() 24 | * - MatrixBase::applyOnTheRight(). 25 | */ 26 | 27 | #include "src/Jacobi/Jacobi.h" 28 | 29 | #include "src/Core/util/ReenableStupidWarnings.h" 30 | 31 | #endif // EIGEN_JACOBI_MODULE_H 32 | 33 | -------------------------------------------------------------------------------- /src/engine/Eigen/KLUSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_KLUSUPPORT_MODULE_H 9 | #define EIGEN_KLUSUPPORT_MODULE_H 10 | 11 | #include 12 | 13 | #include 14 | 15 | extern "C" { 16 | #include 17 | #include 18 | } 19 | 20 | /** \ingroup Support_modules 21 | * \defgroup KLUSupport_Module KLUSupport module 22 | * 23 | * This module provides an interface to the KLU library which is part of the suitesparse package. 24 | * It provides the following factorization class: 25 | * - class KLU: a sparse LU factorization, well-suited for circuit simulation. 26 | * 27 | * \code 28 | * #include 29 | * \endcode 30 | * 31 | * In order to use this module, the klu and btf headers must be accessible from the include paths, and your binary must be linked to the klu library and its dependencies. 32 | * The dependencies depend on how umfpack has been compiled. 33 | * For a cmake based project, you can use our FindKLU.cmake module to help you in this task. 34 | * 35 | */ 36 | 37 | #include "src/KLUSupport/KLUSupport.h" 38 | 39 | #include 40 | 41 | #endif // EIGEN_KLUSUPPORT_MODULE_H 42 | -------------------------------------------------------------------------------- /src/engine/Eigen/LU: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_LU_MODULE_H 9 | #define EIGEN_LU_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** \defgroup LU_Module LU module 16 | * This module includes %LU decomposition and related notions such as matrix inversion and determinant. 17 | * This module defines the following MatrixBase methods: 18 | * - MatrixBase::inverse() 19 | * - MatrixBase::determinant() 20 | * 21 | * \code 22 | * #include 23 | * \endcode 24 | */ 25 | 26 | #include "src/misc/Kernel.h" 27 | #include "src/misc/Image.h" 28 | #include "src/LU/FullPivLU.h" 29 | #include "src/LU/PartialPivLU.h" 30 | #ifdef EIGEN_USE_LAPACKE 31 | #ifdef EIGEN_USE_MKL 32 | #include "mkl_lapacke.h" 33 | #else 34 | #include "src/misc/lapacke.h" 35 | #endif 36 | #include "src/LU/PartialPivLU_LAPACKE.h" 37 | #endif 38 | #include "src/LU/Determinant.h" 39 | #include "src/LU/InverseImpl.h" 40 | 41 | #if defined EIGEN_VECTORIZE_SSE || defined EIGEN_VECTORIZE_NEON 42 | #include "src/LU/arch/InverseSize4.h" 43 | #endif 44 | 45 | #include "src/Core/util/ReenableStupidWarnings.h" 46 | 47 | #endif // EIGEN_LU_MODULE_H 48 | -------------------------------------------------------------------------------- /src/engine/Eigen/MetisSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_METISSUPPORT_MODULE_H 9 | #define EIGEN_METISSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | extern "C" { 16 | #include 17 | } 18 | 19 | 20 | /** \ingroup Support_modules 21 | * \defgroup MetisSupport_Module MetisSupport module 22 | * 23 | * \code 24 | * #include 25 | * \endcode 26 | * This module defines an interface to the METIS reordering package (http://glaros.dtc.umn.edu/gkhome/views/metis). 27 | * It can be used just as any other built-in method as explained in \link OrderingMethods_Module here. \endlink 28 | */ 29 | 30 | 31 | #include "src/MetisSupport/MetisSupport.h" 32 | 33 | #include "src/Core/util/ReenableStupidWarnings.h" 34 | 35 | #endif // EIGEN_METISSUPPORT_MODULE_H 36 | -------------------------------------------------------------------------------- /src/engine/Eigen/OrderingMethods: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_ORDERINGMETHODS_MODULE_H 9 | #define EIGEN_ORDERINGMETHODS_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** 16 | * \defgroup OrderingMethods_Module OrderingMethods module 17 | * 18 | * This module is currently for internal use only 19 | * 20 | * It defines various built-in and external ordering methods for sparse matrices. 21 | * They are typically used to reduce the number of elements during 22 | * the sparse matrix decomposition (LLT, LU, QR). 23 | * Precisely, in a preprocessing step, a permutation matrix P is computed using 24 | * those ordering methods and applied to the columns of the matrix. 25 | * Using for instance the sparse Cholesky decomposition, it is expected that 26 | * the nonzeros elements in LLT(A*P) will be much smaller than that in LLT(A). 27 | * 28 | * 29 | * Usage : 30 | * \code 31 | * #include 32 | * \endcode 33 | * 34 | * A simple usage is as a template parameter in the sparse decomposition classes : 35 | * 36 | * \code 37 | * SparseLU > solver; 38 | * \endcode 39 | * 40 | * \code 41 | * SparseQR > solver; 42 | * \endcode 43 | * 44 | * It is possible as well to call directly a particular ordering method for your own purpose, 45 | * \code 46 | * AMDOrdering ordering; 47 | * PermutationMatrix perm; 48 | * SparseMatrix A; 49 | * //Fill the matrix ... 50 | * 51 | * ordering(A, perm); // Call AMD 52 | * \endcode 53 | * 54 | * \note Some of these methods (like AMD or METIS), need the sparsity pattern 55 | * of the input matrix to be symmetric. When the matrix is structurally unsymmetric, 56 | * Eigen computes internally the pattern of \f$A^T*A\f$ before calling the method. 57 | * If your matrix is already symmetric (at leat in structure), you can avoid that 58 | * by calling the method with a SelfAdjointView type. 59 | * 60 | * \code 61 | * // Call the ordering on the pattern of the lower triangular matrix A 62 | * ordering(A.selfadjointView(), perm); 63 | * \endcode 64 | */ 65 | 66 | #include "src/OrderingMethods/Amd.h" 67 | #include "src/OrderingMethods/Ordering.h" 68 | #include "src/Core/util/ReenableStupidWarnings.h" 69 | 70 | #endif // EIGEN_ORDERINGMETHODS_MODULE_H 71 | -------------------------------------------------------------------------------- /src/engine/Eigen/PaStiXSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_PASTIXSUPPORT_MODULE_H 9 | #define EIGEN_PASTIXSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | extern "C" { 16 | #include 17 | #include 18 | } 19 | 20 | #ifdef complex 21 | #undef complex 22 | #endif 23 | 24 | /** \ingroup Support_modules 25 | * \defgroup PaStiXSupport_Module PaStiXSupport module 26 | * 27 | * This module provides an interface to the PaSTiX library. 28 | * PaSTiX is a general \b supernodal, \b parallel and \b opensource sparse solver. 29 | * It provides the two following main factorization classes: 30 | * - class PastixLLT : a supernodal, parallel LLt Cholesky factorization. 31 | * - class PastixLDLT: a supernodal, parallel LDLt Cholesky factorization. 32 | * - class PastixLU : a supernodal, parallel LU factorization (optimized for a symmetric pattern). 33 | * 34 | * \code 35 | * #include 36 | * \endcode 37 | * 38 | * In order to use this module, the PaSTiX headers must be accessible from the include paths, and your binary must be linked to the PaSTiX library and its dependencies. 39 | * This wrapper resuires PaStiX version 5.x compiled without MPI support. 40 | * The dependencies depend on how PaSTiX has been compiled. 41 | * For a cmake based project, you can use our FindPaSTiX.cmake module to help you in this task. 42 | * 43 | */ 44 | 45 | #include "src/PaStiXSupport/PaStiXSupport.h" 46 | 47 | #include "src/Core/util/ReenableStupidWarnings.h" 48 | 49 | #endif // EIGEN_PASTIXSUPPORT_MODULE_H 50 | -------------------------------------------------------------------------------- /src/engine/Eigen/PardisoSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_PARDISOSUPPORT_MODULE_H 9 | #define EIGEN_PARDISOSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include 16 | 17 | /** \ingroup Support_modules 18 | * \defgroup PardisoSupport_Module PardisoSupport module 19 | * 20 | * This module brings support for the Intel(R) MKL PARDISO direct sparse solvers. 21 | * 22 | * \code 23 | * #include 24 | * \endcode 25 | * 26 | * In order to use this module, the MKL headers must be accessible from the include paths, and your binary must be linked to the MKL library and its dependencies. 27 | * See this \ref TopicUsingIntelMKL "page" for more information on MKL-Eigen integration. 28 | * 29 | */ 30 | 31 | #include "src/PardisoSupport/PardisoSupport.h" 32 | 33 | #include "src/Core/util/ReenableStupidWarnings.h" 34 | 35 | #endif // EIGEN_PARDISOSUPPORT_MODULE_H 36 | -------------------------------------------------------------------------------- /src/engine/Eigen/QR: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_QR_MODULE_H 9 | #define EIGEN_QR_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "Cholesky" 14 | #include "Jacobi" 15 | #include "Householder" 16 | 17 | #include "src/Core/util/DisableStupidWarnings.h" 18 | 19 | /** \defgroup QR_Module QR module 20 | * 21 | * 22 | * 23 | * This module provides various QR decompositions 24 | * This module also provides some MatrixBase methods, including: 25 | * - MatrixBase::householderQr() 26 | * - MatrixBase::colPivHouseholderQr() 27 | * - MatrixBase::fullPivHouseholderQr() 28 | * 29 | * \code 30 | * #include 31 | * \endcode 32 | */ 33 | 34 | #include "src/QR/HouseholderQR.h" 35 | #include "src/QR/FullPivHouseholderQR.h" 36 | #include "src/QR/ColPivHouseholderQR.h" 37 | #include "src/QR/CompleteOrthogonalDecomposition.h" 38 | #ifdef EIGEN_USE_LAPACKE 39 | #ifdef EIGEN_USE_MKL 40 | #include "mkl_lapacke.h" 41 | #else 42 | #include "src/misc/lapacke.h" 43 | #endif 44 | #include "src/QR/HouseholderQR_LAPACKE.h" 45 | #include "src/QR/ColPivHouseholderQR_LAPACKE.h" 46 | #endif 47 | 48 | #include "src/Core/util/ReenableStupidWarnings.h" 49 | 50 | #endif // EIGEN_QR_MODULE_H 51 | -------------------------------------------------------------------------------- /src/engine/Eigen/QtAlignedMalloc: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_QTMALLOC_MODULE_H 9 | #define EIGEN_QTMALLOC_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #if (!EIGEN_MALLOC_ALREADY_ALIGNED) 14 | 15 | #include "src/Core/util/DisableStupidWarnings.h" 16 | 17 | void *qMalloc(std::size_t size) 18 | { 19 | return Eigen::internal::aligned_malloc(size); 20 | } 21 | 22 | void qFree(void *ptr) 23 | { 24 | Eigen::internal::aligned_free(ptr); 25 | } 26 | 27 | void *qRealloc(void *ptr, std::size_t size) 28 | { 29 | void* newPtr = Eigen::internal::aligned_malloc(size); 30 | std::memcpy(newPtr, ptr, size); 31 | Eigen::internal::aligned_free(ptr); 32 | return newPtr; 33 | } 34 | 35 | #include "src/Core/util/ReenableStupidWarnings.h" 36 | 37 | #endif 38 | 39 | #endif // EIGEN_QTMALLOC_MODULE_H 40 | -------------------------------------------------------------------------------- /src/engine/Eigen/SPQRSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_SPQRSUPPORT_MODULE_H 9 | #define EIGEN_SPQRSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include "SuiteSparseQR.hpp" 16 | 17 | /** \ingroup Support_modules 18 | * \defgroup SPQRSupport_Module SuiteSparseQR module 19 | * 20 | * This module provides an interface to the SPQR library, which is part of the suitesparse package. 21 | * 22 | * \code 23 | * #include 24 | * \endcode 25 | * 26 | * In order to use this module, the SPQR headers must be accessible from the include paths, and your binary must be linked to the SPQR library and its dependencies (Cholmod, AMD, COLAMD,...). 27 | * For a cmake based project, you can use our FindSPQR.cmake and FindCholmod.Cmake modules 28 | * 29 | */ 30 | 31 | #include "src/CholmodSupport/CholmodSupport.h" 32 | #include "src/SPQRSupport/SuiteSparseQRSupport.h" 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/engine/Eigen/SVD: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_SVD_MODULE_H 9 | #define EIGEN_SVD_MODULE_H 10 | 11 | #include "QR" 12 | #include "Householder" 13 | #include "Jacobi" 14 | 15 | #include "src/Core/util/DisableStupidWarnings.h" 16 | 17 | /** \defgroup SVD_Module SVD module 18 | * 19 | * 20 | * 21 | * This module provides SVD decomposition for matrices (both real and complex). 22 | * Two decomposition algorithms are provided: 23 | * - JacobiSVD implementing two-sided Jacobi iterations is numerically very accurate, fast for small matrices, but very slow for larger ones. 24 | * - BDCSVD implementing a recursive divide & conquer strategy on top of an upper-bidiagonalization which remains fast for large problems. 25 | * These decompositions are accessible via the respective classes and following MatrixBase methods: 26 | * - MatrixBase::jacobiSvd() 27 | * - MatrixBase::bdcSvd() 28 | * 29 | * \code 30 | * #include 31 | * \endcode 32 | */ 33 | 34 | #include "src/misc/RealSvd2x2.h" 35 | #include "src/SVD/UpperBidiagonalization.h" 36 | #include "src/SVD/SVDBase.h" 37 | #include "src/SVD/JacobiSVD.h" 38 | #include "src/SVD/BDCSVD.h" 39 | #if defined(EIGEN_USE_LAPACKE) && !defined(EIGEN_USE_LAPACKE_STRICT) 40 | #ifdef EIGEN_USE_MKL 41 | #include "mkl_lapacke.h" 42 | #else 43 | #include "src/misc/lapacke.h" 44 | #endif 45 | #include "src/SVD/JacobiSVD_LAPACKE.h" 46 | #endif 47 | 48 | #include "src/Core/util/ReenableStupidWarnings.h" 49 | 50 | #endif // EIGEN_SVD_MODULE_H 51 | -------------------------------------------------------------------------------- /src/engine/Eigen/Sparse: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_SPARSE_MODULE_H 9 | #define EIGEN_SPARSE_MODULE_H 10 | 11 | /** \defgroup Sparse_Module Sparse meta-module 12 | * 13 | * Meta-module including all related modules: 14 | * - \ref SparseCore_Module 15 | * - \ref OrderingMethods_Module 16 | * - \ref SparseCholesky_Module 17 | * - \ref SparseLU_Module 18 | * - \ref SparseQR_Module 19 | * - \ref IterativeLinearSolvers_Module 20 | * 21 | \code 22 | #include 23 | \endcode 24 | */ 25 | 26 | #include "SparseCore" 27 | #include "OrderingMethods" 28 | #include "SparseCholesky" 29 | #include "SparseLU" 30 | #include "SparseQR" 31 | #include "IterativeLinearSolvers" 32 | 33 | #endif // EIGEN_SPARSE_MODULE_H 34 | 35 | -------------------------------------------------------------------------------- /src/engine/Eigen/SparseCholesky: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2013 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPARSECHOLESKY_MODULE_H 11 | #define EIGEN_SPARSECHOLESKY_MODULE_H 12 | 13 | #include "SparseCore" 14 | #include "OrderingMethods" 15 | 16 | #include "src/Core/util/DisableStupidWarnings.h" 17 | 18 | /** 19 | * \defgroup SparseCholesky_Module SparseCholesky module 20 | * 21 | * This module currently provides two variants of the direct sparse Cholesky decomposition for selfadjoint (hermitian) matrices. 22 | * Those decompositions are accessible via the following classes: 23 | * - SimplicialLLt, 24 | * - SimplicialLDLt 25 | * 26 | * Such problems can also be solved using the ConjugateGradient solver from the IterativeLinearSolvers module. 27 | * 28 | * \code 29 | * #include 30 | * \endcode 31 | */ 32 | 33 | #include "src/SparseCholesky/SimplicialCholesky.h" 34 | #include "src/SparseCholesky/SimplicialCholesky_impl.h" 35 | #include "src/Core/util/ReenableStupidWarnings.h" 36 | 37 | #endif // EIGEN_SPARSECHOLESKY_MODULE_H 38 | -------------------------------------------------------------------------------- /src/engine/Eigen/SparseCore: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_SPARSECORE_MODULE_H 9 | #define EIGEN_SPARSECORE_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | /** 22 | * \defgroup SparseCore_Module SparseCore module 23 | * 24 | * This module provides a sparse matrix representation, and basic associated matrix manipulations 25 | * and operations. 26 | * 27 | * See the \ref TutorialSparse "Sparse tutorial" 28 | * 29 | * \code 30 | * #include 31 | * \endcode 32 | * 33 | * This module depends on: Core. 34 | */ 35 | 36 | #include "src/SparseCore/SparseUtil.h" 37 | #include "src/SparseCore/SparseMatrixBase.h" 38 | #include "src/SparseCore/SparseAssign.h" 39 | #include "src/SparseCore/CompressedStorage.h" 40 | #include "src/SparseCore/AmbiVector.h" 41 | #include "src/SparseCore/SparseCompressedBase.h" 42 | #include "src/SparseCore/SparseMatrix.h" 43 | #include "src/SparseCore/SparseMap.h" 44 | #include "src/SparseCore/MappedSparseMatrix.h" 45 | #include "src/SparseCore/SparseVector.h" 46 | #include "src/SparseCore/SparseRef.h" 47 | #include "src/SparseCore/SparseCwiseUnaryOp.h" 48 | #include "src/SparseCore/SparseCwiseBinaryOp.h" 49 | #include "src/SparseCore/SparseTranspose.h" 50 | #include "src/SparseCore/SparseBlock.h" 51 | #include "src/SparseCore/SparseDot.h" 52 | #include "src/SparseCore/SparseRedux.h" 53 | #include "src/SparseCore/SparseView.h" 54 | #include "src/SparseCore/SparseDiagonalProduct.h" 55 | #include "src/SparseCore/ConservativeSparseSparseProduct.h" 56 | #include "src/SparseCore/SparseSparseProductWithPruning.h" 57 | #include "src/SparseCore/SparseProduct.h" 58 | #include "src/SparseCore/SparseDenseProduct.h" 59 | #include "src/SparseCore/SparseSelfAdjointView.h" 60 | #include "src/SparseCore/SparseTriangularView.h" 61 | #include "src/SparseCore/TriangularSolver.h" 62 | #include "src/SparseCore/SparsePermutation.h" 63 | #include "src/SparseCore/SparseFuzzy.h" 64 | #include "src/SparseCore/SparseSolverBase.h" 65 | 66 | #include "src/Core/util/ReenableStupidWarnings.h" 67 | 68 | #endif // EIGEN_SPARSECORE_MODULE_H 69 | 70 | -------------------------------------------------------------------------------- /src/engine/Eigen/SparseLU: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2012 Désiré Nuentsa-Wakam 5 | // Copyright (C) 2012 Gael Guennebaud 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_SPARSELU_MODULE_H 12 | #define EIGEN_SPARSELU_MODULE_H 13 | 14 | #include "SparseCore" 15 | 16 | /** 17 | * \defgroup SparseLU_Module SparseLU module 18 | * This module defines a supernodal factorization of general sparse matrices. 19 | * The code is fully optimized for supernode-panel updates with specialized kernels. 20 | * Please, see the documentation of the SparseLU class for more details. 21 | */ 22 | 23 | // Ordering interface 24 | #include "OrderingMethods" 25 | 26 | #include "src/Core/util/DisableStupidWarnings.h" 27 | 28 | #include "src/SparseLU/SparseLU_gemm_kernel.h" 29 | 30 | #include "src/SparseLU/SparseLU_Structs.h" 31 | #include "src/SparseLU/SparseLU_SupernodalMatrix.h" 32 | #include "src/SparseLU/SparseLUImpl.h" 33 | #include "src/SparseCore/SparseColEtree.h" 34 | #include "src/SparseLU/SparseLU_Memory.h" 35 | #include "src/SparseLU/SparseLU_heap_relax_snode.h" 36 | #include "src/SparseLU/SparseLU_relax_snode.h" 37 | #include "src/SparseLU/SparseLU_pivotL.h" 38 | #include "src/SparseLU/SparseLU_panel_dfs.h" 39 | #include "src/SparseLU/SparseLU_kernel_bmod.h" 40 | #include "src/SparseLU/SparseLU_panel_bmod.h" 41 | #include "src/SparseLU/SparseLU_column_dfs.h" 42 | #include "src/SparseLU/SparseLU_column_bmod.h" 43 | #include "src/SparseLU/SparseLU_copy_to_ucol.h" 44 | #include "src/SparseLU/SparseLU_pruneL.h" 45 | #include "src/SparseLU/SparseLU_Utils.h" 46 | #include "src/SparseLU/SparseLU.h" 47 | 48 | #include "src/Core/util/ReenableStupidWarnings.h" 49 | 50 | #endif // EIGEN_SPARSELU_MODULE_H 51 | -------------------------------------------------------------------------------- /src/engine/Eigen/SparseQR: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_SPARSEQR_MODULE_H 9 | #define EIGEN_SPARSEQR_MODULE_H 10 | 11 | #include "SparseCore" 12 | #include "OrderingMethods" 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** \defgroup SparseQR_Module SparseQR module 16 | * \brief Provides QR decomposition for sparse matrices 17 | * 18 | * This module provides a simplicial version of the left-looking Sparse QR decomposition. 19 | * The columns of the input matrix should be reordered to limit the fill-in during the 20 | * decomposition. Built-in methods (COLAMD, AMD) or external methods (METIS) can be used to this end. 21 | * See the \link OrderingMethods_Module OrderingMethods\endlink module for the list 22 | * of built-in and external ordering methods. 23 | * 24 | * \code 25 | * #include 26 | * \endcode 27 | * 28 | * 29 | */ 30 | 31 | #include "src/SparseCore/SparseColEtree.h" 32 | #include "src/SparseQR/SparseQR.h" 33 | 34 | #include "src/Core/util/ReenableStupidWarnings.h" 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/engine/Eigen/StdDeque: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // Copyright (C) 2009 Hauke Heibel 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_STDDEQUE_MODULE_H 12 | #define EIGEN_STDDEQUE_MODULE_H 13 | 14 | #include "Core" 15 | #include 16 | 17 | #if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */ 18 | 19 | #define EIGEN_DEFINE_STL_DEQUE_SPECIALIZATION(...) 20 | 21 | #else 22 | 23 | #include "src/StlSupport/StdDeque.h" 24 | 25 | #endif 26 | 27 | #endif // EIGEN_STDDEQUE_MODULE_H 28 | -------------------------------------------------------------------------------- /src/engine/Eigen/StdList: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Hauke Heibel 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_STDLIST_MODULE_H 11 | #define EIGEN_STDLIST_MODULE_H 12 | 13 | #include "Core" 14 | #include 15 | 16 | #if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */ 17 | 18 | #define EIGEN_DEFINE_STL_LIST_SPECIALIZATION(...) 19 | 20 | #else 21 | 22 | #include "src/StlSupport/StdList.h" 23 | 24 | #endif 25 | 26 | #endif // EIGEN_STDLIST_MODULE_H 27 | -------------------------------------------------------------------------------- /src/engine/Eigen/StdVector: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // Copyright (C) 2009 Hauke Heibel 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_STDVECTOR_MODULE_H 12 | #define EIGEN_STDVECTOR_MODULE_H 13 | 14 | #include "Core" 15 | #include 16 | 17 | #if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */ 18 | 19 | #define EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(...) 20 | 21 | #else 22 | 23 | #include "src/StlSupport/StdVector.h" 24 | 25 | #endif 26 | 27 | #endif // EIGEN_STDVECTOR_MODULE_H 28 | -------------------------------------------------------------------------------- /src/engine/Eigen/SuperLUSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_SUPERLUSUPPORT_MODULE_H 9 | #define EIGEN_SUPERLUSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #ifdef EMPTY 16 | #define EIGEN_EMPTY_WAS_ALREADY_DEFINED 17 | #endif 18 | 19 | typedef int int_t; 20 | #include 21 | #include 22 | #include 23 | 24 | // slu_util.h defines a preprocessor token named EMPTY which is really polluting, 25 | // so we remove it in favor of a SUPERLU_EMPTY token. 26 | // If EMPTY was already defined then we don't undef it. 27 | 28 | #if defined(EIGEN_EMPTY_WAS_ALREADY_DEFINED) 29 | # undef EIGEN_EMPTY_WAS_ALREADY_DEFINED 30 | #elif defined(EMPTY) 31 | # undef EMPTY 32 | #endif 33 | 34 | #define SUPERLU_EMPTY (-1) 35 | 36 | namespace Eigen { struct SluMatrix; } 37 | 38 | /** \ingroup Support_modules 39 | * \defgroup SuperLUSupport_Module SuperLUSupport module 40 | * 41 | * This module provides an interface to the SuperLU library. 42 | * It provides the following factorization class: 43 | * - class SuperLU: a supernodal sequential LU factorization. 44 | * - class SuperILU: a supernodal sequential incomplete LU factorization (to be used as a preconditioner for iterative methods). 45 | * 46 | * \warning This wrapper requires at least versions 4.0 of SuperLU. The 3.x versions are not supported. 47 | * 48 | * \warning When including this module, you have to use SUPERLU_EMPTY instead of EMPTY which is no longer defined because it is too polluting. 49 | * 50 | * \code 51 | * #include 52 | * \endcode 53 | * 54 | * In order to use this module, the superlu headers must be accessible from the include paths, and your binary must be linked to the superlu library and its dependencies. 55 | * The dependencies depend on how superlu has been compiled. 56 | * For a cmake based project, you can use our FindSuperLU.cmake module to help you in this task. 57 | * 58 | */ 59 | 60 | #include "src/SuperLUSupport/SuperLUSupport.h" 61 | 62 | #include "src/Core/util/ReenableStupidWarnings.h" 63 | 64 | #endif // EIGEN_SUPERLUSUPPORT_MODULE_H 65 | -------------------------------------------------------------------------------- /src/engine/Eigen/UmfPackSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_UMFPACKSUPPORT_MODULE_H 9 | #define EIGEN_UMFPACKSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | extern "C" { 16 | #include 17 | } 18 | 19 | /** \ingroup Support_modules 20 | * \defgroup UmfPackSupport_Module UmfPackSupport module 21 | * 22 | * This module provides an interface to the UmfPack library which is part of the suitesparse package. 23 | * It provides the following factorization class: 24 | * - class UmfPackLU: a multifrontal sequential LU factorization. 25 | * 26 | * \code 27 | * #include 28 | * \endcode 29 | * 30 | * In order to use this module, the umfpack headers must be accessible from the include paths, and your binary must be linked to the umfpack library and its dependencies. 31 | * The dependencies depend on how umfpack has been compiled. 32 | * For a cmake based project, you can use our FindUmfPack.cmake module to help you in this task. 33 | * 34 | */ 35 | 36 | #include "src/UmfPackSupport/UmfPackSupport.h" 37 | 38 | #include "src/Core/util/ReenableStupidWarnings.h" 39 | 40 | #endif // EIGEN_UMFPACKSUPPORT_MODULE_H 41 | -------------------------------------------------------------------------------- /src/engine/Eigen/src/Core/DiagonalProduct.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // Copyright (C) 2007-2009 Benoit Jacob 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_DIAGONALPRODUCT_H 12 | #define EIGEN_DIAGONALPRODUCT_H 13 | 14 | namespace Eigen { 15 | 16 | /** \returns the diagonal matrix product of \c *this by the diagonal matrix \a diagonal. 17 | */ 18 | template 19 | template 20 | EIGEN_DEVICE_FUNC inline const Product 21 | MatrixBase::operator*(const DiagonalBase &a_diagonal) const 22 | { 23 | return Product(derived(),a_diagonal.derived()); 24 | } 25 | 26 | } // end namespace Eigen 27 | 28 | #endif // EIGEN_DIAGONALPRODUCT_H 29 | -------------------------------------------------------------------------------- /src/engine/Eigen/src/Core/SelfCwiseBinaryOp.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009-2010 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SELFCWISEBINARYOP_H 11 | #define EIGEN_SELFCWISEBINARYOP_H 12 | 13 | namespace Eigen { 14 | 15 | // TODO generalize the scalar type of 'other' 16 | 17 | template 18 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::operator*=(const Scalar& other) 19 | { 20 | internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::mul_assign_op()); 21 | return derived(); 22 | } 23 | 24 | template 25 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& ArrayBase::operator+=(const Scalar& other) 26 | { 27 | internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::add_assign_op()); 28 | return derived(); 29 | } 30 | 31 | template 32 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& ArrayBase::operator-=(const Scalar& other) 33 | { 34 | internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::sub_assign_op()); 35 | return derived(); 36 | } 37 | 38 | template 39 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::operator/=(const Scalar& other) 40 | { 41 | internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::div_assign_op()); 42 | return derived(); 43 | } 44 | 45 | } // end namespace Eigen 46 | 47 | #endif // EIGEN_SELFCWISEBINARYOP_H 48 | -------------------------------------------------------------------------------- /src/engine/Eigen/src/Core/arch/AVX512/TypeCasting.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2019 Rasmus Munk Larsen 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_TYPE_CASTING_AVX512_H 11 | #define EIGEN_TYPE_CASTING_AVX512_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | template<> EIGEN_STRONG_INLINE Packet16i pcast(const Packet16f& a) { 18 | return _mm512_cvttps_epi32(a); 19 | } 20 | 21 | template<> EIGEN_STRONG_INLINE Packet16f pcast(const Packet16i& a) { 22 | return _mm512_cvtepi32_ps(a); 23 | } 24 | 25 | template<> EIGEN_STRONG_INLINE Packet16i preinterpret(const Packet16f& a) { 26 | return _mm512_castps_si512(a); 27 | } 28 | 29 | template<> EIGEN_STRONG_INLINE Packet16f preinterpret(const Packet16i& a) { 30 | return _mm512_castsi512_ps(a); 31 | } 32 | 33 | template <> 34 | struct type_casting_traits { 35 | enum { 36 | VectorizedCast = 1, 37 | SrcCoeffRatio = 1, 38 | TgtCoeffRatio = 1 39 | }; 40 | }; 41 | 42 | template<> EIGEN_STRONG_INLINE Packet16f pcast(const Packet16h& a) { 43 | return half2float(a); 44 | } 45 | 46 | template <> 47 | struct type_casting_traits { 48 | enum { 49 | VectorizedCast = 1, 50 | SrcCoeffRatio = 1, 51 | TgtCoeffRatio = 1 52 | }; 53 | }; 54 | 55 | template<> EIGEN_STRONG_INLINE Packet16h pcast(const Packet16f& a) { 56 | return float2half(a); 57 | } 58 | 59 | template <> 60 | struct type_casting_traits { 61 | enum { 62 | VectorizedCast = 1, 63 | SrcCoeffRatio = 1, 64 | TgtCoeffRatio = 1 65 | }; 66 | }; 67 | 68 | template<> EIGEN_STRONG_INLINE Packet16f pcast(const Packet16bf& a) { 69 | return Bf16ToF32(a); 70 | } 71 | 72 | template <> 73 | struct type_casting_traits { 74 | enum { 75 | VectorizedCast = 1, 76 | SrcCoeffRatio = 1, 77 | TgtCoeffRatio = 1 78 | }; 79 | }; 80 | 81 | template<> EIGEN_STRONG_INLINE Packet16bf pcast(const Packet16f& a) { 82 | return F32ToBf16(a); 83 | } 84 | 85 | } // end namespace internal 86 | 87 | } // end namespace Eigen 88 | 89 | #endif // EIGEN_TYPE_CASTING_AVX512_H 90 | -------------------------------------------------------------------------------- /src/engine/Eigen/src/Core/arch/AltiVec/MathFunctions.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2007 Julien Pommier 5 | // Copyright (C) 2009 Gael Guennebaud 6 | // Copyright (C) 2016 Konstantinos Margaritis 7 | // 8 | // This Source Code Form is subject to the terms of the Mozilla 9 | // Public License v. 2.0. If a copy of the MPL was not distributed 10 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 11 | 12 | #ifndef EIGEN_MATH_FUNCTIONS_ALTIVEC_H 13 | #define EIGEN_MATH_FUNCTIONS_ALTIVEC_H 14 | 15 | namespace Eigen { 16 | 17 | namespace internal { 18 | 19 | template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED 20 | Packet4f plog(const Packet4f& _x) 21 | { 22 | return plog_float(_x); 23 | } 24 | 25 | template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED 26 | Packet4f pexp(const Packet4f& _x) 27 | { 28 | return pexp_float(_x); 29 | } 30 | 31 | template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED 32 | Packet4f psin(const Packet4f& _x) 33 | { 34 | return psin_float(_x); 35 | } 36 | 37 | template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED 38 | Packet4f pcos(const Packet4f& _x) 39 | { 40 | return pcos_float(_x); 41 | } 42 | 43 | #ifndef EIGEN_COMP_CLANG 44 | template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED 45 | Packet4f prsqrt(const Packet4f& x) 46 | { 47 | return vec_rsqrt(x); 48 | } 49 | #endif 50 | 51 | #ifdef __VSX__ 52 | #ifndef EIGEN_COMP_CLANG 53 | template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED 54 | Packet2d prsqrt(const Packet2d& x) 55 | { 56 | return vec_rsqrt(x); 57 | } 58 | #endif 59 | 60 | template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED 61 | Packet4f psqrt(const Packet4f& x) 62 | { 63 | return vec_sqrt(x); 64 | } 65 | 66 | template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED 67 | Packet2d psqrt(const Packet2d& x) 68 | { 69 | return vec_sqrt(x); 70 | } 71 | 72 | template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED 73 | Packet2d pexp(const Packet2d& _x) 74 | { 75 | return pexp_double(_x); 76 | } 77 | #endif 78 | 79 | // Hyperbolic Tangent function. 80 | template <> 81 | EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet4f 82 | ptanh(const Packet4f& x) { 83 | return internal::generic_fast_tanh_float(x); 84 | } 85 | 86 | } // end namespace internal 87 | 88 | } // end namespace Eigen 89 | 90 | #endif // EIGEN_MATH_FUNCTIONS_ALTIVEC_H 91 | -------------------------------------------------------------------------------- /src/engine/Eigen/src/Core/arch/Default/Settings.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2010 Gael Guennebaud 5 | // Copyright (C) 2006-2008 Benoit Jacob 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | 12 | /* All the parameters defined in this file can be specialized in the 13 | * architecture specific files, and/or by the user. 14 | * More to come... */ 15 | 16 | #ifndef EIGEN_DEFAULT_SETTINGS_H 17 | #define EIGEN_DEFAULT_SETTINGS_H 18 | 19 | /** Defines the maximal loop size to enable meta unrolling of loops. 20 | * Note that the value here is expressed in Eigen's own notion of "number of FLOPS", 21 | * it does not correspond to the number of iterations or the number of instructions 22 | */ 23 | #ifndef EIGEN_UNROLLING_LIMIT 24 | #define EIGEN_UNROLLING_LIMIT 110 25 | #endif 26 | 27 | /** Defines the threshold between a "small" and a "large" matrix. 28 | * This threshold is mainly used to select the proper product implementation. 29 | */ 30 | #ifndef EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 31 | #define EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 8 32 | #endif 33 | 34 | /** Defines the maximal width of the blocks used in the triangular product and solver 35 | * for vectors (level 2 blas xTRMV and xTRSV). The default is 8. 36 | */ 37 | #ifndef EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH 38 | #define EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH 8 39 | #endif 40 | 41 | 42 | /** Defines the default number of registers available for that architecture. 43 | * Currently it must be 8 or 16. Other values will fail. 44 | */ 45 | #ifndef EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS 46 | #define EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS 8 47 | #endif 48 | 49 | #endif // EIGEN_DEFAULT_SETTINGS_H 50 | -------------------------------------------------------------------------------- /src/engine/Eigen/src/Core/arch/GPU/TypeCasting.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2016 Benoit Steiner 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_TYPE_CASTING_GPU_H 11 | #define EIGEN_TYPE_CASTING_GPU_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | #if (defined(EIGEN_HAS_CUDA_FP16) && defined(EIGEN_CUDA_ARCH) && EIGEN_CUDA_ARCH >= 300) || \ 18 | (defined(EIGEN_HAS_HIP_FP16) && defined(EIGEN_HIP_DEVICE_COMPILE)) 19 | 20 | 21 | template <> 22 | struct type_casting_traits { 23 | enum { 24 | VectorizedCast = 1, 25 | SrcCoeffRatio = 1, 26 | TgtCoeffRatio = 2 27 | }; 28 | }; 29 | 30 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pcast(const half2& a, const half2& b) { 31 | float2 r1 = __half22float2(a); 32 | float2 r2 = __half22float2(b); 33 | return make_float4(r1.x, r1.y, r2.x, r2.y); 34 | } 35 | 36 | 37 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet4h2 pcast(const float4& a, const float4& b) { 38 | Packet4h2 r; 39 | half2* r_alias=reinterpret_cast(&r); 40 | r_alias[0]=__floats2half2_rn(a.x,a.y); 41 | r_alias[1]=__floats2half2_rn(a.z,a.w); 42 | r_alias[2]=__floats2half2_rn(b.x,b.y); 43 | r_alias[3]=__floats2half2_rn(b.z,b.w); 44 | return r; 45 | } 46 | 47 | template <> 48 | struct type_casting_traits { 49 | enum { 50 | VectorizedCast = 1, 51 | SrcCoeffRatio = 2, 52 | TgtCoeffRatio = 1 53 | }; 54 | }; 55 | 56 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pcast(const Packet4h2& a) { 57 | // Simply discard the second half of the input 58 | float4 r; 59 | const half2* a_alias=reinterpret_cast(&a); 60 | float2 r1 = __half22float2(a_alias[0]); 61 | float2 r2 = __half22float2(a_alias[1]); 62 | r.x=static_cast(r1.x); 63 | r.y=static_cast(r1.y); 64 | r.z=static_cast(r2.x); 65 | r.w=static_cast(r2.y); 66 | return r; 67 | } 68 | 69 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE half2 pcast(const float4& a) { 70 | // Simply discard the second half of the input 71 | return __floats2half2_rn(a.x, a.y); 72 | } 73 | 74 | #endif 75 | 76 | } // end namespace internal 77 | 78 | } // end namespace Eigen 79 | 80 | #endif // EIGEN_TYPE_CASTING_GPU_H 81 | -------------------------------------------------------------------------------- /src/engine/Eigen/src/Core/arch/HIP/hcc/math_constants.h: -------------------------------------------------------------------------------- 1 | /* 2 | * math_constants.h - 3 | * HIP equivalent of the CUDA header of the same name 4 | */ 5 | 6 | #ifndef __MATH_CONSTANTS_H__ 7 | #define __MATH_CONSTANTS_H__ 8 | 9 | /* single precision constants */ 10 | 11 | #define HIPRT_INF_F __int_as_float(0x7f800000) 12 | #define HIPRT_NAN_F __int_as_float(0x7fffffff) 13 | #define HIPRT_MIN_DENORM_F __int_as_float(0x00000001) 14 | #define HIPRT_MAX_NORMAL_F __int_as_float(0x7f7fffff) 15 | #define HIPRT_NEG_ZERO_F __int_as_float(0x80000000) 16 | #define HIPRT_ZERO_F 0.0f 17 | #define HIPRT_ONE_F 1.0f 18 | 19 | /* double precision constants */ 20 | #define HIPRT_INF __hiloint2double(0x7ff00000, 0x00000000) 21 | #define HIPRT_NAN __hiloint2double(0xfff80000, 0x00000000) 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /src/engine/Eigen/src/Core/arch/SVE/MathFunctions.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2020, Arm Limited and Contributors 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_MATH_FUNCTIONS_SVE_H 11 | #define EIGEN_MATH_FUNCTIONS_SVE_H 12 | 13 | namespace Eigen { 14 | namespace internal { 15 | 16 | template <> 17 | EIGEN_STRONG_INLINE EIGEN_UNUSED PacketXf pexp(const PacketXf& x) { 18 | return pexp_float(x); 19 | } 20 | 21 | template <> 22 | EIGEN_STRONG_INLINE EIGEN_UNUSED PacketXf plog(const PacketXf& x) { 23 | return plog_float(x); 24 | } 25 | 26 | template <> 27 | EIGEN_STRONG_INLINE EIGEN_UNUSED PacketXf psin(const PacketXf& x) { 28 | return psin_float(x); 29 | } 30 | 31 | template <> 32 | EIGEN_STRONG_INLINE EIGEN_UNUSED PacketXf pcos(const PacketXf& x) { 33 | return pcos_float(x); 34 | } 35 | 36 | // Hyperbolic Tangent function. 37 | template <> 38 | EIGEN_STRONG_INLINE EIGEN_UNUSED PacketXf ptanh(const PacketXf& x) { 39 | return internal::generic_fast_tanh_float(x); 40 | } 41 | } // end namespace internal 42 | } // end namespace Eigen 43 | 44 | #endif // EIGEN_MATH_FUNCTIONS_SVE_H 45 | -------------------------------------------------------------------------------- /src/engine/Eigen/src/Core/arch/SVE/TypeCasting.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2020, Arm Limited and Contributors 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_TYPE_CASTING_SVE_H 11 | #define EIGEN_TYPE_CASTING_SVE_H 12 | 13 | namespace Eigen { 14 | namespace internal { 15 | 16 | template <> 17 | struct type_casting_traits { 18 | enum { VectorizedCast = 1, SrcCoeffRatio = 1, TgtCoeffRatio = 1 }; 19 | }; 20 | 21 | template <> 22 | struct type_casting_traits { 23 | enum { VectorizedCast = 1, SrcCoeffRatio = 1, TgtCoeffRatio = 1 }; 24 | }; 25 | 26 | template <> 27 | EIGEN_STRONG_INLINE PacketXf pcast(const PacketXi& a) { 28 | return svcvt_f32_s32_z(svptrue_b32(), a); 29 | } 30 | 31 | template <> 32 | EIGEN_STRONG_INLINE PacketXi pcast(const PacketXf& a) { 33 | return svcvt_s32_f32_z(svptrue_b32(), a); 34 | } 35 | 36 | template <> 37 | EIGEN_STRONG_INLINE PacketXf preinterpret(const PacketXi& a) { 38 | return svreinterpret_f32_s32(a); 39 | } 40 | 41 | template <> 42 | EIGEN_STRONG_INLINE PacketXi preinterpret(const PacketXf& a) { 43 | return svreinterpret_s32_f32(a); 44 | } 45 | 46 | } // namespace internal 47 | } // namespace Eigen 48 | 49 | #endif // EIGEN_TYPE_CASTING_SVE_H 50 | -------------------------------------------------------------------------------- /src/engine/Eigen/src/Core/functors/TernaryFunctors.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2016 Eugene Brevdo 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_TERNARY_FUNCTORS_H 11 | #define EIGEN_TERNARY_FUNCTORS_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | //---------- associative ternary functors ---------- 18 | 19 | 20 | 21 | } // end namespace internal 22 | 23 | } // end namespace Eigen 24 | 25 | #endif // EIGEN_TERNARY_FUNCTORS_H 26 | -------------------------------------------------------------------------------- /src/engine/Eigen/src/Core/util/NonMPL2.h: -------------------------------------------------------------------------------- 1 | #ifdef EIGEN_MPL2_ONLY 2 | #error Including non-MPL2 code in EIGEN_MPL2_ONLY mode 3 | #endif 4 | -------------------------------------------------------------------------------- /src/engine/Eigen/src/Core/util/ReenableStupidWarnings.h: -------------------------------------------------------------------------------- 1 | #ifdef EIGEN_WARNINGS_DISABLED_2 2 | // "DisableStupidWarnings.h" was included twice recursively: Do not reenable warnings yet! 3 | # undef EIGEN_WARNINGS_DISABLED_2 4 | 5 | #elif defined(EIGEN_WARNINGS_DISABLED) 6 | #undef EIGEN_WARNINGS_DISABLED 7 | 8 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 9 | #ifdef _MSC_VER 10 | #pragma warning( pop ) 11 | #elif defined __INTEL_COMPILER 12 | #pragma warning pop 13 | #elif defined __clang__ 14 | #pragma clang diagnostic pop 15 | #elif defined __GNUC__ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) 16 | #pragma GCC diagnostic pop 17 | #endif 18 | 19 | #if defined __NVCC__ 20 | // Don't reenable the diagnostic messages, as it turns out these messages need 21 | // to be disabled at the point of the template instantiation (i.e the user code) 22 | // otherwise they'll be triggered by nvcc. 23 | // #pragma diag_default code_is_unreachable 24 | // #pragma diag_default initialization_not_reachable 25 | // #pragma diag_default 2651 26 | // #pragma diag_default 2653 27 | #endif 28 | 29 | #endif 30 | 31 | #endif // EIGEN_WARNINGS_DISABLED 32 | -------------------------------------------------------------------------------- /src/engine/Eigen/src/Core/util/ReshapedHelper.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2017 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | 11 | #ifndef EIGEN_RESHAPED_HELPER_H 12 | #define EIGEN_RESHAPED_HELPER_H 13 | 14 | namespace Eigen { 15 | 16 | enum AutoSize_t { AutoSize }; 17 | const int AutoOrder = 2; 18 | 19 | namespace internal { 20 | 21 | template 22 | struct get_compiletime_reshape_size { 23 | enum { value = get_fixed_value::value }; 24 | }; 25 | 26 | template 27 | Index get_runtime_reshape_size(SizeType size, Index /*other*/, Index /*total*/) { 28 | return internal::get_runtime_value(size); 29 | } 30 | 31 | template 32 | struct get_compiletime_reshape_size { 33 | enum { 34 | other_size = get_fixed_value::value, 35 | value = (TotalSize==Dynamic || other_size==Dynamic) ? Dynamic : TotalSize / other_size }; 36 | }; 37 | 38 | inline Index get_runtime_reshape_size(AutoSize_t /*size*/, Index other, Index total) { 39 | return total/other; 40 | } 41 | 42 | template 43 | struct get_compiletime_reshape_order { 44 | enum { value = Order == AutoOrder ? Flags & RowMajorBit : Order }; 45 | }; 46 | 47 | } 48 | 49 | } // end namespace Eigen 50 | 51 | #endif // EIGEN_RESHAPED_HELPER_H 52 | -------------------------------------------------------------------------------- /src/engine/Eigen/src/SparseCore/MappedSparseMatrix.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2014 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_MAPPED_SPARSEMATRIX_H 11 | #define EIGEN_MAPPED_SPARSEMATRIX_H 12 | 13 | namespace Eigen { 14 | 15 | /** \deprecated Use Map > 16 | * \class MappedSparseMatrix 17 | * 18 | * \brief Sparse matrix 19 | * 20 | * \param _Scalar the scalar type, i.e. the type of the coefficients 21 | * 22 | * See http://www.netlib.org/linalg/html_templates/node91.html for details on the storage scheme. 23 | * 24 | */ 25 | namespace internal { 26 | template 27 | struct traits > : traits > 28 | {}; 29 | } // end namespace internal 30 | 31 | template 32 | class MappedSparseMatrix 33 | : public Map > 34 | { 35 | typedef Map > Base; 36 | 37 | public: 38 | 39 | typedef typename Base::StorageIndex StorageIndex; 40 | typedef typename Base::Scalar Scalar; 41 | 42 | inline MappedSparseMatrix(Index rows, Index cols, Index nnz, StorageIndex* outerIndexPtr, StorageIndex* innerIndexPtr, Scalar* valuePtr, StorageIndex* innerNonZeroPtr = 0) 43 | : Base(rows, cols, nnz, outerIndexPtr, innerIndexPtr, valuePtr, innerNonZeroPtr) 44 | {} 45 | 46 | /** Empty destructor */ 47 | inline ~MappedSparseMatrix() {} 48 | }; 49 | 50 | namespace internal { 51 | 52 | template 53 | struct evaluator > 54 | : evaluator > > 55 | { 56 | typedef MappedSparseMatrix<_Scalar,_Options,_StorageIndex> XprType; 57 | typedef evaluator > Base; 58 | 59 | evaluator() : Base() {} 60 | explicit evaluator(const XprType &mat) : Base(mat) {} 61 | }; 62 | 63 | } 64 | 65 | } // end namespace Eigen 66 | 67 | #endif // EIGEN_MAPPED_SPARSEMATRIX_H 68 | -------------------------------------------------------------------------------- /src/engine/Eigen/src/SparseCore/SparseFuzzy.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2014 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPARSE_FUZZY_H 11 | #define EIGEN_SPARSE_FUZZY_H 12 | 13 | namespace Eigen { 14 | 15 | template 16 | template 17 | bool SparseMatrixBase::isApprox(const SparseMatrixBase& other, const RealScalar &prec) const 18 | { 19 | const typename internal::nested_eval::type actualA(derived()); 20 | typename internal::conditional::type, 22 | const PlainObject>::type actualB(other.derived()); 23 | 24 | return (actualA - actualB).squaredNorm() <= prec * prec * numext::mini(actualA.squaredNorm(), actualB.squaredNorm()); 25 | } 26 | 27 | } // end namespace Eigen 28 | 29 | #endif // EIGEN_SPARSE_FUZZY_H 30 | -------------------------------------------------------------------------------- /src/engine/Eigen/src/SparseCore/SparseRedux.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2014 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPARSEREDUX_H 11 | #define EIGEN_SPARSEREDUX_H 12 | 13 | namespace Eigen { 14 | 15 | template 16 | typename internal::traits::Scalar 17 | SparseMatrixBase::sum() const 18 | { 19 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 20 | Scalar res(0); 21 | internal::evaluator thisEval(derived()); 22 | for (Index j=0; j::InnerIterator iter(thisEval,j); iter; ++iter) 24 | res += iter.value(); 25 | return res; 26 | } 27 | 28 | template 29 | typename internal::traits >::Scalar 30 | SparseMatrix<_Scalar,_Options,_Index>::sum() const 31 | { 32 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 33 | if(this->isCompressed()) 34 | return Matrix::Map(m_data.valuePtr(), m_data.size()).sum(); 35 | else 36 | return Base::sum(); 37 | } 38 | 39 | template 40 | typename internal::traits >::Scalar 41 | SparseVector<_Scalar,_Options,_Index>::sum() const 42 | { 43 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 44 | return Matrix::Map(m_data.valuePtr(), m_data.size()).sum(); 45 | } 46 | 47 | } // end namespace Eigen 48 | 49 | #endif // EIGEN_SPARSEREDUX_H 50 | -------------------------------------------------------------------------------- /src/engine/Eigen/src/SparseLU/SparseLU_Utils.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2012 Désiré Nuentsa-Wakam 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | 11 | #ifndef EIGEN_SPARSELU_UTILS_H 12 | #define EIGEN_SPARSELU_UTILS_H 13 | 14 | namespace Eigen { 15 | namespace internal { 16 | 17 | /** 18 | * \brief Count Nonzero elements in the factors 19 | */ 20 | template 21 | void SparseLUImpl::countnz(const Index n, Index& nnzL, Index& nnzU, GlobalLU_t& glu) 22 | { 23 | nnzL = 0; 24 | nnzU = (glu.xusub)(n); 25 | Index nsuper = (glu.supno)(n); 26 | Index jlen; 27 | Index i, j, fsupc; 28 | if (n <= 0 ) return; 29 | // For each supernode 30 | for (i = 0; i <= nsuper; i++) 31 | { 32 | fsupc = glu.xsup(i); 33 | jlen = glu.xlsub(fsupc+1) - glu.xlsub(fsupc); 34 | 35 | for (j = fsupc; j < glu.xsup(i+1); j++) 36 | { 37 | nnzL += jlen; 38 | nnzU += j - fsupc + 1; 39 | jlen--; 40 | } 41 | } 42 | } 43 | 44 | /** 45 | * \brief Fix up the data storage lsub for L-subscripts. 46 | * 47 | * It removes the subscripts sets for structural pruning, 48 | * and applies permutation to the remaining subscripts 49 | * 50 | */ 51 | template 52 | void SparseLUImpl::fixupL(const Index n, const IndexVector& perm_r, GlobalLU_t& glu) 53 | { 54 | Index fsupc, i, j, k, jstart; 55 | 56 | StorageIndex nextl = 0; 57 | Index nsuper = (glu.supno)(n); 58 | 59 | // For each supernode 60 | for (i = 0; i <= nsuper; i++) 61 | { 62 | fsupc = glu.xsup(i); 63 | jstart = glu.xlsub(fsupc); 64 | glu.xlsub(fsupc) = nextl; 65 | for (j = jstart; j < glu.xlsub(fsupc + 1); j++) 66 | { 67 | glu.lsub(nextl) = perm_r(glu.lsub(j)); // Now indexed into P*A 68 | nextl++; 69 | } 70 | for (k = fsupc+1; k < glu.xsup(i+1); k++) 71 | glu.xlsub(k) = nextl; // other columns in supernode i 72 | } 73 | 74 | glu.xlsub(n) = nextl; 75 | } 76 | 77 | } // end namespace internal 78 | 79 | } // end namespace Eigen 80 | #endif // EIGEN_SPARSELU_UTILS_H 81 | -------------------------------------------------------------------------------- /src/engine/Eigen/src/misc/RealSvd2x2.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009-2010 Benoit Jacob 5 | // Copyright (C) 2013-2016 Gael Guennebaud 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_REALSVD2X2_H 12 | #define EIGEN_REALSVD2X2_H 13 | 14 | namespace Eigen { 15 | 16 | namespace internal { 17 | 18 | template 19 | void real_2x2_jacobi_svd(const MatrixType& matrix, Index p, Index q, 20 | JacobiRotation *j_left, 21 | JacobiRotation *j_right) 22 | { 23 | using std::sqrt; 24 | using std::abs; 25 | Matrix m; 26 | m << numext::real(matrix.coeff(p,p)), numext::real(matrix.coeff(p,q)), 27 | numext::real(matrix.coeff(q,p)), numext::real(matrix.coeff(q,q)); 28 | JacobiRotation rot1; 29 | RealScalar t = m.coeff(0,0) + m.coeff(1,1); 30 | RealScalar d = m.coeff(1,0) - m.coeff(0,1); 31 | 32 | if(abs(d) < (std::numeric_limits::min)()) 33 | { 34 | rot1.s() = RealScalar(0); 35 | rot1.c() = RealScalar(1); 36 | } 37 | else 38 | { 39 | // If d!=0, then t/d cannot overflow because the magnitude of the 40 | // entries forming d are not too small compared to the ones forming t. 41 | RealScalar u = t / d; 42 | RealScalar tmp = sqrt(RealScalar(1) + numext::abs2(u)); 43 | rot1.s() = RealScalar(1) / tmp; 44 | rot1.c() = u / tmp; 45 | } 46 | m.applyOnTheLeft(0,1,rot1); 47 | j_right->makeJacobi(m,0,1); 48 | *j_left = rot1 * j_right->transpose(); 49 | } 50 | 51 | } // end namespace internal 52 | 53 | } // end namespace Eigen 54 | 55 | #endif // EIGEN_REALSVD2X2_H 56 | -------------------------------------------------------------------------------- /src/engine/Eigen/src/misc/lapacke_mangling.h: -------------------------------------------------------------------------------- 1 | #ifndef LAPACK_HEADER_INCLUDED 2 | #define LAPACK_HEADER_INCLUDED 3 | 4 | #ifndef LAPACK_GLOBAL 5 | #if defined(LAPACK_GLOBAL_PATTERN_LC) || defined(ADD_) 6 | #define LAPACK_GLOBAL(lcname,UCNAME) lcname##_ 7 | #elif defined(LAPACK_GLOBAL_PATTERN_UC) || defined(UPPER) 8 | #define LAPACK_GLOBAL(lcname,UCNAME) UCNAME 9 | #elif defined(LAPACK_GLOBAL_PATTERN_MC) || defined(NOCHANGE) 10 | #define LAPACK_GLOBAL(lcname,UCNAME) lcname 11 | #else 12 | #define LAPACK_GLOBAL(lcname,UCNAME) lcname##_ 13 | #endif 14 | #endif 15 | 16 | #endif 17 | 18 | -------------------------------------------------------------------------------- /src/engine/c_bindings/aabb_c.h: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #ifndef AABB_T_H 26 | #define AABB_T_H 27 | 28 | #include "vector3_c.h" 29 | 30 | typedef struct AABB_t { 31 | Vector3_t position; 32 | float width; 33 | float height; 34 | float depth; 35 | } AABB_t; 36 | 37 | #endif -------------------------------------------------------------------------------- /src/engine/c_bindings/diffuseparticle_c.h: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #ifndef FLUIDENGINE_DIFFUSEPARTICLE_T_H 26 | #define FLUIDENGINE_DIFFUSEPARTICLE_T_H 27 | 28 | #include "vector3_c.h" 29 | 30 | typedef struct DiffuseParticle_t { 31 | Vector3_t position; 32 | Vector3_t velocity; 33 | float lifetime; 34 | char type; 35 | unsigned char id; 36 | } DiffuseParticle_t; 37 | 38 | #endif -------------------------------------------------------------------------------- /src/engine/c_bindings/forcefieldgrid_c.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "../forcefieldgrid.h" 26 | #include "../forcefield.h" 27 | #include "cbindings.h" 28 | 29 | #ifdef _WIN32 30 | #define EXPORTDLL __declspec(dllexport) 31 | #else 32 | #define EXPORTDLL 33 | #endif 34 | 35 | extern "C" { 36 | 37 | EXPORTDLL ForceFieldGrid* ForceFieldGrid_new(int *err) { 38 | 39 | *err = CBindings::SUCCESS; 40 | ForceFieldGrid *fgrid = nullptr; 41 | try { 42 | fgrid = new ForceFieldGrid(); 43 | } catch (std::exception &ex) { 44 | CBindings::set_error_message(ex); 45 | *err = CBindings::FAIL; 46 | } 47 | 48 | return fgrid; 49 | } 50 | 51 | EXPORTDLL void ForceFieldGrid_destroy(ForceFieldGrid *obj) { 52 | delete obj; 53 | } 54 | 55 | EXPORTDLL void ForceFieldGrid_add_force_field(ForceFieldGrid* obj, ForceField *field, int *err) { 56 | CBindings::safe_execute_method_void_1param( 57 | obj, &ForceFieldGrid::addForceField, field, err 58 | ); 59 | } 60 | 61 | } -------------------------------------------------------------------------------- /src/engine/c_bindings/forcefieldpoint_c.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "../forcefieldpoint.h" 26 | #include "cbindings.h" 27 | 28 | #ifdef _WIN32 29 | #define EXPORTDLL __declspec(dllexport) 30 | #else 31 | #define EXPORTDLL 32 | #endif 33 | 34 | extern "C" { 35 | 36 | EXPORTDLL ForceFieldPoint* ForceFieldPoint_new(int *err) { 37 | 38 | *err = CBindings::SUCCESS; 39 | ForceFieldPoint *ffp = nullptr; 40 | try { 41 | ffp = new ForceFieldPoint(); 42 | } catch (std::exception &ex) { 43 | CBindings::set_error_message(ex); 44 | *err = CBindings::FAIL; 45 | } 46 | 47 | return ffp; 48 | } 49 | 50 | EXPORTDLL void ForceFieldPoint_destroy(ForceFieldPoint *obj) { 51 | delete obj; 52 | } 53 | 54 | } -------------------------------------------------------------------------------- /src/engine/c_bindings/forcefieldsurface_c.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "../forcefieldsurface.h" 26 | #include "cbindings.h" 27 | 28 | #ifdef _WIN32 29 | #define EXPORTDLL __declspec(dllexport) 30 | #else 31 | #define EXPORTDLL 32 | #endif 33 | 34 | extern "C" { 35 | 36 | EXPORTDLL ForceFieldSurface* ForceFieldSurface_new(int *err) { 37 | 38 | *err = CBindings::SUCCESS; 39 | ForceFieldSurface *ffs = nullptr; 40 | try { 41 | ffs = new ForceFieldSurface(); 42 | } catch (std::exception &ex) { 43 | CBindings::set_error_message(ex); 44 | *err = CBindings::FAIL; 45 | } 46 | 47 | return ffs; 48 | } 49 | 50 | EXPORTDLL void ForceFieldSurface_destroy(ForceFieldSurface *obj) { 51 | delete obj; 52 | } 53 | 54 | } -------------------------------------------------------------------------------- /src/engine/c_bindings/forcefieldvolume_c.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "../forcefieldvolume.h" 26 | #include "cbindings.h" 27 | 28 | #ifdef _WIN32 29 | #define EXPORTDLL __declspec(dllexport) 30 | #else 31 | #define EXPORTDLL 32 | #endif 33 | 34 | extern "C" { 35 | 36 | EXPORTDLL ForceFieldVolume* ForceFieldVolume_new(int *err) { 37 | 38 | *err = CBindings::SUCCESS; 39 | ForceFieldVolume *ffv = nullptr; 40 | try { 41 | ffv = new ForceFieldVolume(); 42 | } catch (std::exception &ex) { 43 | CBindings::set_error_message(ex); 44 | *err = CBindings::FAIL; 45 | } 46 | 47 | return ffv; 48 | } 49 | 50 | EXPORTDLL void ForceFieldVolume_destroy(ForceFieldVolume *obj) { 51 | delete obj; 52 | } 53 | 54 | } -------------------------------------------------------------------------------- /src/engine/c_bindings/gridindex_c.h: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #ifndef FLUIDENGINE_GRIDINDEX_T_H 26 | #define FLUIDENGINE_GRIDINDEX_T_H 27 | 28 | typedef struct GridIndex_t { 29 | int i; 30 | int j; 31 | int k; 32 | } GridIndex_t; 33 | 34 | #endif -------------------------------------------------------------------------------- /src/engine/c_bindings/markerparticle_c.h: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #ifndef FLUIDENGINE_MARKERPARTICLE_T_H 26 | #define FLUIDENGINE_MARKERPARTICLE_T_H 27 | 28 | #include "vector3_c.h" 29 | 30 | typedef struct MarkerParticle_t { 31 | Vector3_t position; 32 | Vector3_t velocity; 33 | } MarkerParticle_t; 34 | 35 | #endif -------------------------------------------------------------------------------- /src/engine/c_bindings/vector3_c.h: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #ifndef FLUIDENGINE_VECTOR3_T_H 26 | #define FLUIDENGINE_VECTOR3_T_H 27 | 28 | typedef struct Vector3_t { 29 | float x; 30 | float y; 31 | float z; 32 | } Vector3_t; 33 | 34 | #endif -------------------------------------------------------------------------------- /src/engine/diffuseparticle.h: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #ifndef FLUIDENGINE_DIFFUSEPARTICLE_H 26 | #define FLUIDENGINE_DIFFUSEPARTICLE_H 27 | 28 | enum class DiffuseParticleType : char { 29 | bubble = 0x00, 30 | foam = 0x01, 31 | spray = 0x02, 32 | dust = 0x03, 33 | notset = 0x04 34 | }; 35 | 36 | struct DiffuseParticle { 37 | vmath::vec3 position; 38 | vmath::vec3 velocity; 39 | float lifetime; 40 | DiffuseParticleType type; 41 | unsigned char id; 42 | 43 | DiffuseParticle() : lifetime(0.0), 44 | type(DiffuseParticleType::notset) {} 45 | 46 | DiffuseParticle(vmath::vec3 p, vmath::vec3 v, float time, unsigned char ident) : 47 | position(p), 48 | velocity(v), 49 | lifetime(time), 50 | type(DiffuseParticleType::notset), 51 | id(ident) {} 52 | }; 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/engine/fluidsimassert.h: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #ifndef FLUIDENGINE_FLUIDSIMASSERT_H 26 | #define FLUIDENGINE_FLUIDSIMASSERT_H 27 | 28 | #ifndef NFLUIDSIMDEBUG 29 | #include 30 | #include 31 | #include 32 | #define FLUIDSIM_ASSERT(condition)\ 33 | {\ 34 | if (!(condition))\ 35 | {\ 36 | std::cerr << "Assertion failed: " << #condition <<\ 37 | ", file " << __FILE__ <<\ 38 | ", function " << __FUNCTION__ <<\ 39 | ", line " << __LINE__ << std::endl;\ 40 | abort();\ 41 | }\ 42 | } 43 | #else 44 | #define FLUIDSIM_ASSERT(condition) (condition) 45 | #endif 46 | 47 | #endif -------------------------------------------------------------------------------- /src/engine/forcefieldpoint.h: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #ifndef FLUIDENGINE_FORCEFIELDPOINT_H 26 | #define FLUIDENGINE_FORCEFIELDPOINT_H 27 | 28 | #include "forcefield.h" 29 | 30 | 31 | class ForceFieldPoint : public ForceField 32 | { 33 | public: 34 | ForceFieldPoint(); 35 | virtual ~ForceFieldPoint(); 36 | 37 | virtual void update(double dt, double frameInterpolation); 38 | virtual void addForceFieldToGrid(MACVelocityField &fieldGrid); 39 | virtual void addGravityScaleToGrid(ForceFieldGravityScaleGrid &scaleGrid); 40 | virtual std::vector generateDebugProbes(); 41 | 42 | protected: 43 | virtual void _initialize(); 44 | virtual bool _isSubclassStateChanged(); 45 | virtual void _clearSubclassState(); 46 | 47 | private: 48 | 49 | void _addForceFieldToGridMT(MACVelocityField &fieldGrid, int dir); 50 | void _addForceFieldToGridThread(int startidx, int endidx, 51 | MACVelocityField *fieldGrid, int dir); 52 | 53 | double _frameInterpolation = 0.0; 54 | int _numDebugProbes = 200; 55 | float _minRadiusFactor = 4.0f; 56 | 57 | }; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /src/engine/forcefieldutils.h: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | 26 | #ifndef FLUIDENGINE_FORCEFIELDUTILS_H 27 | #define FLUIDENGINE_FORCEFIELDUTILS_H 28 | 29 | #include "meshlevelset.h" 30 | 31 | namespace ForceFieldUtils { 32 | 33 | struct VectorFieldGenerationData { 34 | Array3d phi; 35 | Array3d closestTriangle; 36 | Array3d closestPoint; 37 | Array3d isClosestPointSet; 38 | double dx; 39 | }; 40 | 41 | extern int _bandwidth; 42 | extern float _sleepTimeFactor; 43 | 44 | extern void generateSurfaceVectorField(MeshLevelSet &sdf, TriangleMesh &mesh, Array3d &vectorField, 45 | bool generateFrontFacing = true, bool generateBackFacing = true, bool generateEdgeFacing = true); 46 | extern void _initializeNarrowBandClosestPoint(MeshLevelSet &sdf, TriangleMesh &mesh, 47 | VectorFieldGenerationData &data); 48 | extern void _initializeNarrowBandClosestPointThread(int startidx, int endidx, 49 | MeshLevelSet *sdf, TriangleMesh *mesh, 50 | VectorFieldGenerationData *data); 51 | extern void _fastSweepingMethod(VectorFieldGenerationData &data); 52 | extern void _sweepThread(VectorFieldGenerationData *data, Array3d *isFrozen, GridIndex sweepdir); 53 | extern void _checkNeighbour(VectorFieldGenerationData *data, Array3d *isFrozen, 54 | vmath::vec3 gx, GridIndex g, int di, int dj, int dk); 55 | 56 | } 57 | 58 | #endif -------------------------------------------------------------------------------- /src/engine/forcefieldvolume.h: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #ifndef FLUIDENGINE_FORCEFIELDVOLUME_H 26 | #define FLUIDENGINE_FORCEFIELDVOLUME_H 27 | 28 | #include "forcefield.h" 29 | #include "meshlevelset.h" 30 | 31 | 32 | class ForceFieldVolume : public ForceField 33 | { 34 | public: 35 | ForceFieldVolume(); 36 | virtual ~ForceFieldVolume(); 37 | 38 | virtual void update(double dt, double frameInterpolation); 39 | virtual void addForceFieldToGrid(MACVelocityField &fieldGrid); 40 | virtual void addGravityScaleToGrid(ForceFieldGravityScaleGrid &scaleGrid); 41 | virtual std::vector generateDebugProbes(); 42 | 43 | protected: 44 | virtual void _initialize(); 45 | virtual bool _isSubclassStateChanged(); 46 | virtual void _clearSubclassState(); 47 | 48 | private: 49 | 50 | void _updateGridDimensions(TriangleMesh &mesh); 51 | void _addForceFieldToGridMT(MACVelocityField &fieldGrid, int dir); 52 | void _addForceFieldToGridThread(int startidx, int endidx, 53 | MACVelocityField *fieldGrid, int dir); 54 | 55 | int _ioffsetSDF = 0; 56 | int _joffsetSDF = 0; 57 | int _koffsetSDF = 0; 58 | vmath::vec3 _offsetSDF; 59 | int _isizeSDF = 0; 60 | int _jsizeSDF = 0; 61 | int _ksizeSDF = 0; 62 | 63 | bool _isLevelsetUpToDate = false; 64 | float _lastMaxDistance = -1.0f; 65 | 66 | MeshLevelSet _sdf; 67 | Array3d _vectorField; 68 | 69 | int _numDebugProbes = 900; 70 | float _jitterFactor = 0.25; 71 | float _minRadiusFactor = 0.5f; 72 | float _maxRadiusFactor = 5.0f; 73 | 74 | }; 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /src/engine/glibc_version_header/LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Tom Mason 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/engine/gridindexkeymap.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "gridindexkeymap.h" 26 | 27 | #include "grid3d.h" 28 | 29 | GridIndexKeyMap::GridIndexKeyMap() { 30 | } 31 | 32 | GridIndexKeyMap::GridIndexKeyMap(int i, int j, int k) : _isize(i), _jsize(j), _ksize(k) { 33 | _indices = std::vector(i*j*k, _notFoundValue); 34 | } 35 | 36 | GridIndexKeyMap::~GridIndexKeyMap() { 37 | } 38 | 39 | void GridIndexKeyMap::clear() { 40 | for (unsigned int i = 0; i < _indices.size(); i++) { 41 | _indices[i] = _notFoundValue; 42 | } 43 | } 44 | 45 | void GridIndexKeyMap::insert(GridIndex g, int key) { 46 | insert(g.i, g.j, g.k, key); 47 | } 48 | 49 | void GridIndexKeyMap::insert(int i, int j, int k, int key) { 50 | FLUIDSIM_ASSERT(Grid3d::isGridIndexInRange(i, j, k, _isize, _jsize, _ksize)); 51 | 52 | int flatidx = _getFlatIndex(i, j, k); 53 | _indices[flatidx] = key; 54 | } 55 | 56 | int GridIndexKeyMap::find(GridIndex g) { 57 | return find(g.i, g.j, g.k); 58 | } 59 | 60 | int GridIndexKeyMap::find(int i, int j, int k) { 61 | FLUIDSIM_ASSERT(Grid3d::isGridIndexInRange(i, j, k, _isize, _jsize, _ksize)); 62 | 63 | if (_indices.size() == 0) { 64 | return _notFoundValue; 65 | } 66 | 67 | int flatidx = _getFlatIndex(i, j, k); 68 | return _indices[flatidx]; 69 | } 70 | -------------------------------------------------------------------------------- /src/engine/gridindexkeymap.h: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #ifndef FLUIDENGINE_GRIDINDEXKEYMAP_H 26 | #define FLUIDENGINE_GRIDINDEXKEYMAP_H 27 | 28 | #include "array3d.h" 29 | 30 | class GridIndexKeyMap 31 | { 32 | public: 33 | GridIndexKeyMap(); 34 | GridIndexKeyMap(int i, int j, int k); 35 | ~GridIndexKeyMap(); 36 | 37 | void clear(); 38 | void insert(GridIndex g, int key); 39 | void insert(int i, int j, int k, int key); 40 | int find(GridIndex g); 41 | int find(int i, int j, int k); 42 | 43 | private: 44 | 45 | inline unsigned int _getFlatIndex(int i, int j, int k) { 46 | return (unsigned int)i + (unsigned int)_isize * 47 | ((unsigned int)j + (unsigned int)_jsize * (unsigned int)k); 48 | } 49 | 50 | inline unsigned int _getFlatIndex(GridIndex g) { 51 | return (unsigned int)g.i + (unsigned int)_isize * 52 | ((unsigned int)g.j + (unsigned int)_jsize * (unsigned int)g.k); 53 | } 54 | 55 | int _isize = 0; 56 | int _jsize = 0; 57 | int _ksize = 0; 58 | 59 | std::vector _indices; 60 | int _notFoundValue = -1; 61 | 62 | }; 63 | 64 | #endif -------------------------------------------------------------------------------- /src/engine/influencegrid.h: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #ifndef FLUIDENGINE_INFLUENCEGRID_H 26 | #define FLUIDENGINE_INFLUENCEGRID_H 27 | 28 | #include "array3d.h" 29 | 30 | class MeshLevelSet; 31 | 32 | class InfluenceGrid 33 | { 34 | public: 35 | InfluenceGrid(); 36 | InfluenceGrid(int isize, int jsize, int ksize, double dx, float baselevel); 37 | ~InfluenceGrid(); 38 | 39 | void getGridDimensions(int *i, int *j, int *k); 40 | float getBaseLevel(); 41 | void setBaseLevel(float level); 42 | float getDecayRate(); 43 | void setDecayRate(float rate); 44 | Array3d* getInfluenceGrid(); 45 | 46 | void update(MeshLevelSet *solidSDF, double dt); 47 | 48 | private: 49 | 50 | void _updateDecay(double dt); 51 | void _updateSpread(double dt); 52 | void _updateSpreadThread(int startidx, int endidx, double dt); 53 | void _updateInfluenceSources(MeshLevelSet *solidSDF); 54 | 55 | int _isize = 0; 56 | int _jsize = 0; 57 | int _ksize = 0; 58 | double _dx = 0; 59 | float _baselevel = 1.0f; 60 | float _decayrate = 2.0f; 61 | float _spreadFactor = 2.0; 62 | bool isSpreadEnabled = false; 63 | float _narrowBandWidth = 3.0; // In # of cells 64 | 65 | Array3d _influence; 66 | Array3d _tempinfluence; 67 | }; 68 | 69 | #endif -------------------------------------------------------------------------------- /src/engine/interpolation.h: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #ifndef FLUIDENGINE_INTERPOLATION_H 26 | #define FLUIDENGINE_INTERPOLATION_H 27 | 28 | #include "vmath.h" 29 | #include "array3d.h" 30 | 31 | namespace Interpolation { 32 | 33 | extern double cubicInterpolate(double p[4], double x); 34 | extern double bicubicInterpolate(double p[4][4], double x, double y); 35 | extern double tricubicInterpolate(double p[4][4][4], double x, double y, double z); 36 | 37 | extern double trilinearInterpolate(double p[8], double x, double y, double z); 38 | extern double trilinearInterpolate(vmath::vec3 p, double dx, Array3d &grid); 39 | 40 | extern double bilinearInterpolate(double v00, double v10, double v01, double v11, 41 | double ix, double iy); 42 | extern vmath::vec3 trilinearInterpolate(vmath::vec3 p, double dx, Array3d &grid); 43 | extern void trilinearInterpolateGradient( 44 | vmath::vec3 p, double dx, Array3d &grid, vmath::vec3 *grad); 45 | } 46 | 47 | #endif -------------------------------------------------------------------------------- /src/engine/kernels/kernels.cpp.in: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "kernels.h" 26 | 27 | namespace Kernels { 28 | 29 | std::string trilinearinterpolateCL = R"CLC( 30 | @TRILINEAR_INTERPOLATE_KERNEL_STRING@ 31 | )CLC"; 32 | 33 | std::string scalarfieldCL = R"CLC( 34 | @SCALAR_FIELD_KERNEL_STRING@ 35 | )CLC"; 36 | 37 | } -------------------------------------------------------------------------------- /src/engine/kernels/kernels.h: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #ifndef FLUIDENGINE_KERNELS_H 26 | #define FLUIDENGINE_KERNELS_H 27 | 28 | #include 29 | 30 | namespace Kernels { 31 | 32 | extern std::string trilinearinterpolateCL; 33 | 34 | extern std::string scalarfieldCL; 35 | 36 | } 37 | 38 | #endif -------------------------------------------------------------------------------- /src/engine/mingw32_threads/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016, Mega Limited 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | 25 | -------------------------------------------------------------------------------- /src/engine/mixbox/mixbox_stub.cpp: -------------------------------------------------------------------------------- 1 | // Mixbox is not available in this version 2 | // This is a stub implementation 3 | 4 | #include 5 | 6 | void mixbox_initialize(char *lut_data, size_t length) {} 7 | bool mixbox_is_initialized() { return false; } 8 | 9 | void mixbox_lerp_srgb8(unsigned char r1,unsigned char g1,unsigned char b1, 10 | unsigned char r2,unsigned char g2,unsigned char b2, 11 | float t, 12 | unsigned char* out_r,unsigned char* out_g,unsigned char* out_b) { *out_r=0; *out_g=0; *out_b=0; } 13 | 14 | void mixbox_lerp_srgb32f(float r1,float g1,float b1, 15 | float r2,float g2,float b2, 16 | float t, 17 | float* out_r,float* out_g,float* out_b) { *out_r=0; *out_g=0; *out_b=0; } 18 | 19 | void mixbox_srgb8_to_latent(unsigned char r,unsigned char g,unsigned char b,float* out_latent) { *out_latent=0; } 20 | void mixbox_latent_to_srgb8(float* latent,unsigned char* out_r,unsigned char* out_g,unsigned char* out_b) { *out_r=0; *out_g=0; *out_b=0; } 21 | 22 | void mixbox_srgb32f_to_latent(float r,float g,float b,float* out_latent) { *out_latent=0; } 23 | void mixbox_latent_to_srgb32f(float* latent,float* out_r,float* out_g,float* out_b) { *out_r=0; *out_g=0; *out_b=0; } 24 | 25 | 26 | void mixbox_lerp_srgb8_dither(unsigned char r1,unsigned char g1,unsigned char b1, 27 | unsigned char r2,unsigned char g2,unsigned char b2, 28 | float t, 29 | float dither_r,float dither_g,float dither_b, 30 | unsigned char* out_r,unsigned char* out_g,unsigned char* out_b) { *out_r=0; *out_g=0; *out_b=0; } 31 | 32 | void mixbox_latent_to_srgb8_dither(float* latent,float dither_r,float dither_g,float dither_b,unsigned char* out_r,unsigned char* out_g,unsigned char* out_b) { *out_r=0; *out_g=0; *out_b=0; } 33 | -------------------------------------------------------------------------------- /src/engine/openclutils.h: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #ifndef FLUIDENGINE_OPENCLUTILS_H 26 | #define FLUIDENGINE_OPENCLUTILS_H 27 | 28 | #include 29 | 30 | #include "opencl_bindings/clcpp.h" 31 | 32 | namespace OpenCLUtils { 33 | extern bool _isOpenCLEnabled; 34 | extern std::string _preferredGPUDevice; 35 | 36 | extern bool isOpenCLEnabled(); 37 | extern int getNumGPUDevices(); 38 | extern std::vector getGPUDevices(); 39 | extern std::string getPreferredGPUDevice(); 40 | extern void setPreferredGPUDevice(std::string device_name); 41 | } 42 | 43 | #endif -------------------------------------------------------------------------------- /src/engine/particlemaskgrid.h: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #ifndef FLUIDENGINE_PARTICLEMASKGRID_H 26 | #define FLUIDENGINE_PARTICLEMASKGRID_H 27 | 28 | #include "array3d.h" 29 | #include "vmath.h" 30 | 31 | class ParticleMaskGrid 32 | { 33 | public: 34 | ParticleMaskGrid(); 35 | ParticleMaskGrid(int i, int j, int k, double dx); 36 | ~ParticleMaskGrid(); 37 | 38 | void clear(); 39 | unsigned char operator()(int i, int j, int k); 40 | unsigned char operator()(GridIndex g); 41 | void addParticle(vmath::vec3 p); 42 | void addParticles(std::vector &particles); 43 | bool isSubCellSet(int i, int j, int k); 44 | bool isSubCellSet(GridIndex g); 45 | bool isSubCellSet(vmath::vec3 p); 46 | 47 | private: 48 | 49 | int _isize = 0; 50 | int _jsize = 0; 51 | int _ksize = 0; 52 | double _dx = 0.0; 53 | double _subdx = 0.0; 54 | 55 | Array3d _maskGrid; 56 | 57 | }; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /src/engine/pyfluid/__init__.py: -------------------------------------------------------------------------------- 1 | # MIT License 2 | # 3 | # Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | from . import pyfluid 24 | from .aabb import AABB, AABB_t 25 | from .fluidsimulation import FluidSimulation, MarkerParticle_t, DiffuseParticle_t 26 | from .meshobject import MeshObject 27 | from .meshfluidsource import MeshFluidSource 28 | from .forcefieldgrid import ForceFieldGrid 29 | from .forcefield import ForceField 30 | from .forcefieldpoint import ForceFieldPoint 31 | from .forcefieldsurface import ForceFieldSurface 32 | from .forcefieldvolume import ForceFieldVolume 33 | from .forcefieldcurve import ForceFieldCurve 34 | from .trianglemesh import TriangleMesh, TriangleMesh_t 35 | from .gridindex import GridIndex, GridIndex_t 36 | from .vector3 import Vector3, Vector3_t 37 | from . import gpu_utils 38 | from . import mixbox -------------------------------------------------------------------------------- /src/engine/pyfluid/forcefieldgrid.py: -------------------------------------------------------------------------------- 1 | # MIT License 2 | # 3 | # Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | from ctypes import c_void_p, c_char_p, c_int, c_float, c_double, byref 24 | 25 | from .pyfluid import pyfluid as lib 26 | from . import pybindings as pb 27 | from . import method_decorators as decorators 28 | 29 | class ForceFieldGrid(): 30 | 31 | def __init__(self, c_pointer=None): 32 | if c_pointer is not None: 33 | self._obj = c_pointer 34 | self._is_owner = False 35 | else: 36 | libfunc = lib.ForceFieldGrid_new 37 | args = [c_void_p] 38 | pb.init_lib_func(libfunc, args, c_void_p) 39 | self._obj = pb.execute_lib_func(libfunc, []) 40 | self._is_owner = True 41 | 42 | def __del__(self): 43 | if not self._is_owner: 44 | return 45 | try: 46 | libfunc = lib.MeshObject_destroy 47 | pb.init_lib_func(libfunc, [c_void_p], None) 48 | libfunc(self._obj) 49 | except: 50 | pass 51 | 52 | def __call__(self): 53 | return self._obj 54 | 55 | def add_force_field(self, field): 56 | libfunc = lib.ForceFieldGrid_add_force_field 57 | args = [c_void_p, c_void_p, c_void_p] 58 | pb.init_lib_func(libfunc, args, None) 59 | pb.execute_lib_func(libfunc, [self(), field()]) 60 | -------------------------------------------------------------------------------- /src/engine/pyfluid/forcefieldpoint.py: -------------------------------------------------------------------------------- 1 | # MIT License 2 | # 3 | # Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | from abc import ABCMeta, abstractmethod 24 | from ctypes import c_void_p, c_char_p, c_int, c_float, c_double, byref 25 | 26 | from .pyfluid import pyfluid as lib 27 | from .forcefield import ForceField 28 | from . import pybindings as pb 29 | from . import method_decorators as decorators 30 | 31 | class ForceFieldPoint(ForceField): 32 | 33 | def __init__(self): 34 | libfunc = lib.ForceFieldPoint_new 35 | args = [c_void_p] 36 | pb.init_lib_func(libfunc, args, c_void_p) 37 | self._obj = pb.execute_lib_func(libfunc, []) 38 | 39 | def __del__(self): 40 | try: 41 | libfunc = lib.ForceFieldPoint_destroy 42 | pb.init_lib_func(libfunc, [c_void_p], None) 43 | libfunc(self._obj) 44 | except: 45 | pass 46 | -------------------------------------------------------------------------------- /src/engine/pyfluid/forcefieldsurface.py: -------------------------------------------------------------------------------- 1 | # MIT License 2 | # 3 | # Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | from abc import ABCMeta, abstractmethod 24 | from ctypes import c_void_p, c_char_p, c_int, c_float, c_double, byref 25 | 26 | from .pyfluid import pyfluid as lib 27 | from .forcefield import ForceField 28 | from . import pybindings as pb 29 | from . import method_decorators as decorators 30 | 31 | class ForceFieldSurface(ForceField): 32 | 33 | def __init__(self): 34 | libfunc = lib.ForceFieldSurface_new 35 | args = [c_void_p] 36 | pb.init_lib_func(libfunc, args, c_void_p) 37 | self._obj = pb.execute_lib_func(libfunc, []) 38 | 39 | def __del__(self): 40 | try: 41 | libfunc = lib.ForceFieldSurface_destroy 42 | pb.init_lib_func(libfunc, [c_void_p], None) 43 | libfunc(self._obj) 44 | except: 45 | pass 46 | -------------------------------------------------------------------------------- /src/engine/pyfluid/forcefieldvolume.py: -------------------------------------------------------------------------------- 1 | # MIT License 2 | # 3 | # Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | from abc import ABCMeta, abstractmethod 24 | from ctypes import c_void_p, c_char_p, c_int, c_float, c_double, byref 25 | 26 | from .pyfluid import pyfluid as lib 27 | from .forcefield import ForceField 28 | from . import pybindings as pb 29 | from . import method_decorators as decorators 30 | 31 | class ForceFieldVolume(ForceField): 32 | 33 | def __init__(self): 34 | libfunc = lib.ForceFieldVolume_new 35 | args = [c_void_p] 36 | pb.init_lib_func(libfunc, args, c_void_p) 37 | self._obj = pb.execute_lib_func(libfunc, []) 38 | 39 | def __del__(self): 40 | try: 41 | libfunc = lib.ForceFieldVolume_destroy 42 | pb.init_lib_func(libfunc, [c_void_p], None) 43 | libfunc(self._obj) 44 | except: 45 | pass 46 | -------------------------------------------------------------------------------- /src/engine/pyfluid/gpu_utils.py: -------------------------------------------------------------------------------- 1 | # MIT License 2 | # 3 | # Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | import ctypes 24 | from ctypes import c_void_p, c_char_p, c_char, c_int, c_uint, c_float, c_double, byref 25 | 26 | from .pyfluid import pyfluid as lib 27 | from . import pybindings as pb 28 | 29 | DEVICE_STRING_LEN = 4096 30 | 31 | class GPUDevice_t(ctypes.Structure): 32 | _fields_ = [("name", ctypes.c_char * DEVICE_STRING_LEN), 33 | ("description", ctypes.c_char * DEVICE_STRING_LEN), 34 | ("score", ctypes.c_float)] 35 | 36 | 37 | def get_num_gpu_devices(): 38 | libfunc = lib.OpenCLUtils_get_num_gpu_devices 39 | pb.init_lib_func(libfunc, [c_void_p], c_int) 40 | return pb.execute_lib_func(libfunc, []) 41 | 42 | def find_gpu_devices(): 43 | num_devices = get_num_gpu_devices() 44 | if num_devices == 0: 45 | return [] 46 | 47 | device_structs = (GPUDevice_t * num_devices)() 48 | libfunc = lib.OpenCLUtils_get_gpu_devices 49 | pb.init_lib_func(libfunc, [c_void_p, c_int, c_void_p], None) 50 | pb.execute_lib_func(libfunc, [device_structs, num_devices]) 51 | 52 | devices = [] 53 | for d in device_structs: 54 | device_info = {"name": d.name.decode("utf-8"), 55 | "description": d.description.decode("utf-8"), 56 | "score": d.score} 57 | devices.append(device_info) 58 | 59 | return devices 60 | -------------------------------------------------------------------------------- /src/engine/pyfluid/mixbox.py: -------------------------------------------------------------------------------- 1 | # MIT License 2 | # 3 | # Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | import ctypes 24 | from ctypes import c_void_p, c_char_p, c_char, c_int, c_uint, c_float, c_double, byref 25 | 26 | from .pyfluid import pyfluid as lib 27 | from .vector3 import Vector3, Vector3_t 28 | from . import pybindings as pb 29 | 30 | 31 | class MixboxLutData_t(ctypes.Structure): 32 | _fields_ = [("size", c_int), 33 | ("data", c_char_p)] 34 | 35 | 36 | def initialize(lut_data, lut_data_size): 37 | c_lut_data = (c_char * len(lut_data)).from_buffer_copy(lut_data) 38 | 39 | mb_data = MixboxLutData_t() 40 | mb_data.size = lut_data_size 41 | mb_data.data = ctypes.cast(c_lut_data, c_char_p) 42 | 43 | libfunc = lib.Mixbox_initialize 44 | pb.init_lib_func(libfunc, [MixboxLutData_t, c_void_p], None) 45 | pb.execute_lib_func(libfunc, [mb_data]) 46 | 47 | 48 | def is_initialized(): 49 | libfunc = lib.Mixbox_is_initialized 50 | pb.init_lib_func(libfunc, [c_void_p], c_int) 51 | return bool(pb.execute_lib_func(libfunc, [])) 52 | 53 | 54 | def lerp_srgb32f(r1, g1, b1, r2, g2, b2, t): 55 | libfunc = lib.Mixbox_lerp_srgb32f 56 | pb.init_lib_func(libfunc, [c_float, c_float, c_float, c_float, c_float, c_float, c_float, c_void_p], Vector3_t) 57 | cvect = pb.execute_lib_func(libfunc, [r1, g1, b1, r2, g2, b2, t]) 58 | return cvect.x, cvect.y, cvect.z 59 | -------------------------------------------------------------------------------- /src/engine/pyfluid/pybindings.py: -------------------------------------------------------------------------------- 1 | # MIT License 2 | # 3 | # Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | from .pyfluid import pyfluid as lib 24 | from ctypes import c_char_p, c_int, byref 25 | 26 | def check_success(success, errprefix): 27 | libfunc = lib.CBindings_get_error_message 28 | init_lib_func(libfunc, [], c_char_p) 29 | if not success: 30 | raise RuntimeError(errprefix + str(libfunc().decode("utf-8"))) 31 | 32 | def init_lib_func(libfunc, argtypes, restype): 33 | if libfunc.argtypes is None: 34 | libfunc.argtypes = argtypes 35 | libfunc.restype = restype 36 | 37 | def execute_lib_func(libfunc, params): 38 | args = [] 39 | for idx, arg in enumerate(params): 40 | try: 41 | cval = libfunc.argtypes[idx](arg) 42 | except: 43 | cval = arg 44 | args.append(cval) 45 | success = c_int(); 46 | args.append(byref(success)) 47 | 48 | result = None 49 | if libfunc.restype: 50 | funcresult = libfunc(*args) 51 | check_success(success, libfunc.__name__ + " - ") 52 | try: 53 | return libfunc.restype(funcresult).value 54 | except: 55 | return funcresult 56 | else: 57 | libfunc(*args) 58 | 59 | check_success(success, libfunc.__name__ + " - ") 60 | return result -------------------------------------------------------------------------------- /src/engine/stopwatch.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "stopwatch.h" 26 | 27 | StopWatch::StopWatch() 28 | { 29 | } 30 | 31 | void StopWatch::start() { 32 | 33 | #if defined(__linux__) || defined(__APPLE__) || defined(__MACOSX) 34 | struct timeval tp; 35 | gettimeofday(&tp, nullptr); 36 | _tbegin = (double)tp.tv_sec + (double)tp.tv_usec / 1000000.0; 37 | #elif defined(_WIN32) 38 | _tbegin = (double)GetTickCount() / 1000.0; 39 | #else 40 | #endif 41 | 42 | _isStarted = true; 43 | } 44 | 45 | 46 | void StopWatch::stop() { 47 | if (!_isStarted) { 48 | return; 49 | } 50 | 51 | #if defined(__linux__) || defined(__APPLE__) || defined(__MACOSX) 52 | struct timeval tp; 53 | gettimeofday(&tp, nullptr); 54 | _tend = (double)tp.tv_sec + (double)tp.tv_usec / 1000000.0; 55 | #elif defined(_WIN32) 56 | _tend = (double)GetTickCount() / 1000.0; 57 | #else 58 | #endif 59 | 60 | double time = _tend - _tbegin; 61 | _timeRunning += time; 62 | } 63 | 64 | void StopWatch::reset() { 65 | _isStarted = false; 66 | _timeRunning = 0.0; 67 | } 68 | 69 | double StopWatch::getTime() { 70 | return _timeRunning >= 0.0 ? _timeRunning : 0.0; 71 | } 72 | 73 | void StopWatch::setTime(double value) { 74 | _timeRunning = value; 75 | } -------------------------------------------------------------------------------- /src/engine/stopwatch.h: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #ifndef FLUIDENGINE_STOPWATCH_H 26 | #define FLUIDENGINE_STOPWATCH_H 27 | 28 | #if defined(__linux__) || defined(__APPLE__) || defined(__MACOSX) 29 | #include 30 | #elif defined(_WIN32) 31 | #include 32 | #include 33 | #else 34 | #endif 35 | 36 | class StopWatch 37 | { 38 | public: 39 | StopWatch(); 40 | void start(); 41 | void stop(); 42 | void reset(); 43 | double getTime(); // in seconds 44 | void setTime(double value); 45 | 46 | private: 47 | bool _isStarted = false; 48 | double _tbegin, _tend; 49 | double _timeRunning = 0.0; 50 | }; 51 | 52 | #endif -------------------------------------------------------------------------------- /src/engine/threadutils.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "threadutils.h" 26 | 27 | #include 28 | 29 | #include "fluidsimassert.h" 30 | 31 | int ThreadUtils::_maxThreadCount = 0; 32 | bool ThreadUtils::_isMaxThreadCountInitialized = false; 33 | 34 | void ThreadUtils::_initializeMaxThreadCount() { 35 | if (_isMaxThreadCountInitialized) { 36 | return; 37 | } 38 | 39 | _maxThreadCount = std::thread::hardware_concurrency(); 40 | _isMaxThreadCountInitialized = true; 41 | } 42 | 43 | int ThreadUtils::getMaxThreadCount(){ 44 | _initializeMaxThreadCount(); 45 | return _maxThreadCount; 46 | } 47 | 48 | void ThreadUtils::setMaxThreadCount(int n) { 49 | FLUIDSIM_ASSERT(n > 0); 50 | _maxThreadCount = n; 51 | _isMaxThreadCountInitialized = true; 52 | } 53 | 54 | std::vector ThreadUtils::splitRangeIntoIntervals(int rangeBegin, int rangeEnd, 55 | int numIntervals) { 56 | int intervalSize = floor((double)(rangeEnd - rangeBegin) / (double)numIntervals); 57 | int intervalRemainder = (rangeEnd - rangeBegin) - intervalSize * numIntervals; 58 | std::vector intervals; 59 | intervals.reserve(numIntervals + 1); 60 | intervals.push_back(rangeBegin); 61 | 62 | int intervalBegin = rangeBegin; 63 | for (int i = 0; i < numIntervals; i++) { 64 | int intervalEnd = intervalBegin + intervalSize; 65 | if (i < intervalRemainder) { 66 | intervalEnd++; 67 | } 68 | intervals.push_back(intervalEnd); 69 | intervalBegin = intervalEnd; 70 | } 71 | 72 | return intervals; 73 | } -------------------------------------------------------------------------------- /src/engine/threadutils.h: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #ifndef FLUIDENGINE_THREADUTILS_H 26 | #define FLUIDENGINE_THREADUTILS_H 27 | 28 | #if __MINGW32__ && !_WIN64 29 | #include 30 | #include "mingw32_threads/mingw.thread.h" 31 | #include "mingw32_threads/mingw.condition_variable.h" 32 | #include "mingw32_threads/mingw.mutex.h" 33 | #else 34 | #include 35 | #include 36 | #include 37 | #endif 38 | 39 | #include 40 | #include 41 | 42 | namespace ThreadUtils { 43 | 44 | extern int _maxThreadCount; 45 | extern bool _isMaxThreadCountInitialized; 46 | 47 | extern void _initializeMaxThreadCount(); 48 | extern int getMaxThreadCount(); 49 | extern void setMaxThreadCount(int n); 50 | extern std::vector splitRangeIntoIntervals(int rangeBegin, 51 | int rangeEnd, 52 | int numIntervals); 53 | } 54 | 55 | #endif -------------------------------------------------------------------------------- /src/engine/triangle.h: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #ifndef FLUIDENGINE_TRIANGLE_H 26 | #define FLUIDENGINE_TRIANGLE_H 27 | 28 | struct Triangle { 29 | int tri[3]; // indices to a vertex 30 | 31 | Triangle() { 32 | tri[0] = 0; 33 | tri[1] = 0; 34 | tri[2] = 0; 35 | } 36 | 37 | Triangle(int p1, int p2, int p3) { 38 | tri[0] = p1; 39 | tri[1] = p2; 40 | tri[2] = p3; 41 | } 42 | }; 43 | 44 | #endif -------------------------------------------------------------------------------- /src/engine/versionutils.cpp.in: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "versionutils.h" 26 | 27 | int VersionUtils::_major = @FLUIDENGINE_VERSION_MAJOR@; 28 | int VersionUtils::_minor = @FLUIDENGINE_VERSION_MINOR@; 29 | int VersionUtils::_revision = @FLUIDENGINE_VERSION_REVISION@; 30 | std::string VersionUtils::_label = "@FLUIDENGINE_VERSION_LABEL@"; 31 | 32 | void VersionUtils::getVersion(int *major, int *minor, int *revision) { 33 | *major = _major; 34 | *minor = _minor; 35 | *revision = _revision; 36 | } 37 | 38 | int VersionUtils::getMajor() { 39 | return _major; 40 | } 41 | 42 | int VersionUtils::getMinor() { 43 | return _minor; 44 | } 45 | 46 | int VersionUtils::getRevision() { 47 | return _revision; 48 | } 49 | 50 | std::string VersionUtils::getLabel() { 51 | return _label; 52 | } -------------------------------------------------------------------------------- /src/engine/versionutils.h: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (C) 2025 Ryan L. Guy & Dennis Fassbaender 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #ifndef FLUIDENGINE_VERSIONUTILS_H 26 | #define FLUIDENGINE_VERSIONUTILS_H 27 | 28 | #include 29 | 30 | namespace VersionUtils { 31 | extern int _major; 32 | extern int _minor; 33 | extern int _revision; 34 | extern std::string _label; 35 | extern void getVersion(int *major, int *minor, int *revision); 36 | extern int getMajor(); 37 | extern int getMinor(); 38 | extern int getRevision(); 39 | extern std::string getLabel(); 40 | } 41 | 42 | #endif --------------------------------------------------------------------------------