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...
 
 ~DOP_Engine () override
 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 () override
 Pass through to our parent's notification. More...
 
UT_ErrorSeverity getErrorSeverity () const
 
void registerNodeError (OP_Node *node, const UT_StringHolder &errmsg, UT_ErrorSeverity sev) const
 
void applyErrorsToNode (OP_Node *sink, OP_Node *sourcenode, bool only_nodes_errors=true, UT_ErrorSeverity minseverity=UT_ERROR_MESSAGE) const
 
void applyErrorsToManager (UT_ErrorManager *sink, OP_Node *sourcenode, bool only_nodes_errors=true, UT_ErrorSeverity minseverity=UT_ERROR_MESSAGE) const
 
- 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...
 
 SIM_Engine (const SIM_Engine &)=delete
 
SIM_Engineoperator= (const SIM_Engine &)=delete
 
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)
 
int getRelationshipsAtPastTimes (const SIM_Relationship **const past_rels[], SIM_Time past_times[], const int num_rels, const SIM_Relationship *const rels[], const int max_past) const
 Equivalent of getObjectsAtPastTimes() for relationships. More...
 
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_Array< int > &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
 
void resetErrors ()
 Resets the errors stored in the simulation. More...
 
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
 
bool hasOPInterest (OP_Node *node) const
 Returns whether there is an explicit interest on the node. More...
 
void getDataTypes (UT_StringArray &datatypes, const UT_StringRef &datatype) const
 
void getDataTypeSuperclasses (const UT_StringRef &datatype, UT_StringArray &classes) const
 Returns a list of the superclass names for the specified data type. More...
 
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 getExtraInterests (OP_NodeList &extras, bool normal, bool guides) 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...
 
int64 getModVersion () const
 
- Public Member Functions inherited from UT_IntrusiveRefCounter< SIM_Engine >
SYS_FORCE_INLINE UT_IntrusiveRefCounter () noexcept
 Default constructor: Sets counter to 0. More...
 
SYS_FORCE_INLINE UT_IntrusiveRefCounter (const UT_IntrusiveRefCounter &) noexcept
 Copy constructor: Sets counter to 0. More...
 
UT_IntrusiveRefCounteroperator= (const UT_IntrusiveRefCounter &) noexcept
 Assignment operator: Does not modify counter. More...
 
SYS_FORCE_INLINE uint32 use_count () const noexcept
 Return current counter. More...
 
SYS_FORCE_INLINE bool conditionalAddRef () noexcept
 

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

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

Additional Inherited Members

- Protected Attributes inherited from SIM_Engine
SIM_SimulationMicroNode mySimInputMicroNode
 
OP_DopParentMicroNode 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.

DOP_Engine::~DOP_Engine ( )
override

Destructor destroys all data for the simulation.

Member Function Documentation

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

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).

void DOP_Engine::applyErrorsToManager ( UT_ErrorManager sink,
OP_Node sourcenode,
bool  only_nodes_errors = true,
UT_ErrorSeverity  minseverity = UT_ERROR_MESSAGE 
) const

Re-applies any errors cached locally to the given node. Only applies errors with severity greater or equal to minimum. If only_nodes_errors is false, will catch all errors and apply them to sink.

void DOP_Engine::applyErrorsToNode ( OP_Node sink,
OP_Node sourcenode,
bool  only_nodes_errors = true,
UT_ErrorSeverity  minseverity = UT_ERROR_MESSAGE 
) const

Re-applies any errors cached locally to the given node. Only applies errors with severity greater or equal to minimum. If only_nodes_errors is false, will catch all errors and apply them to sink.

void DOP_Engine::clearReferencesToMostRecentState ( )
overrideprotectedvirtual

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).

const SIM_Time DOP_Engine::getEngineTimeSubclass ( const SIM_Time t) const
overrideprotectedvirtual

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

Reimplemented from SIM_Engine.

UT_ErrorSeverity DOP_Engine::getErrorSeverity ( ) const
inline

Definition at line 110 of file DOP_Engine.h.

const SIM_Time DOP_Engine::getGlobalTimeSubclass ( const SIM_Time t) const
overrideprotectedvirtual

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.

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

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 ( )
overridevirtual

Pass through to our parent's notification.

Reimplemented from SIM_Engine.

void DOP_Engine::objectCreated ( SIM_Object object)
overrideprotectedvirtual

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.

void DOP_Engine::objectRemoved ( SIM_Object object)
overrideprotectedvirtual

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.

void DOP_Engine::postSimulationStep ( )
overrideprotectedvirtual

Overrides the actions that occur after a simulation step.

Reimplemented from SIM_Engine.

void DOP_Engine::preSimulationStep ( )
overrideprotectedvirtual

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.

void DOP_Engine::registerNodeError ( OP_Node node,
const UT_StringHolder errmsg,
UT_ErrorSeverity  sev 
) const

Registers an error against a specified node so it will be resurrected every time that node recooks. Usually handled transparently by addErrorSubclass, but required when the error is added outside the simulation path.

void DOP_Engine::resetErrorsSubclass ( )
overrideprotectedvirtual

We keep track of all the accumulated errors so we can re-post them every time the DOP nodes cook (as they cook independently of simulating.) This will clear out all the cached errors.

Reimplemented from SIM_Engine.

void DOP_Engine::resetSimulation ( )
overrideprotectedvirtual

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.

bool DOP_Engine::setIsSimulating ( bool  issimulating) const
overrideprotectedvirtual

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: