Loading...
Searching...
No Matches
GridBackwardEulerDiffusionSolver2.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_BACKWARD_EULER_DIFFUSION_SOLVER2_HPP
12#define CUBBYFLOW_GRID_BACKWARD_EULER_DIFFUSION_SOLVER2_HPP
13
16
17namespace CubbyFlow
18{
31{
32 public:
33 enum class BoundaryType
34 {
37 };
38
42
45 const GridBackwardEulerDiffusionSolver2&) = delete;
46
50
53
57
61
73 double timeIntervalInSeconds, ScalarGrid2* dest,
75 ConstantScalarField2{ std::numeric_limits<double>::max() },
77 -std::numeric_limits<double>::max() }) override;
78
90 double timeIntervalInSeconds, CollocatedVectorGrid2* dest,
92 ConstantScalarField2{ std::numeric_limits<double>::max() },
94 -std::numeric_limits<double>::max() }) override;
95
107 double timeIntervalInSeconds, FaceCenteredGrid2* dest,
109 ConstantScalarField2{ std::numeric_limits<double>::max() },
111 -std::numeric_limits<double>::max() }) override;
112
115
116 private:
117 void BuildMarkers(const Vector2UZ& size,
118 const std::function<Vector2D(size_t, size_t)>& pos,
120 const ScalarField2& fluidSDF);
121
122 void BuildMatrix(const Vector2UZ& size, const Vector2D& c);
123
124 void BuildVectors(const ConstArrayView2<double>& f, const Vector2D& c);
125
126 void BuildVectors(const ConstArrayView2<Vector2D>& f, const Vector2D& c,
127 size_t component);
128
129 BoundaryType m_boundaryType;
130 FDMLinearSystem2 m_system;
131 FDMLinearSystemSolver2Ptr m_systemSolver;
132 Array2<char> m_markers;
133};
134
137 std::shared_ptr<GridBackwardEulerDiffusionSolver2>;
138} // namespace CubbyFlow
139
140#endif
Abstract base class for N-D collocated vector grid structure.
Definition CollocatedVectorGrid.hpp:23
N-D constant scalar field.
Definition ConstantScalarField.hpp:21
N-D face-centered (a.k.a MAC or staggered) grid.
Definition FaceCenteredGrid.hpp:32
2-D grid-based backward Euler diffusion solver.
Definition GridBackwardEulerDiffusionSolver2.hpp:31
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
GridBackwardEulerDiffusionSolver2(BoundaryType boundaryType=BoundaryType::Neumann)
Constructs the solver with given boundary type.
void Solve(const CollocatedVectorGrid2 &source, double diffusionCoefficient, double timeIntervalInSeconds, CollocatedVectorGrid2 *dest, const ScalarField2 &boundarySDF=ConstantScalarField2{ std::numeric_limits< double >::max() }, const ScalarField2 &fluidSDF=ConstantScalarField2{ -std::numeric_limits< double >::max() }) override
BoundaryType
Definition GridBackwardEulerDiffusionSolver2.hpp:34
GridBackwardEulerDiffusionSolver2(GridBackwardEulerDiffusionSolver2 &&) noexcept=delete
Deleted move constructor.
void Solve(const FaceCenteredGrid2 &source, double diffusionCoefficient, double timeIntervalInSeconds, FaceCenteredGrid2 *dest, const ScalarField2 &boundarySDF=ConstantScalarField2{ std::numeric_limits< double >::max() }, const ScalarField2 &fluidSDF=ConstantScalarField2{ -std::numeric_limits< double >::max() }) override
void SetLinearSystemSolver(const FDMLinearSystemSolver2Ptr &solver)
Sets the linear system solver for this diffusion solver.
GridBackwardEulerDiffusionSolver2(const GridBackwardEulerDiffusionSolver2 &)=delete
Deleted copy constructor.
Abstract base class for 2-D grid-based diffusion equation solver.
Definition GridDiffusionSolver2.hpp:31
Definition Matrix.hpp:30
Abstract base class for N-D scalar field.
Definition ScalarField.hpp:25
Abstract base class for N-D scalar grid structure.
Definition ScalarGrid.hpp:25
Definition pybind11Utils.hpp:21
Vector2< double > Vector2D
Definition Matrix.hpp:774
std::shared_ptr< GridBackwardEulerDiffusionSolver2 > GridBackwardEulerDiffusionSolver2Ptr
Shared pointer type for the GridBackwardEulerDiffusionSolver2.
Definition GridBackwardEulerDiffusionSolver2.hpp:137
std::shared_ptr< FDMLinearSystemSolver2 > FDMLinearSystemSolver2Ptr
Shared pointer type for the FDMLinearSystemSolver2.
Definition FDMLinearSystemSolver2.hpp:52
Linear system (Ax=b) for 2-D finite differencing.
Definition FDMLinearSystem2.hpp:41