HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SIM_Engine.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_Engine_h__
9 #define __SIM_Engine_h__
10 
11 #include "SIM_API.h"
12 #include "SIM_Cache.h"
13 #include "SIM_Data.h"
14 #include "SIM_Error.h"
15 #include <OP/OP_Value.h>
16 #include <DEP/DEP_MicroNode.h>
17 #include <UT/UT_Map.h>
18 #include <UT/UT_Set.h>
19 #include <UT/UT_SymbolTable.h>
20 
21 #define SIM_PATH_SEPCHAR '/'
22 #define SIM_OBJECT_SEPCHAR ':'
23 #define SIM_OBJECTNUM_SEPCHAR '.'
24 #define SIM_OBJECTDATA_SEPCHAR '/'
25 
26 class UT_InfoTree;
27 class UT_StringArray;
28 class UT_StringRef;
29 class OP_Node;
30 class SIM_BaseCache;
31 class SIM_DopDescription;
33 class SIM_DataFactory;
34 class SIM_Data;
35 class SIM_SimulationState;
36 class SIM_MetaObject;
37 class SIM_MetaObjectArray;
39 class SIM_ObjectArray;
40 class SIM_SaveCommand;
41 
43 {
44 public:
46  virtual const char * className() const
47  { return "SIM_SimulationMicroNode"; }
48  virtual void becameDirty(DEP_MicroNode &src, const DEP_PropagateData &data);
49 protected:
51 };
52 
53 /// This is the main engine behind all simulations. Any number of these
54 /// can be created to create independent simulations. Generally a simulation
55 /// will be owned by a particular OP_Node. For example, the DopNet object
56 /// contains a SIM_Engine.
58 {
59 public:
60  /// Constructor to create a new simulation.
61  SIM_Engine(OP_Node *owner);
62  /// Destructor to destroy all data associated with a simulation.
63  virtual ~SIM_Engine();
64 
65  /// Returns the OP_Node that owns this engine. This may be null if
66  /// the engine isn't associated with a particular node.
67  OP_Node *getOwner() const;
68  /// Gets the full path to the DOP Network node that owns this simulation.
69  const UT_String &getOwnerFullPath() const;
70  void getOwnerFullPathString(UT_String &str) const;
71 
72  /// Allocates a new SIM_Object and adds it to the simulation.
73  /// The name parameter is assigned to the object. This name does not
74  /// have to be unique.
75  SIM_Object *addSimulationObject(bool solvefirstframe);
76  /// Removes a SIM_Object from the simulation.
77  /// The index value is the current location of the object in the
78  /// simulations's list of objects. This value will not be the same
79  /// as the SIM_Object::getObjectId() value, and may change when objects
80  /// are added to or removed from the simulation.
81  void removeSimulationObject(int index);
82  /// Removes a SIM_Object from the simulation.
83  /// This version of this function takes a SIM_Object pointer instead
84  /// of an index. The pointer is converted to an index and the indexed
85  /// version of removeSimulationObject() is called.
86  void removeSimulationObject(SIM_Object *object);
87  /// Returns the number of objects currently in the simulation.
88  int getNumSimulationObjects() const;
89  /// Returns the number of objects currently in the simulation.
90  int64 getNumSimulationData() const;
91  /// Returns a pointer to the SIM_Object at the specified index.
92  /// The index value is the current location of the object in the
93  /// simulations's list of objects. This value will not be the same
94  /// as the SIM_Object::getObjectId() value.
95  const SIM_Object *getSimulationObject(int index) const;
96  /// Returns a pointer to the SIM_Object with the specified unique id.
97  /// This function searches the current list of objects for the
98  /// specified objectid. If the objectid is not found, this function
99  /// returns null.
100  const SIM_Object *getSimulationObjectFromId(int objectid) const;
101  /// Returns the "nth" simulation object that matches a supplied filter.
102  /// If less than the supplied n objects match the filter, 0 is returned.
103  const SIM_Object *getNthSimulationObject(
104  const SIM_DataFilter &filter,
105  int n) const;
106 
107  /// Creates a new relationship. The creationflags parameter accepts the
108  /// same SIM_DATA_* flags accepted by the creationflags parameter of
109  /// SIM_Data::createNamedSubData().
110  SIM_Relationship *addRelationship(const char *name,
111  int creationflags);
112  /// Returns the number of relationships in the current simulation state.
113  int getNumRelationships() const;
114  /// This function allows looping through the simulations relationships.
115  const SIM_Relationship *getRelationship(int index) const;
116  /// Returns the relationship with the specified name.
117  const SIM_Relationship *getRelationship(const char *name) const;
118  /// Gets all the relationships of a particular type. The type of a
119  /// relationship is defined by the one subdata on the SIM_Relationship.
120  void filterConstRelationships(
121  const SIM_DataFilter &filter,
122  SIM_ConstDataArray &rels) const;
123  /// Removes the relationship at the specified position.
124  void removeRelationship(int index);
125  /// Removes the relationship with the specified name.
126  void removeRelationship(const char *name);
127  /// Removes the specified relationship.
128  void removeRelationship(SIM_Relationship *rel);
129  /// Removes all relationships created by a particular DOP node. If -1
130  /// is specified, then all relationships are removed. Relationships in
131  /// the "except" array are not removed.
132  void removeAllRelationships(int createdby,
133  const SIM_RelationshipArray *except);
134 
135  /// Returns either a SIM_Relationship or SIM_Object depending on the
136  /// information stored in the id parameter.
137  const SIM_RootData *getRootDataFromId(
138  const SIM_RootDataId &id) const;
139 
140  // Only HOM should call this method:
141  SIM_RootData *getNonConstRootDataFromId(
142  const SIM_RootDataId &id);
143 
144  /// Returns a pointer to the state of an object at some time in the past.
145  /// This function searches for these past object states in three ways.
146  /// First, if the specified time is equal to a past time step, the state
147  /// for that time step is returned. Second, if the specified time is not
148  /// equal to a past time step, then past time steps are searched for
149  /// object states stored explicitly with createSubStepObject(). Finally,
150  /// if both these methods fail to find a matching object state, then the
151  /// closest object states before and after the specified time are found
152  /// using the first two approaches. Then a new object state is created by
153  /// interpolating between these two states using SIM_Data::interpolate().
154  /// This third approach is skipped if allowinterpolation is set to false.
155  /// If no previous or no future object state can be found, then this
156  /// function returns null.
157  const SIM_Object *getObjectAtTime(const SIM_Object &object,
158  const SIM_Time &time,
159  bool allowinterpolation) const;
160 
161  /// Returns a non-const pointer to an object for a particular time.
162  /// This function is very similar to getObjectAtTime() except for two
163  /// things. First, it requires a non-const starting object, and it is
164  /// a non-const function. Second, if the specified time exactly matches
165  /// a time in the past, the returned object will be a copy of that past
166  /// object, not the object itself. Otherwise modifying that object could
167  /// modify the past. However, if the current time is sepcified, the actual
168  /// object (i.e. a pointer to the passed in SIM_Object) is returned.
169  /// This function is for use by solvers that want to modify their
170  /// affector objects and which do substepping.
171  SIM_Object *getAffectorAtTime(SIM_Object &object,
172  const SIM_Time &time,
173  bool allowinterpolation);
174 
175  /// This is a more direct, more efficient method for reading
176  /// cached versions of objects from previous frames, without interpolation.
177  ///
178  /// Before the call, 'past_objects' must be a valid array of
179  /// SIM_Object* arrays and 'past_times' must be a valid array of SIM_Time.
180  /// 'past_objects' must have size 'max_past'
181  /// each element of 'past_objects' must be an array of SIM_Object* of
182  //// size 'num_objects'
183  /// 'past_times' must be an array of size 'max_past'
184  ///
185  /// Output:
186  /// The number of cached frames is returned.
187  /// The cached version of object[oi] at time past_times[i]
188  /// is stored in the array past_objects[i] at location oi,
189  /// for all 0 <= i < "the returned number of cached frames"
190 
191  int getObjectsAtPastTimes(
192  const SIM_Object**const past_objects[],
193  SIM_Time past_times[],
194  const int num_objects,
195  const SIM_Object*const objects[],
196  const int max_past
197  );
198 
199  /// Creates an object in the current state with a particular time stamp.
200  /// This function is useful for solvers that need to do their own time
201  /// stepping with step sizes smaller than the globally specified time
202  /// step size. These explicitly stored subsamples are accessible later
203  /// with the getObjectAtTime() function.
204  SIM_Object *createSubStepObject(const SIM_Object &object,
205  const SIM_Time &time);
206  /// Removes an object previously created by createSubStepObject().
207  /// If the allwithmatchingid parameter is set to true, not only will
208  /// the specified object be destroyed, but all other objects with the
209  /// same object id created using createSubStepObject() will be destroyed.
210  /// This provides a quick way to destroy all temporary working copies
211  /// of a particular object.
212  void removeSubStepObject(SIM_Object *objectattime,
213  bool allwithmatchingid);
214 
215  /// Loads a simulation state from a file and merges it into the current
216  /// simulation state. The data that gets loaded is not allowed to do any
217  /// sharing of data with the current state, since the data id's can't
218  /// be expected to match. Objects from the file will replace objects from
219  /// the current state if their object ids match. Objects loaded from the
220  /// file will be flagged so that they will not be solved in the current
221  /// timestep. In subsequent timesteps these objects will be solved.
222  /// The filter parameter specifies which objects stored in the file
223  /// are merged in.
224  bool mergeSimulationFile(const char *filename,
225  const SIM_DataFilter &filter,
226  const SIM_ObjectArray &replaceobjects,
227  const OP_Node *defaultcreator,
228  bool forcecreatortodefault,
229  bool acceptnewobjects,
230  bool matchbyname,
231  const char *nameprefix);
232  /// Schedules some objects to be saved to a files at the end of the
233  /// current timestep. The filter parameter makes it possible to save
234  /// only some of the objects to the file. The actual save happens
235  /// in the postSimulationStep().
236  void saveSimulationFile(OP_Node *node,
237  const char *filename,
238  const SIM_DataFilter &filter,
239  const SIM_ObjectArray &objects,
241  /// Saves the entire current state of the simulation immediately.
242  bool saveSimulationState(std::ostream &os,
244  bool saveSimulationStateToFile(const char *fname,
246  bool threadedio) const;
247 
248  /// Sets the current time for the simulation. If the new simulation
249  /// time is less than the current time, the SIM_Cache is simply set to
250  /// use its best match for the chosen time. If the new simulation time
251  /// is greater than the current time, the simulation is stepped forward
252  /// in time to the new time. The resimlasttimestep parameter causes the
253  /// most recent cache entry to be deleted before trying to set the
254  /// current time. This is useful if some parameter of the simulation
255  /// changes on the current timestep. It causes the timestep to be
256  /// recooked with the new parameter. This resimulation may also happen
257  /// if the simulation was interrupted the last time this function was
258  /// called. The forceresetsim parameter tells the SIM_Engine to reset
259  /// the simulation before trying to move to the specified time, whether
260  /// the reset is required or not.
261  void setSimulationTime(const SIM_Time &t,
262  bool resimlasttimestep,
263  bool forceresetsim,
264  bool allowsimulation);
265 
266  /// Marks this engine as invalid without actually clearing or
267  /// resetting anything. A proper reset implies also a frame
268  /// advance to the first frame that can be expensive.
269  /// Note the cache will not be cleared until it is cooked, however!
271  { myFirstSimulationStep = true; }
272 
273  /// Returns the current simulation time.
274  const SIM_Time &getSimulationTime() const;
275  /// Returns the simulation time that corresponds to the given global time.
276  const SIM_Time getEngineTime(const SIM_Time &t) const;
277  /// Returns the global time that corresponds to the given simulation time.
278  const SIM_Time getGlobalTime(const SIM_Time &t) const;
279  /// Returns the time of the earliest simulation state in the cache.
280  const SIM_Time &getEarliestCacheTime() const;
281  const SIM_Time &getLatestCacheTime() const;
282  /// Returns the cached frames.
283  /// Inclusive.
284  void getCachedFrames(UT_IntArray &frames, bool inmemory) const;
285  /// Returns a reference to the cache options for this simulation.
286  const SIM_CacheOptions &getCacheOptions() const;
287  /// Sets the cache options for this simulation.
288  void setCacheOptions(const SIM_CacheOptions &o);
289  /// Returns the time step size.
290  const SIM_Time &getTimeStep() const;
291  /// Sets the global time step size.
292  void setTimeStep(const SIM_Time &time);
293  /// Gets the maximum number of allowed feedback iterations.
294  int getMaxFeedbackIterations() const;
295  /// Sets the maximum number of allowed feedback iterations.
296  void setMaxFeedbackIterations(int max);
297  /// Gets the current feedback iteration we are on. If we are not
298  /// currently solving, this function will return -1;
299  int getFeedbackIteration() const;
300  /// Returns true if the engine is providing data hierarchy hints.
301  bool getProvideDataHints() const;
302  /// Specifies whether the engine should provide data hierarchy hints.
303  void setProvideDataHints(bool providehints);
304  /// Gets the id for the node that is currently being processed.
306  { return myCurrentCreatorId; }
307  /// Gets the index of the node output that is currently being processed.
309  { return myCurrentCreatorIndex; }
310  /// Set the creator information. These values are automatically reset
311  /// to (-1, -1) before performing a simulation step.
312  void setCreatorInfo(int id, int index);
313  /// Returns the SIM_Data pointer with the specified unique id.
314  const SIM_Data *getConstDataWithId(const UT_Guid &id) const;
315  /// Returns the simulation frame number that corresponds to the given
316  /// time. The simulation frame number is the number of timesteps that
317  /// need to be run to get to the specified time, plus one (so that
318  /// time zero is frame 1).
319  int getSimulationFrame(const SIM_Time &time) const;
320  /// Returns the simulation time that corresponds to the given simulation
321  /// frame.
322  const SIM_Time getSimulationTime(int frame) const;
323 
324  /// Adds an error to the engine. The object and data parameters allow
325  /// the DOP_Engine to put the error message on an appropriate DOP Node.
326  /// Errors are found in the SIM error file. This function simply calls
327  /// addErrorSubclass().
328  void addError(const SIM_RootData *rootdata,
329  const SIM_Data *data,
330  int errorcode,
331  const char *errorparm,
332  UT_ErrorSeverity severity) const;
333 
334  /// Returns the total amount of memory used by all data currently in
335  /// this simulation, at the current time or in the cache.
336  int64 getTotalMemorySize() const;
337 
338  /// Removes all node interests from the engine.
339  void removeAllOPInterests() const;
340  /// Adds an interest in the supplied node. When the node changes, the
341  /// engine's handleExternalNodeChange function will be called.
342  void addOPInterest(OP_Node *node) const;
343 
344  /// Passes up to our owner to alert anything that needs an OP_Event
345  /// in response to use becoming dirty.
347 
348  /// Returns all available data type names.
349  /// If a null type pointer is passed in, this function returns a list
350  /// of every data type that the SIM_Engine can create. If a data type
351  /// name is passed in, the list returned will only contain those data
352  /// types that can be cast to the specified data type using the
353  /// SIM_Data::getPointerToType() function.
354  void getDataTypes(UT_StringArray &datatypes,
355  const UT_StringRef &datatype) const;
356  /// Returns all available data types and the source of their definition.
357  /// The definition source will be an empty string if the data type is
358  /// defined internally to Houdini. Otherwise it will be the name of the
359  /// DSO or DLL file that contains the data type.
360  void getDataTypeSources(UT_StringArray &datatypes,
361  UT_StringArray &srcs) const;
362  /// Returns the descriptive name for a data type.
363  /// Given the unique identifying name for a data type this function
364  /// finds the appropriate data factory and returns the descriptive
365  /// string assigned to the type.
366  const char *getDescription(
367  const UT_StringRef &datatype) const;
368  /// Returns the SIM_DopDescription from the SIM_DataFactory of a
369  /// particular data type.
370  const SIM_DopDescription *getDopDescription(
371  const UT_StringRef &datatype) const;
372 
373  /// Returns whether we can cast to a superclass data type without creating
374  /// the SIM_Data.
375  static bool canCastToDataType(
376  const UT_StringRef &from_type,
377  const UT_StringRef &to_type);
378 
379  /// Filters all our simulation objects based on a string pattern.
380  /// Note that the time value is a simulation time, not global time.
381  void findAllObjectsFromString(const char *objspec,
382  SIM_ConstObjectArray &objects,
383  const SIM_Time &t,
384  bool interpolateobj) const;
385  /// Returns a single object matching a specified string pattern.
386  /// Note that the time value is a simulation time, not global time.
387  const SIM_Object *findObjectFromString(const char *objspec,
388  int whichmatch, int *nummatch,
389  const SIM_Time &t,
390  bool interpolateobj) const;
391  /// Returns a list of objects created by the specified node, or any
392  /// nodes inside the specified node (if it is a subnet).
393  void findAllObjectsCreatedBy(OP_Node *creator,
394  SIM_ConstObjectArray &objects) const;
395  /// Filters all our relationships based on a string pattern.
396  /// Note that the time value is a simulation time, not global time.
397  void findAllRelationshipsFromString(
398  const char *relspec,
399  SIM_ConstDataArray &relationships,
400  const SIM_Time &t,
401  bool interpolaterel) const;
402  /// Returns a single relationship matching a specified string pattern.
403  /// Note that the time value is a simulation time, not global time.
404  const SIM_Relationship *findRelationshipFromString(
405  const char *relspec,
406  int whichmatch, int *nummatch,
407  const SIM_Time &t,
408  bool interpolaterel) const;
409 
410  /// Gets a list of all selected data in the simulation.
411  void getSelection(SIM_ConstDataArray &data) const;
412  /// Clears the selection flag on all data in this simulation.
413  void clearSelection() const;
414 
415  /// Returns the scale factor to convert a value in the provided units
416  /// into the equivalent MKS value.
417  fpreal scaleToMKS(const char *fromunits) const;
418  /// Returns the scale factor to convert a value in MKS units into the
419  /// equivalent value in the provided units.
420  fpreal scaleFromMKS(const char *tounits) const;
421 
422  /// The micronode representing the simulation result. It is marked as
423  /// dirtied and propagated whenever the simulation is cleared. Callers can
424  /// use this to express dependencies on/from the simulation.
426  { return mySimMicroNode; }
427  const DEP_MicroNode & simMicroNode() const
428  { return mySimMicroNode; }
429  /// This micronode holds the simulation input. It is wired directly
430  /// to the simMicroNode, however, does not care about refilter
431  /// events.
433  { return mySimInputMicroNode; }
435  { return mySimInputMicroNode; }
437  { return myResimParmsMicroNode; }
439  { return myResimParmsMicroNode; }
441  { return myRefilterParmsMicroNode; }
443  { return myRefilterParmsMicroNode; }
444 
445  /// Sets this simulation as a player. It will replace it's cache
446  /// with simulation data from the files given and not simulate,
447  /// just read the files.
448  void setIsPlayer(bool isPlayer);
449  bool isPlayer() const { return myIsPlayer; }
450 
451  /// Rebuilds the player cache.
452  void resetPlayer();
453  /// Tries to expand the cached frame range
454  void updatePlayerFrames();
455 
456 protected:
457  /// Resets the simulation to a clean state. This function calls
458  /// clearSimulation(), then builds a single empty simulation state.
459  virtual void resetSimulation();
460  /// This function is run before passing each object to its solver.
461  /// The implementation at this level clears out all temporary data
462  /// from the simulation objects.
463  virtual void preSimulationStep();
464  /// This function is run after all objects are processed by their solvers.
465  virtual void postSimulationStep();
466  /// This function is called by our cache whenever the most recent
467  /// simulated timestep is being removed from memory (either deleted
468  /// or moved onto disk).
469  virtual void clearReferencesToMostRecentState();
470  /// Initializes a newly created object. This function is called by
471  /// addSimulationObject(). The default implementation does nothing.
472  virtual void objectCreated(SIM_Object *object);
473  /// Allows special handling of objects that are being removed. This
474  /// function is called by removeSimulationObject(). The default
475  /// implementation does nothing.
476  virtual void objectRemoved(SIM_Object *object);
477  /// Override this method to handle changes to external nodes in which
478  /// we have an interest. The default implementation does nothing.
479  virtual void handleExternalNodeChangeSubclass(
480  OP_Node *changednode,
481  OP_EventType eventtype,
482  void *data);
483  /// The default implementation of this function does nothing.
484  virtual void addErrorSubclass(const SIM_RootData *rootdata,
485  const SIM_Data *data,
486  int errorcode,
487  const char *errorparm,
488  UT_ErrorSeverity severity) const;
489  /// Returns the simulation time that corresponds to the given global time.
490  virtual const SIM_Time getEngineTimeSubclass(const SIM_Time &t) const;
491  /// Returns the global time that corresponds to the given simulation time.
492  virtual const SIM_Time getGlobalTimeSubclass(const SIM_Time &t) const;
493  /// This function is the only way for a SIM_Engine subclass to get a
494  /// non-const SIM_Object pointer.
495  SIM_Object *getNonConstSimulationObject(int index);
496 
497  /// Alerts our owner that we are simulating due to an internally
498  /// generated need. Returns the previous state
499  virtual bool setIsSimulating(bool issimulating) const;
500 
501 private:
502  /// Gets the unique id of the OP_Node that owns this engine.
503  int getOwnerUniqueId() const;
504  /// Completely clears all existing data related to a simulation.
505  void clearSimulation();
506  /// Takes one time step forward in the simulation.
507  void doSimulationStep(bool forreset);
508  /// Solves a meta object for one time step. All affectors will already
509  /// be solved.
510  void doSimulationStepForMetaObject(
511  SIM_MetaObject &metaobject,
512  const SIM_Time &timestep,
513  bool isLastMetaObject);
514  /// Merges another simulation state in with our current state. This
515  /// state can come from a file or another live simulation.
516  void mergeSimulation(
517  SIM_SimulationState &fromstate,
518  const SIM_DataFilter *filter,
519  const SIM_ObjectArray *replaceobjects,
520  bool acceptnewobjects,
521  bool matchbyname,
522  const char *nameprefix);
523 
524  /// Solves a relationship for one timestep. All objects will
525  /// already be solved.
526  void solveRelationship(SIM_Relationship *relation,
527  const SIM_Time &timestep);
528 
529  /// Gets the current simulation state. Notably, it returns non-const.
530  /// It is quite questionable to use this non-const function in
531  /// solvers! One should acquire non-const SIM_Objects through
532  /// your affector lists or other ways.
533  SIM_SimulationState &getSimulationObjects();
534  /// Gets a const reference to the current simulation state.
535  const SIM_SimulationState &getSimulationObjects() const;
536 
537  SIM_Object *getNonConstSimulationObjectFromId(
538  int objectid);
539  SIM_Relationship *getNonConstRelationship(const char *name);
540  SIM_Relationship *getNonConstRelationshipFromIndex(int index);
541 
542  /// Returns the SIM_Data pointer with the specified unique id.
543  SIM_Data *getDataWithId(const UT_Guid &id) const;
544  /// Destroy any data that has a zero reference count.
545  void purgeUnusedData() const;
546 
547  /// Register a new piece of data with the engine. This is
548  /// called from the SIM_DataFactory newData function to add
549  /// the data to myAllData and myAllChangedSizeData.
550  void registerNewData(SIM_Data *newdata) const;
551  /// Create data using our factories.
552  /// Only SIM_Data should use this functions.
553  SIM_Data *newData(const UT_StringRef &datatype,
554  bool doinit=true) const;
555  /// Create data using our factories, and set the uniqueid of the new data.
556  /// Only SIM_SimulationState should use this functions.
557  SIM_Data *newData(const UT_StringRef &datatype,
558  const UT_Guid &uniqueid) const;
559  /// Unregister a piece of data that is being deleted. This is
560  /// called from the SIM_DataFactory deleteData function to remove
561  /// the data from myAllData and myAllChangedSizeData.
562  void unregisterDeletedData(SIM_Data *deleteddata) const;
563  /// Delete data using our factories.
564  /// Only SIM_Data should use this functions.
565  void deleteData(SIM_Data *data) const;
566  /// This function is called when the unique id of a SIM_Data changes.
567  /// It lets us keep the myAllData hash table up to date.
568  void changeDataUniqueId(SIM_Data *data,
569  const UT_Guid &newid) const;
570  /// This function is called when a piece of data has decided it needs
571  /// to recalculate its memory size.
572  void setNeedsToRecalculateMemorySize(
573  const SIM_Data *data) const;
574 
575  /// Access our data factories.
576  SIM_DataFactory *getDataFactory(const UT_StringRef &name) const;
577  void addDataFactory(SIM_DataFactory *factory);
578 
579  /// This function is called when an external node in which we have an
580  /// interest changes. It calls handleExternalNodeChangeSubclass.
581  void handleExternalNodeChange(OP_Node *changednode,
582  OP_EventType eventtype,
583  void *data);
584  /// This static version of handleExternalNodeChange converts the callee
585  /// pointer to a SIM_Engine pointer and calls handleExternalNodeChange
586  /// on that engine.
587  static void handleExternalNodeChange(OP_Node *changednode,
588  void *callee,
589  OP_EventType eventtype,
590  void *data);
591 
592  /// Adds a SIM_DataFactoryCreator to the global list.
593  static void addDataFactoryCreator(SIM_DataFactoryCreator *creator);
594  /// Removes a SIM_DataFactoryCreator from the global list.
595  static void removeDataFactoryCreator(SIM_DataFactoryCreator *creator);
596  /// Returns the global list of data factory creators.
597  static UT_ValArray<SIM_DataFactoryCreator *> &getCreators();
598 
600  SIM_Cache myCache;
601  SIM_BaseCache *myBaseCache;
602  SIM_Time myTimeStep;
603  OP_Node *myOwner;
604  int myMaxFeedbackIterations;
605  int myFeedbackIteration;
606  int myCurrentCreatorId;
607  int myCurrentCreatorIndex;
608  mutable UT_String myOwnerFullPath;
609  mutable UT_ValArray<SIM_SaveCommand *> mySaveCommands;
610  mutable UT_Map<UT_Guid, SIM_Data *> myAllData;
611  mutable UT_Set<const SIM_Data *> myAllChangedSizeData;
612  mutable UT_Set<OP_Node *> myOPInterestNodes;
613  mutable int64 myTotalMemorySize;
614  bool myProvideDataHints;
615  bool myFirstSimulationStep;
616  bool myLastCookInterrupted;
617 
618  friend class SIM_Data;
619  friend class SIM_DataFactory;
621  friend class SIM_SimulationState;
622  friend class SIM_SaveCommand;
623  friend class SIM_BaseCache;
624  friend class SIM_Cache;
625 
626 protected:
632 
633 };
634 
635 #endif
DEP_MicroNode & refilterParmsMicroNode()
Definition: SIM_Engine.h:440
DEP_MicroNode myResimParmsMicroNode
Definition: SIM_Engine.h:629
virtual void becameDirty(DEP_MicroNode &src, const DEP_PropagateData &propdata)
DEP_MicroNode & resimParmsMicroNode()
Definition: SIM_Engine.h:436
bool myIsPlayer
Definition: SIM_Engine.h:631
UT_ErrorSeverity
Definition: UT_Error.h:25
virtual void notifySimulationChangeSinksOfChange()
Definition: SIM_Engine.h:346
int getCurrentCreatorId() const
Gets the id for the node that is currently being processed.
Definition: SIM_Engine.h:305
DEP_MicroNode mySimMicroNode
Definition: SIM_Engine.h:628
const hboost::disable_if_c< VecTraits< T >::IsVec, T >::type & max(const T &a, const T &b)
Definition: Composite.h:132
Holds pointers to a number of SIM_Relationships.
long long int64
Definition: SYS_Types.h:106
void resetToFirstSimulationStep()
Definition: SIM_Engine.h:270
GLdouble n
Definition: glcorearb.h:2007
virtual const char * className() const
Definition: SIM_Engine.h:46
SIM_SimulationMicroNode mySimInputMicroNode
Definition: SIM_Engine.h:627
DEP_MicroNode & simInputMicroNode()
Definition: SIM_Engine.h:432
Holds pointers to a number of SIM_Object objects.
GLenum GLenum severity
Definition: glcorearb.h:2538
GLboolean * data
Definition: glcorearb.h:130
DEP_MicroNode myRefilterParmsMicroNode
Definition: SIM_Engine.h:630
GLuint const GLchar * name
Definition: glcorearb.h:785
Holds pointers to a number of const SIM_Object objects.
SIM_Engine & myEngine
Definition: SIM_Engine.h:50
const DEP_MicroNode & refilterParmsMicroNode() const
Definition: SIM_Engine.h:442
double fpreal
Definition: SYS_Types.h:269
const DEP_MicroNode & resimParmsMicroNode() const
Definition: SIM_Engine.h:438
UT_CompressionType
bool isPlayer() const
Definition: SIM_Engine.h:449
GLuint index
Definition: glcorearb.h:785
#define SIM_API
Definition: SIM_API.h:10
OP_EventType
Definition: OP_Value.h:22
Propagation info for a dep micro node.
Definition: DEP_MicroNode.h:39
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
This class stores all the caching options used by the SIM_Cache.
int getCurrentCreatorIndex() const
Gets the index of the node output that is currently being processed.
Definition: SIM_Engine.h:308
const DEP_MicroNode & simInputMicroNode() const
Definition: SIM_Engine.h:434
DEP_MicroNode & simMicroNode()
Definition: SIM_Engine.h:425
const DEP_MicroNode & simMicroNode() const
Definition: SIM_Engine.h:427
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glcorearb.h:1296
GLenum src
Definition: glcorearb.h:1792