HDK
|
#include <SIM_Engine.h>
Public Member Functions | |
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_Engine & | operator= (const SIM_Engine &)=delete |
OP_Node * | getOwner () const |
const UT_String & | getOwnerFullPath () const |
Gets the full path to the DOP Network node that owns this simulation. More... | |
void | getOwnerFullPathString (UT_String &str) const |
SIM_Object * | addSimulationObject (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_Object * | getSimulationObject (int index) const |
const SIM_Object * | getSimulationObjectFromId (int objectid) const |
const SIM_Object * | getNthSimulationObject (const SIM_DataFilter &filter, int n) const |
SIM_Relationship * | addRelationship (const char *name, int creationflags) |
int | getNumRelationships () const |
Returns the number of relationships in the current simulation state. More... | |
const SIM_Relationship * | getRelationship (int index) const |
This function allows looping through the simulations relationships. More... | |
const SIM_Relationship * | getRelationship (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_RootData * | getRootDataFromId (const SIM_RootDataId &id) const |
SIM_RootData * | getNonConstRootDataFromId (const SIM_RootDataId &id) |
const SIM_Object * | getObjectAtTime (const SIM_Object &object, const SIM_Time &time, bool allowinterpolation) const |
SIM_Object * | getAffectorAtTime (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_Object * | createSubStepObject (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_Time & | getSimulationTime () 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_Time & | getEarliestCacheTime () const |
Returns the time of the earliest simulation state in the cache. More... | |
const SIM_Time & | getLatestCacheTime () const |
void | getCachedFrames (UT_Array< int > &frames, bool inmemory) const |
const SIM_CacheOptions & | getCacheOptions () 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_Time & | getTimeStep () 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_Data * | getConstDataWithId (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... | |
virtual void | notifySimulationChangeSinksOfChange () |
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_DopDescription * | getDopDescription (const UT_StringRef &datatype) const |
void | findAllObjectsFromString (const char *objspec, SIM_ConstObjectArray &objects, const SIM_Time &t, bool interpolateobj) const |
const SIM_Object * | findObjectFromString (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_Relationship * | findRelationshipFromString (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_MicroNode & | simMicroNode () |
const DEP_MicroNode & | simMicroNode () const |
DEP_MicroNode & | simInputMicroNode () |
const DEP_MicroNode & | simInputMicroNode () const |
DEP_MicroNode & | resimParmsMicroNode () |
const DEP_MicroNode & | resimParmsMicroNode () const |
DEP_MicroNode & | refilterParmsMicroNode () |
const DEP_MicroNode & | refilterParmsMicroNode () 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_IntrusiveRefCounter & | operator= (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 | canCastToDataType (const UT_StringRef &from_type, const UT_StringRef &to_type) |
Protected Member Functions | |
virtual void | resetSimulation () |
virtual void | preSimulationStep () |
virtual void | postSimulationStep () |
This function is run after all objects are processed by their solvers. 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 |
The default implementation of this function does nothing. More... | |
virtual void | resetErrorsSubclass () |
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... | |
SIM_Object * | getNonConstSimulationObject (int index) |
virtual bool | setIsSimulating (bool issimulating) const |
Protected Member Functions inherited from UT_IntrusiveRefCounter< SIM_Engine > | |
SYS_FORCE_INLINE | ~UT_IntrusiveRefCounter () |
Destructor: Only derived classes can destruct this. More... | |
Protected Attributes | |
SIM_SimulationMicroNode | mySimInputMicroNode |
OP_DopParentMicroNode | mySimMicroNode |
DEP_MicroNode | myResimParmsMicroNode |
DEP_MicroNode | myRefilterParmsMicroNode |
bool | myIsPlayer |
Friends | |
class | SIM_Data |
class | SIM_DataFactory |
class | SIM_DataFactoryCreator |
class | SIM_SimulationState |
class | SIM_SaveCommand |
class | SIM_BaseCache |
class | SIM_Cache |
class | SIM_ObjectSolveInfo |
This is the main engine behind all simulations. Any number of these can be created to create independent simulations. Generally a simulation will be owned by a particular OP_Node. For example, the DopNet object contains a SIM_Engine.
Definition at line 65 of file SIM_Engine.h.
SIM_Engine::SIM_Engine | ( | OP_Node * | owner | ) |
Constructor to create a new simulation.
|
virtual |
Destructor to destroy all data associated with a simulation.
|
delete |
void SIM_Engine::addError | ( | const SIM_RootData * | rootdata, |
const SIM_Data * | data, | ||
int | errorcode, | ||
const char * | errorparm, | ||
UT_ErrorSeverity | severity | ||
) | const |
Adds an error to the engine. The object and data parameters allow the DOP_Engine to put the error message on an appropriate DOP Node. Errors are found in the SIM error file. This function simply calls addErrorSubclass().
|
protectedvirtual |
The default implementation of this function does nothing.
Reimplemented in DOP_Engine.
Adds an interest in the supplied node. When the node changes, the engine's handleExternalNodeChange function will be called.
SIM_Relationship* SIM_Engine::addRelationship | ( | const char * | name, |
int | creationflags | ||
) |
Creates a new relationship. The creationflags parameter accepts the same SIM_DATA_* flags accepted by the creationflags parameter of SIM_Data::createNamedSubData().
SIM_Object* SIM_Engine::addSimulationObject | ( | bool | solvefirstframe | ) |
Allocates a new SIM_Object and adds it to the simulation. The name parameter is assigned to the object. This name does not have to be unique.
|
static |
Returns whether we can cast to a superclass data type without creating the SIM_Data.
|
protectedvirtual |
This function is called by our cache whenever the most recent simulated timestep is being removed from memory (either deleted or moved onto disk).
Reimplemented in DOP_Engine.
void SIM_Engine::clearSelection | ( | ) | const |
Clears the selection flag on all data in this simulation.
SIM_Object* SIM_Engine::createSubStepObject | ( | const SIM_Object & | object, |
const SIM_Time & | time | ||
) |
Creates an object in the current state with a particular time stamp. This function is useful for solvers that need to do their own time stepping with step sizes smaller than the globally specified time step size. These explicitly stored subsamples are accessible later with the getObjectAtTime() function.
void SIM_Engine::filterConstRelationships | ( | const SIM_DataFilter & | filter, |
SIM_ConstDataArray & | rels | ||
) | const |
Gets all the relationships of a particular type. The type of a relationship is defined by the one subdata on the SIM_Relationship.
void SIM_Engine::findAllObjectsCreatedBy | ( | OP_Node * | creator, |
SIM_ConstObjectArray & | objects | ||
) | const |
Returns a list of objects created by the specified node, or any nodes inside the specified node (if it is a subnet).
void SIM_Engine::findAllObjectsFromString | ( | const char * | objspec, |
SIM_ConstObjectArray & | objects, | ||
const SIM_Time & | t, | ||
bool | interpolateobj | ||
) | const |
Filters all our simulation objects based on a string pattern. Note that the time value is a simulation time, not global time.
void SIM_Engine::findAllRelationshipsFromString | ( | const char * | relspec, |
SIM_ConstDataArray & | relationships, | ||
const SIM_Time & | t, | ||
bool | interpolaterel | ||
) | const |
Filters all our relationships based on a string pattern. Note that the time value is a simulation time, not global time.
const SIM_Object* SIM_Engine::findObjectFromString | ( | const char * | objspec, |
int | whichmatch, | ||
int * | nummatch, | ||
const SIM_Time & | t, | ||
bool | interpolateobj | ||
) | const |
Returns a single object matching a specified string pattern. Note that the time value is a simulation time, not global time.
const SIM_Relationship* SIM_Engine::findRelationshipFromString | ( | const char * | relspec, |
int | whichmatch, | ||
int * | nummatch, | ||
const SIM_Time & | t, | ||
bool | interpolaterel | ||
) | const |
Returns a single relationship matching a specified string pattern. Note that the time value is a simulation time, not global time.
SIM_Object* SIM_Engine::getAffectorAtTime | ( | SIM_Object & | object, |
const SIM_Time & | time, | ||
bool | allowinterpolation | ||
) |
Returns a non-const pointer to an object for a particular time. This function is very similar to getObjectAtTime() except for two things. First, it requires a non-const starting object, and it is a non-const function. Second, if the specified time exactly matches a time in the past, the returned object will be a copy of that past object, not the object itself. Otherwise modifying that object could modify the past. However, if the current time is sepcified, the actual object (i.e. a pointer to the passed in SIM_Object) is returned. This function is for use by solvers that want to modify their affector objects and which do substepping.
Returns the cached frames. Inclusive.
const SIM_CacheOptions& SIM_Engine::getCacheOptions | ( | ) | const |
Returns a reference to the cache options for this simulation.
Returns the SIM_Data pointer with the specified unique id.
|
inline |
Gets the id for the node that is currently being processed.
Definition at line 326 of file SIM_Engine.h.
|
inline |
Gets the index of the node output that is currently being processed.
Definition at line 329 of file SIM_Engine.h.
void SIM_Engine::getDataTypes | ( | UT_StringArray & | datatypes, |
const UT_StringRef & | datatype | ||
) | const |
Returns all available data type names. If a null type pointer is passed in, this function returns a list of every data type that the SIM_Engine can create. If a data type name is passed in, the list returned will only contain those data types that can be cast to the specified data type using the SIM_Data::getPointerToType() function.
void SIM_Engine::getDataTypeSources | ( | UT_StringArray & | datatypes, |
UT_StringArray & | srcs | ||
) | const |
Returns all available data types and the source of their definition. The definition source will be an empty string if the data type is defined internally to Houdini. Otherwise it will be the name of the DSO or DLL file that contains the data type.
void SIM_Engine::getDataTypeSuperclasses | ( | const UT_StringRef & | datatype, |
UT_StringArray & | classes | ||
) | const |
Returns a list of the superclass names for the specified data type.
const char* SIM_Engine::getDescription | ( | const UT_StringRef & | datatype | ) | const |
Returns the descriptive name for a data type. Given the unique identifying name for a data type this function finds the appropriate data factory and returns the descriptive string assigned to the type.
const SIM_DopDescription* SIM_Engine::getDopDescription | ( | const UT_StringRef & | datatype | ) | const |
Returns the SIM_DopDescription from the SIM_DataFactory of a particular data type.
const SIM_Time& SIM_Engine::getEarliestCacheTime | ( | ) | const |
Returns the time of the earliest simulation state in the cache.
Returns the simulation time that corresponds to the given global time.
|
protectedvirtual |
Returns the simulation time that corresponds to the given global time.
Reimplemented in DOP_Engine.
void SIM_Engine::getExtraInterests | ( | OP_NodeList & | extras, |
bool | normal, | ||
bool | guides | ||
) | const |
Fetch all the nodes in which this simulation has an interest. This method can get the normal node interests, guide geometry interests, or both.
int SIM_Engine::getFeedbackIteration | ( | ) | const |
Gets the current feedback iteration we are on. If we are not currently solving, this function will return -1;
Returns the global time that corresponds to the given simulation time.
|
protectedvirtual |
Returns the global time that corresponds to the given simulation time.
Reimplemented in DOP_Engine.
const SIM_Time& SIM_Engine::getLatestCacheTime | ( | ) | const |
int SIM_Engine::getMaxFeedbackIterations | ( | ) | const |
Gets the maximum number of allowed feedback iterations.
|
inline |
Unique id that is bumped whenever the simulation is reset or a frame is resimulated.
Definition at line 495 of file SIM_Engine.h.
SIM_RootData* SIM_Engine::getNonConstRootDataFromId | ( | const SIM_RootDataId & | id | ) |
|
protected |
This function is the only way for a SIM_Engine subclass to get a non-const SIM_Object pointer.
const SIM_Object* SIM_Engine::getNthSimulationObject | ( | const SIM_DataFilter & | filter, |
int | n | ||
) | const |
Returns the "nth" simulation object that matches a supplied filter. If less than the supplied n objects match the filter, 0 is returned.
int SIM_Engine::getNumRelationships | ( | ) | const |
Returns the number of relationships in the current simulation state.
int64 SIM_Engine::getNumSimulationData | ( | ) | const |
Returns the number of objects currently in the simulation.
int SIM_Engine::getNumSimulationObjects | ( | ) | const |
Returns the number of objects currently in the simulation.
const SIM_Object* SIM_Engine::getObjectAtTime | ( | const SIM_Object & | object, |
const SIM_Time & | time, | ||
bool | allowinterpolation | ||
) | const |
Returns a pointer to the state of an object at some time in the past. This function searches for these past object states in three ways. First, if the specified time is equal to a past time step, the state for that time step is returned. Second, if the specified time is not equal to a past time step, then past time steps are searched for object states stored explicitly with createSubStepObject(). Finally, if both these methods fail to find a matching object state, then the closest object states before and after the specified time are found using the first two approaches. Then a new object state is created by interpolating between these two states using SIM_Data::interpolate(). This third approach is skipped if allowinterpolation is set to false. If no previous or no future object state can be found, then this function returns null.
int SIM_Engine::getObjectsAtPastTimes | ( | const SIM_Object **const | past_objects[], |
SIM_Time | past_times[], | ||
const int | num_objects, | ||
const SIM_Object *const | objects[], | ||
const int | max_past | ||
) |
This is a more direct, more efficient method for reading cached versions of objects from previous frames, without interpolation.
Before the call, 'past_objects' must be a valid array of SIM_Object* arrays and 'past_times' must be a valid array of SIM_Time. 'past_objects' must have size 'max_past' each element of 'past_objects' must be an array of SIM_Object* of size 'num_objects' 'past_times' must be an array of size 'max_past'
Output: The number of cached frames is returned. The cached version of object[oi] at time past_times[i] is stored in the array past_objects[i] at location oi, for all 0 <= i < "the returned number of cached frames"
OP_Node* SIM_Engine::getOwner | ( | ) | const |
Returns the OP_Node that owns this engine. This may be null if the engine isn't associated with a particular node.
const UT_String& SIM_Engine::getOwnerFullPath | ( | ) | const |
Gets the full path to the DOP Network node that owns this simulation.
bool SIM_Engine::getProvideDataHints | ( | ) | const |
Returns true if the engine is providing data hierarchy hints.
const SIM_Relationship* SIM_Engine::getRelationship | ( | int | index | ) | const |
This function allows looping through the simulations relationships.
const SIM_Relationship* SIM_Engine::getRelationship | ( | const char * | name | ) | const |
Returns the relationship with the specified name.
int SIM_Engine::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.
const SIM_RootData* SIM_Engine::getRootDataFromId | ( | const SIM_RootDataId & | id | ) | const |
Returns either a SIM_Relationship or SIM_Object depending on the information stored in the id parameter.
void SIM_Engine::getSelection | ( | SIM_ConstDataArray & | data | ) | const |
Gets a list of all selected data in the simulation.
Returns the simulation frame number that corresponds to the given time. The simulation frame number is the number of timesteps that need to be run to get to the specified time, plus one (so that time zero is frame 1).
const SIM_Object* SIM_Engine::getSimulationObject | ( | int | index | ) | const |
Returns a pointer to the SIM_Object at the specified index. The index value is the current location of the object in the simulations's list of objects. This value will not be the same as the SIM_Object::getObjectId() value.
const SIM_Object* SIM_Engine::getSimulationObjectFromId | ( | int | objectid | ) | const |
Returns a pointer to the SIM_Object with the specified unique id. This function searches the current list of objects for the specified objectid. If the objectid is not found, this function returns null.
const SIM_Time& SIM_Engine::getSimulationTime | ( | ) | const |
Returns the current simulation time.
Returns the simulation time that corresponds to the given simulation frame.
const SIM_Time& SIM_Engine::getTimeStep | ( | ) | const |
Returns the time step size.
int64 SIM_Engine::getTotalMemorySize | ( | ) | const |
Returns the total amount of memory used by all data currently in this simulation, at the current time or in the cache.
|
protectedvirtual |
Override this method to handle changes to external nodes in which we have an interest. The default implementation does nothing.
Reimplemented in DOP_Engine.
|
inline |
Returns whether there is an explicit interest on the node.
Definition at line 369 of file SIM_Engine.h.
|
inline |
Definition at line 486 of file SIM_Engine.h.
bool SIM_Engine::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 | ||
) |
Loads a simulation state from a file and merges it into the current simulation state. The data that gets loaded is not allowed to do any sharing of data with the current state, since the data id's can't be expected to match. Objects from the file will replace objects from the current state if their object ids match. Objects loaded from the file will be flagged so that they will not be solved in the current timestep. In subsequent timesteps these objects will be solved. The filter parameter specifies which objects stored in the file are merged in.
|
inlinevirtual |
Passes up to our owner to alert anything that needs an OP_Event in response to use becoming dirty.
Reimplemented in DOP_Engine.
Definition at line 374 of file SIM_Engine.h.
|
protectedvirtual |
Initializes a newly created object. This function is called by addSimulationObject(). The default implementation does nothing.
Reimplemented in DOP_Engine.
|
protectedvirtual |
Allows special handling of objects that are being removed. This function is called by removeSimulationObject(). The default implementation does nothing.
Reimplemented in DOP_Engine.
|
delete |
|
protectedvirtual |
This function is run after all objects are processed by their solvers.
Reimplemented in DOP_Engine.
|
protectedvirtual |
This function is run before passing each object to its solver. The implementation at this level clears out all temporary data from the simulation objects.
Reimplemented in DOP_Engine.
|
inline |
Definition at line 472 of file SIM_Engine.h.
|
inline |
Definition at line 474 of file SIM_Engine.h.
void SIM_Engine::removeAllOPInterests | ( | ) | const |
Removes all node interests from the engine.
void SIM_Engine::removeAllRelationships | ( | int | createdby, |
const SIM_RelationshipArray * | except | ||
) |
Removes all relationships created by a particular DOP node. If -1 is specified, then all relationships are removed. Relationships in the "except" array are not removed.
Removes the relationship at the specified position.
void SIM_Engine::removeRelationship | ( | const char * | name | ) |
Removes the relationship with the specified name.
void SIM_Engine::removeRelationship | ( | SIM_Relationship * | rel | ) |
Removes the specified relationship.
Removes a SIM_Object from the simulation. The index value is the current location of the object in the simulations's list of objects. This value will not be the same as the SIM_Object::getObjectId() value, and may change when objects are added to or removed from the simulation.
void SIM_Engine::removeSimulationObject | ( | SIM_Object * | object | ) |
Removes a SIM_Object from the simulation. This version of this function takes a SIM_Object pointer instead of an index. The pointer is converted to an index and the indexed version of removeSimulationObject() is called.
void SIM_Engine::removeSubStepObject | ( | SIM_Object * | objectattime, |
bool | allwithmatchingid | ||
) |
Removes an object previously created by createSubStepObject(). If the allwithmatchingid parameter is set to true, not only will the specified object be destroyed, but all other objects with the same object id created using createSubStepObject() will be destroyed. This provides a quick way to destroy all temporary working copies of a particular object.
void SIM_Engine::resetErrors | ( | ) |
Resets the errors stored in the simulation.
|
protectedvirtual |
Reimplemented in DOP_Engine.
void SIM_Engine::resetPlayer | ( | ) |
Rebuilds the player cache.
|
protectedvirtual |
Resets the simulation to a clean state. This function calls clearSimulation(), then builds a single empty simulation state.
Reimplemented in DOP_Engine.
|
inline |
Marks this engine as invalid without actually clearing or resetting anything. A proper reset implies also a frame advance to the first frame that can be expensive. Note the cache will not be cleared until it is cooked, however!
Definition at line 290 of file SIM_Engine.h.
|
inline |
Definition at line 468 of file SIM_Engine.h.
|
inline |
Definition at line 470 of file SIM_Engine.h.
void SIM_Engine::saveSimulationFile | ( | OP_Node * | node, |
const char * | filename, | ||
const SIM_DataFilter & | filter, | ||
const SIM_ObjectArray & | objects, | ||
UT_CompressionType | type = UT_COMPRESSION_TYPE_BLOSC |
||
) | const |
Schedules some objects to be saved to a files at the end of the current timestep. The filter parameter makes it possible to save only some of the objects to the file. The actual save happens in the postSimulationStep().
bool SIM_Engine::saveSimulationState | ( | std::ostream & | os, |
UT_CompressionType | type = UT_COMPRESSION_TYPE_BLOSC |
||
) | const |
Saves the entire current state of the simulation immediately.
bool SIM_Engine::saveSimulationStateToFile | ( | const char * | fname, |
UT_CompressionType | type, | ||
bool | threadedio | ||
) | const |
fpreal SIM_Engine::scaleFromMKS | ( | const char * | tounits | ) | const |
Returns the scale factor to convert a value in MKS units into the equivalent value in the provided units.
fpreal SIM_Engine::scaleToMKS | ( | const char * | fromunits | ) | const |
Returns the scale factor to convert a value in the provided units into the equivalent MKS value.
void SIM_Engine::setCacheOptions | ( | const SIM_CacheOptions & | o | ) |
Sets the cache options for this simulation.
Set the creator information. These values are automatically reset to (-1, -1) before performing a simulation step.
void SIM_Engine::setIsPlayer | ( | bool | isPlayer | ) |
Sets this simulation as a player. It will replace it's cache with simulation data from the files given and not simulate, just read the files.
|
protectedvirtual |
Alerts our owner that we are simulating due to an internally generated need. Returns the previous state
Reimplemented in DOP_Engine.
Sets the maximum number of allowed feedback iterations.
void SIM_Engine::setProvideDataHints | ( | bool | providehints | ) |
Specifies whether the engine should provide data hierarchy hints.
void SIM_Engine::setSimulationTime | ( | const SIM_Time & | t, |
bool | resimlasttimestep, | ||
bool | forceresetsim, | ||
bool | allowsimulation | ||
) |
Sets the current time for the simulation. If the new simulation time is less than the current time, the SIM_Cache is simply set to use its best match for the chosen time. If the new simulation time is greater than the current time, the simulation is stepped forward in time to the new time. The resimlasttimestep parameter causes the most recent cache entry to be deleted before trying to set the current time. This is useful if some parameter of the simulation changes on the current timestep. It causes the timestep to be recooked with the new parameter. This resimulation may also happen if the simulation was interrupted the last time this function was called. The forceresetsim parameter tells the SIM_Engine to reset the simulation before trying to move to the specified time, whether the reset is required or not.
|
inline |
This micronode holds the simulation input. It is wired directly to the simMicroNode, however, does not care about refilter events.
Definition at line 464 of file SIM_Engine.h.
|
inline |
Definition at line 466 of file SIM_Engine.h.
|
inline |
The micronode representing the simulation result. It is marked as dirtied and propagated whenever the simulation is cleared. Callers can use this to express dependencies on/from the simulation.
Definition at line 457 of file SIM_Engine.h.
|
inline |
Definition at line 459 of file SIM_Engine.h.
void SIM_Engine::updatePlayerFrames | ( | ) |
Tries to expand the cached frame range.
|
friend |
Definition at line 683 of file SIM_Engine.h.
Definition at line 684 of file SIM_Engine.h.
Definition at line 678 of file SIM_Engine.h.
|
friend |
Definition at line 679 of file SIM_Engine.h.
|
friend |
Definition at line 680 of file SIM_Engine.h.
|
friend |
Definition at line 686 of file SIM_Engine.h.
|
friend |
Definition at line 682 of file SIM_Engine.h.
|
friend |
Definition at line 681 of file SIM_Engine.h.
|
protected |
Definition at line 693 of file SIM_Engine.h.
|
protected |
Definition at line 692 of file SIM_Engine.h.
|
protected |
Definition at line 691 of file SIM_Engine.h.
|
protected |
Definition at line 689 of file SIM_Engine.h.
|
protected |
Definition at line 690 of file SIM_Engine.h.