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  GET_DATA_FUNC_S("resetfields", FieldsToReset);
25  GET_DATA_FUNC_B("fulltiles", FillTiles);
26  GET_DATA_FUNC_I("expansionpasses", ExpansionPasses);
27  GET_DATA_FUNC_I("resetrule", ResetRule);
28 
29 protected:
30  explicit GAS_BuildOccupancyMask(const SIM_DataFactory* factory);
31  ~GAS_BuildOccupancyMask() override;
32 
33  /// Builds the occupancy field for the given source fields.
34  bool solveGasSubclass(SIM_Engine& engine,
35  SIM_Object* obj,
36  SIM_Time time,
37  SIM_Time timestep) override;
38 
39  /// Given two matching stencil, finds the areas that need to be reset in
40  /// accordance to the given rule.
41  THREADED_METHOD3_CONST(GAS_BuildOccupancyMask, src1->numTiles() > 64,
42  findResetAreas,
43  UT_VoxelArrayF*, src1,
44  const UT_VoxelArrayF*, src0,
45  int, rule);
46  void findResetAreasPartial(UT_VoxelArrayF* src1,
47  const UT_VoxelArrayF* src0,
48  int resetRule,
49  const UT_JobInfo& info) const;
50 
51  /// Resets the values of all aligned and unaligned fields to their border
52  /// value in the areas where the mask is greater than a half.
54  resetFields,
55  const SIM_RawField*, mask,
56  const UT_Array<SIM_RawField*>&, aligned,
57  const UT_Array<SIM_RawField*>&, unaligned);
58  void resetFieldsPartial(const SIM_RawField* mask,
59  const UT_Array<SIM_RawField*>& aligned,
60  const UT_Array<SIM_RawField*>& unaligned,
61  const UT_JobInfo& info) const;
62 
63  /// Performs the work of finding occupied voxels in fine mode (voxels can
64  /// be individually occupied).
66  calculateMaskFine,
67  UT_VoxelArrayF*, destination,
68  const SIM_RawField*, mask,
69  const UT_Array<SIM_RawField*>&, aligned,
70  const UT_Array<SIM_RawField*>&, unaligned,
71  bool, compress);
72  void calculateMaskFinePartial(UT_VoxelArrayF* destination,
73  const SIM_RawField* maskField,
74  const UT_Array<SIM_RawField*>& aligned,
75  const UT_Array<SIM_RawField*>& unaligned,
76  bool compress,
77  const UT_JobInfo& info) const;
78 
79  /// Performs the work of finding occupied voxels in tiled mode (the entire
80  /// tile is set to active if one of its voxels is occupied).
82  calculateMaskFilled,
83  UT_VoxelArrayF*, destination,
84  const SIM_RawField*, mask,
85  const UT_Array<SIM_RawField*>&, aligned,
86  const UT_Array<SIM_RawField*>&, unaligned);
87  void calculateMaskFilledPartial(UT_VoxelArrayF* destination,
88  const SIM_RawField* mask,
89  const UT_Array<SIM_RawField*>& aligned,
90  const UT_Array<SIM_RawField*>& unaligned,
91  const UT_JobInfo& info) const;
92 
93  /// Does a single step of expansion on the given source field, putting the
94  /// results into the destination field. Can also shrink the occupied area.
95  /// This version works in fine mode.
97  expandFine,
99  const UT_VoxelArrayF*, src,
100  bool, shrink,
101  bool, compress);
102  void expandFinePartial(UT_VoxelArrayF* dst, const UT_VoxelArrayF* src,
103  bool shrink, bool compress,
104  const UT_JobInfo& info) const;
105 
106  /// Does a single step of expansion on the given source field, putting the
107  /// results into the destination field. Can also shrink the occupied area.
108  /// This version works in tiled mode.
110  expandFilled,
112  const UT_VoxelArrayF*, src,
113  bool, shrink);
114  void expandFilledPartial(UT_VoxelArrayF* dst, const UT_VoxelArrayF* src,
115  bool shrink, const UT_JobInfo& info) const;
116 
117 private:
118  static const SIM_DopDescription* getDopDescription();
119 
123  "Gas Occupancy Mask",
124  getDopDescription());
125 };
126 
127 #endif
128 
#define DECLARE_STANDARD_GETCASTTOTYPE()
Definition: SIM_DataUtils.h:45
#define THREADED_METHOD4_CONST(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2, PARMTYPE3, PARMNAME3, PARMTYPE4, PARMNAME4)
GLenum src
Definition: glew.h:2410
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
GLhandleARB obj
Definition: glew.h:6236
GLenum GLint GLuint mask
Definition: glew.h:1845
bool shouldMultiThread() const
Returns true if this should be multithreaded.
Definition: SIM_RawField.h:149
#define THREADED_METHOD5_CONST(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2, PARMTYPE3, PARMNAME3, PARMTYPE4, PARMNAME4, PARMTYPE5, PARMNAME5)
#define DECLARE_DATAFACTORY(DataClass, SuperClass, Description, DopParms)
Definition: SIM_DataUtils.h:58
#define GET_DATA_FUNC_I(DataName, FuncName)
int numTiles() const
GLenum GLenum dst
Definition: glew.h:2410
typedef int(WINAPI *PFNWGLRELEASEPBUFFERDCARBPROC)(HPBUFFERARB hPbuffer
#define GET_DATA_FUNC_B(DataName, FuncName)
#define THREADED_METHOD3_CONST(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2, PARMTYPE3, PARMNAME3)
#define GET_DATA_FUNC_S(DataName, FuncName)