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 #include <CE/CE_Vector.h>
27 
28 class SIM_ScalarField;
29 class SIM_VectorField;
30 class SIM_MatrixField;
31 
33 {
34 public:
35  GET_DATA_FUNC_S(GAS_NAME_FIELDDEST, FieldDstName);
37  GET_DATA_FUNC_S(GAS_NAME_GEOMETRY, GeometryName);
38  GET_DATA_FUNC_S("optionpath", OptionName);
39  GET_DATA_FUNC_B("createattrib", CreateAttrib);
40 
41  GET_DATA_FUNC_I("reduction", Reduce);
42  GET_DATA_FUNC_I("scaleby", ScaleBy);
43  GET_DATA_FUNC_F("percentile", Percentile);
44  GET_DATA_FUNC_B("maskissdf", MaskIsSDF);
45 
46  // Reduce methods
48  {
49  REDUCE_MAX = 0,
54  REDUCE_PERCENTILE, // Yeah, expensive :>
59  NUM_REDUCE
60  };
61 
62 protected:
63  explicit GAS_Reduce(const SIM_DataFactory *factory);
64  ~GAS_Reduce() override;
65 
66  bool solveGasSubclass(SIM_Engine &engine,
67  SIM_Object *obj,
68  SIM_Time time,
69  SIM_Time timestep) override;
70 
71  fpreal reduceVal(const SIM_RawField *src,
72  const SIM_RawField *maskfield);
73  fpreal reduceValCL(const SIM_RawField *src,
74  const SIM_RawField *maskfield);
75  void doReduce(SIM_RawField *dest,
76  const SIM_RawField *src,
77  const SIM_RawField *maskfield);
78 
79  fpreal reduceVal(const GA_SplittableRange &range,
80  const GA_Attribute *src,
81  int comp,
82  REDUCTION_NAMES op);
83  template <typename T>
84  fpreal64 reduceValCL(const CE_VectorT<T> &v,
85  int comp,
86  REDUCTION_NAMES op);
87 
88  bool reduceGeoToAttribute(SIM_Object *obj,
89  SIM_GeometryCopy *geo,
90  const UT_String &srcname,
91  const UT_String &dstname);
92  bool reduceGeoToAttributeCL(SIM_Object *obj,
93  SIM_GeometryCopy *geo,
94  const UT_String &srcname,
95  const UT_String &dstname);
96 
97  bool reduceGeoToOptions(SIM_Object *obj,
98  SIM_GeometryCopy *geo,
99  const UT_String &srcname,
100  const UT_String &optionpath);
101  bool reduceGeoToOptionsCL(SIM_Object *obj,
102  SIM_GeometryCopy *geo,
103  const UT_String &srcname,
104  const UT_String &optionpath);
105 
106  template <typename T>
107  T reduceWithCEVector(GA_CEAttribute *ce_attrib,
108  REDUCTION_NAMES reduceop,
109  int comp,
110  int tuplesize,
111  exint npts);
112 
113 private:
114  static const SIM_DopDescription *getDopDescription();
115 
116 
120  "Gas Reduce",
121  getDopDescription());
122 
123  // Cache our timestep for so we can calculate the timescale
124  // effects.
125  float myTimeStep;
126 
127  bool getUseOpenCL();
128 };
129 
130 #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
const GLdouble * v
Definition: glcorearb.h:837
#define GAS_API
Definition: GAS_API.h:10
int64 exint
Definition: SYS_Types.h:125
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
double fpreal64
Definition: SYS_Types.h:201
#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.