HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GAS_Analysis.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_Analysis.h ( GAS Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GAS_Analysis__
12 #define __GAS_Analysis__
13 
14 #include "GAS_API.h"
15 
17 #include <GU/GU_Detail.h>
18 
19 #include <SIM/SIM_RawField.h>
20 #include <SIM/SIM_ScalarField.h>
21 #include <SIM/SIM_VectorField.h>
22 #include <SIM/SIM_PhysicalParms.h>
23 
24 #include "GAS_SubSolver.h"
25 #include "GAS_Utils.h"
26 
27 class SIM_ScalarField;
28 class SIM_VectorField;
29 class SIM_MatrixField;
30 
32 {
33 public:
34  GET_DATA_FUNC_S(GAS_NAME_FIELDDEST, FieldDstName);
36 
37  GET_DATA_FUNC_I("analysis", Analysis);
38  GET_DATA_FUNC_B(SIM_NAME_OPENCL, UseOpenCL);
39 
40  // Analysis methods
42  {
50  NUM_ANALYSIS
51  };
52 
53 protected:
54  explicit GAS_Analysis(const SIM_DataFactory *factory);
55  virtual ~GAS_Analysis();
56 
57  bool shouldMultiThread(const SIM_RawField *field) const
58  { return field->field()->numTiles() > 1; }
59 
60  virtual bool solveGasSubclass(SIM_Engine &engine,
61  SIM_Object *obj,
62  SIM_Time time,
63  SIM_Time timestep);
64 
65 private:
66  static const SIM_DopDescription *getDopDescription();
67 
68 
69  // We have helper wrappers around the same->same methods to avoid
70  // read/modify/write problems where the source and destination fields
71  // are the same. This is impossible for the ones that change
72  // dimensions.
73  void calculateCurvature(SIM_RawField *dst, SIM_RawField *src) const;
74  THREADED_METHOD2_CONST(GAS_Analysis, shouldMultiThread(dst),
75  threadCurvature,
76  SIM_RawField *, dst,
77  const SIM_RawField *, src);
78  void threadCurvaturePartial(SIM_RawField *dst,
79  const SIM_RawField *src,
80  const UT_JobInfo &info) const;
81 
82  void calculateLaplacian(SIM_RawField *dst, const SIM_RawField *src) const;
83  THREADED_METHOD2_CONST(GAS_Analysis, shouldMultiThread(dst),
84  threadLaplacian,
85  SIM_RawField *, dst,
86  const SIM_RawField *, src);
87  void threadLaplacianPartial(SIM_RawField *dst,
88  const SIM_RawField *src,
89  const UT_JobInfo &info) const;
90 
91  THREADED_METHOD2_CONST(GAS_Analysis, shouldMultiThread(src->getField()),
92  calculateScalarGradientAligned,
94  const SIM_ScalarField *, src);
95  void calculateScalarGradientAlignedPartial(
97  const SIM_ScalarField *src,
98  const UT_JobInfo &info) const;
99  THREADED_METHOD3_CONST(GAS_Analysis, shouldMultiThread(dst),
100  calculateScalarGradient,
101  SIM_RawField *, dst,
102  int, axis,
103  const SIM_ScalarField *, src);
104  void calculateScalarGradientPartial(SIM_RawField *dst,
105  int axis,
106  const SIM_ScalarField *src,
107  const UT_JobInfo &info) const;
108  THREADED_METHOD2_CONST(GAS_Analysis, shouldMultiThread(src->getField(0)),
109  calculateVectorGradientAligned,
110  SIM_MatrixField *, dst,
111  const SIM_VectorField *, src);
112  void calculateVectorGradientAlignedPartial(
114  const SIM_VectorField *src,
115  const UT_JobInfo &info) const;
116  THREADED_METHOD4_CONST(GAS_Analysis, shouldMultiThread(dst),
117  calculateVectorGradient,
118  SIM_RawField *, dst,
119  int, a1,
120  int, a2,
121  const SIM_VectorField *, src);
122  void calculateVectorGradientPartial(SIM_RawField *dst,
123  int a1, int a2,
124  const SIM_VectorField *src,
125  const UT_JobInfo &info) const;
126 
127  THREADED_METHOD2_CONST(GAS_Analysis, shouldMultiThread(dst),
128  calculateDivergence,
129  SIM_RawField *, dst,
130  const SIM_VectorField *, src);
131  void calculateDivergencePartial(SIM_RawField *dst,
132  const SIM_VectorField *src,
133  const UT_JobInfo &info) const;
134 
135  void calculateCurl(SIM_VectorField *dst, const SIM_VectorField *src);
136 
137  THREADED_METHOD2_CONST(GAS_Analysis, shouldMultiThread(dst[0]),
138  threadCurlAligned,
139  SIM_RawField **, dst,
140  const SIM_VectorField *, src);
141  void threadCurlAlignedPartial(SIM_RawField **dst,
142  const SIM_VectorField *src,
143  const UT_JobInfo &info) const;
144  THREADED_METHOD2_CONST(GAS_Analysis, shouldMultiThread(dst[0]),
145  threadCurlAlignedFace,
146  SIM_RawField **, dst,
147  const SIM_VectorField *, src);
148  void threadCurlAlignedFacePartial(SIM_RawField **dst,
149  const SIM_VectorField *src,
150  const UT_JobInfo &info) const;
151  THREADED_METHOD3_CONST(GAS_Analysis, shouldMultiThread(dst),
152  threadCurl,
153  SIM_RawField *, dst,
154  int, axis,
155  const SIM_VectorField *, src);
156  void threadCurlPartial(SIM_RawField *dst,
157  int axis,
158  const SIM_VectorField *src,
159  const UT_JobInfo &info) const;
160 
161  void calculateNormalize(SIM_VectorField *dst, const SIM_VectorField *src);
162  THREADED_METHOD2_CONST(GAS_Analysis, shouldMultiThread(dst->getField(0)),
163  threadNormalizeAligned,
164  SIM_VectorField *, dst,
165  const SIM_VectorField *, src);
166  void threadNormalizeAlignedPartial(SIM_VectorField *dst,
167  const SIM_VectorField *src,
168  const UT_JobInfo &info) const;
169  THREADED_METHOD3_CONST(GAS_Analysis, shouldMultiThread(dst),
170  threadNormalize,
171  SIM_RawField *, dst,
172  int, axis,
173  const SIM_VectorField *, src);
174  void threadNormalizePartial(SIM_RawField *dst,
175  int axis,
176  const SIM_VectorField *src,
177  const UT_JobInfo &info) const;
178 
179  THREADED_METHOD2_CONST(GAS_Analysis, shouldMultiThread(dst),
180  calculateLengthAligned,
181  SIM_RawField *, dst,
182  const SIM_VectorField *, src);
183  void calculateLengthAlignedPartial(SIM_RawField *dst,
184  const SIM_VectorField *src,
185  const UT_JobInfo &info) const;
186  THREADED_METHOD2_CONST(GAS_Analysis, shouldMultiThread(dst),
187  calculateLength,
188  SIM_RawField *, dst,
189  const SIM_VectorField *, src);
190  void calculateLengthPartial(SIM_RawField *dst,
191  const SIM_VectorField *src,
192  const UT_JobInfo &info) const;
193 
194  THREADED_METHOD2_CONST(GAS_Analysis, shouldMultiThread(dst),
195  calculateMatrixLengthAligned,
196  SIM_RawField *, dst,
197  const SIM_MatrixField *, src);
198  void calculateMatrixLengthAlignedPartial(SIM_RawField *dst,
199  const SIM_MatrixField *src,
200  const UT_JobInfo &info) const;
201  THREADED_METHOD2_CONST(GAS_Analysis, shouldMultiThread(dst),
202  calculateMatrixLength,
203  SIM_RawField *, dst,
204  const SIM_MatrixField *, src);
205  void calculateMatrixLengthPartial(SIM_RawField *dst,
206  const SIM_MatrixField *src,
207  const UT_JobInfo &info) const;
208 
209  // OpenCL functions
210  void calculateCurlCL(SIM_Object *obj,
212  const SIM_VectorField *src);
213  void calculateLengthCL(SIM_Object *obj,
215  const SIM_VectorField *src);
216  void calculateScalarGradientCL(SIM_Object *obj,
218  const SIM_ScalarField* src,
219  bool doNormalize = false);
220  void calculateNormalizeCL(SIM_Object *obj,
223  void calculateDivergenceCL(SIM_Object *obj,
226 
230  "Gas Analysis",
231  getDopDescription());
232 
233  // Cache our timestep for so we can calculate the timescale
234  // effects.
235  float myTimeStep;
236 };
237 
238 #endif
#define DECLARE_STANDARD_GETCASTTOTYPE()
Definition: SIM_DataUtils.h:45
#define THREADED_METHOD4_CONST(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2, PARMTYPE3, PARMNAME3, PARMTYPE4, PARMNAME4)
bool shouldMultiThread(const SIM_RawField *field) const
Definition: GAS_Analysis.h:57
#define GAS_API
Definition: GAS_API.h:10
virtual bool solveGasSubclass(SIM_Engine &engine, SIM_Object *obj, SIM_Time time, SIM_Time timestep)=0
#define DECLARE_DATAFACTORY(DataClass, SuperClass, Description, DopParms)
Definition: SIM_DataUtils.h:58
#define GET_DATA_FUNC_I(DataName, FuncName)
int numTiles() const
#define GAS_NAME_FIELDSOURCE
Definition: GAS_Utils.h:27
#define GAS_NAME_FIELDDEST
Definition: GAS_Utils.h:26
This class holds a three dimensional tensor field.
#define THREADED_METHOD2_CONST(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2)
GLenum GLenum dst
Definition: glcorearb.h:1792
#define GET_DATA_FUNC_B(DataName, FuncName)
This class holds a three dimensional scalar field.
#define SIM_NAME_OPENCL
Definition: SIM_Names.h:221
#define THREADED_METHOD3_CONST(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2, PARMTYPE3, PARMNAME3)
This class holds a three dimensional vector field.
#define GET_DATA_FUNC_S(DataName, FuncName)
UT_VoxelArrayF UT_VoxelArrayF & field
GLenum src
Definition: glcorearb.h:1792