HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GAS_FilterHourglassModes.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_FilterHourglassModes.h ( GAS Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GAS_FilterHourglassModes__
12 #define __GAS_FilterHourglassModes__
13 
14 #include "GAS_SubSolver.h"
15 #include "GAS_Utils.h"
16 #include <SIM/SIM_VectorField.h>
17 
18 /// Filters spurious hourglass modes that are left behind when corner-sampled
19 /// pressure projection is performed on a centre-sampled velocity field. Thus,
20 /// this node only operates on collocated vector fields.
22 {
23 public:
24  GET_DATA_FUNC_S(GAS_NAME_FIELD, FieldName);
25  GET_DATA_FUNC_S(GAS_NAME_STENCIL, StencilName);
26  GET_DATA_FUNC_B("scalebydiv", ScaleByDivergence);
27  GET_DATA_FUNC_F("divscale", DivergenceScale);
28  GET_DATA_FUNC_B("relativediv", DivIsRelative);
29  GET_DATA_FUNC_F("amount", Amount);
30  GET_DATA_FUNC_S("divscalefield", DivScaleField);
31 
32 protected:
33  explicit GAS_FilterHourglassModes(const SIM_DataFactory* factory);
34  ~GAS_FilterHourglassModes() override;
35 
36  /// Filters hourglass modes for the supplied fields.
37  bool solveGasSubclass(SIM_Engine& engine,
38  SIM_Object* obj,
39  SIM_Time time,
40  SIM_Time timestep) override;
41 
42  /// Processes a single field.
43  void filterField(UT_VoxelArrayF temp[3], SIM_VectorField* field,
44  const SIM_RawField* stencil,
45  SIM_RawField* divscale,
46  float amount, float divcoeff, bool reldiv) const;
47 
48  /// Calculates the sum of fourth order derivatives (xxxx, yyyy, zzzz) for
49  /// the given vector field (per component), storing the results in output
50  /// voxel arrays; the values will be multiplied by amount.
51  /// If divcoeff is greater than 0, the results will also be scaled by the
52  /// ratio of divergence (times divcoeff) to max vector component in each
53  /// voxel.
54  /// If a stencil field is provided, only areas where its value is greater
55  /// than 0.5 will have the derivatives computed; if the stencil is not
56  /// aligned with src, then areas where stencil is no greater than 0.5 will
57  /// be set to 0 in the destination arrays.
58  /// The incoming vector field must have collocated components.
60  in.getField(0)->shouldMultiThread(),
61  scaledFourthOrderDer,
62  UT_VoxelArrayF*, out,
63  const SIM_VectorField&, in,
64  const SIM_RawField*, stencil,
65  SIM_RawField*, divscale,
66  float, amount, float, difcoeff,
67  bool, reldiv);
68  void scaledFourthOrderDerPartial(UT_VoxelArrayF out[3],
69  const SIM_VectorField& in,
70  const SIM_RawField* stencil,
71  SIM_RawField* divscale,
72  float amount, float divcoeff,
73  bool reldiv, const UT_JobInfo& info) const;
74 
75  /// Adds contents of der to field. If a matching stencil is passed in, work
76  /// will only be performed where its values are greater than 0.5.
77  THREADED_METHOD3_CONST(GAS_FilterHourglassModes, field.shouldMultiThread(),
78  addDerivative,
79  const UT_VoxelArrayF&, der,
80  SIM_RawField&, field,
81  const SIM_RawField*, stencil);
82  void addDerivativePartial(const UT_VoxelArrayF& der,
83  SIM_RawField& field,
84  const SIM_RawField* stencil,
85  const UT_JobInfo& info) const;
86 
87 private:
88  static const SIM_DopDescription* getDopDescription();
89 
93  "Gas Filter Hourglass Modes",
94  getDopDescription());
95 };
96 
97 #endif
98 
#define DECLARE_STANDARD_GETCASTTOTYPE()
Definition: SIM_DataUtils.h:50
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 GAS_NAME_FIELD
Definition: GAS_Utils.h:27
#define THREADED_METHOD7_CONST(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2, PARMTYPE3, PARMNAME3, PARMTYPE4, PARMNAME4, PARMTYPE5, PARMNAME5, PARMTYPE6, PARMNAME6, PARMTYPE7, PARMNAME7)
#define GET_DATA_FUNC_B(DataName, FuncName)
#define GET_DATA_FUNC_F(DataName, FuncName)
GLint GLfloat GLint stencil
Definition: glcorearb.h:1278
#define THREADED_METHOD3_CONST(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2, PARMTYPE3, PARMNAME3)
This class holds a three dimensional vector field.
#define GET_DATA_FUNC_S(DataName, FuncName)
#define GAS_NAME_STENCIL
Definition: GAS_Utils.h:19