HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GAS_AdvectField-2.0.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: GAS_AdvectField-2.0.h ( GAS Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GAS_AdvectField_2_0__
12 #define __GAS_AdvectField_2_0__
13 
14 #include "GAS_SubSolver.h"
15 #include "GAS_Utils.h"
16 
17 /// Tracing methods supported by this operator.
19 {
24 };
25 /// Captures the sampling pattern of a velocity field, as well as its
26 /// relationship to the advected field.
28 {
29  NON_MATCHING, // Velocity and advected fields do not match.
30  GENERIC_MATCHING, // Velocity and advected fields match, but not one of
31  // the cases below.
32  FACE_MATCHING, // Velocity field is center sampled, and advected field
33  // is face or center sampled.
34  CENTER_MATCHING // All velocity field components and the advected field
35  // are aligned.
36 };
37 
39 {
40 public:
41  GET_DATA_FUNC_S(GAS_NAME_FIELDDEST, FieldDstName);
42  GET_DATA_FUNC_S(GAS_NAME_STENCIL, StencilName);
43  GET_DATA_FUNC_S(GAS_NAME_VELOCITY, VelocityName);
44  GET_DATA_FUNC_I("advectscheme", AdvectScheme);
45  GET_DATA_FUNC_I("clampvalues", ClampingMode);
46  GET_DATA_FUNC_F("blendwidth", Blendwidth);
47  GET_DATA_FUNC_I("tracemethod", TraceMethod);
48  GET_DATA_FUNC_B("usecfl", UseCFL);
49  GET_DATA_FUNC_F("cflcond", CFLCond);
50  GET_DATA_FUNC_B("limitsteps", LimitSteps);
51  GET_DATA_FUNC_I("maxsteps", MaxSteps);
52  GET_DATA_FUNC_B("limitbatch", LimitBatchSize);
53  GET_DATA_FUNC_I("maxbatchsize", MaxBatchSize);
56  GET_DATA_FUNC_B("opencl", OpenCL);
57  GET_DATA_FUNC_V3("wind", Wind);
58 
59 protected:
61  {
63  float CFLCondition;
64  float Timestep;
65  float MaxSteps;
67  };
68 
70  {
71  NONE = 0,
72  CLAMP_MIN_MAX = 1,
73  REVERT_MIN_MAX = 2,
74  CALCULATE_MIN_MAX = 3
75  };
77  {
79  float Blendwidth;
80  };
81 
82  THREADED_METHOD10_CONST(GAS_AdvectField2, field->shouldMultiThread(),
83  advectBatch,
84  const UT_Array<UT_VoxelArrayF*>&, dest,
85  const UT_Array<UT_VoxelArrayF*>&, mina,
86  const UT_Array<UT_VoxelArrayF*>&, maxa,
88  const SIM_RawField*, field,
89  const SIM_RawField*, stencil,
90  const gas_AdvectParms&, parms,
91  bool, forward,
92  const UT_Vector3&, wind,
93  const gas_ClampingParms&, clampParms);
94  void advectBatchPartial(const UT_Array<UT_VoxelArrayF*>& dest,
95  const UT_Array<UT_VoxelArrayF*>& mina,
96  const UT_Array<UT_VoxelArrayF*>& maxa,
98  const SIM_RawField* field,
99  const SIM_RawField* stencil,
100  const gas_AdvectParms& parms,
101  bool forward,
102  const UT_Vector3& wind,
103  const gas_ClampingParms& clampParms,
104  const UT_JobInfo& info) const;
105 
106  THREADED_METHOD7_CONST(GAS_AdvectField2, dest->numTiles() > 1,
107  clampValues,
108  UT_VoxelArrayF*, dest,
109  const UT_VoxelArrayF*, revert,
110  const UT_VoxelArrayF*, minf,
111  const UT_VoxelArrayF*, maxf,
112  const SIM_RawField*, field,
113  const SIM_RawField*, stencil,
114  const gas_ClampingParms&, parms);
115  void clampValuesPartial(UT_VoxelArrayF* dest,
116  const UT_VoxelArrayF* revert,
117  const UT_VoxelArrayF* minf,
118  const UT_VoxelArrayF* maxf,
119  const SIM_RawField* field,
120  const SIM_RawField* stencil,
121  const gas_ClampingParms& parms,
122  const UT_JobInfo& info) const;
123 
124  /// Performs the necessary error correction for the given advection scheme,
125  /// putting the final results in a2.
126  /// a0 should be the advected array, a1 is the original array, and a2 is
127  /// un-advected a0.
128  /// If a stencil field is provided, it's expected to match the three operand
129  /// arrays.
130  THREADED_METHOD5_CONST(GAS_AdvectField2, a0->numTiles() > 1,
131  compensateForError,
132  const UT_VoxelArrayF*, a0,
133  const UT_VoxelArrayF*, a1,
134  UT_VoxelArrayF*, a2,
135  const SIM_RawField*, stencil,
136  int, scheme);
137  void compensateForErrorPartial(const UT_VoxelArrayF* a0,
138  const UT_VoxelArrayF* a1,
139  UT_VoxelArrayF* a2,
140  const SIM_RawField* stencil,
141  int scheme,
142  const UT_JobInfo& info) const;
143 
144  bool solveGasSubclass(SIM_Engine& engine,
145  SIM_Object* obj,
146  SIM_Time time,
147  SIM_Time timestep) override;
148  bool advectCL(SIM_Object* obj, SIM_Time timestep);
149 
150  explicit GAS_AdvectField2(const SIM_DataFactory* factory);
151  ~GAS_AdvectField2() override;
152 
153 private:
154  static const SIM_DopDescription* getDopDescription();
155 
156  template<GAS_TraceMethod METHOD, int AXIS_2D, GAS_ClampingMode CLAMPING_MODE>
157  inline void advectBatchHelper(const UT_Array<UT_VoxelArrayF*>& dest,
158  const UT_Array<UT_VoxelArrayF*>& mina,
159  const UT_Array<UT_VoxelArrayF*>& maxa,
161  const SIM_RawField* field,
162  const SIM_RawField* stencil,
163  const gas_AdvectParms& parms,
164  bool forward,
165  float blendwidth,
166  const UT_Vector3& wind,
167  const UT_JobInfo& info) const;
168 
169  template<bool REVERT>
170  inline void clampValuesHelper(UT_VoxelArrayF* dest,
171  const UT_VoxelArrayF* revert,
172  const UT_VoxelArrayF* minf,
173  const UT_VoxelArrayF* maxf,
174  const SIM_RawField* field,
175  const SIM_RawField* stencil,
176  float blendwidth,
177  const UT_JobInfo& info) const;
178 
182  "Gas Advect Field",
183  getDopDescription());
184 };
185 
186 #endif
187 
#define DECLARE_STANDARD_GETCASTTOTYPE()
Definition: SIM_DataUtils.h:50
#define GET_DATA_FUNC_V3(DataName, FuncName)
GT_API const UT_StringHolder time
#define GAS_NAME_USETIMESTEP
Definition: GAS_Utils.h:39
#define GAS_API
Definition: GAS_API.h:10
virtual bool solveGasSubclass(SIM_Engine &engine, SIM_Object *obj, SIM_Time time, SIM_Time timestep)=0
GLenum src
Definition: glcorearb.h:1793
#define THREADED_METHOD5_CONST(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2, PARMTYPE3, PARMNAME3, PARMTYPE4, PARMNAME4, PARMTYPE5, PARMNAME5)
#define GAS_NAME_VELOCITY
Definition: GAS_Utils.h:42
#define DECLARE_DATAFACTORY(DataClass, SuperClass, Description, DopParms)
Definition: SIM_DataUtils.h:63
#define GET_DATA_FUNC_I(DataName, FuncName)
#define THREADED_METHOD7_CONST(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2, PARMTYPE3, PARMNAME3, PARMTYPE4, PARMNAME4, PARMTYPE5, PARMNAME5, PARMTYPE6, PARMNAME6, PARMTYPE7, PARMNAME7)
#define THREADED_METHOD10_CONST(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2, PARMTYPE3, PARMNAME3, PARMTYPE4, PARMNAME4, PARMTYPE5, PARMNAME5, PARMTYPE6, PARMNAME6, PARMTYPE7, PARMNAME7, PARMTYPE8, PARMNAME8, PARMTYPE9, PARMNAME9, PARMTYPE10, PARMNAME10)
GLhandleARB obj
Definition: glew.h:6266
#define GAS_NAME_FIELDDEST
Definition: GAS_Utils.h:28
typedef int(WINAPI *PFNWGLRELEASEPBUFFERDCARBPROC)(HPBUFFERARB hPbuffer
GAS_TraceMethod
Tracing methods supported by this operator.
#define GET_DATA_FUNC_B(DataName, FuncName)
#define GET_DATA_FUNC_F(DataName, FuncName)
#define GAS_NAME_TIMESCALE
Definition: GAS_Utils.h:40
GAS_VectorSampling
GLint GLfloat GLint stencil
Definition: glcorearb.h:1278
This class holds a three dimensional vector field.
#define GET_DATA_FUNC_S(DataName, FuncName)
#define GAS_NAME_STENCIL
Definition: GAS_Utils.h:19