Loading...
Searching...
No Matches
LevelSetLiquidSolver3.hpp
Go to the documentation of this file.
1// This code is based on Jet framework.
2// Copyright (c) 2018 Doyub Kim
3// CubbyFlow is voxel-based fluid simulation engine for computer games.
4// Copyright (c) 2020 CubbyFlow Team
5// Core Part: Chris Ohk, Junwoo Hwang, Jihong Sin, Seungwoo Yoo
6// AI Part: Dongheon Cho, Minseo Kim
7// We are making my contributions/submissions to this project solely in our
8// personal capacity and are not conveying any rights to any intellectual
9// property of any third parties.
10
11#ifndef CUBBYFLOW_LEVEL_SET_LIQUID_SOLVER3_HPP
12#define CUBBYFLOW_LEVEL_SET_LIQUID_SOLVER3_HPP
13
16
17namespace CubbyFlow
18{
31{
32 public:
33 class Builder;
34
37
40 const Vector3D& gridSpacing,
41 const Vector3D& gridOrigin);
42
45
48
51
54
57
60
63
66
68 void SetMinReinitializeDistance(double distance);
69
83
92
95
98 void OnBeginAdvanceTimeStep(double timeIntervalInSeconds) override;
99
101 void OnEndAdvanceTimeStep(double timeIntervalInSeconds) override;
102
104 void ComputeAdvection(double timeIntervalInSeconds) override;
105
114
115 private:
116 void Reinitialize(double currentCFL);
117
118 void ExtrapolateVelocityToAir(double currentCFL);
119
120 void AddVolume(double volDiff);
121
122 size_t m_signedDistanceFieldId;
123 LevelSetSolver3Ptr m_levelSetSolver;
124 double m_minReinitializeDistance = 10.0;
125 bool m_isGlobalCompensationEnabled = false;
126 double m_lastKnownVolume = 0.0;
127};
128
131
145} // namespace CubbyFlow
146
147#endif
Abstract base class for grid-based 3-D fluid solver.
Definition GridFluidSolver3.hpp:36
Base class for grid-based fluid solver builder.
Definition GridFluidSolver3.hpp:316
Front-end to create LevelSetLiquidSolver3 objects step by step.
Definition LevelSetLiquidSolver3.hpp:137
LevelSetLiquidSolver3Ptr MakeShared() const
Builds shared pointer of LevelSetLiquidSolver3 instance.
LevelSetLiquidSolver3 Build() const
Builds LevelSetLiquidSolver3.
Level set based 3-D liquid solver.
Definition LevelSetLiquidSolver3.hpp:31
void ComputeAdvection(double timeIntervalInSeconds) override
Customizes advection step.
void SetMinReinitializeDistance(double distance)
Sets minimum reinitialization distance.
LevelSetLiquidSolver3()
Default constructor.
LevelSetLiquidSolver3(LevelSetLiquidSolver3 &&) noexcept=delete
Deleted move constructor.
ScalarField3Ptr GetFluidSDF() const override
Returns fluid region as a signed-distance field.
void OnEndAdvanceTimeStep(double timeIntervalInSeconds) override
Called at the end of the time-step.
LevelSetLiquidSolver3(const Vector3UZ &resolution, const Vector3D &gridSpacing, const Vector3D &gridOrigin)
Constructs solver with initial grid size.
void OnBeginAdvanceTimeStep(double timeIntervalInSeconds) override
Called at the beginning of the time-step.
ScalarGrid3Ptr GetSignedDistanceField() const
Returns signed-distance field.
double ComputeVolume() const
Returns liquid volume measured by smeared Heaviside function.
void SetIsGlobalCompensationEnabled(bool isEnabled)
Enables (or disables) global compensation feature flag.
void SetLevelSetSolver(const LevelSetSolver3Ptr &newSolver)
Sets the level set solver.
static Builder GetBuilder()
Returns builder fox LevelSetLiquidSolver3.
LevelSetSolver3Ptr GetLevelSetSolver() const
Returns the level set solver.
LevelSetLiquidSolver3(const LevelSetLiquidSolver3 &)=delete
Deleted copy constructor.
Definition Matrix.hpp:30
Definition pybind11Utils.hpp:21
std::shared_ptr< LevelSetSolver3 > LevelSetSolver3Ptr
Shared pointer type for the LevelSetSolver3.
Definition LevelSetSolver3.hpp:93
std::shared_ptr< ScalarGrid3 > ScalarGrid3Ptr
Shared pointer for the ScalarGrid3 type.
Definition ScalarGrid.hpp:269
std::shared_ptr< LevelSetLiquidSolver3 > LevelSetLiquidSolver3Ptr
Shared pointer type for the LevelSetLiquidSolver3.
Definition LevelSetLiquidSolver3.hpp:130
Matrix< T, Rows, 1 > Vector
Definition Matrix.hpp:738
std::shared_ptr< ScalarField3 > ScalarField3Ptr
Shared pointer for the ScalarField3 type.
Definition ScalarField.hpp:70