HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GAS_DisturbFieldCL.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_DisturbFieldCL.h ( GAS Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GAS_DisturbFieldCL_h__
12 #define __GAS_DisturbFieldCL_h__
13 
14 #include "GAS_SubSolver.h"
15 #include "GAS_Utils.h"
16 #include <GA/GA_SplittableRange.h>
17 
19 {
20 public:
21  GET_DATA_FUNC_S( "disturbfield", DisturbField);
22 
23  GET_DATA_FUNC_S( "threshold", ThresholdField);
24  GET_DATA_FUNC_S( "control", ControlField );
25 
26  GET_DATA_FUNC_B( SIM_NAME_OPENCL, UseOpenCL );
27  GET_DATA_FUNC_B( "useblock", UseBlocks );
28  GET_DATA_FUNC_B( "usecontrol", UseControl );
29 
30  GET_DATA_FUNC_F( "disturbance", Disturbance );
31  GET_DATA_FUNC_F( "cutoff", Cutoff );
32  GET_DATA_FUNC_F( "blocksize", BlockSize );
33  GET_DATA_FUNC_F( "timescale", TimeScale );
34  GET_DATA_FUNC_I( "locality", Locality );
35 
36  GET_DATA_FUNC_F( "controlinfluence", ControlInfluence );
37  GET_DATA_FUNC_F( "controlmin", ControlMin );
38  GET_DATA_FUNC_F( "controlmax", ControlMax );
39 
40 protected:
41  explicit GAS_DisturbFieldCL(const SIM_DataFactory *factory);
42  virtual ~GAS_DisturbFieldCL();
43 
44 
45  /// The overloaded callback that GAS_SubSolver will invoke to
46  /// perform our actual computation. We are giving a single object
47  /// at a time to work on.
48  virtual bool solveGasSubclass(SIM_Engine &engine,
49  SIM_Object *obj,
50  SIM_Time time,
52 
53 
54 private:
55  float myTime, myTimeInc, myFrame;
56 
57  bool disturb(SIM_RawField *dest, SIM_Object *obj,
58  SIM_Time timestep, int a1, int a2);
59 
60  // Performs disturb field using opencl
61  bool disturbFieldCL(SIM_Object *obj,
62  SIM_RawField* dst,
63  const SIM_RawField* control,
64  const SIM_RawField* threshold,
65  UT_WorkBuffer & flags );
66 
67  void disturbField( SIM_RawField *dst,
68  const SIM_RawField *control,
69  const SIM_RawField *threshold,
70  int vectorWidth );
71 
72  // Performs disturb field using CPU method
73  void doDisturbFieldPartial( SIM_RawField *dst,
74  const SIM_RawField *threshold_field,
75  const SIM_RawField *control_field,
76  UT_Vector3 scale_par,
77  UT_Vector3 control_par,
78  float blocksize,
79  float locality_inv,
80  int vector_width,
81  const UT_JobInfo &info );
82 
83  // Declare multithreaded Disturb Field
84  THREADED_METHOD8(GAS_DisturbFieldCL, dst->shouldMultiThread(),
85  doDisturbField,
86  SIM_RawField *, dst,
87  const SIM_RawField *, threshold_field,
88  const SIM_RawField *, control_field,
89  UT_Vector3, scale_par,
90  UT_Vector3, control_par,
91  float, blocksize,
92  float, locality,
93  int, vector_width );
94 
95 
96  /// We define this to be a DOP_Auto node which means we do not
97  /// need to implement a DOP_Node derivative for this data. Instead,
98  /// this description is used to define the interface.
99  static const SIM_DopDescription *getDopDescription();
100 
101  /// These macros are necessary to bind our node to the factory and
102  /// ensure useful constants like BaseClass are defined.
103  DECLARE_STANDARD_GETCASTTOTYPE();
104  DECLARE_DATAFACTORY(GAS_DisturbFieldCL,
106  "Gas Disturb Field CL",
107  getDopDescription());
108 };
109 
110 #endif
111 
GET_DATA_FUNC_S("disturbfield", DisturbField)
GET_DATA_FUNC_F("disturbance", Disturbance)
GT_API const UT_StringHolder time
UT_Vector3T< float > UT_Vector3
GLbitfield flags
Definition: glcorearb.h:1595
bool shouldMultiThread() const
Returns true if this should be multithreaded.
Definition: SIM_RawField.h:138
GET_DATA_FUNC_B(SIM_NAME_OPENCL, UseOpenCL)
virtual bool solveGasSubclass(SIM_Engine &engine, SIM_Object *obj, SIM_Time time, SIM_Time timestep)
virtual ~GAS_DisturbFieldCL()
GLenum GLenum dst
Definition: glcorearb.h:1792
typedef int
Definition: png.h:1175
GET_DATA_FUNC_I("locality", Locality)
#define SIM_NAME_OPENCL
Definition: SIM_Names.h:221
const UT_JobInfo & info
GAS_DisturbFieldCL(const SIM_DataFactory *factory)
const GA_PointGroup SIM_Time timestep