HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GAS_BuildOccupancyMask.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_BuildOccupancyMask.h ( GAS Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GAS_BuildOccupancyMask__
12 #define __GAS_BuildOccupancyMask__
13 
14 #include "GAS_SubSolver.h"
15 #include "GAS_Utils.h"
16 
17 /// Builds an occupancy mask out of a set of fields. Voxel is considered
18 /// occupied if its value is larger than 0 for at least one of the source
19 /// fields. Output field's voxels are set to 1 if occupied and 0 otherwise.
21 {
22 public:
23  GET_DATA_FUNC_S("mask", MaskField);
24 
25  GET_DATA_FUNC_S("resetfields", FieldsToReset);
26  GET_DATA_FUNC_I("resetrule", ResetRule);
27 
28  GET_DATA_FUNC_B("fulltiles", FillTiles);
29  GET_DATA_FUNC_I("expansionpasses", ExpansionPasses);
30 
31  GET_DATA_FUNC_S(GAS_NAME_VELOCITY, VelocityName);
32 
33  GET_DATA_FUNC_B("directional", DirectionalExpansions);
34  GET_DATA_FUNC_F("padding", Padding);
35  GET_DATA_FUNC_B("enablemaxpadding", ClampPadding);
36  GET_DATA_FUNC_F("maxpadding", MaxPadding);
37  GET_DATA_FUNC_F("dirrate", DirectionalRate);
38  GET_DATA_FUNC_F("tangrate", TangentialRate);
39 
40  GET_DATA_FUNC_B("streakvel", StreakVelocity);
41  GET_DATA_FUNC_F("streakfalloff", StreakFalloff);
42  GET_DATA_FUNC_F("streakwidth", StreakBlendwidth);
43 
44 protected:
45  explicit GAS_BuildOccupancyMask(const SIM_DataFactory* factory);
46  ~GAS_BuildOccupancyMask() override;
47 
48  /// Builds the occupancy field for the given source fields.
49  bool solveGasSubclass(SIM_Engine& engine,
50  SIM_Object* obj,
51  SIM_Time time,
52  SIM_Time timestep) override;
53 
54  /// Given two matching stencil, finds the areas that need to be reset in
55  /// accordance to the given rule.
56  THREADED_METHOD3_CONST(GAS_BuildOccupancyMask, src1->numTiles() > 64,
57  findResetAreas,
58  UT_VoxelArrayF*, src1,
59  const UT_VoxelArrayF*, src0,
60  int, rule);
61  void findResetAreasPartial(UT_VoxelArrayF* src1,
62  const UT_VoxelArrayF* src0,
63  int resetRule,
64  const UT_JobInfo& info) const;
65 
66  /// Resets the values of all aligned and unaligned fields to their border
67  /// value in the areas where the mask is greater than a half.
69  resetFields,
70  const SIM_RawField*, mask,
71  const UT_Array<const SIM_RawField*>&, aligned,
72  const UT_Array<const SIM_RawField*>&, unaligned);
73  void resetFieldsPartial(const SIM_RawField* mask,
74  const UT_Array<const SIM_RawField*>& aligned,
75  const UT_Array<const SIM_RawField*>& unaligned,
76  const UT_JobInfo& info) const;
77 
78  /// Performs the work of finding occupied voxels in fine mode (voxels can
79  /// be individually occupied).
81  calculateMaskFine,
82  UT_VoxelArrayF*, destination,
83  const SIM_RawField*, mask,
84  const UT_Array<const SIM_RawField*>&, aligned,
85  const UT_Array<const SIM_RawField*>&, unaligned,
86  bool, compress);
87  void calculateMaskFinePartial(UT_VoxelArrayF* destination,
88  const SIM_RawField* maskField,
89  const UT_Array<const SIM_RawField*>& aligned,
90  const UT_Array<const SIM_RawField*>& unaligned,
91  bool compress,
92  const UT_JobInfo& info) const;
93 
94  /// Performs the work of finding occupied voxels in tiled mode (the entire
95  /// tile is set to active if one of its voxels is occupied).
97  calculateMaskFilled,
98  UT_VoxelArrayF*, destination,
99  const SIM_RawField*, mask,
100  const UT_Array<const SIM_RawField*>&, aligned,
101  const UT_Array<const SIM_RawField*>&, unaligned);
102  void calculateMaskFilledPartial(UT_VoxelArrayF* destination,
103  const SIM_RawField* mask,
104  const UT_Array<const SIM_RawField*>& aligned,
105  const UT_Array<const SIM_RawField*>& unaligned,
106  const UT_JobInfo& info) const;
107 
108  /// Does a single step of expansion on the given source field, putting the
109  /// results into the destination field. Can also shrink the occupied area.
110  /// This version works in fine mode.
112  expandFine,
114  const UT_VoxelArrayF*, src,
115  bool, shrink,
116  bool, compress);
117  void expandFinePartial(UT_VoxelArrayF* dst, const UT_VoxelArrayF* src,
118  bool shrink, bool compress,
119  const UT_JobInfo& info) const;
120 
121  /// Does a single step of expansion on the given source field, putting the
122  /// results into the destination field. Can also shrink the occupied area.
123  /// This version works in tiled mode.
125  expandFilled,
127  const UT_VoxelArrayF*, src,
128  bool, shrink);
129  void expandFilledPartial(UT_VoxelArrayF* dst, const UT_VoxelArrayF* src,
130  bool shrink, const UT_JobInfo& info) const;
131 
132 private:
133  static const SIM_DopDescription* getDopDescription();
134 
138  "Gas Occupancy Mask",
139  getDopDescription());
140 };
141 
142 #endif
143 
#define DECLARE_STANDARD_GETCASTTOTYPE()
Definition: SIM_DataUtils.h:50
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
#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
virtual bool solveGasSubclass(SIM_Engine &engine, SIM_Object *obj, SIM_Time time, SIM_Time timestep)=0
bool shouldMultiThread() const
Returns true if this should be multithreaded.
Definition: SIM_RawField.h:151
#define THREADED_METHOD5_CONST(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2, PARMTYPE3, PARMNAME3, PARMTYPE4, PARMNAME4, PARMTYPE5, PARMNAME5)
#define GAS_NAME_VELOCITY
Definition: GAS_Utils.h:42
#define DECLARE_DATAFACTORY(DataClass, SuperClass, Description, DopParms)
Definition: SIM_DataUtils.h:63
#define GET_DATA_FUNC_I(DataName, FuncName)
int numTiles() const
GLint GLuint mask
Definition: glcorearb.h:124
GLenum GLenum dst
Definition: glcorearb.h:1793
#define GET_DATA_FUNC_B(DataName, FuncName)
#define GET_DATA_FUNC_F(DataName, FuncName)
#define THREADED_METHOD3_CONST(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2, PARMTYPE3, PARMNAME3)
#define GET_DATA_FUNC_S(DataName, FuncName)
GLenum src
Definition: glcorearb.h:1793