HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GAS_Diffuse.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_Diffuse.h ( GAS Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GAS_Diffuse__
12 #define __GAS_Diffuse__
13 
14 #include "GAS_API.h"
15 
17 #include <GU/GU_Detail.h>
18 
19 #include "GAS_SubSolver.h"
20 #include "GAS_Utils.h"
21 
22 class GU_Detail;
23 class SIM_RawField;
24 class GAS_SPH;
25 
27 {
28 public:
29  GET_DATA_FUNC_S(GAS_NAME_FIELD, FieldName);
30  GETSET_DATA_FUNCS_F("diffuse", DiffuseRate);
31  GET_DATA_FUNC_F("cflcond", CFLCond);
32  GET_DATA_FUNC_I("maxiter", MaxIter);
33  GET_DATA_FUNC_I("miniter", MinIter);
34  GET_DATA_FUNC_B("relax", DoRelax);
36  GET_DATA_FUNC_S("attribute", Attribute);
37  GET_DATA_FUNC_I("attribtype", AttribType);
38 
41 
42  bool shouldMultiThread() { return true; }
43 
44 protected:
45  // Geometry attribute types
51  VECTOR
52  };
53 
54  explicit GAS_Diffuse(const SIM_DataFactory *factory);
55  virtual ~GAS_Diffuse();
56 
57  /// Diffuses scalar fields by moving along curvature or performing
58  /// relaxation steps.
59  virtual bool solveGasSubclass(SIM_Engine &engine,
60  SIM_Object *obj,
61  SIM_Time time,
62  SIM_Time timestep);
63 
64  /// Actual performs the diffusion on one specific field.
65  void doDiffuse(SIM_RawField *field,
66  SIM_Time timestep);
67 
68  /// Performs point attribute diffusion on a geometry field.
69  void doDiffuse(SIM_Object *obj, GU_Detail *gdp,
70  SIM_Time timestep,
71  const UT_String &attribname,
72  gas_AttribType type);
73 
74  /// Uses a CFL condition to calculate a diffusion timestep
75  /// based on the computed delta values.
77  const gas_AttribType type,
78  const int attribSize,
79  const UT_Vector4Array &deltas,
80  fpreal cflCond,
81  fpreal mindivstep,
82  fpreal maxdivstep,
83  fpreal timeleft);
84 
85  /// A multi-threaded function used to calculate the rate of
86  /// change of the given attribute value.
87  THREADED_METHOD7(GAS_Diffuse, shouldMultiThread(), computeDeltas,
88  const GU_Detail *, gdp,
89  const GAS_SPH &, sph,
90  UT_Vector4Array &, deltas,
91  const fpreal, diffuseRate,
92  const gas_AttribType, type,
93  const int, attribSize,
94  const UT_String &, attribName)
95  void computeDeltasPartial(const GU_Detail *gdp,
96  const GAS_SPH &sph,
97  UT_Vector4Array &deltas,
98  const fpreal diffuseRate,
100  const int attribSize,
101  const UT_String &attribName,
102  const UT_JobInfo &info);
103 
104  /// A multi-threaded function used to apply diffusion changes
105  /// to the given attribute value.
106  THREADED_METHOD6(GAS_Diffuse, shouldMultiThread(), applyDeltas,
107  GU_Detail *, gdp,
108  const UT_Vector4Array &, deltas,
109  const gas_AttribType, type,
110  const int, attribSize,
111  const UT_String &, attribName,
112  SIM_Time, timestep)
113  void applyDeltasPartial(GU_Detail *gdp,
114  const UT_Vector4Array &deltas,
115  const gas_AttribType type,
116  const int attribSize,
117  const UT_String &attribName,
118  SIM_Time timestep,
119  const UT_JobInfo &info);
120 
121 private:
122  static const SIM_DopDescription *getDopDescription();
123 
125  DECLARE_DATAFACTORY(GAS_Diffuse,
127  "Gas Diffuse",
128  getDopDescription());
129 };
130 
131 #endif
bool shouldMultiThread()
Definition: GAS_Diffuse.h:42
#define DECLARE_STANDARD_GETCASTTOTYPE()
Definition: SIM_DataUtils.h:45
#define THREADED_METHOD7(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2, PARMTYPE3, PARMNAME3, PARMTYPE4, PARMNAME4, PARMTYPE5, PARMNAME5, PARMTYPE6, PARMNAME6, PARMTYPE7, PARMNAME7)
#define GAS_NAME_GEOMETRY
Definition: GAS_Utils.h:28
#define GAS_NAME_USETIMESTEP
Definition: GAS_Utils.h:37
#define GAS_API
Definition: GAS_API.h:10
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
virtual bool solveGasSubclass(SIM_Engine &engine, SIM_Object *obj, SIM_Time time, SIM_Time timestep)=0
#define GETSET_DATA_FUNCS_F(DataName, FuncName)
fpreal calculateTimestep(SIM_Engine &engine, const SIM_VectorField *velocity, fpreal cflcond, UT_Vector3 *maxvel=0) const
#define DECLARE_DATAFACTORY(DataClass, SuperClass, Description, DopParms)
Definition: SIM_DataUtils.h:58
#define GAS_NAME_FIELD
Definition: GAS_Utils.h:25
#define GET_DATA_FUNC_I(DataName, FuncName)
double fpreal
Definition: SYS_Types.h:263
#define GET_DATA_FUNC_B(DataName, FuncName)
#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)
#define GAS_NAME_TIMESCALE
Definition: GAS_Utils.h:38
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
#define const
Definition: zconf.h:214
#define GET_DATA_FUNC_S(DataName, FuncName)