HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SIM_OpenCLMergeVDB.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_OpenCLMergeVDB.h ( SIMZ Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __SIM_OpenCLMergeVDB__
12 #define __SIM_OpenCLMergeVDB__
13 
14 #include "SIMZ_API.h"
15 
16 #include <DOP/DOP_Node.h>
17 #include <DOP/DOP_AutoSolver.h>
18 #include <GAS/GAS_SubSolver.h>
19 #include <GAS/GAS_Utils.h>
20 #include <SIM/SIM_Query.h>
21 #include <SIM/SIM_QueryCombine.h>
22 
24 
25 class SIM_SourceRule;
26 
27 /// This class implements the solving logic.
29 {
30 public:
31  SIM_OpenCLMergeVDBParms& param() { return myParms; }
32  const SIM_OpenCLMergeVDBParms& param() const { return myParms; }
33 
34  OP_VERSION versionParms() const { return myVersion; }
35  void setVersionParms(OP_VERSION version) { myVersion = version; }
36 
37 protected:
38  explicit SIM_GasOpenCLMergeVDB(const SIM_DataFactory* factory);
39  ~SIM_GasOpenCLMergeVDB() override;
40 
41  void saveSubclass(std::ostream& os) const override
42  {
43  BaseClass::saveSubclass(os);
44  myParms.save(os);
45  }
46 
47  bool loadSubclass(UT_IStream& is) override
48  {
49  if (!BaseClass::loadSubclass(is))
50  return false;
51  if (!myParms.load(is))
52  return false;
53  return true;
54  }
55 
57  {
58  return new SIM_QueryCombine(BaseClass::createQueryObjectSubclass(),
59  myParms.createQueryObject(this));
60  }
61 
62  void makeEqualSubclass(const SIM_Data* source) override
63  {
64  BaseClass::makeEqualSubclass(source);
67  if (src)
68  {
69  myParms = src->param();
70  myVersion = src->versionParms();
71  }
72  }
73 
74  bool solveGasSubclass(SIM_Engine& engine,
75  SIM_Object* obj,
76  SIM_Time time,
77  SIM_Time timestep) override;
78 
79  void instanceVolumes(SIM_Object* obj,
80  const GU_Detail* gdp,
81  const UT_Vector3& pos,
82  GA_CEAttribute* pos_attrib,
83  GA_CEAttribute* orient_attrib,
84  GA_CEAttribute* pivot_attrib,
85  SIM_Time timestep) const;
86  void instancePackedSets(SIM_Object* obj,
87  const GU_Detail* gdp,
88  const GU_Detail* inst_geo,
89  const UT_Vector3& pos,
90  SIM_Time timestep) const;
91 
92  void doSource(SIM_ScalarField* targets, SIM_VectorField* targetv,
93  SIM_ScalarField* weight, const GEO_PrimVDB* srcfield,
94  const GEO_PrimVDB* srcweight,
95  const SIM_SourceRule& source,
96  const UT_Vector3& position, const GA_CEAttribute* pos,
98  float timestep) const;
99  void doSourceSingle(SIM_ScalarField* targets,
100  SIM_VectorField* targetv,
101  SIM_ScalarField* weight,
102  const GEO_PrimVDB* srcfield,
103  const GEO_PrimVDB* srcweight,
104  const SIM_SourceRule& s,
105  const UT_Vector3& pos,
106  const UT_Vector3& inst_pos,
107  const UT_Quaternion& inst_orient,
108  const UT_Vector3& inst_pivot,
109  const UT_Vector3& inst_vel,
110  const UT_Vector3& inst_angvel,
111  float timestep) const;
112 
113 private:
114  SIM_OpenCLMergeVDBParms myParms;
115  OP_VERSION myVersion;
116 
117  static const SIM_DopDescription* getDopDescription();
118 
122  "Gas OpenCL Merge VDB",
123  getDopDescription());
124 };
125 
126 // This class applies parameters to SIM_GasOpenCLMergeVDB.
128 {
129 public:
130  DOP_OpenCLMergeVDB(OP_Network* net, const char* name, OP_Operator* entry);
131  ~DOP_OpenCLMergeVDB() override;
132 
133  static OP_Node* myConstructor(OP_Network* net, const char* name,
134  OP_Operator* entry);
135  static PRM_Template myTemplateList[];
136  static PRM_Template myObsoleteList[];
137 
138  bool updateParmsFlags() override;
139 
140 protected:
141  void doApplyOutputDataSubclass(fpreal time, int outputidx,
142  SIM_RootData& rootdata,
143  const char* parentdataname,
144  DOP_Engine& engine,
145  UT_StringArray* datanames,
146  bool active) override;
147  void getInputInfoSubclass(int inputidx, DOP_InOutInfo& info) const override;
148 };
149 
150 #endif
151 
#define SIMZ_API
Definition: SIMZ_API.h:10
#define DECLARE_STANDARD_GETCASTTOTYPE()
Definition: SIM_DataUtils.h:50
#define SIM_DATA_CASTCONST(Data, DataClass)
Definition: SIM_Utils.h:34
uint64 OP_VERSION
Definition: OP_Version.h:6
const SIM_OpenCLMergeVDBParms & param() const
OP_VERSION versionParms() const
GT_API const UT_StringHolder time
virtual bool solveGasSubclass(SIM_Engine &engine, SIM_Object *obj, SIM_Time time, SIM_Time timestep)=0
GLdouble s
Definition: glad.h:3009
This class encapsulates a volume merging rule.
#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.
SIM_OpenCLMergeVDBParms & param()
This class implements the solving logic.
void setVersionParms(OP_VERSION version)
bool updateParmsFlags() override
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:803
SIM_Query * createQueryObjectSubclass() const override
GLuint const GLchar * name
Definition: glcorearb.h:786
GA_API const UT_StringHolder orient
GT_API const UT_StringHolder version
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
SIM_API const UT_StringHolder position
void makeEqualSubclass(const SIM_Data *source) override
This class holds a three dimensional scalar field.
GA_API const UT_StringHolder pivot
This class holds a three dimensional vector field.
static OP_Node * myConstructor(OP_Network *net, const char *name, OP_Operator *entry)
void saveSubclass(std::ostream &os) const override
bool loadSubclass(UT_IStream &is) override
GLenum src
Definition: glcorearb.h:1793