GridBoundaryConditionSolver3.h
Go to the documentation of this file.
1 /*************************************************************************
2 > File Name: GridBoundaryConditionSolver3.h
3 > Project Name: CubbyFlow
4 > Author: Chan-Ho Chris Ohk
5 > Purpose: Abstract base class for 3-D boundary condition solver for grids.
6 > Created Time: 2017/08/09
7 > Copyright (c) 2018, Chan-Ho Chris Ohk
8 *************************************************************************/
9 #ifndef CUBBYFLOW_GRID_BOUNDARY_CONDITION_SOLVER3_H
10 #define CUBBYFLOW_GRID_BOUNDARY_CONDITION_SOLVER3_H
11 
15 #include <Core/Size/Size3.h>
16 
17 namespace CubbyFlow
18 {
27  {
28  public:
31 
34 
36  const Collider3Ptr& GetCollider() const;
37 
50  void UpdateCollider(
51  const Collider3Ptr& newCollider,
52  const Size3& gridSize,
53  const Vector3D& gridSpacing,
54  const Vector3D& gridOrigin);
55 
57  int GetClosedDomainBoundaryFlag() const;
58 
60  void SetClosedDomainBoundaryFlag(int flag);
61 
69  virtual void ConstrainVelocity(
70  FaceCenteredGrid3* velocity,
71  unsigned int extrapolationDepth = 5) = 0;
72 
74  virtual ScalarField3Ptr GetColliderSDF() const = 0;
75 
77  virtual VectorField3Ptr GetColliderVelocityField() const = 0;
78 
79  protected:
81  virtual void OnColliderUpdated(
82  const Size3& gridSize,
83  const Vector3D& gridSpacing,
84  const Vector3D& gridOrigin) = 0;
85 
87  const Size3& GetGridSize() const;
88 
90  const Vector3D& GetGridSpacing() const;
91 
93  const Vector3D& GetGridOrigin() const;
94 
95  private:
96  Collider3Ptr m_collider;
97  Size3 m_gridSize;
98  Vector3D m_gridSpacing;
99  Vector3D m_gridOrigin;
100  int m_closedDomainBoundaryFlag = DIRECTION_ALL;
101  };
102 
104  using GridBoundaryConditionSolver3Ptr = std::shared_ptr<GridBoundaryConditionSolver3>;
105 }
106 
107 #endif
3-D vector class.
Definition: Vector3.h:26
std::shared_ptr< Collider3 > Collider3Ptr
Shared pointer type for the Collider3.
Definition: Collider3.h:112
const Vector3D & GetGridOrigin() const
Returns the origin of the velocity grid to be constrained.
virtual VectorField3Ptr GetColliderVelocityField() const =0
Returns the velocity field of the collider.
constexpr int DIRECTION_ALL
All direction.
Definition: Constants.h:187
virtual ~GridBoundaryConditionSolver3()
Default destructor.
const Vector3D & GetGridSpacing() const
Returns the spacing of the velocity grid to be constrained.
std::shared_ptr< ScalarField3 > ScalarField3Ptr
Shared pointer for the ScalarField3 type.
Definition: ScalarField3.h:44
Abstract base class for 3-D boundary condition solver for grids.
Definition: GridBoundaryConditionSolver3.h:26
std::shared_ptr< VectorField3 > VectorField3Ptr
Shared pointer for the VectorField3 type.
Definition: VectorField3.h:44
std::shared_ptr< GridBoundaryConditionSolver3 > GridBoundaryConditionSolver3Ptr
Shared pointer type for the GridBoundaryConditionSolver3.
Definition: GridBoundaryConditionSolver3.h:104
3-D face-centered (a.k.a MAC or staggered) grid.
Definition: FaceCenteredGrid3.h:25
void SetClosedDomainBoundaryFlag(int flag)
Sets the closed domain boundary flag.
3-D point class.
Definition: Point3.h:26
const Collider3Ptr & GetCollider() const
Returns associated collider.
GridBoundaryConditionSolver3()
Default constructor.
Definition: pybind11Utils.h:24
virtual void OnColliderUpdated(const Size3 &gridSize, const Vector3D &gridSpacing, const Vector3D &gridOrigin)=0
Invoked when a new collider is set.
void UpdateCollider(const Collider3Ptr &newCollider, const Size3 &gridSize, const Vector3D &gridSpacing, const Vector3D &gridOrigin)
Applies new collider and build the internals.
int GetClosedDomainBoundaryFlag() const
Returns the closed domain boundary flag.
virtual ScalarField3Ptr GetColliderSDF() const =0
Returns the signed distance field of the collider.
const Size3 & GetGridSize() const
Returns the size of the velocity grid to be constrained.
virtual void ConstrainVelocity(FaceCenteredGrid3 *velocity, unsigned int extrapolationDepth=5)=0