HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SIM_OpenCLEnforceBoundary.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: SIM_OpenCLEnforceBoundary.h ( SIMZ Library, C++)
7  *
8  * COMMENTS:
9  * Performs IOP-style of boundary enforcement on the given fields. Fields are
10  * reset to 0 inside the colliders, while the velocity field is overridden by
11  * the collider's velocity.
12  */
13 
14 #ifndef __SIM_OpenCLEnforceBoundary__
15 #define __SIM_OpenCLEnforceBoundary__
16 
17 #include "SIMZ_API.h"
18 
19 #include <DOP/DOP_Node.h>
20 #include <DOP/DOP_AutoSolver.h>
21 #include <GAS/GAS_SubSolver.h>
22 #include <GAS/GAS_Utils.h>
23 #include <SIM/SIM_Query.h>
24 #include <SIM/SIM_QueryCombine.h>
25 
27 
28 class CE_Grid;
29 class CE_VDBGrid;
30 
31 /// This class implements the solving logic.
33 {
34 public:
35  SIM_OpenCLEnforceBoundaryParms& param() { return myParms; }
36  const SIM_OpenCLEnforceBoundaryParms& param() const { return myParms; }
37 
38  OP_VERSION versionParms() const { return myVersion; }
39  void setVersionParms(OP_VERSION version) { myVersion = version; }
40 
41 protected:
42  explicit SIM_GasOpenCLEnforceBoundary(const SIM_DataFactory* factory);
43  ~SIM_GasOpenCLEnforceBoundary() override;
44 
45  void saveSubclass(std::ostream& os) const override
46  {
47  BaseClass::saveSubclass(os);
48  myParms.save(os);
49  }
50 
51  bool loadSubclass(UT_IStream& is) override
52  {
53  if (!BaseClass::loadSubclass(is))
54  return false;
55  if (!myParms.load(is))
56  return false;
57  return true;
58  }
59 
61  {
62  return new SIM_QueryCombine(BaseClass::createQueryObjectSubclass(),
63  myParms.createQueryObject(this));
64  }
65 
66  void makeEqualSubclass(const SIM_Data* source) override
67  {
68  BaseClass::makeEqualSubclass(source);
71  if (src)
72  {
73  myParms = src->param();
74  myVersion = src->versionParms();
75  }
76  }
77 
78  bool solveGasSubclass(SIM_Engine& engine,
79  SIM_Object* obj,
80  SIM_Time time,
81  SIM_Time timestep) override;
82 
83  /// Does the sourcing work when set to use individual volumes.
84  bool sourceVolumes(SIM_Object* obj,
85  const UT_Array<SIM_ScalarField*>& sfields,
86  const UT_Array<SIM_VectorField*>& vfields,
87  SIM_VectorField* vel, const GU_Detail* gdp,
88  const SIM_Geometry* inst_geo, const UT_Vector3& pos)
89  const;
90  /// Does the sourcing work when set to use packed sets.
91  bool instancePackedSets(SIM_Object* obj,
92  const UT_Array<SIM_ScalarField*>& sfields,
93  const UT_Array<SIM_VectorField*>& vfields,
94  SIM_VectorField* vel, const GU_Detail* gdp,
95  const GU_Detail* inst_geo, const UT_Vector3& pos)
96  const;
97 
98 private:
100  myParms;
101  OP_VERSION myVersion;
102 
103  static const SIM_DopDescription* getDopDescription();
104 
108  "Gas OpenCL Enforce Boundary",
109  getDopDescription());
110 };
111 
112 // This class applies parameters to SIM_GasOpenCLEnforceBoundary.
114 {
115 public:
116  DOP_OpenCLEnforceBoundary(OP_Network* net, const char* name,
117  OP_Operator* entry);
118  ~DOP_OpenCLEnforceBoundary() override;
119 
120  static OP_Node* myConstructor(OP_Network* net, const char* name,
121  OP_Operator* entry);
122  static PRM_Template myTemplateList[];
123  static PRM_Template myObsoleteList[];
124 
125  bool updateParmsFlags() override;
126 
127 protected:
128  void doApplyOutputDataSubclass(fpreal time, int outputidx,
129  SIM_RootData& rootdata,
130  const char* parentdataname,
131  DOP_Engine& engine,
132  UT_StringArray* datanames,
133  bool active) override;
134  void getInputInfoSubclass(int inputidx, DOP_InOutInfo& info) const override;
135 };
136 
137 #endif
138 
#define SIMZ_API
Definition: SIMZ_API.h:10
#define DECLARE_STANDARD_GETCASTTOTYPE()
Definition: SIM_DataUtils.h:50
void makeEqualSubclass(const SIM_Data *source) override
#define SIM_DATA_CASTCONST(Data, DataClass)
Definition: SIM_Utils.h:34
uint64 OP_VERSION
Definition: OP_Version.h:6
GT_API const UT_StringHolder time
void saveSubclass(std::ostream &os) const override
virtual bool solveGasSubclass(SIM_Engine &engine, SIM_Object *obj, SIM_Time time, SIM_Time timestep)=0
SIM_OpenCLEnforceBoundaryParms & param()
SIM_Query * createQueryObjectSubclass() const override
This class implements the solving logic.
#define DECLARE_DATAFACTORY(DataClass, SuperClass, Description, DopParms)
Definition: SIM_DataUtils.h:63
void getInputInfoSubclass(int inputidx, DOP_InOutInfo &info) const override
This default implementation specifies the input accepts objects.
void setVersionParms(OP_VERSION version)
bool updateParmsFlags() override
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:803
GLuint const GLchar * name
Definition: glcorearb.h:786
that also have some descendant prim *whose name begins with which in turn has a child named baz where *the predicate active
GT_API const UT_StringHolder version
const SIM_OpenCLEnforceBoundaryParms & param() const
bool loadSubclass(UT_IStream &is) override
virtual void doApplyOutputDataSubclass(fpreal time, int outputidx, SIM_RootData &rootdata, const char *parentdataname, DOP_Engine &engine, UT_StringArray *datanames, bool active)
fpreal64 fpreal
Definition: SYS_Types.h:277
This class holds a three dimensional vector field.
static OP_Node * myConstructor(OP_Network *net, const char *name, OP_Operator *entry)
GLenum src
Definition: glcorearb.h:1793