HDK
|
#include <SIM_Data.h>
Public Member Functions | |
const UT_StringHolder & | getDataType () const |
void | initialize (const SIM_SubdataBehavior &subdatabehavior) |
void | makeEqual (const SIM_Data *source, const SIM_SubdataBehavior &subdatabehavior) |
void | setParameters (const SIM_Options &parms) |
void | interpolate (const SIM_Data *source1, const SIM_Data *source2, fpreal interp) |
int64 | getMemorySize () const |
bool | getIsAlternateRepresentation () const |
bool | saveToFile (const char *filename, UT_CompressionType compressionType) const |
bool | saveToStream (std::ostream &os, UT_CompressionType compressionType) const |
void | appendFullDataPath (const SIM_Data *subdata, bool useobjectid, UT_String &datapath) const |
bool | loadFromFile (const char *filename) |
bool | loadFromStream (UT_IStream &is, bool skiptype=false) |
bool | getIsOfType (const UT_StringRef &datatype) const |
const void * | getConstPointerToType (const UT_StringRef &datatype) const |
void * | getPointerToType (const UT_StringRef &datatype) |
int | getNumSubData () const |
Get the number of sub-data items attached to this data. More... | |
const UT_StringHolder & | getSubDataName (int index) const |
Get the name of the sub-data at a particular index location. More... | |
int | getSubDataIndex (const SIM_Data *subdata) const |
bool | buildSubDataPath (const SIM_Data *subdata, UT_String &pathto) const |
const SIM_Query & | getQueryObject () const |
SIM_Options * | getUserOptions () |
const SIM_Options * | getConstUserOptions () const |
long | getGuideParmVersion () const |
void | addGuideDep (DEP_MicroNode &src) const |
virtual bool | getGuideGeometryList (const SIM_RootData &root, const char *datapath, const SIM_Time &t, UT_Array< GU_ConstDetailHandle > &detailArray, UT_Array< UT_DMatrix4 > &xformArray) const |
GU_ConstDetailHandle | getGuideGeometry (const SIM_RootData &root, const char *datapath, UT_DMatrix4 &xform, const SIM_Time &t) const |
void | buildGuideOptions (SIM_Options &options, const SIM_Time &time) const |
SIM_Data * | getSubData (int index) |
const SIM_Data * | getConstSubData (int index) const |
SIM_Data * | getNamedSubData (const char *dataname) |
const SIM_Data * | getConstNamedSubData (const char *dataname) const |
void | filterSubData (SIM_DataArray &ncdp, UT_StringArray *names, const SIM_DataFilter &ncfilter, const char *startfrom, const SIM_DataFilter &recursefilter) |
void | filterConstSubData (SIM_ConstDataArray &dp, UT_StringArray *names, const SIM_DataFilter &filter, const char *startfrom, const SIM_DataFilter &recurseFilter) const |
SIM_Data * | getNthSubData (UT_String *name, const SIM_DataFilter &filter, int n, const char *startfrom, const SIM_DataFilter &recurseFilter) |
const SIM_Data * | getNthConstSubData (UT_String *name, const SIM_DataFilter &filter, int n, const char *startfrom, const SIM_DataFilter &recurseFilter) const |
void | forEachSubData (SIM_EachDataCallback &cb, const SIM_DataFilter &filter, const char *startfrom, const SIM_DataFilter &recurseFilter) |
void | forEachConstSubData (SIM_EachDataCallback &cb, const SIM_DataFilter &filter, const char *startfrom, const SIM_DataFilter &recurseFilter) const |
SIM_Data * | createNamedSubData (const char *dataname, const char *datatype, int creationflags, UT_String *newdatanameptr=NULL) |
SIM_Data * | getOrCreateAlternateRepresentation (const char *dataname, const char *datatype) const |
void | interpolateSubData (const SIM_Data &source1, const SIM_Data &source2, fpreal interp, const SIM_DataFilter &interpdata, const SIM_DataFilter &recurse) |
void | setNamedSubData (const char *dataname, const SIM_Data *data, int setflags) |
void | createUniqueSubDataName (const SIM_Data *subdata, UT_String &dataname) const |
void | removeNamedSubData (const char *dataname) |
Remove some existing sub-data by name. More... | |
void | removeSubData (int index) |
Remove some existing sub-data by index. More... | |
void | moveNamedSubData (const char *oldname, const char *newname) |
const UT_Guid & | getUniqueId () const |
long | getReferenceCount () const |
int | getCreatorId () const |
Get the ID of the node that created this data. More... | |
OP_Node * | getCreatorNode () const |
Use the creator ID to look up the OP_Node that created this data. More... | |
OP_Node * | getOwnerNetwork () const |
Look up the owner node of our engine to get the DOP Network pointer. More... | |
const SIM_Engine & | getEngine () const |
Get the engine that created us (from our data factory). More... | |
int | getCreatorIndex () const |
Get the output index of the creator node that generated this data. More... | |
const SIM_Time & | getCreationTime () const |
Get the creation time for this data. More... | |
bool | getIsSelected () const |
Get the selected flag for this data. More... | |
void | setIsSelected (bool selected) const |
bool | getSelectionRepresentsObject () const |
void | copyCreationInfoFrom (const SIM_Data *source) |
OP_Node & | getNodePathsRelativeTo () const |
OP_Node * | getOPNode (const char *path, bool addinterest) const |
Given a path relative to our creator node, return an OBJ_Node. More... | |
OBJ_Node * | getOBJNode (const char *path, bool addinterest) const |
Given a path relative to our creator node, return an OBJ_Node. More... | |
SOP_Node * | getSOPNode (const char *path, bool addinterest) const |
Given a path relative to our creator node, return a SOP_Node. More... | |
DOP_Node * | getDOPNode (const char *path, bool addinterest) const |
Given a path relative to our creator node, return a DOP_Node. More... | |
COP2_Node * | getCOP2Node (const char *path, bool addinterest) const |
Given a path relative to our creator node, return a COP2_Node. More... | |
CHOP_Node * | getCHOPNode (const char *path, bool addinterest) const |
Given a path relative to our creator node, return a CHOP_Node. More... | |
void | addOPInterest (OP_Node *node) const |
Adds an interest in the specified node to our engine's owner node. More... | |
void | addError (const SIM_RootData *root, int errorcode, const char *errorparm, UT_ErrorSeverity severity) const |
Adds an error to our SIM_Engine. More... | |
void | makeMemberDataUnique () |
virtual void | makeMemberDataUniqueSubclass () |
Static Public Member Functions | |
static bool | getDataTypeFromFile (const char *filename, UT_String &datatype) |
static bool | getDataTypeFromStream (UT_IStream &is, UT_String &datatype) |
static const void * | castConstPointerToType (const SIM_Data *data, const UT_StringRef &datatype) |
static void * | castPointerToType (SIM_Data *data, const UT_StringRef &datatype) |
Static Protected Member Functions | |
static const PRM_Template * | getEmptyTemplateList () |
static const SIM_DopDescription * | getEmptyDopDescription () |
A DOP description that says not to create an automatic DOP. More... | |
static void | getDataTypeSuperclasses (UT_StringArray &) |
Friends | |
class | SIM_DataFactory |
class | SIM_SimulationState |
class | SIM_OptionsUser |
class | SIM_Guide |
This is the base class for all data types that are part of a simulation. To work within a simulation, any data that you want to attach to a simulation object must be a subclass of this type. A number of useful subclasses of this type are provided, such as SIM_Geometry and SIM_Position. Every SIM_Data subclass that is attached to a parent data must be assigned a unique name, so the more data that can be put into a single SIM_Data subclass the more efficient it will be. At the same time, providing small discrete classes makes those classes more likely to be usable in different circumstances.
Definition at line 137 of file SIM_Data.h.
|
explicitprotected |
The SIM_Data constructor when being created by a SIM_DataFactory. All SIM_Data subclasses should have protected constructors to ensure that only the SIM_DataFactory can create objects of this type.
|
protectedvirtual |
The SIM_Data destructor. It is very important that SIM_Data created by a SIM_DataFactory only be deleted by that SIM_DataFactory.
void SIM_Data::addError | ( | const SIM_RootData * | root, |
int | errorcode, | ||
const char * | errorparm, | ||
UT_ErrorSeverity | severity | ||
) | const |
Adds an error to our SIM_Engine.
void SIM_Data::addGuideDep | ( | DEP_MicroNode & | src | ) | const |
Adds a dependency to our guide from the given micronode, meant to be invoked inside of buildGuideGeometrySubclass
Adds an interest in the specified node to our engine's owner node.
void SIM_Data::appendFullDataPath | ( | const SIM_Data * | subdata, |
bool | useobjectid, | ||
UT_String & | datapath | ||
) | const |
Returns the full path starting at this data to the specified subdata. If this is a simulation object, the path will start with the name or the object ID (depending on useobjectid flag). If this is a relationship, the path will start with "Relationships/". Otherwise, the path will start with a slash.
|
protectedvirtual |
Override this function to create custom guide geometry for this class. This method should add geometry to the gdp (if supplied), not alter anything that is already there. The xform will always default to an identity matrix. The gdp pointer or the xform pointer may be null, in which case the other should still be calculated.
Reimplemented in HDK_Sample::SNOW_Visualize, SIM_BVTree, SIM_ForceField, SIM_ForceVortex, SIM_SDF, SIM_ScalarFieldVisualization, SIM_VectorFieldVisualization, HDK_Sample::SIM_ForceOrbit, SIM_ForceFan, SIM_ParticleFieldVisualization, SIM_Visualization, SIM_MatrixFieldVisualization, SIM_IndexFieldVisualization, SIM_ForceMagnet, SIM_SlicePlane, SIM_SopGuide, SIM_Constraint, and SIM_ConstraintNetworkVisualization.
void SIM_Data::buildGuideOptions | ( | SIM_Options & | options, |
const SIM_Time & | time | ||
) | const |
Collect the information in our guide templates and store to a SIM_Options structure.
Finds the given data as subdata. Returns true if found and populates the path required to get there. There is no preceding '/' on the returned path. If subdata == this, "" is the path.
|
static |
This static function checks the passed in value for a null pointer then calls getConstPointerToType().
|
static |
This static function checks the passed in value for a null pointer then calls getPointerToType().
Copy the creation info from the specified data into this data. This optional call after makeEqual() copies the creation info from the source data which is appropriate if this data is meant to replace or precisely represent the source data.
|
protectedvirtual |
Override this to create a custom SIM_Guide subclass. The SIM_Guide class controls how requests for guide geometry are translated into actual geometry creation.
Reimplemented in HDK_Sample::SNOW_Visualize, SIM_BVTree, SIM_ForceField, SIM_ForceVortex, SIM_SDF, SIM_ScalarFieldVisualization, SIM_VectorFieldVisualization, SIM_ParticleFieldVisualization, SIM_ForceFan, SIM_Visualization, HDK_Sample::SIM_ForceOrbit, SIM_MatrixFieldVisualization, SIM_IndexFieldVisualization, SIM_ForceMagnet, SIM_SlicePlane, SIM_SopGuide, SIM_Constraint, and SIM_ConstraintNetworkVisualization.
SIM_Data* SIM_Data::createNamedSubData | ( | const char * | dataname, |
const char * | datatype, | ||
int | creationflags, | ||
UT_String * | newdatanameptr = NULL |
||
) |
Adds a new sub-data item to this data. The returned value is a pointer to the newly created sub-data. The creationflags parameter can be any combination of the SIM_DATA flags defined in this file. The SIM_DATA_CREATE macro provides an easy way to call this function and cast the return value in a single step.
|
protectedvirtual |
Override this method to create a custom SIM_Query for this class. By creating a custom SIM_Query, it is possible to customize the expression function interface to the data.
Reimplemented in SIM_Object, SIM_Impacts, SIM_ConRel, SIM_Relationship, SIM_Geometry, SIM_SolverEnable, SIM_GasOpenCLEnforceBoundary, GAS_GeometryVex, SIM_GasOpenCLMergeVDB, and GAS_OpenCL.
Generates a unique sub-data name. Using the passed in dataname parameter as a starting point. this function generates a subdata name that is not currently in use. This function usually does not need to be called explicitly since it is called by setNamedSubData() and createNamedSubData() if the SIM_DATA_CREATE_UNIQUE_NAME flag is passed in.
|
protected |
Delete the guide geometry for this data, if it exists.
|
protected |
Deletes the query object for this data, if there is one.
void SIM_Data::filterConstSubData | ( | SIM_ConstDataArray & | dp, |
UT_StringArray * | names, | ||
const SIM_DataFilter & | filter, | ||
const char * | startfrom, | ||
const SIM_DataFilter & | recurseFilter | ||
) | const |
Fills an array with all subdata pointers accepted by a filter. The startfrom parameter, if not null, is the name of a subdata item which acts as the root of the search. No data items will be copied by this function, even if they are shared. The names parameter, if not null, will be filled with the paths to the returned data items relative to the startfrom data. The recurseFilter determines which data items have their subdata items searched (and which of those subdata items have their subdata items searched, and so on).
void SIM_Data::filterSubData | ( | SIM_DataArray & | ncdp, |
UT_StringArray * | names, | ||
const SIM_DataFilter & | ncfilter, | ||
const char * | startfrom, | ||
const SIM_DataFilter & | recursefilter | ||
) |
Fills an array with all subdata pointers accepted by a filter. The startfrom parameter, if not null, is the name of a subdata item which acts as the root of the search. Data items accepted by the filter will be copied if they point to shared data. When searching recursively, this means that the parents of any returned data must also be copied. The names parameter, if not null, will be filled with the paths to the returned data items relative to the startfrom data. The recurseFilter determines which data items have their subdata items searched (and which of those subdata items have their subdata items searched, and so on).
void SIM_Data::forEachConstSubData | ( | SIM_EachDataCallback & | cb, |
const SIM_DataFilter & | filter, | ||
const char * | startfrom, | ||
const SIM_DataFilter & | recurseFilter | ||
) | const |
Executes a callback function for each sub-data item that matches the filter criteria. The callback is called with each data item as a parameter. If the recurse parameter is true, this function searches each sub-data recursively, looking for sub-data items of its own. No data items will be copied by this function, even if they are shared.
void SIM_Data::forEachSubData | ( | SIM_EachDataCallback & | cb, |
const SIM_DataFilter & | filter, | ||
const char * | startfrom, | ||
const SIM_DataFilter & | recurseFilter | ||
) |
Executes a callback function for each sub-data item that matches the filter criteria. The callback is called with each data item as a parameter. If the recurse parameter is true, this function searches each sub-data recursively, looking for sub-data items of its own. Data items accepted by the filter will be copied if they point to shared data. When searching recursively, this means that the parents of any returned data must also be copied.
|
inlineprotected |
Definition at line 699 of file SIM_Data.h.
|
protectedvirtual |
Return this pointer cast us to another data type. All subclasses should implement this function, but generally the DECLARE_STANDARD_GETCASTTOYPE() macro will work. Only if your class uses multiple inheritance will it be necessary to write a custom version of this function. If you write your own custom implementation of this method, remember to call the base class implementation.
CHOP_Node* SIM_Data::getCHOPNode | ( | const char * | path, |
bool | addinterest | ||
) | const |
Given a path relative to our creator node, return a CHOP_Node.
const SIM_Data* SIM_Data::getConstNamedSubData | ( | const char * | dataname | ) | const |
Get the sub-data attached to this data with a particular name. If no sub-data with the specified name exists, null is returned. The returned data is not copied even if it is shared.
const void* SIM_Data::getConstPointerToType | ( | const UT_StringRef & | datatype | ) | const |
Return a const pointer that can be cast directly to the specified type. This function calls getDistanceToType(). It will return null if we can't be converted to the specified type. This function should normally not be called directly. Instead, the SIM_DATA_CASTCONST macro provides a safer method of using this function.
This is the same as getSubData(), but it returns a const pointer. Also, the returned data is not copied even if it is shared.
|
inline |
Definition at line 265 of file SIM_Data.h.
COP2_Node* SIM_Data::getCOP2Node | ( | const char * | path, |
bool | addinterest | ||
) | const |
Given a path relative to our creator node, return a COP2_Node.
const SIM_Time& SIM_Data::getCreationTime | ( | ) | const |
Get the creation time for this data.
int SIM_Data::getCreatorId | ( | ) | const |
Get the ID of the node that created this data.
int SIM_Data::getCreatorIndex | ( | ) | const |
Get the output index of the creator node that generated this data.
OP_Node* SIM_Data::getCreatorNode | ( | ) | const |
Use the creator ID to look up the OP_Node that created this data.
const UT_StringHolder& SIM_Data::getDataType | ( | ) | const |
Return the unique descriptive name for the class. The returned value will always be the most-derived class for the data object. The name is fetched from the SIM_DataFactory that created this data.
|
static |
Opens the specified file and returns the type of data stored in that file. Having a static function here to look up this information from the file saves any callers from requiring any knowledge of the single data format.
|
static |
|
protectedvirtual |
Returns the class name for this data type. This function is automaticaly implemented by the DECLARE_CLASSNAME() and DECLARE_DATAFACTORY() macros.
|
inlinestaticprotected |
Definition at line 709 of file SIM_Data.h.
DOP_Node* SIM_Data::getDOPNode | ( | const char * | path, |
bool | addinterest | ||
) | const |
Given a path relative to our creator node, return a DOP_Node.
|
staticprotected |
A DOP description that says not to create an automatic DOP.
|
staticprotected |
An empty parm template. This provides a simple default value to use for those SIM_Data subclasses that don't want to define a parm template.
|
inline |
Get the engine that created us (from our data factory).
Definition at line 455 of file SIM_Data.h.
GU_ConstDetailHandle SIM_Data::getGuideGeometry | ( | const SIM_RootData & | root, |
const char * | datapath, | ||
UT_DMatrix4 & | xform, | ||
const SIM_Time & | t | ||
) | const |
Get the guide geometry associated with this data. The returned value may be null if there is no guide geometry.
|
virtual |
Get the guide geometry list associated with this data. The returned value is true if at least one guide geometry has been generated, false otherwise. Note, the detail and xform arrays will be cleared prior to use.
long SIM_Data::getGuideParmVersion | ( | ) | const |
Returns a number that indicates the current state of the guide parms on our source node (or nodes). This value is used to automatically refresh our guide geometry if one of our guide parms changes. This function just calls getGuideParmVersionSubclass().
|
protectedvirtual |
Override this if the guide geometry for this data depends on parameters on nodes other than our creator node. Otherwise the guide geometry won't refresh when changing those parameters.
Reimplemented in SIM_Constraint.
bool SIM_Data::getIsAlternateRepresentation | ( | ) | const |
This function returns true if this data is built on demand from some other data. This function calls getIsAlternateRepresentationSubclass(). This value is usually a characteristic of the data type as a whole, and will be the same for all data of a particular type.
|
protectedvirtual |
Override this method to return true if your data type is built on demand. This is true for data that is just an alternative representation of some other data. This has several consequences. First, it implies that the data can be rebuilt from other data on the object, therefore it is not saved to disk. Also, it is assumed to be represent its parent data, so any modifications to the parent data cause this data to be deleted. If you override this method, do not call the base class implementation.
Reimplemented in HDK_Sample::SNOW_Visualize, SIM_BVTree, RBD_SpherePointTree, SIM_SDF, RBD_SphereEdgeTree, SIM_ScalarFieldVisualization, SIM_VectorFieldVisualization, SIM_ParticleFieldVisualization, SIM_TriangulatedGeometry, SIM_MatrixFieldVisualization, SIM_IndexFieldVisualization, SIM_PointNeighbourList, SIM_PointTree, SIM_RayIntersect, SIM_PointMapping, SIM_ConstraintNetworkVisualization, and SIM_ContainerAlt.
|
protected |
Returns true if we are performing a simplified load or save. A simplified load or save is one performed from the saveToFile or loadFromFile functions.
bool SIM_Data::getIsOfType | ( | const UT_StringRef & | datatype | ) | const |
Return whether we are of the specified type, or a subclass of it. This function calls the getPointerToType() function to make this determination.
bool SIM_Data::getIsSelected | ( | ) | const |
Get the selected flag for this data.
int64 SIM_Data::getMemorySize | ( | ) | const |
This function returns the amount of memory consumed by this data. The returned value will not include the size of any subdata.
|
protectedvirtual |
Override this function to return an accurate representation of the amount of memory used by this piece of data. The size of subdata should not be included in this calculation.
Reimplemented in SIM_VectorField, SIM_Object, SIM_Impacts, SIM_MatrixField, SIM_ScalarField, SIM_IndexField, HDK_Sample::SNOW_VoxelArray, SIM_Relationship, SIM_Geometry, RBD_SpherePointTree, SIM_SDF, RBD_SphereEdgeTree, SIM_TriangulatedGeometry, SIM_BVTreeBase, SIM_PointNeighbourList, SIM_PointTree, SIM_RayIntersect, and SIM_PointMapping.
SIM_Data* SIM_Data::getNamedSubData | ( | const char * | dataname | ) |
Get the sub-data attached to this data with a particular name. If no sub-data with the specified name exists, null is returned. If the found data is shared, then the data is copied before it is returned.
|
protected |
Tests whether an alternate representation requires initialization.
OP_Node& SIM_Data::getNodePathsRelativeTo | ( | ) | const |
Returns the node that relative node paths are relative to. This function returns the creator node if there is one, otherwise it returns the OP_Director.
const SIM_Data* SIM_Data::getNthConstSubData | ( | UT_String * | name, |
const SIM_DataFilter & | filter, | ||
int | n, | ||
const char * | startfrom, | ||
const SIM_DataFilter & | recurseFilter | ||
) | const |
Returns the nth data item which matches the filter criteria. The startfrom parameter, if not null, is the name of a subdata item which acts as the root of the search. If the recurse parameter is true, then subdata are checked recursively. No data items will be copied by this function, even if they are shared. The name parameter, if not null, will be filled with the path to the returned data item relative to the startfrom data. Note that n starts at zero, in typical C++ fashion.
SIM_Data* SIM_Data::getNthSubData | ( | UT_String * | name, |
const SIM_DataFilter & | filter, | ||
int | n, | ||
const char * | startfrom, | ||
const SIM_DataFilter & | recurseFilter | ||
) |
Returns the nth data item which matches the filter criteria. The startfrom parameter, if not null, is the name of a subdata item which acts as the root of the search. If the recurse parameter is true, then subdata are checked recursively. The data item returned by this function will be copied if it points to shared data. When searching recursively, this means that the parents of the returned data must also be copied. The name parameter, if not null, will be filled with the path to the returned data item relative to the startfrom data. Note that n starts at zero, in typical C++ fashion.
int SIM_Data::getNumSubData | ( | ) | const |
Get the number of sub-data items attached to this data.
OBJ_Node* SIM_Data::getOBJNode | ( | const char * | path, |
bool | addinterest | ||
) | const |
Given a path relative to our creator node, return an OBJ_Node.
OP_Node* SIM_Data::getOPNode | ( | const char * | path, |
bool | addinterest | ||
) | const |
Given a path relative to our creator node, return an OBJ_Node.
SIM_Data* SIM_Data::getOrCreateAlternateRepresentation | ( | const char * | dataname, |
const char * | datatype | ||
) | const |
This function is a special version of the function above. It can only be used to create subdata that represents an alternate representation of this data. Because the new subdata is just another representation of this data, it can be added to a const SIM_Data. There is no creationflags parameter because this parameter is always implicitly SIM_DATA_RETURN_EXISTING.
OP_Node* SIM_Data::getOwnerNetwork | ( | ) | const |
Look up the owner node of our engine to get the DOP Network pointer.
void* SIM_Data::getPointerToType | ( | const UT_StringRef & | datatype | ) |
Return a pointer that can be cast directly to the specified type. This function calls getDistanceToType(). It will return null if we can't be converted to the specified type. This function should normally not be called directly. Instead, the SIM_DATA_CAST macro provides a safer method of using this function.
const SIM_Query& SIM_Data::getQueryObject | ( | ) | const |
Get a SIM_Query object associated with this data. The returned reference will generally be destroyed when the data is next modified.
long SIM_Data::getReferenceCount | ( | ) | const |
Returns the reference count for this data. This is the number of other data items that hold a pointer to this data.
bool SIM_Data::getSelectionRepresentsObject | ( | ) | const |
This function returns true if selecting this data is equivalent to selecting the DOP object to which it is attached. This is currently a property of the data type.
SOP_Node* SIM_Data::getSOPNode | ( | const char * | path, |
bool | addinterest | ||
) | const |
Given a path relative to our creator node, return a SOP_Node.
Get the sub-data at a particular index location. If the found data is shared, then the data is copied before it is returned.
Returns the index for a piece of sub-data. The return value is -1 if the sub-data can't be found.
const UT_StringHolder& SIM_Data::getSubDataName | ( | int | index | ) | const |
Get the name of the sub-data at a particular index location.
const UT_Guid& SIM_Data::getUniqueId | ( | ) | const |
Returns the unique identifier for this data. The unique identifier will be unique for all data over all time in this simulations.
|
inline |
Provide direct access to the SIM_UserOptions that may have been mixed into this data. Will be null if none has been mixed in.
Definition at line 264 of file SIM_Data.h.
Call this function whenever the internal data of this object changes. The code parameter can be used to signal what sort of modification has occurred. The meaning of this code can be different from one data type to the next. This function calls handleModificationSubclass.
Override this method to customize the behavior when our internal data changes. The code parameter is a data type specific value which can be used to indicate the type of change that has occurred. The default implementation deletes all subdata that was created with the deleteifmodified flag turned on. Remember to call the base class implementation.
Reimplemented in HDK_Sample::SNOW_VoxelArray, SIM_SopGeometry, SIM_SopScalarField, and SIM_SopVectorField.
|
protected |
This function is called from getOrCreateAlternateRepresentation(). It should be used to initialize the alternate representation from the parent data. It calls initAlternateRepresentationSubclass() to do the actual work.
Override this function if getIsAlternateRepresentationSubclass() is overridden to return true. This function is used to initialize the alternate representation based on the data to which it was just attached.
Reimplemented in HDK_Sample::SNOW_Visualize, SIM_BVTree, RBD_SpherePointTree, SIM_SDF, RBD_SphereEdgeTree, SIM_ScalarFieldVisualization, SIM_VectorFieldVisualization, SIM_ParticleFieldVisualization, SIM_TriangulatedGeometry, SIM_MatrixFieldVisualization, SIM_IndexFieldVisualization, SIM_PointNeighbourList, SIM_PointTree, SIM_RayIntersect, SIM_PointMapping, and SIM_ConstraintNetworkVisualization.
void SIM_Data::initialize | ( | const SIM_SubdataBehavior & | subdatabehavior | ) |
Set this data to its default empty state. This function calls initializeSubclass() to initialize the state of the data. After calling this function, the data should be indistinguishable from a new instance of this data type. This function is always called when a new piece of data is created.
|
protected |
This function looks through the parameter templates defined in our SIM_DopDescription, loads the default values into a SIM_Options structure, and calls setParameters(). This function is useful for initializing data types that use the SIM_DopDescription to create an automatic DOP node type.
|
protectedvirtual |
Override this method to set this data to its default empty state. Remember to call the base class implementation. The default implementation clears all subdata, and if the data is a subclass of SIM_OptionsUser, calls initializeFromParmDefaults().
Reimplemented in SIM_VectorField, SIM_Object, SIM_Impacts, SIM_MatrixField, HDK_Sample::SNOW_Visualize, SIM_ScalarField, SIM_IndexField, HDK_Sample::SNOW_VoxelArray, GAS_AdaptiveViscosity, SIM_ConRel, SIM_Relationship, RBD_SpherePointTree, SIM_Geometry, RBD_SphereEdgeTree, GAS_ProjectNonDivergentVariational, SIM_ScalarFieldVisualization, SIM_GeometryCopy, SIM_SDF, SIM_VectorFieldVisualization, SIM_ParticleFieldVisualization, GAS_Viscosity, SIM_MatrixFieldVisualization, SIM_IndexFieldVisualization, SIM_PointNeighbourList, SIM_PointTree, GAS_SDFToFog, SIM_PointPosition, SIM_RayIntersect, SIM_PointMapping, SIM_ConstraintNetworkVisualization, and SIM_RandomTwister.
Set this data to be some linear interpolation between two input data. This method is used by the simulation engine to generate approximate data between timesteps. It can also be used by solvers that sub-sample the global timestep, and for display purposes if the global time step is greater than one step time. This function calls interpolateSubclass.
Warning: if the source1 or source2 pointers are equal to the this pointer, this function will only do an assignment (via makeEqual) to one of the sources.
|
protectedvirtual |
Override this method to customize the interpolation behavior. The interp parameter will always be greater than 0 and less than one in this call. Values outside this range are handled by the interpolate() function by calling makeEqual() on one source or the other. The default implementation calls makeEqualSubclass() on source1 or source2 depending on whether interp is less or greater than 0.5. Both source1 and source2 are guaranteed to be non-null in this call. Subclasses should not call the base class implementation, except in the case of an error condition which prevents the custom interpolation from functioning properly. You should also not call makeEqual() from this function, though makeEqualSubclass() is acceptable.
Reimplemented in SIM_Object, SIM_Geometry, SIM_PositionSimple, SIM_SopGeometry, SIM_SopScalarField, and SIM_SopVectorField.
void SIM_Data::interpolateSubData | ( | const SIM_Data & | source1, |
const SIM_Data & | source2, | ||
fpreal | interp, | ||
const SIM_DataFilter & | interpdata, | ||
const SIM_DataFilter & | recurse | ||
) |
Creates a new sub-data item for this data by interpolating between two reference sub-data items. This function provides an easy way to interpolate certain sub-data items after making a copy of some existing data.
bool SIM_Data::loadFromFile | ( | const char * | filename | ) |
Loads this piece of data from a file. This file must be in a format like that saved from saveToFile(). No subdata or creation info is loaded (because it isn't saved in the file).
bool SIM_Data::loadFromStream | ( | UT_IStream & | is, |
bool | skiptype = false |
||
) |
skiptype is set if the stream is already past the type data, for example due to an earlier call to getDataTypeFromStream
|
protectedvirtual |
Loading variant that allows you to request loading data at the end of the .sim file that was saved with saveIOSubclass If not overloaded, passes through to loadSubclass. If io is NULL, shoudl not attempt threaded loading.
Reimplemented in HDK_Sample::SNOW_VoxelArray, and SIM_Geometry.
|
protected |
This function loads a SIM_Options from a stream. Using a SIM_Options provides an easy way to allow for forward and backward compatibility when new data is added or removed.
|
protectedvirtual |
Override this method to read in subclass-specific data. Remember to call the base class implementation.
Reimplemented in SIM_VectorField, SIM_Object, SIM_Impacts, SIM_MatrixField, SIM_ScalarField, SIM_IndexField, SIM_ConRel, SIM_Relationship, SIM_Geometry, SIM_BVTreeStructure, SIM_SolverEnable, SIM_SDF, GAS_OpenCL, GAS_GeometryVex, SIM_GasOpenCLEnforceBoundary, SIM_GasOpenCLMergeVDB, and SIM_RandomTwister.
void SIM_Data::makeEqual | ( | const SIM_Data * | source, |
const SIM_SubdataBehavior & | subdatabehavior | ||
) |
Sets our data to be the same as the source data. This function calls makeEqualSubclass() to do the actual assignment. Note that it is legal to call makeEqual() with any pair of SIM_Data subclasses, not just related types. It is up to the makeEqualSubclass implementation to determine if the passed in data type is acceptable.
Override this method to set subclass data equal to the source data. The source parameter at this level is guaranteed to be non-null. Remember to call the base class implementation.
Reimplemented in SIM_VectorField, SIM_Object, SIM_Impacts, SIM_MatrixField, SIM_ScalarField, SIM_IndexField, HDK_Sample::SNOW_VoxelArray, SIM_ConRel, SIM_Relationship, SIM_Geometry, SIM_SolverSop, SIM_GeometryCopy, SIM_SolverEnable, SIM_GasOpenCLEnforceBoundary, SIM_GasOpenCLMergeVDB, GAS_GeometryVex, GAS_OpenCL, GAS_FieldVex, SIM_BVTreeBase, and SIM_RandomTwister.
|
inline |
Simulation data may have member data which it thinks it can write to; but someone may have shared a copy between simulations. This callback can be used to verify it is unique and unique it if needed.
Definition at line 507 of file SIM_Data.h.
|
inlinevirtual |
Reimplemented in SIM_GeometryCopy.
Definition at line 508 of file SIM_Data.h.
void SIM_Data::moveNamedSubData | ( | const char * | oldname, |
const char * | newname | ||
) |
Change the name of some existing sub-data found by name. The newname may specify a completely different location than the old name.
void SIM_Data::removeNamedSubData | ( | const char * | dataname | ) |
Remove some existing sub-data by name.
|
protectedvirtual |
Override this function to do special processing when removing subdata. One example would be to eliminate a cached value set up in the setNamedSubDataSubclass() function.
Reimplemented in SIM_Object.
|
protectedvirtual |
Save variant that allows you to delay part of your saving to a background thread. If not overloaded, passes through to saveSubclass. If io is NULL, shoudl not attempt threaded loading.
Reimplemented in HDK_Sample::SNOW_VoxelArray, and SIM_Geometry.
|
protected |
This function saves a SIM_Options to a stream. Using a SIM_Options provides an easy way to allow for forward and backward compatibility when new data is added or removed.
|
protectedvirtual |
Override this method to write out subclass-specific data. Remember to call the base class implementation.
Reimplemented in SIM_VectorField, SIM_Object, SIM_Impacts, SIM_MatrixField, SIM_ScalarField, SIM_IndexField, SIM_ConRel, SIM_Relationship, SIM_Geometry, SIM_BVTreeStructure, SIM_SDF, SIM_SolverEnable, GAS_OpenCL, GAS_GeometryVex, SIM_GasOpenCLEnforceBoundary, SIM_GasOpenCLMergeVDB, and SIM_RandomTwister.
bool SIM_Data::saveToFile | ( | const char * | filename, |
UT_CompressionType | compressionType | ||
) | const |
Saves this piece of data to a file. This is the only public method for saving SIM_Data. It does not save subdata or creation info. It simply saves the contents of this single piece of data to a file.
bool SIM_Data::saveToStream | ( | std::ostream & | os, |
UT_CompressionType | compressionType | ||
) | const |
void SIM_Data::setIsSelected | ( | bool | selected | ) | const |
Set the selected flag for this data. Notice this method is const. Selection isn't really part of the data, it is a UI concept.
Add a new piece of sub-data to this data. If data with the given name already exists it will be deleted and replaced with the new data. The data pointer will most likely come from a call to createNamedData() or getSubData() on another parent data. The setflags parameter can be any combination of the SIM_DATA flags defined in this file.
|
protectedvirtual |
Override this virtual to do special processing when adding subdata. One example would be to cache certain pieces of subdata for quicker access through member functions. Remember to also handle the removeNamedSubDataSubclass function to handle the removal of subdata.
Reimplemented in SIM_Object.
|
protected |
Flags an alternate representation subdata as requiring initialization.
|
protectedvirtual |
Override this method to invalidate cached data based on object geometry.
|
protected |
This function flags the data as needing to recalculate its memory size. The default handleModificationSubclass() implementation calls this function, but it can also be called directly when the memory size of a SIM_Data is changing without any changes that would require a handleModification() call.
void SIM_Data::setParameters | ( | const SIM_Options & | parms | ) |
Given a SIM_Options, set up this data. This function calls setParametersSubclass() to do its work. It is used by automatically generated DOP nodes to convert parameter values into SIM_Options entries, then set up the data. This function can also be used by loadSubclass() if some of the data for this type is stored in a SIM_Options.
|
protectedvirtual |
Override this method to process our DOP node parameter values. Automatically created DOP nodes turn their parameter values into SIM_Options entries, which are passed to this function. This function can also be used to help load data from a stream if it is stored in a SIM_Options. Remember to call the base class implementation.
Reimplemented in SIM_GeometryCopy, and SIM_PointPosition.
|
protected |
Sets the flag indicating that selecting this object represents a selection of the object to which it is attached.
|
friend |
Definition at line 811 of file SIM_Data.h.
Definition at line 814 of file SIM_Data.h.
|
friend |
Definition at line 813 of file SIM_Data.h.
|
friend |
Definition at line 812 of file SIM_Data.h.