HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GAS_ExternalForces.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_ExternalForces.h ( GAS Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GAS_ExternalForces__
12 #define __GAS_ExternalForces__
13 
14 #include "GAS_API.h"
15 
16 #include <SIM/SIM_VectorField.h>
17 #include "GAS_SubSolver.h"
18 #include "GAS_Utils.h"
19 
20 class SIM_ForceResolver;
21 
23 {
24 public:
25  GET_DATA_FUNC_S(GAS_NAME_SURFACE, SurfaceName);
26  GET_DATA_FUNC_S(GAS_NAME_DENSITY, DensityName);
27  GET_DATA_FUNC_S(GAS_NAME_VELOCITY, VelocityName);
28  GET_DATA_FUNC_S(GAS_NAME_STENCIL, StencilName);
29  GET_DATA_FUNC_S(GAS_NAME_GEOMETRY, GeometryName);
30  GET_DATA_FUNC_S(GAS_NAME_PTGROUP, PointGroupName);
31  GET_DATA_FUNC_S("forcenames", ForceNames);
32  GET_DATA_FUNC_B("scalebysurface", ScaleBySurface);
33  GET_DATA_FUNC_B("scalebydensity", ScaleByDensity);
34  GET_DATA_FUNC_I("scaletype", ScaleType);
35  GET_DATA_FUNC_B("computev", ComputeVelocity);
36  GET_DATA_FUNC_B("stabledrag", StableDrag);
37 
40 
41  // Different ways of scaling the forces. Needed so that forces
42  // can be scaled using density rather than mass in SPH simulations.
43  enum ScaleMethod {
47  };
48 
49 protected:
50  explicit GAS_ExternalForces(const SIM_DataFactory *factory);
51  ~GAS_ExternalForces() override;
52 
53  /// Adds to the velocity field the effect of all forces at that point.
54  /// Unit density is currently assumed.
55  /// Only incorpreates the external simulation forces. Internal
56  /// gas forces are handled elsewher.
57  bool solveGasSubclass(SIM_Engine &engine,
58  SIM_Object *obj,
59  SIM_Time time,
60  SIM_Time timestep) override;
61 
62 protected:
63  void applyForcesToField(SIM_Object *obj,
64  const SIM_ConstDataArray &forces,
65  SIM_VectorField *velocity,
66  const SIM_ScalarField *stencil,
67  const SIM_ScalarField *surface,
68  const SIM_ScalarField *density,
69  SIM_Time timestep);
70 
71  struct applyParms
72  {
77  SIM_RawField *vel[3];
82  };
83 
84  THREADED_METHOD2(GAS_ExternalForces, parms.velocity->getXField()->shouldMultiThread(),
85  applyForceResolversToField,
86  const applyParms &, parms,
87  const UT_ValArray<SIM_ForceResolver *> &, forceresolvers)
88  void applyForceResolversToFieldPartial(
89  const applyParms &parms,
90  const UT_ValArray<SIM_ForceResolver *> &forceresolvers,
91  const UT_JobInfo &info);
92 
93 
94  void applyForcesToGeo(SIM_Object *obj,
95  const SIM_ConstDataArray &forces,
96  GU_Detail *gdp,
97  const GA_PointGroup *ptgrp,
98  SIM_Time timestep);
99 
100  THREADED_METHOD5(GAS_ExternalForces, gdp->getNumPoints() > 2048,
101  applyForceResolversToGeo,
102  SIM_Object *, obj,
103  GU_Detail *, gdp,
104  const GA_PointGroup *, ptgrp,
106  const UT_ValArray<SIM_ForceResolver *> &, forceresolvers)
107  void applyForceResolversToGeoPartial(SIM_Object *obj,
108  GU_Detail *gdp,
109  const GA_PointGroup *ptgrp,
110  SIM_Time timestep,
111  const UT_ValArray<SIM_ForceResolver *> &forceresolvers,
112  const UT_JobInfo &info);
113 
115  parms.velocity->getXField()->shouldMultiThread(),
116  addBackField,
117  const applyParms &, parms,
118  int, axis);
119  void addBackFieldPartial(const applyParms &parms,
120  int axis,
121  const UT_JobInfo &info);
122 
123 private:
124  static const SIM_DopDescription *getDopDescription();
125 
129  "Gas External Forces",
130  getDopDescription());
131 };
132 
133 #endif
134 
#define DECLARE_STANDARD_GETCASTTOTYPE()
Definition: SIM_DataUtils.h:50
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
const GA_PointGroup * ptgrp
#define GAS_NAME_GEOMETRY
Definition: GAS_Utils.h:30
GT_API const UT_StringHolder time
#define GAS_NAME_USETIMESTEP
Definition: GAS_Utils.h:39
#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 GAS_NAME_DENSITY
Definition: GAS_Utils.h:25
#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 THREADED_METHOD2(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2)
#define THREADED_METHOD5(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2, PARMTYPE3, PARMNAME3, PARMTYPE4, PARMNAME4, PARMTYPE5, PARMNAME5)
#define GET_DATA_FUNC_B(DataName, FuncName)
#define GET_DATA_FUNC_F(DataName, FuncName)
This class holds a three dimensional scalar field.
#define GAS_NAME_TIMESCALE
Definition: GAS_Utils.h:40
#define GAS_NAME_PTGROUP
Definition: GAS_Utils.h:34
GLint GLfloat GLint stencil
Definition: glcorearb.h:1278
#define GAS_NAME_SURFACE
Definition: GAS_Utils.h:38
This class holds a three dimensional vector field.
#define GET_DATA_FUNC_S(DataName, FuncName)
#define GAS_NAME_STENCIL
Definition: GAS_Utils.h:19
const GA_PointGroup SIM_Time timestep