GteFluid3ComputeDivergence.h
Go to the documentation of this file.
1 // David Eberly, Geometric Tools, Redmond WA 98052
2 // Copyright (c) 1998-2017
3 // Distributed under the Boost Software License, Version 1.0.
4 // http://www.boost.org/LICENSE_1_0.txt
5 // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
6 // File Version: 3.0.0 (2016/06/19)
7 
8 #pragma once
9 
13 #include <Graphics/GteTexture3.h>
14 
15 namespace gte
16 {
17 
18 class GraphicsEngine;
19 
21 {
22 public:
23  // Construction. Compute the divergence of the velocity vector field:
24  // Divergence(V(x,y,z)) = dV/dx + dV/dy + dV/dz. The derivatives are
25  // estimated using centered finite differences,
26  // dV/dx = (V(x+dx,y,z) - V(x-dx,y,z))/(2*dx)
27  // dV/dy = (V(x,y+dy,z) - V(x,y-dy,z))/(2*dy)
28  // dV/dz = (V(x,y,z+dz) - V(x,y,z-dz))/(2*dz)
29  Fluid3ComputeDivergence(std::shared_ptr<ProgramFactory> const& factory,
30  int xSize, int ySize, int zSize, int numXThreads, int numYThreads, int numZThreads,
31  std::shared_ptr<ConstantBuffer> const& parameters);
32 
33  // Member access.
34  inline std::shared_ptr<Texture3> const& GetDivergence() const;
35 
36  // Compute the divergence of the velocity vector field for the input
37  // state.
38  void Execute(std::shared_ptr<GraphicsEngine> const& engine,
39  std::shared_ptr<Texture3> const& state);
40 
41 private:
42  int mNumXGroups, mNumYGroups, mNumZGroups;
43  std::shared_ptr<ComputeProgram> mComputeDivergence;
44  std::shared_ptr<Texture3> mDivergence;
45 
46  // Shader source code as strings.
47  static std::string const msGLSLSource;
48  static std::string const msHLSLSource;
49  static std::string const* msSource[ProgramFactory::PF_NUM_API];
50 };
51 
52 inline std::shared_ptr<Texture3> const& Fluid3ComputeDivergence::GetDivergence() const
53 {
54  return mDivergence;
55 }
56 
57 }
std::shared_ptr< ComputeProgram > mComputeDivergence
GLsizei const GLchar *const * string
Definition: glcorearb.h:809
std::shared_ptr< Texture3 > const & GetDivergence() const
std::shared_ptr< Texture3 > mDivergence
static std::string const msGLSLSource
#define GTE_IMPEXP
Definition: GTEngineDEF.h:63
static std::string const msHLSLSource


geometric_tools_engine
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 03:59:59