SemiLagrangian3.h
Go to the documentation of this file.
1 /*************************************************************************
2 > File Name: SemiLagrangian3.h
3 > Project Name: CubbyFlow
4 > Author: Chan-Ho Chris Ohk
5 > Purpose: Implementation of 3-D semi-Lagrangian advection solver.
6 > Created Time: 2017/08/07
7 > Copyright (c) 2018, Chan-Ho Chris Ohk
8 *************************************************************************/
9 #ifndef CUBBYFLOW_SEMI_LAGRANGIAN3_H
10 #define CUBBYFLOW_SEMI_LAGRANGIAN3_H
11 
13 
14 namespace CubbyFlow
15 {
28  {
29  public:
31 
32  virtual ~SemiLagrangian3();
33 
52  void Advect(
53  const ScalarGrid3& input,
54  const VectorField3& flow,
55  double dt,
56  ScalarGrid3* output,
57  const ScalarField3& boundarySDF = ConstantScalarField3(std::numeric_limits<double>::max())) final;
58 
77  void Advect(
78  const CollocatedVectorGrid3& input,
79  const VectorField3& flow,
80  double dt,
81  CollocatedVectorGrid3* output,
82  const ScalarField3& boundarySDF = ConstantScalarField3(std::numeric_limits<double>::max())) final;
83 
103  void Advect(
104  const FaceCenteredGrid3& input,
105  const VectorField3& flow,
106  double dt,
107  FaceCenteredGrid3* output,
108  const ScalarField3& boundarySDF = ConstantScalarField3(std::numeric_limits<double>::max())) final;
109 
110  protected:
119  virtual std::function<double(const Vector3D&)> GetScalarSamplerFunc(const ScalarGrid3& input) const;
120 
130  virtual std::function<Vector3D(const Vector3D&)> GetVectorSamplerFunc(const CollocatedVectorGrid3& input) const;
131 
141  virtual std::function<Vector3D(const Vector3D&)> GetVectorSamplerFunc(const FaceCenteredGrid3& input) const;
142 
143  private:
144  Vector3D BackTrace(
145  const VectorField3& flow,
146  double dt,
147  double h,
148  const Vector3D& pt0,
149  const ScalarField3& boundarySDF) const;
150  };
151 
152  using SemiLagrangian3Ptr = std::shared_ptr<SemiLagrangian3>;
153 }
154 
155 #endif
virtual std::function< Vector3D(const Vector3D &)> GetVectorSamplerFunc(const CollocatedVectorGrid3 &input) const
Returns spatial interpolation function object for given collocated vector grid.
3-D vector class.
Definition: Vector3.h:26
Abstract base class for 3-D collocated vector grid structure.
Definition: CollocatedVectorGrid3.h:19
Implementation of 3-D semi-Lagrangian advection solver.
Definition: SemiLagrangian3.h:27
3-D face-centered (a.k.a MAC or staggered) grid.
Definition: FaceCenteredGrid3.h:25
void Advect(const ScalarGrid3 &input, const VectorField3 &flow, double dt, ScalarGrid3 *output, const ScalarField3 &boundarySDF=ConstantScalarField3(std::numeric_limits< double >::max())) final
Computes semi-Lagrangian for given scalar grid.
Definition: pybind11Utils.h:24
3-D constant scalar field.
Definition: ConstantScalarField3.h:17
Abstract based class for 3-D grid-based advection solver.
Definition: AdvectionSolver3.h:26
Abstract base class for 3-D vector field.
Definition: VectorField3.h:21
Abstract base class for 3-D scalar field.
Definition: ScalarField3.h:21
Abstract base class for 3-D scalar grid structure.
Definition: ScalarGrid3.h:21
std::shared_ptr< SemiLagrangian3 > SemiLagrangian3Ptr
Definition: SemiLagrangian3.h:152
virtual std::function< double(const Vector3D &)> GetScalarSamplerFunc(const ScalarGrid3 &input) const
Returns spatial interpolation function object for given scalar grid.