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 
58 protected:
60  {
62  float CFLCondition;
63  float Timestep;
64  float MaxSteps;
66  };
67 
69  {
70  NONE = 0,
71  CLAMP_MIN_MAX = 1,
72  REVERT_MIN_MAX = 2,
73  CALCULATE_MIN_MAX = 3
74  };
76  {
78  float Blendwidth;
79  };
80 
81  THREADED_METHOD9_CONST(GAS_AdvectField2, field->shouldMultiThread(),
82  advectBatch,
83  const UT_Array<UT_VoxelArrayF*>&, dest,
84  const UT_Array<UT_VoxelArrayF*>&, mina,
85  const UT_Array<UT_VoxelArrayF*>&, maxa,
87  const SIM_RawField*, field,
88  const SIM_RawField*, stencil,
89  const gas_AdvectParms&, parms,
90  bool, forward,
91  const gas_ClampingParms&, clampParms);
92  void advectBatchPartial(const UT_Array<UT_VoxelArrayF*>& dest,
93  const UT_Array<UT_VoxelArrayF*>& mina,
94  const UT_Array<UT_VoxelArrayF*>& maxa,
96  const SIM_RawField* field,
97  const SIM_RawField* stencil,
98  const gas_AdvectParms& parms,
99  bool forward,
100  const gas_ClampingParms& clampParms,
101  const UT_JobInfo& info) const;
102 
103  THREADED_METHOD7_CONST(GAS_AdvectField2, dest->numTiles() > 1,
104  clampValues,
105  UT_VoxelArrayF*, dest,
106  const UT_VoxelArrayF*, revert,
107  const UT_VoxelArrayF*, minf,
108  const UT_VoxelArrayF*, maxf,
109  const SIM_RawField*, field,
110  const SIM_RawField*, stencil,
111  const gas_ClampingParms&, parms);
112  void clampValuesPartial(UT_VoxelArrayF* dest,
113  const UT_VoxelArrayF* revert,
114  const UT_VoxelArrayF* minf,
115  const UT_VoxelArrayF* maxf,
116  const SIM_RawField* field,
117  const SIM_RawField* stencil,
118  const gas_ClampingParms& parms,
119  const UT_JobInfo& info) const;
120 
121  /// Performs the necessary error correction for the given advection scheme,
122  /// putting the final results in a2.
123  /// a0 should be the advected array, a1 is the original array, and a2 is
124  /// un-advected a0.
125  /// If a stencil field is provided, it's expected to match the three operand
126  /// arrays.
127  THREADED_METHOD5_CONST(GAS_AdvectField2, a0->numTiles() > 1,
128  compensateForError,
129  const UT_VoxelArrayF*, a0,
130  const UT_VoxelArrayF*, a1,
131  UT_VoxelArrayF*, a2,
132  const SIM_RawField*, stencil,
133  int, scheme);
134  void compensateForErrorPartial(const UT_VoxelArrayF* a0,
135  const UT_VoxelArrayF* a1,
136  UT_VoxelArrayF* a2,
137  const SIM_RawField* stencil,
138  int scheme,
139  const UT_JobInfo& info) const;
140 
141  bool solveGasSubclass(SIM_Engine& engine,
142  SIM_Object* obj,
143  SIM_Time time,
144  SIM_Time timestep) override;
145  bool advectCL(SIM_Object* obj, SIM_Time timestep);
146 
147  explicit GAS_AdvectField2(const SIM_DataFactory* factory);
148  ~GAS_AdvectField2() override;
149 
150 private:
151  static const SIM_DopDescription* getDopDescription();
152 
153  template<GAS_TraceMethod METHOD, int AXIS_2D, GAS_VectorSampling V_SAMPLE,
154  SIM_FieldSample F_SAMPLE, GAS_ClampingMode CLAMPING_MODE>
155  inline void advectBatchHelper(const UT_Array<UT_VoxelArrayF*>& dest,
156  const UT_Array<UT_VoxelArrayF*>& mina,
157  const UT_Array<UT_VoxelArrayF*>& maxa,
159  const SIM_RawField* field,
160  const SIM_RawField* stencil,
161  const gas_AdvectParms& parms,
162  bool forward,
163  float blendwidth,
164  const UT_JobInfo& info) const;
165 
166  template<bool REVERT>
167  inline void clampValuesHelper(UT_VoxelArrayF* dest,
168  const UT_VoxelArrayF* revert,
169  const UT_VoxelArrayF* minf,
170  const UT_VoxelArrayF* maxf,
171  const SIM_RawField* field,
172  const SIM_RawField* stencil,
173  float blendwidth,
174  const UT_JobInfo& info) const;
175 
179  "Gas Advect Field",
180  getDopDescription());
181 };
182 
183 #endif
184 
#define DECLARE_STANDARD_GETCASTTOTYPE()
Definition: SIM_DataUtils.h:45
GLenum src
Definition: glew.h:2410
#define THREADED_METHOD9_CONST(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2, PARMTYPE3, PARMNAME3, PARMTYPE4, PARMNAME4, PARMTYPE5, PARMNAME5, PARMTYPE6, PARMNAME6, PARMTYPE7, PARMNAME7, PARMTYPE8, PARMNAME8, PARMTYPE9, PARMNAME9)
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
GLhandleARB obj
Definition: glew.h:6236
GLint GLfloat GLint stencil
Definition: glew.h:2167
#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
SIM_FieldSample
Definition: SIM_RawField.h:38
#define DECLARE_DATAFACTORY(DataClass, SuperClass, Description, DopParms)
Definition: SIM_DataUtils.h:58
#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 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
This class holds a three dimensional vector field.
#define GET_DATA_FUNC_S(DataName, FuncName)
#define GAS_NAME_STENCIL
Definition: GAS_Utils.h:19