HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GAS_EnforceBoundary.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_EnforceBoundary.h ( GAS Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GAS_EnforceBoundary__
12 #define __GAS_EnforceBoundary__
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_VectorField;
24 class SIM_IndexField;
25 
27 {
28 public:
29  GET_DATA_FUNC_S(GAS_NAME_FIELD, FieldName);
30  GET_DATA_FUNC_S(GAS_NAME_COLLISION, CollisionName);
31  GET_DATA_FUNC_S(GAS_NAME_COLLISIONVALUE, CollisionValueName);
32  GET_DATA_FUNC_S("boundaryvalue", BoundaryValueName);
33  GET_DATA_FUNC_B("velocityenforce", VelocityEnforce);
34  GET_DATA_FUNC_I("veltype", VelocityType);
35  GET_DATA_FUNC_B("usephysparms", UsePhysParms);
36  GET_DATA_FUNC_B("variational", Variational);
37  GET_DATA_FUNC_F("bandwidth", Bandwidth);
38  GET_DATA_FUNC_B("forbidinterference", ForbidInterference);
39  GET_DATA_FUNC_B(SIM_NAME_OPENCL, UseOpenCL);
40 
41  GET_DATA_FUNC_B("usewaterline", UseWaterline);
42  GET_DATA_FUNC_F("waterline",Waterline);
43  GET_DATA_FUNC_V3("waterlinedirection",WaterlineDirection);
44 
45 
46  /// Returns the friction of the system at the given world position.
47  void calculatePhysParms(const UT_Vector3 &pos,
48  fpreal &bounce,
49  fpreal &friction, fpreal &dynfriction);
50 
51  /// Returns the velocity of the collision object at the given
52  /// world pos
53  UT_Vector3 calculateVelocity(const UT_Vector3 &pos);
54 
55 protected:
56  explicit GAS_EnforceBoundary(const SIM_DataFactory *factory);
57  virtual ~GAS_EnforceBoundary();
58 
59  /// Moves the fields given by FieldName by the given velocity
60  /// field. Moves the points given by GeometryName likewise.
61  virtual bool solveGasSubclass(SIM_Engine &engine,
62  SIM_Object *obj,
63  SIM_Time time,
64  SIM_Time timestep);
65  /// Runs the enforcement on the OpenCL device
66  virtual bool enforceBoundaryCL(SIM_Engine &engine,
67  SIM_Object *obj,
68  SIM_Time time,
69  SIM_Time timestep);
70 
71  void enforceVelBoundary(SIM_Engine &engine,
72  SIM_Object *obj,
73  SIM_VectorField *vectorfield,
74  const SIM_Position *pos,
75  const SIM_ScalarField *collision,
76  const SIM_VectorField *collsionval,
77  const SIM_IndexField *colindexfield,
78  const SIM_BoundaryLine &worldbline = SIM_BoundaryLine());
79 
80 private:
81  static const SIM_DopDescription *getDopDescription();
82 
83  bool myUsePhysParms;
84  SIM_Object *myObject;
85  SIM_Engine *myEngine;
86  const SIM_VectorField *myCollisionVel;
87  const SIM_IndexField *myCollisionIndex;
88  bool myVelUseSDF, myVelUsePoint;
89  bool myToWorldIdentity;
90  UT_DMatrix4 myToWorld;
91 
95  "Gas Enforce Boundary",
96  getDopDescription());
97 };
98 
99 #endif
#define DECLARE_STANDARD_GETCASTTOTYPE()
Definition: SIM_DataUtils.h:45
#define GET_DATA_FUNC_V3(DataName, FuncName)
#define GAS_API
Definition: GAS_API.h:10
#define GAS_NAME_COLLISION
Definition: GAS_Utils.h:19
virtual bool solveGasSubclass(SIM_Engine &engine, SIM_Object *obj, SIM_Time time, SIM_Time timestep)=0
This class holds a three dimensional scalar field.
#define DECLARE_DATAFACTORY(DataClass, SuperClass, Description, DopParms)
Definition: SIM_DataUtils.h:58
#define GAS_NAME_COLLISIONVALUE
Definition: GAS_Utils.h:20
#define GAS_NAME_FIELD
Definition: GAS_Utils.h:25
#define GET_DATA_FUNC_I(DataName, FuncName)
double fpreal
Definition: SYS_Types.h:269
#define GET_DATA_FUNC_B(DataName, FuncName)
#define GET_DATA_FUNC_F(DataName, FuncName)
This class holds a three dimensional scalar field.
#define SIM_NAME_OPENCL
Definition: SIM_Names.h:221
This class holds a three dimensional vector field.
#define GET_DATA_FUNC_S(DataName, FuncName)