8 #ifndef __SIM_Engine_h__
9 #define __SIM_Engine_h__
24 #define SIM_PATH_SEPCHAR '/'
25 #define SIM_OBJECT_SEPCHAR ':'
26 #define SIM_OBJECTNUM_SEPCHAR '.'
27 #define SIM_OBJECTDATA_SEPCHAR '/'
38 class SIM_SimulationState;
40 class SIM_MetaObjectArray;
43 class SIM_SaveCommand;
51 {
return "SIM_SimulationMicroNode"; }
76 const UT_String &getOwnerFullPath()
const;
77 void getOwnerFullPathString(
UT_String &str)
const;
82 SIM_Object *addSimulationObject(
bool solvefirstframe);
88 void removeSimulationObject(
int index);
93 void removeSimulationObject(
SIM_Object *
object);
95 int getNumSimulationObjects()
const;
97 int64 getNumSimulationData()
const;
102 const SIM_Object *getSimulationObject(
int index)
const;
107 const SIM_Object *getSimulationObjectFromId(
int objectid)
const;
120 int getNumRelationships()
const;
127 void filterConstRelationships(
131 void removeRelationship(
int index);
133 void removeRelationship(
const char *name);
139 void removeAllRelationships(
int createdby,
166 bool allowinterpolation)
const;
180 bool allowinterpolation);
198 int getObjectsAtPastTimes(
201 const int num_objects,
219 void removeSubStepObject(
SIM_Object *objectattime,
220 bool allwithmatchingid);
231 bool mergeSimulationFile(
const char *
filename,
235 bool forcecreatortodefault,
236 bool acceptnewobjects,
238 const char *nameprefix);
243 void saveSimulationFile(
OP_Node *node,
244 const char *filename,
249 bool saveSimulationState(std::ostream &os,
251 bool saveSimulationStateToFile(
const char *fname,
253 bool threadedio)
const;
268 void setSimulationTime(
const SIM_Time &
t,
269 bool resimlasttimestep,
271 bool allowsimulation);
278 { myFirstSimulationStep =
true; }
281 const SIM_Time &getSimulationTime()
const;
287 const SIM_Time &getEarliestCacheTime()
const;
288 const SIM_Time &getLatestCacheTime()
const;
291 void getCachedFrames(
UT_IntArray &frames,
bool inmemory)
const;
297 const SIM_Time &getTimeStep()
const;
299 void setTimeStep(
const SIM_Time &time);
301 int getMaxFeedbackIterations()
const;
303 void setMaxFeedbackIterations(
int max);
306 int getFeedbackIteration()
const;
308 bool getProvideDataHints()
const;
310 void setProvideDataHints(
bool providehints);
313 {
return myCurrentCreatorId; }
316 {
return myCurrentCreatorIndex; }
319 void setCreatorInfo(
int id,
int index);
326 int getSimulationFrame(
const SIM_Time &time)
const;
329 const SIM_Time getSimulationTime(
int frame)
const;
338 const char *errorparm,
345 int64 getTotalMemorySize()
const;
348 void removeAllOPInterests()
const;
351 void addOPInterest(
OP_Node *node)
const;
352 void addGuideOPInterest(
OP_Node *node)
const;
376 const char *getDescription(
385 static bool canCastToDataType(
391 void findAllObjectsFromString(
const char *objspec,
394 bool interpolateobj)
const;
397 const SIM_Object *findObjectFromString(
const char *objspec,
398 int whichmatch,
int *nummatch,
400 bool interpolateobj)
const;
403 void findAllObjectsCreatedBy(
OP_Node *creator,
407 void findAllRelationshipsFromString(
411 bool interpolaterel)
const;
416 int whichmatch,
int *nummatch,
418 bool interpolaterel)
const;
423 void clearSelection()
const;
427 fpreal scaleToMKS(
const char *fromunits)
const;
430 fpreal scaleFromMKS(
const char *tounits)
const;
436 {
return mySimMicroNode; }
438 {
return mySimMicroNode; }
443 {
return mySimInputMicroNode; }
445 {
return mySimInputMicroNode; }
447 {
return myResimParmsMicroNode; }
449 {
return myResimParmsMicroNode; }
451 {
return myRefilterParmsMicroNode; }
453 {
return myRefilterParmsMicroNode; }
458 void getExtraInterests(
OP_NodeList &extras,
bool normal,
bool guides)
const;
463 void setIsPlayer(
bool isPlayer);
469 void updatePlayerFrames();
474 virtual void resetSimulation();
478 virtual void preSimulationStep();
480 virtual void postSimulationStep();
484 virtual void clearReferencesToMostRecentState();
487 virtual void objectCreated(
SIM_Object *
object);
491 virtual void objectRemoved(
SIM_Object *
object);
494 virtual void handleExternalNodeChangeSubclass(
500 virtual void addErrorSubclass(
const SIM_RootData *rootdata,
503 const char *errorparm,
505 virtual void resetErrorsSubclass();
512 SIM_Object *getNonConstSimulationObject(
int index);
516 virtual bool setIsSimulating(
bool issimulating)
const;
520 int getOwnerUniqueId()
const;
523 void clearSimulation();
527 void clearSimulationForDestruction();
529 void doSimulationStep(
bool forreset);
532 void doSimulationStepForMetaObject(
533 SIM_MetaObject &metaobject,
535 bool isLastMetaObject);
538 void mergeSimulation(
539 SIM_SimulationState &fromstate,
542 bool acceptnewobjects,
544 const char *nameprefix);
555 SIM_SimulationState &getSimulationObjects();
557 const SIM_SimulationState &getSimulationObjects()
const;
559 SIM_Object *getNonConstSimulationObjectFromId(
567 void purgeUnusedData()
const;
572 void registerNewData(
SIM_Data *newdata)
const;
576 bool doinit=
true)
const;
580 const UT_Guid &uniqueid)
const;
584 void unregisterDeletedData(
SIM_Data *deleteddata)
const;
594 void setNeedsToRecalculateMemorySize(
603 void handleExternalNodeChange(
OP_Node *changednode,
610 static void handleExternalNodeChange(
OP_Node *changednode,
614 static void handleExternalGuideNodeChange(
OP_Node *changednode,
620 void clearAllSolveInfo();
631 SIM_BaseCache *myBaseCache;
634 int myMaxFeedbackIterations;
635 int myFeedbackIteration;
636 int myCurrentCreatorId;
637 int myCurrentCreatorIndex;
644 mutable int64 myTotalMemorySize;
645 bool myProvideDataHints;
646 bool myFirstSimulationStep;
647 bool myLastCookInterrupted;
649 mutable bool myClearingSolveInfos;
654 friend class SIM_SimulationState;
655 friend class SIM_SaveCommand;
656 friend class SIM_BaseCache;
vint4 max(const vint4 &a, const vint4 &b)
DEP_MicroNode & refilterParmsMicroNode()
DEP_MicroNode myResimParmsMicroNode
GT_API const UT_StringHolder filename
virtual void becameDirty(DEP_MicroNode &src, const DEP_PropagateData &propdata)
GLuint const GLchar * name
GT_API const UT_StringHolder time
DEP_MicroNode & resimParmsMicroNode()
const char * className() const override
virtual void notifySimulationChangeSinksOfChange()
A reference counter base class for use with UT_IntrusivePtr.
int getCurrentCreatorId() const
Gets the id for the node that is currently being processed.
Holds pointers to a number of SIM_Relationships.
void resetToFirstSimulationStep()
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
SIM_SimulationMicroNode mySimInputMicroNode
DEP_MicroNode & simInputMicroNode()
GLint GLenum GLsizei GLint GLsizei const void * data
Holds pointers to a number of SIM_Object objects.
OP_DopParentMicroNode mySimMicroNode
DEP_MicroNode myRefilterParmsMicroNode
GLuint GLuint GLsizei GLenum type
Holds pointers to a number of const SIM_Object objects.
const DEP_MicroNode & refilterParmsMicroNode() const
const DEP_MicroNode & resimParmsMicroNode() const
Propagation info for a dep micro node.
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.
const DEP_MicroNode & simInputMicroNode() const
DEP_MicroNode & simMicroNode()
const DEP_MicroNode & simMicroNode() const