GridForwardEulerDiffusionSolver2.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_GRID_FORWARD_EULER_DIFFUSION_SOLVER2_HPP
12 #define CUBBYFLOW_GRID_FORWARD_EULER_DIFFUSION_SOLVER2_HPP
13 
15 
16 namespace CubbyFlow
17 {
30 {
31  public:
34 
37  delete;
38 
41  GridForwardEulerDiffusionSolver2&&) noexcept = delete;
42 
44  ~GridForwardEulerDiffusionSolver2() override = default;
45 
48  const GridForwardEulerDiffusionSolver2&) = delete;
49 
52  GridForwardEulerDiffusionSolver2&&) noexcept = delete;
53 
64  void Solve(const ScalarGrid2& source, double diffusionCoefficient,
65  double timeIntervalInSeconds, ScalarGrid2* dest,
66  const ScalarField2& boundarySDF =
67  ConstantScalarField2{ std::numeric_limits<double>::max() },
68  const ScalarField2& fluidSDF = ConstantScalarField2{
69  -std::numeric_limits<double>::max() }) override;
70 
81  void Solve(const CollocatedVectorGrid2& source, double diffusionCoefficient,
82  double timeIntervalInSeconds, CollocatedVectorGrid2* dest,
83  const ScalarField2& boundarySDF =
84  ConstantScalarField2{ std::numeric_limits<double>::max() },
85  const ScalarField2& fluidSDF = ConstantScalarField2{
86  -std::numeric_limits<double>::max() }) override;
87 
98  void Solve(const FaceCenteredGrid2& source, double diffusionCoefficient,
99  double timeIntervalInSeconds, FaceCenteredGrid2* dest,
100  const ScalarField2& boundarySDF =
101  ConstantScalarField2{ std::numeric_limits<double>::max() },
102  const ScalarField2& fluidSDF = ConstantScalarField2{
103  -std::numeric_limits<double>::max() }) override;
104 
105  private:
106  void BuildMarkers(const Vector2UZ& size,
107  const std::function<Vector2D(const Vector2UZ&)>& pos,
108  const ScalarField2& boundarySDF,
109  const ScalarField2& fluidSDF);
110 
111  Array2<char> m_markers;
112 };
113 
116  std::shared_ptr<GridForwardEulerDiffusionSolver2>;
117 } // namespace CubbyFlow
118 
119 #endif
GridForwardEulerDiffusionSolver2()=default
Default constructor.
std::shared_ptr< GridForwardEulerDiffusionSolver2 > GridForwardEulerDiffusionSolver2Ptr
Shared pointer type for the GridForwardEulerDiffusionSolver2.
Definition: GridForwardEulerDiffusionSolver2.hpp:116
Abstract base class for N-D scalar grid structure.
Definition: ScalarGrid.hpp:24
Abstract base class for N-D scalar field.
Definition: ScalarField.hpp:24
~GridForwardEulerDiffusionSolver2() override=default
Default virtual destructor.
Definition: Matrix.hpp:27
Definition: pybind11Utils.hpp:20
Definition: Array-Impl.hpp:19
Vector2< double > Vector2D
Definition: Matrix.hpp:774
N-D face-centered (a.k.a MAC or staggered) grid.
Definition: FaceCenteredGrid.hpp:31
2-D grid-based forward Euler diffusion solver.
Definition: GridForwardEulerDiffusionSolver2.hpp:29
Abstract base class for N-D collocated vector grid structure.
Definition: CollocatedVectorGrid.hpp:22
N-D constant scalar field.
Definition: ConstantScalarField.hpp:20
GridForwardEulerDiffusionSolver2 & operator=(const GridForwardEulerDiffusionSolver2 &)=delete
Deleted copy assignment operator.
Abstract base class for 2-D grid-based diffusion equation solver.
Definition: GridDiffusionSolver2.hpp:30
void Solve(const ScalarGrid2 &source, double diffusionCoefficient, double timeIntervalInSeconds, ScalarGrid2 *dest, const ScalarField2 &boundarySDF=ConstantScalarField2{ std::numeric_limits< double >::max() }, const ScalarField2 &fluidSDF=ConstantScalarField2{ -std::numeric_limits< double >::max() }) override