HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GAS_Reduce.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_Reduce.h ( GAS Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GAS_Reduce__
12 #define __GAS_Reduce__
13 
14 #include "GAS_API.h"
15 
17 #include <GU/GU_Detail.h>
18 #include <GA/GA_SplittableRange.h>
19 
20 #include <SIM/SIM_RawField.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_S(GAS_NAME_FIELDDEST, FieldDstName);
35  GET_DATA_FUNC_S(GAS_NAME_GEOMETRY, GeometryName);
36  GET_DATA_FUNC_S("optionpath", OptionName);
37  GET_DATA_FUNC_B("createattrib", CreateAttrib);
38 
39  GET_DATA_FUNC_I("reduction", Reduce);
40  GET_DATA_FUNC_I("scaleby", ScaleBy);
41  GET_DATA_FUNC_F("percentile", Percentile);
42  GET_DATA_FUNC_B("maskissdf", MaskIsSDF);
43 
44  // Reduce methods
46  {
47  REDUCE_MAX = 0,
52  REDUCE_PERCENTILE, // Yeah, expensive :>
57  NUM_REDUCE
58  };
59 
60 protected:
61  explicit GAS_Reduce(const SIM_DataFactory *factory);
62  ~GAS_Reduce() override;
63 
64  bool solveGasSubclass(SIM_Engine &engine,
65  SIM_Object *obj,
66  SIM_Time time,
67  SIM_Time timestep) override;
68 
69  fpreal reduceVal(const SIM_RawField *src,
70  const SIM_RawField *maskfield);
71  fpreal reduceValCL(const SIM_RawField *src,
72  const SIM_RawField *maskfield);
73  void doReduce(SIM_RawField *dest,
74  const SIM_RawField *src,
75  const SIM_RawField *maskfield);
76 
77  fpreal reduceVal(const GA_SplittableRange &range,
78  const GA_Attribute *src,
79  int comp,
80  REDUCTION_NAMES op);
81 
82  bool reduceGeoToAttribute(SIM_Object *obj,
83  SIM_GeometryCopy *geo,
84  const UT_String &srcname,
85  const UT_String &dstname);
86 
87  bool reduceGeoToOptions(SIM_Object *obj,
88  SIM_GeometryCopy *geo,
89  const UT_String &srcname,
90  const UT_String &optionpath);
91 
92 private:
93  static const SIM_DopDescription *getDopDescription();
94 
95 
99  "Gas Reduce",
100  getDopDescription());
101 
102  // Cache our timestep for so we can calculate the timescale
103  // effects.
104  float myTimeStep;
105 
106  bool getUseOpenCL();
107 };
108 
109 #endif
#define DECLARE_STANDARD_GETCASTTOTYPE()
Definition: SIM_DataUtils.h:50
Definition of a geometry attribute.
Definition: GA_Attribute.h:198
GLenum GLint * range
Definition: glcorearb.h:1925
#define GAS_NAME_GEOMETRY
Definition: GAS_Utils.h:30
GT_API const UT_StringHolder time
#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:63
#define GET_DATA_FUNC_I(DataName, FuncName)
#define GAS_NAME_FIELDSOURCE
Definition: GAS_Utils.h:29
#define GAS_NAME_FIELDDEST
Definition: GAS_Utils.h:28
This class holds a three dimensional tensor field.
fpreal64 fpreal
Definition: SYS_Types.h:277
#define GET_DATA_FUNC_B(DataName, FuncName)
#define GET_DATA_FUNC_F(DataName, FuncName)
This class holds a three dimensional scalar field.
This class holds a three dimensional vector field.
#define GET_DATA_FUNC_S(DataName, FuncName)
GLenum src
Definition: glcorearb.h:1793
This implements a SIM_Geometry that copies the source geometry.