HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GAS_Advect.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_Advect.h ( GAS Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GAS_Advect__
12 #define __GAS_Advect__
13 
14 #include "GAS_API.h"
15 
16 #include <UT/UT_ValArray.h>
18 
19 #include <GU/GU_Detail.h>
20 
21 #include "GAS_SubSolver.h"
22 #include "GAS_Utils.h"
23 
24 class GAS_SPH;
25 class GU_Detail;
26 class SIM_VectorField;
27 class UT_Lock;
28 
30 {
31 public:
32  GET_DATA_FUNC_S(GAS_NAME_FIELD, FieldName);
33  GET_DATA_FUNC_S("minfield", MinFieldName);
34  GET_DATA_FUNC_S("maxfield", MaxFieldName);
35  GET_DATA_FUNC_S(GAS_NAME_GEOMETRY, GeometryName);
36  GET_DATA_FUNC_S(GAS_NAME_PTGROUP, PointGroupName);
37  GET_DATA_FUNC_S(GAS_NAME_COLLISION, CollisionName);
38  GET_DATA_FUNC_S(GAS_NAME_VELOCITY, VelocityName);
39  GET_DATA_FUNC_B("usegeometryvelocity", UseGeometryVelocity);
40  GET_DATA_FUNC_B("useneighbour", UseNeighbour);
41  GET_DATA_FUNC_B("updatep", UpdatePosition);
42  GETSET_DATA_FUNCS_S("attribute", Attribute);
43  GET_DATA_FUNC_B("updatev", UpdateVelocity);
44  GETSET_DATA_FUNCS_S("velattribute", VelAttribute);
45  GETSET_DATA_FUNCS_F("cflcond", CFLCond);
46 
47  GET_DATA_FUNC_I("advectmethod", AdvectMethod);
48 
51 
52  /// Public velocity evaluation function.
53  static UT_Vector3 getVelocity(const UT_Vector3 &p, int jobnum = 0);
54 
55 protected:
56  explicit GAS_Advect(const SIM_DataFactory *factory);
57  virtual ~GAS_Advect();
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 
66  /// Moves the markers according to the velocity field given.
67  THREADED_METHOD8(GAS_Advect, gdp->getNumPoints() > 2048, advectPoints,
68  GU_Detail *, gdp,
69  const GA_PointGroup *, grp,
70  const UT_DMatrix4 &, xform_togeo,
71  const UT_DMatrix4 &, xform_toworld,
72  const SIM_VectorField *, velocity,
74  const GA_RWHandleV3 &, p_h,
75  const GA_RWHandleV3 &, v_h)
76  void advectPointsPartial(GU_Detail *gdp,
77  const GA_PointGroup *grp,
78  const UT_DMatrix4 &xform_togeo,
79  const UT_DMatrix4 &xform_toworld,
80  const SIM_VectorField *velocity,
81  fpreal timestep,
82  const GA_RWHandleV3 &p_h,
83  const GA_RWHandleV3 &v_h,
84  const UT_JobInfo &info);
85 
86  THREADED_METHOD8(GAS_Advect, gdp->getNumPoints() > 2048, advectPointsGeo,
87  GU_Detail *, gdp,
88  const GA_PointGroup *, grp,
89  const UT_DMatrix4 &, xform_togeo,
90  const UT_DMatrix4 &, xform_toworld,
91  fpreal, timestep,
92  fpreal, voxelsize,
93  const GA_RWHandleV3 &, p_h,
94  const GA_RWHandleV3 &, v_h)
95  void advectPointsGeoPartial(GU_Detail *gdp,
96  const GA_PointGroup *grp,
97  const UT_DMatrix4 &xform_togeo,
98  const UT_DMatrix4 &xform_toworld,
99  fpreal timestep,
100  fpreal voxelsize,
101  const GA_RWHandleV3 &p_h,
102  const GA_RWHandleV3 &v_h,
103  const UT_JobInfo &info);
104 
105  // Advect the points against their own velocities.
106  THREADED_METHOD6(GAS_Advect, gdp->getNumPoints() > 2048, advectPointsVel,
107  SIM_Object *, obj,
108  GU_Detail *, gdp,
109  const GA_PointGroup *, ptgrp,
110  fpreal, timestep,
111  const GA_RWHandleV3 &, p_h,
112  const GA_ROHandleV3 &, v_h)
113  void advectPointsVelPartial(SIM_Object *obj,
114  GU_Detail *gdp,
115  const GA_PointGroup *grp,
116  fpreal timestep,
117  const GA_RWHandleV3 &p_h,
118  const GA_ROHandleV3 &v_h,
119  const UT_JobInfo &info);
120 
121 private:
122  static const SIM_DopDescription *getDopDescription();
123 
124  /// Store a list of SPH data structures. We dynamically resize
125  /// this list during velocity queries to adapt to the number of
126  /// threads being run.
127  static UT_ValArray<GAS_SPH *> ourSPHlist;
128 
129  /// Also store the gdp we're currently using, so that we can
130  /// initialize sph structures as needed.
131  static GU_Detail *ourVelocityGdp;
132 
133  /// Finally, keep track of whether or not to do nearest
134  /// neighbour searching, since new SPH structures will need
135  /// to know this.
136  static bool ourDoNearestNeighbour;
137 
138  /// Store a lock so that we can resize our list of SPH
139  /// structures in a multithreaded way.
140  static UT_Lock ourSPHlock;
141 
142  static GAS_SPH *ourSPH;
143 
147  "Gas Advect",
148  getDopDescription());
149 };
150 
151 #endif
#define DECLARE_STANDARD_GETCASTTOTYPE()
Definition: SIM_DataUtils.h:45
const GA_PointGroup * ptgrp
#define GAS_NAME_GEOMETRY
Definition: GAS_Utils.h:28
#define THREADED_METHOD8(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2, PARMTYPE3, PARMNAME3, PARMTYPE4, PARMNAME4, PARMTYPE5, PARMNAME5, PARMTYPE6, PARMNAME6, PARMTYPE7, PARMNAME7, PARMTYPE8, PARMNAME8)
#define GAS_NAME_USETIMESTEP
Definition: GAS_Utils.h:37
#define GAS_API
Definition: GAS_API.h:10
#define GETSET_DATA_FUNCS_S(DataName, FuncName)
#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
#define GETSET_DATA_FUNCS_F(DataName, FuncName)
#define GAS_NAME_VELOCITY
Definition: GAS_Utils.h:40
#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:269
#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
#define GAS_NAME_PTGROUP
Definition: GAS_Utils.h:32
This class holds a three dimensional vector field.
#define GET_DATA_FUNC_S(DataName, FuncName)
const GA_PointGroup SIM_Time timestep