HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GAS_ProjectNonDivergentVariational.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_ProjectNonDivergentVariational.h ( GAS Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GAS_ProjectNonDivergentVariational_h__
12 #define __GAS_ProjectNonDivergentVariational_h__
13 
14 #include "GAS_SubSolver.h"
15 #include "GAS_Utils.h"
17 #include <SIM/SIM_RawIndexField.h>
18 
19 class SIM_VectorField;
20 class SIM_RawField;
21 class SIM_ScalarField;
22 class gas_VoxelIndex;
23 
24 template <typename T, bool colmajor, bool exint>
26 
28 {
29 public:
30  /// These macros are used to create the accessors
31  /// getFieldDstName and getFieldSrcName functions we'll use
32  /// to access our data options.
34  GET_DATA_FUNC_F("mindensity", MinDensity);
35  GET_DATA_FUNC_F("maxdensity", MaxDensity);
37  GET_DATA_FUNC_F("extrapdist", ExtrapolationDistance);
38  GET_DATA_FUNC_B("usepreconditioner", UsePreconditioner);
39  GET_DATA_FUNC_B(SIM_NAME_OPENCL, UseOpenCL);
40 
41  GET_DATA_FUNC_B("usemgpreconditioner", UseMGPreconditioner);
42 
43  GET_DATA_FUNC_B("usesharpcollisions", UseSharpCollisions);
44 
45  GET_DATA_FUNC_B("useoldpressure", UseOldPressure);
46 
47  GET_DATA_FUNC_S(GAS_NAME_TRACKERADDR, TrackerAddress);
50  GET_DATA_FUNC_I("slice", Slice);
51  GET_DATA_FUNC_I("numslice", NumSlice);
52 
53  GET_DATA_FUNC_B("airincompressibility", AirIncompressibility);
54  GET_DATA_FUNC_B("applyaircollisions", ApplyAirCollisions);
55  GET_DATA_FUNC_F("minairregionsize", MinAirRegionSize);
56 
57  GET_DATA_FUNC_F("waterline",Waterline);
58  GET_DATA_FUNC_B("usewaterline",UseWaterline);
59  GET_DATA_FUNC_V3("waterlinedirection",WaterlineDirection);
60 
63 
64 protected:
65  explicit GAS_ProjectNonDivergentVariational(const SIM_DataFactory *factory);
67 
68  /// The overloaded callback that GAS_SubSolver will invoke to
69  /// perform our actual computation. We are giving a single object
70  /// at a time to work on.
71  bool solveGasSubclass(SIM_Engine &engine,
72  SIM_Object *obj,
73  SIM_Time time,
74  SIM_Time timestep) override;
75 
76  void initializeSubclass() override;
77 
79  divergence.shouldMultiThread(),
80  computeDivergenceWeighted,
81  const SIM_VectorField *, velocity,
82  const SIM_VectorField *, collisionvel,
83  const SIM_RawField **, weights,
85  const SIM_RawIndexField &, index,
86  const bool, apply_smoothed_collision)
87 
88  void computeDivergenceWeightedPartial(const SIM_VectorField *velocity,
89  const SIM_VectorField *collisionvel,
90  const SIM_RawField *weights[3],
92  const SIM_RawIndexField &index,
93  const bool apply_smoothed_collision,
94  const UT_JobInfo &info);
95 
97  {
99  const SIM_RawField *weights[3];
100  const SIM_RawField *surfweights[3];
104 
107  SIM_BoundaryLine indexblines[3];
108  };
109 
111  surface.shouldMultiThread(),
112  classifyVoxels,
113  const classifyVoxelsParms &, parms,
114  const SIM_RawField &, surface);
115 
116  void classifyVoxelsPartial(
117  const classifyVoxelsParms &parms,
118  const SIM_RawField &surface,
119  const UT_JobInfo &info) const;
120 
121  exint buildIndex(const SIM_RawField &surface,
122  const SIM_RawField &collision,
123  const SIM_VectorField *velocity,
124  const SIM_RawField *weights[3],
125  const SIM_RawField *surfweights[3],
126  const SIM_RawIndexField *sliceindex,
127  int thisslice,
129  UT_Array<UT_Array<gas_VoxelIndex> *> &sliceoverflow,
130  UT_ExintArray &slicebase,
131  SIM_BoundaryLine indexblines[3]);
132 
134  {
144  int axis;
146  };
147 
149  applyPressureGradientFace,
150  const applyPressureParms &, parms,
151  SIM_RawField &, u);
152 
153  void applyPressureGradientFacePartial(
154  const applyPressureParms &parms,
155  SIM_RawField &u,
156  const UT_JobInfo &info) const;
157 
158 
160  {
168  SIM_BoundaryLine indexblines[3];
169  };
170 
171 
173  comp.shouldMultiThread(),
174  findOpenSurfaceCells,
175  const openSurfaceCellsParms &, parms,
176  const SIM_RawIndexField &, comp);
177 
178  void findOpenSurfaceCellsPartial(
179  const openSurfaceCellsParms & parms,
180  const SIM_RawIndexField & comp,
181  const UT_JobInfo &info) const;
182 
183  /// Solves the system using multigrid-preconditioned conjugate gradient.
184  /// This function reads all the fields and parameters itself.
185  template <typename SolveType>
186  bool solveUnsmoothMG(SIM_Object* obj, SIM_Time timestep);
187 
188 private:
189  /// We define this to be a DOP_Auto node which means we do not
190  /// need to implement a DOP_Node derivative for this data. Instead,
191  /// this description is used to define the interface.
192  static const SIM_DopDescription *getDopDescription();
193 
194  /// These macros are necessary to bind our node to the factory and
195  /// ensure useful constants like BaseClass are defined.
199  "Gas Project Non Divergent Variational",
200  getDopDescription());
201 
202 };
203 
204 
205 #endif
206 
#define DECLARE_STANDARD_GETCASTTOTYPE()
Definition: SIM_DataUtils.h:50
#define SIM_NAME_TOLERANCE
Definition: SIM_Names.h:202
#define GET_DATA_FUNC_V3(DataName, FuncName)
GT_API const UT_StringHolder time
#define GAS_NAME_USETIMESTEP
Definition: GAS_Utils.h:39
#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 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)
#define GAS_NAME_TRACKERADDR
Definition: GAS_Utils.h:43
#define THREADED_METHOD2(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2)
#define GAS_NAME_TRACKERPORT
Definition: GAS_Utils.h:44
#define THREADED_METHOD2_CONST(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2)
#define GAS_NAME_JOBNAME
Definition: GAS_Utils.h:45
fpreal64 fpreal
Definition: SYS_Types.h:277
#define GET_DATA_FUNC_B(DataName, FuncName)
GLuint index
Definition: glcorearb.h:786
#define GET_DATA_FUNC_F(DataName, FuncName)
#define THREADED_METHOD6(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2, PARMTYPE3, PARMNAME3, PARMTYPE4, PARMNAME4, PARMTYPE5, PARMNAME5, PARMTYPE6, PARMNAME6)
This class holds a three dimensional scalar field.
#define SIM_NAME_OPENCL
Definition: SIM_Names.h:222
#define GAS_NAME_TIMESCALE
Definition: GAS_Utils.h:40
VectorToScalarConverter< GridType >::Type::Ptr divergence(const GridType &grid, bool threaded, InterruptT *interrupt)
Compute the divergence of the given vector-valued grid.
This class holds a three dimensional vector field.
#define GET_DATA_FUNC_S(DataName, FuncName)
virtual void initializeSubclass()