HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SIM_RadialEmit.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2024
3  * Side Effects Software Inc. All rights reserved.
4  *
5  * Redistribution and use of Houdini Development Kit samples in source and
6  * binary forms, with or without modification, are permitted provided that the
7  * following conditions are met:
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  * 2. The name of Side Effects Software may not be used to endorse or
11  * promote products derived from this software without specific prior
12  * written permission.
13  *
14  * THIS SOFTWARE IS PROVIDED BY SIDE EFFECTS SOFTWARE `AS IS' AND ANY EXPRESS
15  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
17  * NO EVENT SHALL SIDE EFFECTS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
18  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
19  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
23  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  *
25  *----------------------------------------------------------------------------
26  */
27 
28 #ifndef __SIM_RadialEmit_h__
29 #define __SIM_RadialEmit_h__
30 
31 #include <GAS/GAS_SubSolver.h>
32 #include <GAS/GAS_Utils.h>
33 
34 namespace HDK_Sample {
35 
36 /// A simple field manipulation class that will add fields
37 /// together.
39 {
40 public:
41  /// These macros are used to create the accessors
42  /// getFieldDstName and getFieldSrcName functions we'll use
43  /// to access our data options.
45  GET_DATA_FUNC_V3("center", Center);
46  GET_DATA_FUNC_V2("distance", Distance);
47  GET_DATA_FUNC_V2("speed", Speed);
48  GET_DATA_FUNC_I("birthrate", BirthRate);
49  GET_DATA_FUNC_I("seed", Seed);
50 
51 protected:
52  explicit SIM_RadialEmit(const SIM_DataFactory *factory);
53  ~SIM_RadialEmit() override;
54 
55  /// Used to determine if the field is complicated enough to justify
56  /// the overhead of multithreading.
57  bool shouldMultiThread(const SIM_RawField *field) const
58  { return field->field()->numTiles() > 1; }
59 
60  /// The overloaded callback that GAS_SubSolver will invoke to
61  /// perform our actual computation. We are giving a single object
62  /// at a time to work on.
63  bool solveGasSubclass(SIM_Engine &engine,
64  SIM_Object *obj,
65  SIM_Time time,
66  SIM_Time timestep) override;
67 
68 private:
69  /// We define this to be a DOP_Auto node which means we do not
70  /// need to implement a DOP_Node derivative for this data. Instead,
71  /// this description is used to define the interface.
72  static const SIM_DopDescription *getDopDescription();
73 
74  /// These macros are necessary to bind our node to the factory and
75  /// ensure useful constants like BaseClass are defined.
76  DECLARE_STANDARD_GETCASTTOTYPE();
77  DECLARE_DATAFACTORY(SIM_RadialEmit,
79  "Gas Radial Emit",
80  getDopDescription());
81 };
82 
83 } // End HDK_Sample namespace
84 
85 #endif
86 
#define GAS_NAME_GEOMETRY
Definition: GAS_Utils.h:30
GT_API const UT_StringHolder time
GET_DATA_FUNC_V3("center", Center)
GET_DATA_FUNC_V2("distance", Distance)
GET_DATA_FUNC_S(GAS_NAME_GEOMETRY, Geometry)
bool shouldMultiThread(const SIM_RawField *field) const
int numTiles() const
GET_DATA_FUNC_I("birthrate", BirthRate)
SIM_RadialEmit(const SIM_DataFactory *factory)
bool solveGasSubclass(SIM_Engine &engine, SIM_Object *obj, SIM_Time time, SIM_Time timestep) override
UT_VoxelArrayF UT_VoxelArrayF & field
const GA_PointGroup SIM_Time timestep