HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SIM_SolverScript.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  */
7 
8 #ifndef __SIM_SolverScript_h__
9 #define __SIM_SolverScript_h__
10 
11 #include "SIMZ_API.h"
12 #include <SIM/SIM_OptionsUser.h>
13 #include <SIM/SIM_Solver.h>
14 #include "SIMZ_Utils.h"
15 
16 class SIM_GeometryCopy;
17 class SIM_SolverScript;
18 
20 {
21 public:
23  : mySolver(0),
24  myObjects(0),
25  myNewObjects(0),
26  myTimestep(0),
27  myTime(0)
28  {}
29 
31  const SIM_ObjectArray *objects,
32  const SIM_ObjectArray *new_objects,
33  const SIM_Time *timestep,
34  const SIM_Time *time)
35  : mySolver(solver),
36  myObjects(objects),
37  myNewObjects(new_objects),
38  myTimestep(timestep),
39  myTime(time)
40  {}
41 
43  {}
44 
45  static UT_Array<SIM_SolverScriptData> &getSolverStack();
46 
49  const SIM_Time *myTime;
52 };
53 
55  public SIM_OptionsUser
56 {
57 public:
58  // Access functions for our specific data.
59  GETSET_DATA_FUNCS_B("usesnippet", UseSnippet);
61  GETSET_DATA_FUNCS_S("pythonsnippet", PythonSnippet);
62 
63  void getDopnetPath(UT_String &path) const;
64  const SIM_Engine &getDopnetEngine() const;
65  static void installCommands();
66 
67  static bool fetchBoilerplate(UT_String &boilerplate);
68 
69 protected:
70  explicit SIM_SolverScript(const SIM_DataFactory *factory);
71  ~SIM_SolverScript() override;
72 
74  SIM_ObjectArray &objects,
75  SIM_ObjectArray &newobjects,
76  SIM_ObjectArray &feedbacktoobjects,
77  const SIM_Time &timestep) override;
78 
79 private:
80  SIM_Result runScript(
81  const char *script,
82  const SIM_ObjectArray &objects,
83  const SIM_ObjectArray &new_objects,
84  const SIM_Time &timestep,
85  const SIM_Time &time);
86  SIM_Result runHscriptScript(
87  const char *script,
88  const char *error_title);
89  SIM_Result runPythonScriptFile(
90  const char *script_file,
91  const char *error_title);
92 
93  SIM_Result runPythonSnippet(
94  const char *snippet,
95  const char *error_title);
96 
97  static const SIM_DopDescription *getSolverScriptDopDescription();
98 
101  SIM_Solver,
102  "Script Solver",
103  getSolverScriptDopDescription());
104 };
105 
106 #endif
107 
#define SIMZ_API
Definition: SIMZ_API.h:10
#define DECLARE_STANDARD_GETCASTTOTYPE()
Definition: SIM_DataUtils.h:50
SIM_SolverScript * mySolver
const SIM_ObjectArray * myNewObjects
#define GETSET_DATA_FUNCS_B(DataName, FuncName)
GT_API const UT_StringHolder time
const SIM_Time * myTime
#define GETSET_DATA_FUNCS_S(DataName, FuncName)
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
#define DECLARE_DATAFACTORY(DataClass, SuperClass, Description, DopParms)
Definition: SIM_DataUtils.h:63
SIM_SolverScriptData(SIM_SolverScript *solver, const SIM_ObjectArray *objects, const SIM_ObjectArray *new_objects, const SIM_Time *timestep, const SIM_Time *time)
Holds pointers to a number of SIM_Object objects.
virtual SIM_Result solveObjectsSubclass(SIM_Engine &engine, SIM_ObjectArray &objects, SIM_ObjectArray &newobjects, SIM_ObjectArray &feedbacktoobjects, const SIM_Time &timestep)=0
const SIM_ObjectArray * myObjects
const SIM_Time * myTimestep
#define SIM_NAME_SCRIPT
Definition: SIMZ_Utils.h:30
This implements a SIM_Geometry that copies the source geometry.