Loading...
Searching...
No Matches
GridBackwardEulerDiffusionSolver3.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_SOLVER3_HPP
12#define CUBBYFLOW_GRID_BACKWARD_EULER_DIFFUSION_SOLVER3_HPP
13
16
17namespace CubbyFlow
18{
31{
32 public:
33 enum class BoundaryType
34 {
37 };
38
42
45 const GridBackwardEulerDiffusionSolver3&) = delete;
46
50
53
57
61
73 double timeIntervalInSeconds, ScalarGrid3* dest,
75 ConstantScalarField3{ std::numeric_limits<double>::max() },
77 -std::numeric_limits<double>::max() }) override;
78
90 double timeIntervalInSeconds, CollocatedVectorGrid3* dest,
92 ConstantScalarField3{ std::numeric_limits<double>::max() },
94 -std::numeric_limits<double>::max() }) override;
95
107 double timeIntervalInSeconds, FaceCenteredGrid3* dest,
109 ConstantScalarField3{ std::numeric_limits<double>::max() },
111 -std::numeric_limits<double>::max() }) override;
112
115
116 private:
117 void BuildMarkers(
118 const Vector3UZ& size,
119 const std::function<Vector3D(size_t, size_t, size_t)>& pos,
121
122 void BuildMatrix(const Vector3UZ& size, const Vector3D& c);
123
124 void BuildVectors(const ConstArrayView3<double>& f, const Vector3D& c);
125
126 void BuildVectors(const ConstArrayView3<Vector3D>& f, const Vector3D& c,
127 size_t component);
128
129 BoundaryType m_boundaryType;
130 FDMLinearSystem3 m_system;
131 FDMLinearSystemSolver3Ptr m_systemSolver;
132 Array3<char> m_markers;
133};
134
137 std::shared_ptr<GridBackwardEulerDiffusionSolver3>;
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
3-D grid-based backward Euler diffusion solver.
Definition GridBackwardEulerDiffusionSolver3.hpp:31
GridBackwardEulerDiffusionSolver3(BoundaryType boundaryType=BoundaryType::Neumann)
Constructs the solver with given boundary type.
void Solve(const CollocatedVectorGrid3 &source, double diffusionCoefficient, double timeIntervalInSeconds, CollocatedVectorGrid3 *dest, const ScalarField3 &boundarySDF=ConstantScalarField3{ std::numeric_limits< double >::max() }, const ScalarField3 &fluidSDF=ConstantScalarField3{ -std::numeric_limits< double >::max() }) override
GridBackwardEulerDiffusionSolver3(const GridBackwardEulerDiffusionSolver3 &)=delete
Deleted copy constructor.
BoundaryType
Definition GridBackwardEulerDiffusionSolver3.hpp:34
void Solve(const FaceCenteredGrid3 &source, double diffusionCoefficient, double timeIntervalInSeconds, FaceCenteredGrid3 *dest, const ScalarField3 &boundarySDF=ConstantScalarField3{ std::numeric_limits< double >::max() }, const ScalarField3 &fluidSDF=ConstantScalarField3{ -std::numeric_limits< double >::max() }) override
void SetLinearSystemSolver(const FDMLinearSystemSolver3Ptr &solver)
Sets the linear system solver for this diffusion solver.
void Solve(const ScalarGrid3 &source, double diffusionCoefficient, double timeIntervalInSeconds, ScalarGrid3 *dest, const ScalarField3 &boundarySDF=ConstantScalarField3{ std::numeric_limits< double >::max() }, const ScalarField3 &fluidSDF=ConstantScalarField3{ -std::numeric_limits< double >::max() }) override
GridBackwardEulerDiffusionSolver3(GridBackwardEulerDiffusionSolver3 &&) noexcept=delete
Deleted move constructor.
Abstract base class for 3-D grid-based diffusion equation solver.
Definition GridDiffusionSolver3.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
std::shared_ptr< FDMLinearSystemSolver3 > FDMLinearSystemSolver3Ptr
Shared pointer type for the FDMLinearSystemSolver3.
Definition FDMLinearSystemSolver3.hpp:52
std::shared_ptr< GridBackwardEulerDiffusionSolver3 > GridBackwardEulerDiffusionSolver3Ptr
Shared pointer type for the GridBackwardEulerDiffusionSolver3.
Definition GridBackwardEulerDiffusionSolver3.hpp:137
Vector3< double > Vector3D
Definition Matrix.hpp:787
Linear system (Ax=b) for 3-D finite differencing.
Definition FDMLinearSystem3.hpp:44