HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DOP_Engine Class Reference

#include <DOP_Engine.h>

+ Inheritance diagram for DOP_Engine:

Public Member Functions

 DOP_Engine (OP_Node *owner)
 Constructor is given a pointer to the network that owns the simulation. More...
 
virtual ~DOP_Engine ()
 Destructor destroys all data for the simulation. More...
 
void getObjectsAtInputs (DOP_Node *node, UT_ValArray< const SIM_ObjectArray * > &objectsatinputs) const
 
void getObjectsForNode (DOP_Node *node, SIM_ConstObjectArray &objects) const
 
void addObjectForNode (DOP_Node *node, SIM_RootData &rootdata)
 
DOP_NodegetDopNodeBeingProcessed () const
 
void propagateSimDirty (bool send_event)
 Explicitly dirty dependents of this simulation. More...
 
void notifySimulationChangeSinksOfChange ()
 Pass through to our parent's notification. More...
 
- Public Member Functions inherited from SIM_Engine
 SIM_Engine (OP_Node *owner)
 Constructor to create a new simulation. More...
 
virtual ~SIM_Engine ()
 Destructor to destroy all data associated with a simulation. More...
 
OP_NodegetOwner () const
 
const UT_StringgetOwnerFullPath () const
 Gets the full path to the DOP Network node that owns this simulation. More...
 
void getOwnerFullPathString (UT_String &str) const
 
SIM_ObjectaddSimulationObject (bool solvefirstframe)
 
void removeSimulationObject (int index)
 
void removeSimulationObject (SIM_Object *object)
 
int getNumSimulationObjects () const
 Returns the number of objects currently in the simulation. More...
 
int64 getNumSimulationData () const
 Returns the number of objects currently in the simulation. More...
 
const SIM_ObjectgetSimulationObject (int index) const
 
const SIM_ObjectgetSimulationObjectFromId (int objectid) const
 
const SIM_ObjectgetNthSimulationObject (const SIM_DataFilter &filter, int n) const
 
SIM_RelationshipaddRelationship (const char *name, int creationflags)
 
int getNumRelationships () const
 Returns the number of relationships in the current simulation state. More...
 
const SIM_RelationshipgetRelationship (int index) const
 This function allows looping through the simulations relationships. More...
 
const SIM_RelationshipgetRelationship (const char *name) const
 Returns the relationship with the specified name. More...
 
void filterConstRelationships (const SIM_DataFilter &filter, SIM_ConstDataArray &rels) const
 
void removeRelationship (int index)
 Removes the relationship at the specified position. More...
 
void removeRelationship (const char *name)
 Removes the relationship with the specified name. More...
 
void removeRelationship (SIM_Relationship *rel)
 Removes the specified relationship. More...
 
void removeAllRelationships (int createdby, const SIM_RelationshipArray *except)
 
const SIM_RootDatagetRootDataFromId (const SIM_RootDataId &id) const
 
SIM_RootDatagetNonConstRootDataFromId (const SIM_RootDataId &id)
 
const SIM_ObjectgetObjectAtTime (const SIM_Object &object, const SIM_Time &time, bool allowinterpolation) const
 
SIM_ObjectgetAffectorAtTime (SIM_Object &object, const SIM_Time &time, bool allowinterpolation)
 
int getObjectsAtPastTimes (const SIM_Object **const past_objects[], SIM_Time past_times[], const int num_objects, const SIM_Object *const objects[], const int max_past)
 
SIM_ObjectcreateSubStepObject (const SIM_Object &object, const SIM_Time &time)
 
void removeSubStepObject (SIM_Object *objectattime, bool allwithmatchingid)
 
bool mergeSimulationFile (const char *filename, const SIM_DataFilter &filter, const SIM_ObjectArray &replaceobjects, const OP_Node *defaultcreator, bool forcecreatortodefault, bool acceptnewobjects, bool matchbyname, const char *nameprefix)
 
void saveSimulationFile (OP_Node *node, const char *filename, const SIM_DataFilter &filter, const SIM_ObjectArray &objects, UT_CompressionType type=UT_COMPRESSION_TYPE_BLOSC) const
 
bool saveSimulationState (std::ostream &os, UT_CompressionType type=UT_COMPRESSION_TYPE_BLOSC) const
 Saves the entire current state of the simulation immediately. More...
 
bool saveSimulationStateToFile (const char *fname, UT_CompressionType type, bool threadedio) const
 
void setSimulationTime (const SIM_Time &t, bool resimlasttimestep, bool forceresetsim, bool allowsimulation)
 
void resetToFirstSimulationStep ()
 
const SIM_TimegetSimulationTime () const
 Returns the current simulation time. More...
 
const SIM_Time getEngineTime (const SIM_Time &t) const
 Returns the simulation time that corresponds to the given global time. More...
 
const SIM_Time getGlobalTime (const SIM_Time &t) const
 Returns the global time that corresponds to the given simulation time. More...
 
const SIM_TimegetEarliestCacheTime () const
 Returns the time of the earliest simulation state in the cache. More...
 
const SIM_TimegetLatestCacheTime () const
 
void getCachedFrames (UT_IntArray &frames, bool inmemory) const
 
const SIM_CacheOptionsgetCacheOptions () const
 Returns a reference to the cache options for this simulation. More...
 
void setCacheOptions (const SIM_CacheOptions &o)
 Sets the cache options for this simulation. More...
 
const SIM_TimegetTimeStep () const
 Returns the time step size. More...
 
void setTimeStep (const SIM_Time &time)
 Sets the global time step size. More...
 
int getMaxFeedbackIterations () const
 Gets the maximum number of allowed feedback iterations. More...
 
void setMaxFeedbackIterations (int max)
 Sets the maximum number of allowed feedback iterations. More...
 
int getFeedbackIteration () const
 
bool getProvideDataHints () const
 Returns true if the engine is providing data hierarchy hints. More...
 
void setProvideDataHints (bool providehints)
 Specifies whether the engine should provide data hierarchy hints. More...
 
int getCurrentCreatorId () const
 Gets the id for the node that is currently being processed. More...
 
int getCurrentCreatorIndex () const
 Gets the index of the node output that is currently being processed. More...
 
void setCreatorInfo (int id, int index)
 
const SIM_DatagetConstDataWithId (const UT_Guid &id) const
 Returns the SIM_Data pointer with the specified unique id. More...
 
int getSimulationFrame (const SIM_Time &time) const
 
const SIM_Time getSimulationTime (int frame) const
 
void addError (const SIM_RootData *rootdata, const SIM_Data *data, int errorcode, const char *errorparm, UT_ErrorSeverity severity) const
 
int64 getTotalMemorySize () const
 
void removeAllOPInterests () const
 Removes all node interests from the engine. More...
 
void addOPInterest (OP_Node *node) const
 
void addGuideOPInterest (OP_Node *node) const
 
void getDataTypes (UT_StringArray &datatypes, const UT_StringRef &datatype) const
 
void getDataTypeSources (UT_StringArray &datatypes, UT_StringArray &srcs) const
 
const char * getDescription (const UT_StringRef &datatype) const
 
const SIM_DopDescriptiongetDopDescription (const UT_StringRef &datatype) const
 
void findAllObjectsFromString (const char *objspec, SIM_ConstObjectArray &objects, const SIM_Time &t, bool interpolateobj) const
 
const SIM_ObjectfindObjectFromString (const char *objspec, int whichmatch, int *nummatch, const SIM_Time &t, bool interpolateobj) const
 
void findAllObjectsCreatedBy (OP_Node *creator, SIM_ConstObjectArray &objects) const
 
void findAllRelationshipsFromString (const char *relspec, SIM_ConstDataArray &relationships, const SIM_Time &t, bool interpolaterel) const
 
const SIM_RelationshipfindRelationshipFromString (const char *relspec, int whichmatch, int *nummatch, const SIM_Time &t, bool interpolaterel) const
 
void getSelection (SIM_ConstDataArray &data) const
 Gets a list of all selected data in the simulation. More...
 
void clearSelection () const
 Clears the selection flag on all data in this simulation. More...
 
fpreal scaleToMKS (const char *fromunits) const
 
fpreal scaleFromMKS (const char *tounits) const
 
DEP_MicroNodesimMicroNode ()
 
const DEP_MicroNodesimMicroNode () const
 
DEP_MicroNodesimInputMicroNode ()
 
const DEP_MicroNodesimInputMicroNode () const
 
DEP_MicroNoderesimParmsMicroNode ()
 
const DEP_MicroNoderesimParmsMicroNode () const
 
DEP_MicroNoderefilterParmsMicroNode ()
 
const DEP_MicroNoderefilterParmsMicroNode () const
 
void setIsPlayer (bool isPlayer)
 
bool isPlayer () const
 
void resetPlayer ()
 Rebuilds the player cache. More...
 
void updatePlayerFrames ()
 Tries to expand the cached frame range. More...
 

Static Public Member Functions

static bool getWantResimulation ()
 Returns whether resimulations is globally disabled. More...
 
static void setWantResimulation (bool want_resimulation)
 
- Static Public Member Functions inherited from SIM_Engine
static bool canCastToDataType (const UT_StringRef &from_type, const UT_StringRef &to_type)
 

Protected Member Functions

virtual void resetSimulation ()
 
virtual void preSimulationStep ()
 
virtual void postSimulationStep ()
 Overrides the actions that occur after a simulation step. More...
 
virtual void clearReferencesToMostRecentState ()
 
virtual void objectCreated (SIM_Object *object)
 
virtual void objectRemoved (SIM_Object *object)
 
virtual void handleExternalNodeChangeSubclass (OP_Node *changednode, OP_EventType eventtype, void *data, bool isguide)
 
virtual void addErrorSubclass (const SIM_RootData *rootdata, const SIM_Data *data, int errorcode, const char *errorparm, UT_ErrorSeverity severity) const
 
virtual const SIM_Time getEngineTimeSubclass (const SIM_Time &t) const
 Returns the simulation time that corresponds to the given global time. More...
 
virtual const SIM_Time getGlobalTimeSubclass (const SIM_Time &t) const
 Returns the global time that corresponds to the given simulation time. More...
 
virtual bool setIsSimulating (bool issimulating) const
 
- Protected Member Functions inherited from SIM_Engine
SIM_ObjectgetNonConstSimulationObject (int index)
 

Additional Inherited Members

- Protected Attributes inherited from SIM_Engine
SIM_SimulationMicroNode mySimInputMicroNode
 
DEP_MicroNode mySimMicroNode
 
DEP_MicroNode myResimParmsMicroNode
 
DEP_MicroNode myRefilterParmsMicroNode
 
bool myIsPlayer
 

Detailed Description

This subclass of SIM_Engine is the one used to contain simulations controlled by DOP_Node networks. It serves as the glue between the pure simulation library and the DOP_Node interface given to simulations in Houdini.

Examples:
DOP/DOP_GroupAndApply.C, and DOP/DOP_GroupAndApply.h.

Definition at line 36 of file DOP_Engine.h.

Constructor & Destructor Documentation

DOP_Engine::DOP_Engine ( OP_Node owner)

Constructor is given a pointer to the network that owns the simulation.

virtual DOP_Engine::~DOP_Engine ( )
virtual

Destructor destroys all data for the simulation.

Member Function Documentation

virtual void DOP_Engine::addErrorSubclass ( const SIM_RootData rootdata,
const SIM_Data data,
int  errorcode,
const char *  errorparm,
UT_ErrorSeverity  severity 
) const
protectedvirtual

Uses the object and data arguments to put the error message on an appropriate DOP_Node. First priority is given to the node that created the data, then the node that created the object, then the node with the display flag.

Reimplemented from SIM_Engine.

void DOP_Engine::addObjectForNode ( DOP_Node node,
SIM_RootData rootdata 
)

Adds the specified root data (cast to an object) as a sort of "extra object" processed by a DOP node. These extra objects don't affect cooking at all, but show up in the list of objects processed by that node (in the MMB info and dopnodeobjs expression).

virtual void DOP_Engine::clearReferencesToMostRecentState ( )
protectedvirtual

When the most recent simulation state is being deleted or removed from memory, we have to clear all our references to it. This basically means our lists of output objects to process.

Reimplemented from SIM_Engine.

DOP_Node* DOP_Engine::getDopNodeBeingProcessed ( ) const

Gets a pointer to the node that is currently being processed by the DOP_Engine. The return value will be null if the engine is not currently in the preSimulationStep and inside a call to DOP_Node::processObjects(). This function is used by subnet DOPs to evaluate standard DOP local variables in the context of the node that is being processed (since subnets have no context of their own).

virtual const SIM_Time DOP_Engine::getEngineTimeSubclass ( const SIM_Time t) const
protectedvirtual

Returns the simulation time that corresponds to the given global time.

Reimplemented from SIM_Engine.

virtual const SIM_Time DOP_Engine::getGlobalTimeSubclass ( const SIM_Time t) const
protectedvirtual

Returns the global time that corresponds to the given simulation time.

Reimplemented from SIM_Engine.

void DOP_Engine::getObjectsAtInputs ( DOP_Node node,
UT_ValArray< const SIM_ObjectArray * > &  objectsatinputs 
) const

Groups objects passed to a DOP_Node by the input they arrived in. Each entry in the returned UT_ValArray represents an input to the DOP_Node. If a particular input is not connected, the corresponding entry in the array will by null. Generally this function will be called from DOP_Node::processObjects() by nodes which need to have objects coming through one input interact in some way with objects coming through another input.

void DOP_Engine::getObjectsForNode ( DOP_Node node,
SIM_ConstObjectArray objects 
) const

Gets the objects in the stream associated with the supplied node. For nodes with multiple outputs, the result is the combination of all objects on any output. This function does not do any cooking of the networks, or call partitionObjects on any nodes. It only pulls existing data from our set of outputs to process. This function is for use by expression functions that want to know what objects most recently passed through a particular node.

static bool DOP_Engine::getWantResimulation ( )
inlinestatic

Returns whether resimulations is globally disabled.

Definition at line 87 of file DOP_Engine.h.

virtual void DOP_Engine::handleExternalNodeChangeSubclass ( OP_Node changednode,
OP_EventType  eventtype,
void data,
bool  isguide 
)
protectedvirtual

Override this method to flag ourselves as requiring a resimulation when any of our external referenced nodes changes in a significant way.

Reimplemented from SIM_Engine.

void DOP_Engine::notifySimulationChangeSinksOfChange ( )
virtual

Pass through to our parent's notification.

Reimplemented from SIM_Engine.

virtual void DOP_Engine::objectCreated ( SIM_Object object)
protectedvirtual

Sets up custom data on a new object. This implementation calls the base class implementation, then it stores information about the DOP_Node that created the object.

Reimplemented from SIM_Engine.

virtual void DOP_Engine::objectRemoved ( SIM_Object object)
protectedvirtual

Overrides the default behavior when removing a simulation object. This implementation eliminates all references to this object stored in our internal data then calls the base class implementation.

Reimplemented from SIM_Engine.

virtual void DOP_Engine::postSimulationStep ( )
protectedvirtual

Overrides the actions that occur after a simulation step.

Reimplemented from SIM_Engine.

virtual void DOP_Engine::preSimulationStep ( )
protectedvirtual

Overrides the actions that occur before doing a simulation step. This is where the network of DOP_Nodes is parsed. Each DOP_Node has a chance to alter the simulation objects in the DOP_Node::processObjects() function. Nodes can also specify which objects are sent to each output of the node.

Reimplemented from SIM_Engine.

void DOP_Engine::propagateSimDirty ( bool  send_event)

Explicitly dirty dependents of this simulation.

virtual void DOP_Engine::resetSimulation ( )
protectedvirtual

Overrides the base class method to make sure that all our internal data related to the last timestep cook has been cleared away.

Reimplemented from SIM_Engine.

virtual bool DOP_Engine::setIsSimulating ( bool  issimulating) const
protectedvirtual

Alerts our owner that we are simulating due to an internally generated need. Returns the previous state

Reimplemented from SIM_Engine.

static void DOP_Engine::setWantResimulation ( bool  want_resimulation)
inlinestatic

Globally disables resimulations caused by external node changes. This is meant for internal use.

Definition at line 92 of file DOP_Engine.h.


The documentation for this class was generated from the following file: