HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GAS_ReduceLocal.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_ReduceLocal.h ( GAS Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GAS_ReduceLocal__
12 #define __GAS_ReduceLocal__
13 
14 #include "GAS_API.h"
15 
17 #include <UT/UT_VoxelArray.h>
18 #include <GU/GU_Detail.h>
19 
20 #include <SIM/SIM_RawField.h>
21 
22 #include "GAS_SubSolver.h"
23 #include "GAS_Utils.h"
24 
25 class GU_Detail;
26 
28 {
29 public:
30  GET_DATA_FUNC_S(GAS_NAME_FIELD, FieldName);
31  GETSET_DATA_FUNCS_F("radius", Radius);
32  GETSET_DATA_FUNCS_V3("voxelradius", VoxelRadius);
33  GET_DATA_FUNC_B("usevoxelradius", UseVoxelRadius);
34  GET_DATA_FUNC_B("opencl", UseOpenCL);
35  GET_DATA_FUNC_I("reduction", Reduce);
36  GET_DATA_FUNC_F("percentile", Percentile);
37  GET_DATA_FUNC_I("scaleby", ScaleBy);
38 
41 
42  // Reduce methods
44  {
45  REDUCE_MAX = 0,
50  REDUCE_MEDIAN, // Yeah, expensive :>
55  NUM_REDUCE
56  };
57  bool shouldMultiThread(UT_VoxelArrayF *field) const
58  {
59  return field->numTiles() > 1;
60  }
61 
62 protected:
63  explicit GAS_ReduceLocal(const SIM_DataFactory *factory);
64  ~GAS_ReduceLocal() override;
65 
66  /// Reduces fields by gathering local windows and applying the
67  /// reduction operator.
68  bool solveGasSubclass(SIM_Engine &engine,
69  SIM_Object *obj,
70  SIM_Time time,
71  SIM_Time timestep) override;
72 
73 
74  void doReduction(SIM_RawField *field, SIM_Time timestep);
75  void doReductionCL(SIM_RawField *field, SIM_Time timestep);
76 
77 private:
78  static const SIM_DopDescription *getDopDescription();
79 
83  "Gas Reduce Local",
84  getDopDescription());
85 };
86 
87 #endif
#define DECLARE_STANDARD_GETCASTTOTYPE()
Definition: SIM_DataUtils.h:50
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
#define GETSET_DATA_FUNCS_F(DataName, FuncName)
#define GETSET_DATA_FUNCS_V3(DataName, FuncName)
#define DECLARE_DATAFACTORY(DataClass, SuperClass, Description, DopParms)
Definition: SIM_DataUtils.h:63
#define GAS_NAME_FIELD
Definition: GAS_Utils.h:27
#define GET_DATA_FUNC_I(DataName, FuncName)
int numTiles() const
bool shouldMultiThread(UT_VoxelArrayF *field) const
#define GET_DATA_FUNC_B(DataName, FuncName)
#define GET_DATA_FUNC_F(DataName, FuncName)
#define GAS_NAME_TIMESCALE
Definition: GAS_Utils.h:40
#define GET_DATA_FUNC_S(DataName, FuncName)