HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GAS_Cross.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_Cross.h ( GAS Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GAS_Cross__
12 #define __GAS_Cross__
13 
14 #include "GAS_API.h"
15 
17 #include <GU/GU_Detail.h>
18 
19 #include <SIM/SIM_RawField.h>
20 #include <SIM/SIM_VectorField.h>
21 #include <SIM/SIM_PhysicalParms.h>
22 
23 #include "GAS_SubSolver.h"
24 #include "GAS_Utils.h"
25 
26 class SIM_ScalarField;
27 class SIM_VectorField;
28 class SIM_MatrixField;
29 
31 {
32 public:
33  GET_DATA_FUNC_B(SIM_NAME_OPENCL, UseOpenCL);
34  GET_DATA_FUNC_S(GAS_NAME_STENCIL, StencilName);
35 
36 protected:
37  explicit GAS_Cross(const SIM_DataFactory *factory);
38  ~GAS_Cross() override;
39 
40  bool shouldMultiThread(SIM_RawField *field) const
41  { return field->field()->numTiles() > 1; }
42 
43  bool solveGasSubclass(SIM_Engine &engine,
44  SIM_Object *obj,
45  SIM_Time time,
46  SIM_Time timestep) override;
47 
48 private:
49  static const SIM_DopDescription *getDopDescription();
50 
51 
52  // We have helper wrappers around the same->same methods to avoid
53  // read/modify/write problems where the source and destination fields
54  // are the same. This is impossible for the ones that change
55  // dimensions.
56  void calculateCross(SIM_VectorField *dst,
57  const SIM_VectorField *a,
58  const SIM_VectorField *b,
59  const SIM_RawField *stencil) const;
60 
61  THREADED_METHOD4_CONST(GAS_Cross, shouldMultiThread(dst->getField(0)),
62  threadCrossAligned,
64  const SIM_VectorField *, a,
65  const SIM_VectorField *, b,
66  const SIM_RawField *, stencil);
67  void threadCrossAlignedPartial(SIM_VectorField *dst,
68  const SIM_VectorField *a,
69  const SIM_VectorField *b,
70  const SIM_RawField *stencil,
71  const UT_JobInfo &info) const;
72  THREADED_METHOD5_CONST(GAS_Cross, shouldMultiThread(dst),
73  threadCross,
74  SIM_RawField *, dst,
75  int, axis,
76  const SIM_VectorField *, a,
77  const SIM_VectorField *, b,
78  const SIM_RawField *, stencil);
79  void threadCrossPartial(SIM_RawField *dst,
80  int axis,
81  const SIM_VectorField *a,
82  const SIM_VectorField *b,
83  const SIM_RawField *stencil,
84  const UT_JobInfo &info) const;
85 
89  "Gas Cross",
90  getDopDescription());
91 
92  void calculateCrossCL(SIM_Object *obj, SIM_VectorField* dst,
94 
95  // Cache our timestep for so we can calculate the timescale
96  // effects.
97  float myTimeStep;
98 };
99 
100 #endif
#define DECLARE_STANDARD_GETCASTTOTYPE()
Definition: SIM_DataUtils.h:50
#define THREADED_METHOD4_CONST(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2, PARMTYPE3, PARMNAME3, PARMTYPE4, PARMNAME4)
GT_API const UT_StringHolder time
#define GAS_API
Definition: GAS_API.h:10
bool shouldMultiThread(SIM_RawField *field) const
Definition: GAS_Cross.h:40
virtual bool solveGasSubclass(SIM_Engine &engine, SIM_Object *obj, SIM_Time time, SIM_Time timestep)=0
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1222
#define THREADED_METHOD5_CONST(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2, PARMTYPE3, PARMNAME3, PARMTYPE4, PARMNAME4, PARMTYPE5, PARMNAME5)
#define DECLARE_DATAFACTORY(DataClass, SuperClass, Description, DopParms)
Definition: SIM_DataUtils.h:63
int numTiles() const
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1222
This class holds a three dimensional tensor field.
GLenum GLenum dst
Definition: glcorearb.h:1793
#define GET_DATA_FUNC_B(DataName, FuncName)
This class holds a three dimensional scalar field.
#define SIM_NAME_OPENCL
Definition: SIM_Names.h:222
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
UT_VoxelArrayF UT_VoxelArrayF & field